|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.backend.DatabaseBackend
A DatabaseBackend
represents a real database backend that
will have to be bound to a virtual C-JDBC database. All connections opened
will use the same url but possibly different login/password.
Field Summary | |
private java.util.Vector |
activeTransactions
List of started transactions. |
private java.util.HashMap |
connectionManagers
Connection managers for this backend. |
private java.lang.String |
driverClassName
Database native JDBC driver class name. |
private DriverCompliance |
driverCompliance
Driver compliance to C-JDBC requirements |
private boolean |
isEnabled
Is this bakend enabled. |
protected Trace |
logger
Logger instance. |
private java.lang.String |
name
Logical name assigned to this backend. |
private java.util.Vector |
pendingRequests
List of pending requests. |
private DatabaseSchema |
schema
The schema of the database. |
private boolean |
schemaIsStatic
true if schema is static. |
private java.lang.String |
url
Real URL to access the database (JDBC URL). |
Constructor Summary | |
DatabaseBackend(java.lang.String name,
java.lang.String driverClassName,
java.lang.String url,
boolean isEnabled)
Creates a new DatabaseBackend instance. |
Method Summary | |
void |
addConnectionManager(java.lang.String vLogin,
AbstractConnectionManager connectionManager)
Adds a ConnectionManager to this backend. |
void |
addPendingRequest(AbstractRequest request)
Adds a pending request to this backend. |
void |
checkDatabaseSchema()
Checks that the current database schema is compatible with all schema gathered from each connection manager. |
void |
checkDriverCompliance()
Check if the driver used by this backend is compliant with C-JDBC needs. |
void |
disable()
Sets the database backend state to disable. |
void |
enable()
Enables the database backend. |
boolean |
equals(java.lang.Object other)
Two database backends are considered equal if they have the same name, URL and driver class name. |
void |
finalizeConnections()
Releases all the connections to the database held by the connection managers. |
AbstractConnectionManager |
getConnectionManager(java.lang.String vLogin)
Returns the ConnectionManager associated to this backend
for a given virtual login. |
DatabaseSchema |
getDatabaseSchema()
Returns the schema of this database. |
java.lang.String |
getDriverClassName()
Returns the database native JDBC driver class name. |
DriverCompliance |
getDriverCompliance()
|
java.lang.String |
getInformation()
Gets information about this backend. |
java.lang.String |
getName()
Returns the backend logical name. |
java.util.Vector |
getPendingRequests()
Returns the list of pending requests for this backend. |
java.lang.String |
getURL()
Returns the JDBC URL used to access the database. |
java.lang.String |
getXmlInformation()
Get xml information about this backend. |
boolean |
hasTable(java.lang.String table)
Returns true if this backend has the given table in its
schema. |
boolean |
hasTables(java.util.ArrayList tables)
Returns true if this backend has the given list of tables
in its schema. |
void |
initializeConnections()
Initializes the connection managers' connections. |
boolean |
isEnabled()
Tests if this backend is enabled (active and synchronized). |
boolean |
isInitialized()
Tests if this backend is enabled (active and synchronized). |
boolean |
isStartedTransaction(java.lang.Integer tid)
Returns true if the specified transaction has been started
on this backend (a connection has been allocated for this transaction). |
boolean |
removePendingRequest(AbstractRequest request)
Removes a pending request from this backend. |
void |
setDatabaseSchema(DatabaseSchema databaseSchema,
boolean isStatic)
Sets the database schema. |
void |
startTransaction(java.lang.Integer tid)
Signals that a transaction has been started on this backend. |
void |
stopTransaction(java.lang.Integer tid)
Signals that a transaction has been stopped on this backend. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String name
private java.lang.String driverClassName
private DriverCompliance driverCompliance
private java.lang.String url
private boolean isEnabled
private DatabaseSchema schema
private boolean schemaIsStatic
true
if schema is static.
private java.util.HashMap connectionManagers
protected transient Trace logger
private java.util.Vector activeTransactions
private java.util.Vector pendingRequests
Constructor Detail |
public DatabaseBackend(java.lang.String name, java.lang.String driverClassName, java.lang.String url, boolean isEnabled)
DatabaseBackend
instance.
name
- logical name assigned to this backenddriverClassName
- class name of the database native JDBC driver to
loadurl
- URL to access the databaseisEnabled
- true
if this backend must be enabledMethod Detail |
public boolean equals(java.lang.Object other)
other
- an object
boolean
valuepublic boolean hasTables(java.util.ArrayList tables)
true
if this backend has the given list of tables
in its schema. The caller must ensure that the database schema has been
defined, using the setDatabaseSchema(DatabaseSchema, boolean)
or
checkDatabaseSchema()
methods.
tables
- the list of table names (ArrayList
of String
)
to look for
true
if all the tables are foundpublic boolean hasTable(java.lang.String table)
true
if this backend has the given table in its
schema. The caller must ensure that the database schema has been defined,
using the setDatabaseSchema(DatabaseSchema, boolean)
or
checkDatabaseSchema()
table
- The table name to look for
true
if tables is found in the schemapublic void initializeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurspublic void finalizeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurspublic void addConnectionManager(java.lang.String vLogin, AbstractConnectionManager connectionManager)
ConnectionManager
to this backend. Note that the
ConnectionManager
is not initialized in this method.
vLogin
- the virtual login corresponding to this connection managerconnectionManager
- the ConnectionManager
to addpublic void startTransaction(java.lang.Integer tid)
tid
- transaction identifierpublic void stopTransaction(java.lang.Integer tid)
tid
- transaction identifierpublic boolean isStartedTransaction(java.lang.Integer tid)
true
if the specified transaction has been started
on this backend (a connection has been allocated for this transaction).
tid
- transaction identifier
true
if the transaction has been startedpublic final boolean isInitialized() throws java.sql.SQLException
true
if this backend is enabled
java.sql.SQLException
- if an error occurspublic final boolean isEnabled()
true
if this backend is enabled.public void enable()
public void disable()
public AbstractConnectionManager getConnectionManager(java.lang.String vLogin)
ConnectionManager
associated to this backend
for a given virtual login.
vLogin
- the virtual login
AbstractConnectionManager
instancepublic java.lang.String getDriverClassName()
public java.lang.String getName()
public java.util.Vector getPendingRequests()
Vector
of AbstractRequests
public void addPendingRequest(AbstractRequest request)
request
- the request to addpublic boolean removePendingRequest(AbstractRequest request)
request
- the request to remove
true
if the request has been found and removedpublic DatabaseSchema getDatabaseSchema()
null
if the
schema has not been set.setDatabaseSchema(org.objectweb.cjdbc.sql.schema.DatabaseSchema, boolean)
public void setDatabaseSchema(DatabaseSchema databaseSchema, boolean isStatic)
databaseSchema
- the schema to setisStatic
- true
if the schema should be staticgetDatabaseSchema()
public void checkDatabaseSchema()
If no schema has been defined, the first gathered schema is used as the current database schema.
For each schema that is not compatible with the current schema, a warning is issued on the logger.
public DriverCompliance getDriverCompliance()
public void checkDriverCompliance() throws java.sql.SQLException
java.sql.SQLException
- if the driver is not compliantpublic java.lang.String getURL()
public java.lang.String getXmlInformation()
public java.lang.String getInformation()
String
containing information
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |