public class GetDAX extends Object
Modifier and Type | Field and Description |
---|---|
static String |
c_prefix
Prefix for the property subset to use with this catalog.
|
static String |
DB_PREFIX
The DB Driver properties prefix.
|
private Connection |
mConnection
Maintains the connection to the database over the lifetime of
this instance.
|
private static String[] |
mCStatements
The statement to prepare to slurp attributes.
|
private LogManager |
mLogger
The instance to the Logging manager.
|
private Properties |
mProps
The properties passed to the client.
|
private 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(Properties props)
Establishes a connection to the database from the properties.
|
Collection<String> |
get(String id,
String dir)
Given a request ID it fetches the DAX's from the DB and writes out to
the directory passed.
|
protected String |
getJDBCURL(String driver,
Properties properties)
Constructs the jdbc url on the basis fo the driver and db properties.
|
protected 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(String[] args)
For Testing purposes only.
|
protected static void |
sanityCheck(File dir)
Checks the destination location for existence, if it can
be created, if it is writable etc.
|
public static final String c_prefix
public static final String DB_PREFIX
private static final String[] mCStatements
private Connection mConnection
private PreparedStatement[] mStatements
private Properties mProps
private LogManager mLogger
public boolean connect(PegasusProperties properties)
properties
- PegasusPropertiespublic boolean connect(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 String getJDBCURL(String driver, Properties properties)
driver
- the driver being used.properties
- the db properitespublic Collection<String> get(String id, 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 PreparedStatement getStatement(int i) throws SQLException
i
- is the index which prepared statement to check.SQLException
- in case of unable to delete entry.protected static void sanityCheck(File dir) throws IOException
dir
- is the new base directory to optionally create.IOException
- in case of error while writing out files.public static void main(String[] args)
args
- the arguments passed.