org.objectweb.cjdbc.common.jmx.mbeans
Interface DatabaseBackendMBean

All Known Implementing Classes:
DatabaseBackend

public interface DatabaseBackendMBean

MBeanInterface to the DatabaseBackend

Version:
1.0
Author:
Nicolas Modrzyk

Method Summary
 boolean 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 disableRead()
          Disables the database backend for reads.
 void disableWrite()
          Disables the database backend for writes.
 void enableRead()
          Enables the database backend for reads.
 void enableWrite()
          Enables the database backend for writes.
 java.util.ArrayList getActiveTransactions()
          Returns the list of active transactions for this backend.
 java.lang.String getConnectionTestStatement()
          Returns the SQL statement to use to check the connection validity.
 DatabaseSchema getDatabaseSchema()
          Returns the schema of this database.
 java.lang.String getDriverClassName()
          Returns the database native JDBC driver class name.
 java.lang.String getDriverPath()
          Returns the driver path.
 java.lang.String getLastKnownCheckpoint()
          Returns the lastKnownCheckpoint value.
 java.lang.String getName()
          Returns the backend logical name.
 java.util.ArrayList getPendingRequestsDescription(int count, boolean fromFirst, boolean clone)
          Returns the list of pending requests for this backend.
 java.lang.String getSchemaXml(boolean expandSchema)
          The getXml() method does not return the schema if it is not static anymore, to avoid confusion between static and dynamic schema.
 java.lang.String getState()
          Returns a description of the state of the backend
 java.lang.String getURL()
          Returns the JDBC URL used to access the database.
 java.lang.String getXml()
          Return a string description of the backend in xml format.
 boolean hasStoredProcedure(java.lang.String procedureName)
          Returns true if this backend has the given stored procedure in its schema.
 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.
 boolean isDisabled()
          Is the backend completely disabled ?
 boolean isInitialized()
          Tests if this backend is enabled (active and synchronized).
 boolean isJDBCConnected()
          Is the backend accessible ?
 boolean isReadEnabled()
          Tests if this backend is read enabled (active and synchronized).
 boolean isSchemaStatic()
           
 boolean isWriteEnabled()
          Tests if this backend is write enabled (active and synchronized).
 void setLastKnownCheckpoint(java.lang.String checkpoint)
          setLastKnownCheckpoint for this backend
 

Method Detail

hasTables

public boolean hasTables(java.util.ArrayList tables)
Returns true if this backend has the given list of tables in its schema. The caller must ensure that the database schema has been defined

Parameters:
tables - the list of table names (ArrayList of String) to look for
Returns:
true if all the tables are found

hasTable

public boolean hasTable(java.lang.String table)
Returns true if this backend has the given table in its schema. The caller must ensure that the database schema has been defined,

Parameters:
table - The table name to look for
Returns:
true if tables is found in the schema

hasStoredProcedure

public boolean hasStoredProcedure(java.lang.String procedureName)
Returns true if this backend has the given stored procedure in its schema. The caller must ensure that the database schema has been defined

Parameters:
procedureName - The stored procedure name to look for
Returns:
true if procedure name is found in the schema

isInitialized

public boolean isInitialized()
                      throws java.lang.Exception
Tests if this backend is enabled (active and synchronized).

Returns:
true if this backend is enabled
Throws:
java.lang.Exception - if an error occurs

isReadEnabled

public boolean isReadEnabled()
Tests if this backend is read enabled (active and synchronized).

Returns:
true if this backend is enabled.

isWriteEnabled

public boolean isWriteEnabled()
Tests if this backend is write enabled (active and synchronized).

Returns:
true if this backend is enabled.

isDisabled

public boolean isDisabled()
Is the backend completely disabled ? This usually means it has a known state with a checkpoint associated to it.

Returns:
true if the backend is disabled

enableRead

public void enableRead()
Enables the database backend for reads. This method should only be called when the backend is synchronized with the others.


enableWrite

public void enableWrite()
Enables the database backend for writes. This method should only be called when the backend is synchronized with the others.


disableRead

public void disableRead()
Disables the database backend for reads. This does not affect write ability


disableWrite

public void disableWrite()
Disables the database backend for writes. This does not affect read ability although the backend will not be coherent anymore as soon as a write as occured. This should be used in conjunction with a checkpoint to recover missing writes.


disable

public void disable()
Sets the database backend state to disable. This state is just an indication and it has no semantic effect. It is up to the request manager (especially the load balancer) to ensure that no more requests are sent to this backend.


getConnectionTestStatement

public java.lang.String getConnectionTestStatement()
Returns the SQL statement to use to check the connection validity.

Returns:
a String containing a SQL statement

getDriverClassName

public java.lang.String getDriverClassName()
Returns the database native JDBC driver class name.

Returns:
the driver class name

getName

public java.lang.String getName()
Returns the backend logical name.

Returns:
the backend logical name

getState

public java.lang.String getState()
Returns a description of the state of the backend

Returns:
a string description of the state. Can be enabled, disabled, recovering, backuping ...
See Also:
CjdbcNotificationList

getPendingRequestsDescription

public java.util.ArrayList getPendingRequestsDescription(int count,
                                                         boolean fromFirst,
                                                         boolean clone)
Returns the list of pending requests for this backend.

Parameters:
count - number of requests to retrieve, if 0, return all.
fromFirst - count the request from first if true, or from last if false
clone - should clone the pending request if true, block it if false
Returns:
ArrayList of String description of each request.

getActiveTransactions

public java.util.ArrayList getActiveTransactions()
Returns the list of active transactions for this backend.

Returns:
ArrayList of Long, corresponding to active transaction identifier.

checkDatabaseSchema

public boolean checkDatabaseSchema()
Checks that the current database schema is compatible with all schema gathered from each connection manager.

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 for that backend

Returns:
true if comptaible, false otherwise

getDatabaseSchema

public DatabaseSchema getDatabaseSchema()
Returns the schema of this database.

Returns:
the schema of this database. Returns null if the schema has not been set.

checkDriverCompliance

public void checkDriverCompliance()
                           throws java.lang.Exception
Check if the driver used by this backend is compliant with C-JDBC needs.

Throws:
java.lang.Exception - if the driver is not compliant

getURL

public java.lang.String getURL()
Returns the JDBC URL used to access the database.

Returns:
a JDBC URL

isSchemaStatic

public boolean isSchemaStatic()
Returns:
Returns the schemaIsStatic.

getDriverPath

public java.lang.String getDriverPath()
Returns the driver path.

Returns:
the driver path

setLastKnownCheckpoint

public void setLastKnownCheckpoint(java.lang.String checkpoint)
setLastKnownCheckpoint for this backend

Parameters:
checkpoint - the checkpoint

getLastKnownCheckpoint

public java.lang.String getLastKnownCheckpoint()
Returns the lastKnownCheckpoint value.

Returns:
Returns the lastKnownCheckpoint.

isJDBCConnected

public boolean isJDBCConnected()
Is the backend accessible ?

Returns:
true if a jdbc connection is still possible from the controller, false if connectionTestStatement failed

getSchemaXml

public java.lang.String getSchemaXml(boolean expandSchema)
The getXml() method does not return the schema if it is not static anymore, to avoid confusion between static and dynamic schema. This method returns a static view of the schema, whatever the dynamic precision is.

Parameters:
expandSchema - if we should force the schema to be expanded. This is needed as the default getXml should call this method.
Returns:
an xml formatted string

getXml

public java.lang.String getXml()
Return a string description of the backend in xml format. This does not include the schema description if the dynamic precision is not set to static.

Returns:
an xml formatted string


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.