public class DBConnectorFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
_CACHE_CONTAINER_NAME
Name for the property for PtolemyDB cache container
name in the config/ptdb-properties file.
|
static java.lang.String |
_DB_CLASS_NAME
Name for the property for XML database class
in the config/ptdb-properties file.
|
static java.lang.String |
_DB_URL
Name for the property for XML database URL/Location
in the config/ptdb-properties file.
|
static java.lang.String |
_PROPERTIES_FILE_PATH
Path to the configuration file.
|
static java.lang.String |
_XMLDB_CONTAINER_NAME
Name for the property for XML database container name
in the config/ptdb-properties file.
|
Constructor and Description |
---|
DBConnectorFactory() |
Modifier and Type | Method and Description |
---|---|
static DBConnection |
getAsyncConnection()
Get an asynchronous connection to the database.
|
static DBConnection |
getCacheConnection(boolean isTransactionRequired)
Get a synchronous connection to the cache database.
|
static DBConnectionParameters |
getDBConnectionParameters()
Return the database connection parameters.
|
static java.lang.String |
getParametersString()
Return the parameters set as a concatenated string.
|
static SetupParameters |
getSetupParameters()
create a setup parameter object that contains the database setup parameters
and return that setup parameter object to the caller.
|
static DBConnection |
getSyncConnection(boolean isTransactionRequired)
This API is used to get a synchronous connection to the database.
|
static DBConnection |
getSyncConnection(DBConnectionParameters dbConnectionParameters)
This API is used to get a synchronous connection to the database.
|
static boolean |
isSetupDone()
Return true if the database setup is completed.
|
static void |
loadDBProperties()
Load the properties from config/ptdb.properties
and set them for use during creating connections
to the XML database.
|
public static final java.lang.String _DB_CLASS_NAME
public static final java.lang.String _DB_URL
public static final java.lang.String _XMLDB_CONTAINER_NAME
public static final java.lang.String _CACHE_CONTAINER_NAME
public static final java.lang.String _PROPERTIES_FILE_PATH
public static SetupParameters getSetupParameters()
public static DBConnection getSyncConnection(boolean isTransactionRequired) throws DBConnectionException
isTransactionRequired
- - Boolean to specify whether
this connection needs a transaction or not.DBConnectionException
- - Whenever we face a problem while
creating a database connection. These problems could be that
configured connection class does not exist, the path for the
database is not found, the container name is incorrect,
the connection to the database could not be established etc.public static DBConnection getSyncConnection(DBConnectionParameters dbConnectionParameters) throws DBConnectionException
dbConnectionParameters
- Connection parameters for creating the
connection.DBConnectionException
- Whenever we face a problem while
creating a database connection. These problems could be that configured
connection class does not exist, the path for the database is not found,
the container name is incorrect, the connection to the database could not
be established etc.public static DBConnection getAsyncConnection() throws DBConnectionException
DBConnectionException
- - Whenever we face a problem while creating
a database connection. These problems could be that configured connection
class does not exist, the path for the database is not found, the container name
is incorrect, the connection to the database could not be established etc.public static DBConnection getCacheConnection(boolean isTransactionRequired) throws DBConnectionException
isTransactionRequired
- - Boolean to specify whether this connection
needs a transaction or not.DBConnectionException
- - Whenever we face a problem while creating
a database connection. These problems could be that configured connection
class does not exist, the path for the database is not found,
the container name is incorrect,
the connection to the database could not be established etc.public static DBConnectionParameters getDBConnectionParameters()
public static boolean isSetupDone()
public static void loadDBProperties()
Ascertain if the database setup has been done and if the properties for the database have been set.
Throw an exception if the config/ptdb.properties file is not found.
public static java.lang.String getParametersString()