public class GetDAX
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
c_prefix
Prefix for the property subset to use with this catalog.
|
static java.lang.String |
DB_PREFIX
The DB Driver properties prefix.
|
private java.sql.Connection |
mConnection
Maintains the connection to the database over the lifetime of
this instance.
|
private static java.lang.String[] |
mCStatements
The statement to prepare to slurp attributes.
|
private LogManager |
mLogger
The instance to the Logging manager.
|
private java.util.Properties |
mProps
The properties passed to the client.
|
private java.sql.PreparedStatement[] |
mStatements
Maintains an essential set of prepared statement, ready to use.
|
Constructor and Description |
---|
GetDAX()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Explicitely free resources before the garbage collection hits.
|
boolean |
connect(PegasusProperties properties)
A convenience method to connect on the basis of PegasusProperties.
|
boolean |
connect(java.util.Properties props)
Establishes a connection to the database from the properties.
|
java.util.Collection<java.lang.String> |
get(java.lang.String id,
java.lang.String dir)
Given a request ID it fetches the DAX's from the DB and writes out to
the directory passed.
|
protected java.lang.String |
getJDBCURL(java.lang.String driver,
java.util.Properties properties)
Constructs the jdbc url on the basis fo the driver and db properties.
|
protected java.sql.PreparedStatement |
getStatement(int i)
Singleton manager for prepared statements.
|
boolean |
isClosed()
Predicate to check, if the connection with the catalog's
implementation is still active.
|
static void |
main(java.lang.String[] args)
For Testing purposes only.
|
protected static void |
sanityCheck(java.io.File dir)
Checks the destination location for existence, if it can
be created, if it is writable etc.
|
public static final java.lang.String c_prefix
public static final java.lang.String DB_PREFIX
private static final java.lang.String[] mCStatements
private java.sql.Connection mConnection
private java.sql.PreparedStatement[] mStatements
private java.util.Properties mProps
private LogManager mLogger
public boolean connect(PegasusProperties properties)
properties
- PegasusPropertiespublic boolean connect(java.util.Properties props)
props
- is the property table with sufficient settings to
establish a link with the database. The minimum key required key is
"url", and possibly "driver". Any other keys depend on the database
driver.DriverManager.getConnection( String, Properties )
protected java.lang.String getJDBCURL(java.lang.String driver, java.util.Properties properties)
driver
- the driver being used.properties
- the db properitespublic java.util.Collection<java.lang.String> get(java.lang.String id, java.lang.String dir)
id
- the request id.dir
- the directory where the DAX'es need to be placed.public boolean isClosed()
close()
.close()
public void close()
protected java.sql.PreparedStatement getStatement(int i) throws java.sql.SQLException
i
- is the index which prepared statement to check.java.sql.SQLException
- in case of unable to delete entry.protected static void sanityCheck(java.io.File dir) throws java.io.IOException
dir
- is the new base directory to optionally create.java.io.IOException
- in case of error while writing out files.public static void main(java.lang.String[] args)
args
- the arguments passed.