org.objectweb.cjdbc.controller.virtualdatabase
Class VirtualDatabase

java.lang.Object
  extended byjavax.management.StandardMBean
      extended byorg.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
          extended byorg.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase
All Implemented Interfaces:
javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, VirtualDatabaseMBean, XmlComponent
Direct Known Subclasses:
DistributedVirtualDatabase

public class VirtualDatabase
extends AbstractStandardMBean
implements VirtualDatabaseMBean, XmlComponent

A VirtualDatabase represents a database from client point of view and hide the complexity of the cluster distribution to the client. The client always uses the virtual database name and the C-JDBC Controller will use the real connections when an SQL request comes in.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier , Nicolas Modrzyk , Vadim Kassin , Jean-Bernard van Zuylen

Nested Class Summary
 
Nested classes inherited from class javax.management.StandardMBean
 
Field Summary
private  java.util.ArrayList activeThreads
           
protected  AuthenticationManager authenticationManager
          Authentification manager matching virtual database login/password to backends login/password
protected  java.util.ArrayList backends
          ArrayList of DatabaseBackend objects
private  AbstractBlobFilter blobFilter
          The filter used to store blobs in the database
static int CHECK_BACKEND_DISABLE
          Use for method getAndCheck
static int CHECK_BACKEND_ENABLE
          Use for method getAndCheck
(package private)  Controller controller
          The controller we belong to
protected  int currentNbOfThreads
          Current number of worker threads
private  java.lang.String databaseProductNames
          Comma separated list of database product names (one instance per name)
private  int idleThreads
           
 Trace logger
          Virtual database logger
protected  int maxNbOfConnections
          Maximum number of concurrent accepted for this virtual database
protected  int maxNbOfThreads
          Maximum number of worker threads to fork
protected  long maxThreadIdleTime
          Maximum time a worker thread can remain idle before dying
protected  VirtualDatabaseDynamicMetaData metadata
          Virtual Database MetaData
protected  int minNbOfThreads
          Minimum number of worker threads to keep in the pool if poolConnectionThreads is true
protected  java.lang.String name
          Virtual database name
static int NO_CHECK_BACKEND
          Use for method getAndCheck
private  java.util.ArrayList pendingConnections
           
protected  boolean poolConnectionThreads
          If false one worker thread is forked per connection else
protected  Trace requestLogger
           
protected  RequestManager requestManager
          The request manager to use for this database
protected  ReadPrioritaryFIFOWriteLock rwLock
          Read/Write lock for backend list
private static long serialVersionUID
           
private  boolean shuttingDown
          Marker to see if the database is shutting down
private  SQLMonitoring sqlMonitor
           
private  int sqlShortFormLength
          Short form of SQL statements to include in traces and exceptions
private  VirtualDatabaseStaticMetaData staticMetadata
           
protected  java.util.LinkedList totalOrderQueue
          ArrayList to store the order of requests
 
Fields inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
 
Fields inherited from class javax.management.StandardMBean
 
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION
 
Constructor Summary
VirtualDatabase(Controller controller, java.lang.String name, int maxConnections, boolean pool, int minThreads, int maxThreads, long maxThreadIdleTime, int sqlShortFormLength, AbstractBlobFilter blobFilter)
          Creates a new VirtualDatabase instance.
 
Method Summary
 void abort(long transactionId, boolean logAbort)
          Abort a transaction that has been started but in which no query was executed.
 void acquireReadLockBackendLists()
          Acquires a read lock on the backend lists (both enabled and disabled backends).
 void addBackend(DatabaseBackend db)
          Add a backend to this virtual database.
 void addBackend(DatabaseBackend db, boolean checkForCompliance)
          Add a backend to this virtual database.
 void addCurrentNbOfThread()
          Adds one to currentNbOfThreads.
 void addIdleThread()
          Method add an idle thread.
 void backupBackend(java.lang.String backendName, java.lang.String login, java.lang.String password, java.lang.String dumpName, java.lang.String backuperName, java.lang.String path, java.util.ArrayList tables)
          Create a backup of a specific backend.
 long begin(java.lang.String login)
          Begins a new transaction and returns the corresponding transaction identifier.
 boolean checkAdminAuthentication(java.lang.String adminLogin, java.lang.String adminPassword)
          Checks if a given admin login/password is ok.
 boolean checkUserAuthentication(java.lang.String virtualLogin, java.lang.String virtualPassword)
          Checks if a given virtual login/password is ok.
 void cleanMonitoringData()
          Clean data collected by the current monitoring system, to avoid memory problems.
 void commit(long transactionId, boolean logCommit)
          Commits a transaction given its id.
 void copyDump(java.lang.String dumpName, java.lang.String remoteControllerName)
          Copy a local dump over to a remote member of this distributed vdb, making it available for restore operation.
 void copyLogFromCheckpoint(java.lang.String dumpName, java.lang.String controllerName)
          Copies a chunk of the local virtual database recovery log onto a remote controller's peer virtual database log.
 void deleteLogUpToCheckpoint(java.lang.String checkpointName)
          Deletes the recovery log (if any) from the begining upto the specified checkpoint.
 void disableAllBackends()
          Prepare this virtual database for shutdown.
 void disableAllBackendsWithCheckpoint(java.lang.String checkpoint)
          Disable all backends and store a checkpoint
 void disableBackendWithCheckpoint(java.lang.String backendName)
          Disables a backend once all the pending write queries are executed.
 void enableAllBackends()
          Enable all the backends without any check.
 void enableAllBackendsFromCheckpoint()
          Enable all backends from their last known states that has been recorded in the recovery log, and enable only the backends which where properly disabled.
 void enableBackendFromCheckpoint(java.lang.String backendName)
          Enable the given backend from its last known checkpoint
 void enableBackendFromCheckpoint(java.lang.String backendName, java.lang.String checkpointName)
          Enable the given backend from the given checkpoint.
 boolean equals(java.lang.Object other)
          Two virtual databases are equal if they have the same name and group.
 ControllerResultSet execReadRequest(SelectRequest request)
          Performs a read request and returns the reply.
 ControllerResultSet execReadStoredProcedure(StoredProcedure proc)
          Call a stored procedure that returns a ResultSet.
 int execWriteRequest(AbstractWriteRequest request)
          Performs a write request and returns the number of rows affected.
 ControllerResultSet execWriteRequestWithKeys(AbstractWriteRequest request)
          Performs a write request and returns the auto generated keys.
protected  int execWriteStoredProcedure(StoredProcedure proc)
          Call a stored procedure that performs an update.
 void forceDisableBackend(java.lang.String backendName)
          Disables a backend that is currently enabled on this virtual database (without further check).
 void forceEnableAllBackendsFromCheckpoint(java.lang.String checkpoint)
          Prepare this virtual database for startup.
 void forceEnableBackend(java.lang.String backendName)
          Enables a backend that has been previously added to this virtual database and that is in the disabled state.
 java.util.ArrayList getActiveThreads()
          Returns the activeThreads.
 java.util.ArrayList getAllBackendNames()
          Get a list of all DatabaseBackend names.
 DatabaseBackend getAndCheckBackend(java.lang.String backendName, int testEnable)
          Find the DatabaseBackend corresponding to the given backend name and check if it is possible to disable this backend.
 java.lang.String getAssociatedString()
          Allow to retrieve internationalization description on mbeans as well
 AuthenticationManager getAuthenticationManager()
          Returns the authentication manager of this virtual database.
 DumpInfo[] getAvailableDumps()
          Get all available dump info for this virtual database
 java.lang.String getBackendInformation(java.lang.String backendName)
          Return information about the specified backend.
 java.util.ArrayList getBackends()
          Return the list of all backends
 java.lang.String getBackendSchema(java.lang.String backendName)
          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 getBackendState(java.lang.String backendName)
          Return the state of a given database backend
 BackendStatistics getBackendStatistics(java.lang.String backendName)
          Retrieves an array of statistics of the given backend for this virtual database
 java.lang.String[] getBackuperNames()
          Get the names of the Backupers available from this BackupManager.
 AbstractBlobFilter getBlobFilter()
          Return the BLOB filter used for this database
 int getCurrentNbOfThreads()
          Returns the currentNbOfThreads.
 java.lang.String getDatabaseName()
          Gets the virtual database name to be used by the client (C-JDBC driver) This method should be used for local references only (it is faster).
 java.lang.String getDatabaseProductName()
           
 DatabaseSchema getDatabaseSchemaFromActiveBackends()
          Get the current database schema from merging the schemas of all active backends.
 DatabaseSchema getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames()
          Get the current database schema from merging the schemas of all active backends.
protected  java.lang.String getDistributionXml()
          Get the XML dump of the Distribution element if any.
 java.lang.String getDumpFormatForBackuper(java.lang.String backuperName)
          Get the dump format associated to a given Backuper
 VirtualDatabaseDynamicMetaData getDynamicMetaData()
           
 int getIdleThreads()
          Returns the number of idle zorker threads.
 int getMaxNbOfConnections()
          Returns the maxNbOfConnections.
 int getMaxNbOfThreads()
          Returns the maxNbOfThreads.
 long getMaxThreadIdleTime()
          Returns the maxThreadIdleTime.
 int getMinNbOfThreads()
          Returns the minNbOfThreads.
 java.util.ArrayList getPendingConnections()
          Returns the pendingConnections.
 RequestManager getRequestManager()
          Gets the request manager associated to this database.
 SQLMonitoring getSQLMonitor()
          Returns the current SQL monitor
 int getSQLShortFormLength()
          Return the sql short form length to use when reporting an error.
 VirtualDatabaseStaticMetaData getStaticMetaData()
          Get the whole static metadata for this virtual database.
 java.util.LinkedList getTotalOrderQueue()
          Returns the totalOrderQueue value.
 java.lang.String getVirtualDatabaseName()
          Gets the virtual database name to be used by the client (C-JDBC driver)
 java.lang.String getXml()
          Retrieves this VirtualDatabase object in xml format
 boolean hasRecoveryLog()
          Indicate if there is a recovery log defined for this virtual database
 boolean hasResultCache()
          Indicate if there is a result cache defined for this virtual database
 boolean isDistributed()
          Is this virtual database distributed ?
 boolean isPoolConnectionThreads()
          Returns the poolConnectionThreads.
 boolean isShuttingDown()
          Return true if this database is shutting down.
 void releaseReadLockBackendLists()
          Releases the read lock on the backend lists (both enabled and disabled backends).
 void releaseSavepoint(long transactionId, java.lang.String name)
          Releases a savepoint given its name from a transaction given its id.
 void removeBackend(DatabaseBackend db)
          Remove a backend from this virtual database.
 void removeBackend(java.lang.String backend)
          Remove a backend from the virtual database list.
 void removeCheckpoint(java.lang.String checkpointName)
          Remove a checkpoint from the recovery log of this virtual database
 void removeCurrentNbOfThread()
          Substract one to currentNbOfThreads.
 boolean removeDump(java.lang.String dumpName)
          Remove a dump from the controller repository
 void removeIdleThread()
          Remove an idle thread.
 void replicateBackend(java.lang.String backendName, java.lang.String newBackendName, java.util.Map parameters)
          Add an additionnal backend to the virtual database with connection managers identical to the backend replicated.
 void restoreDumpOnBackend(java.lang.String databaseBackendName, java.lang.String login, java.lang.String password, java.lang.String dumpName, java.util.ArrayList tables)
          Restore a dump on a specific backend.
 java.lang.String[][] retrieveBackendsData()
          Retrieves an array of data on the backends for this virtual database
 void rollback(long transactionId, boolean logRollback)
          Rollbacks a transaction given its id.
 void rollback(long transactionId, java.lang.String savepointName)
          Rollbacks a transaction given its id to a savepoint given its name
 void setAuthenticationManager(AuthenticationManager authenticationManager)
          Sets the authentication manager for this virtual database.
 void setBackendLastKnownCheckpoint(java.lang.String backendName, java.lang.String checkpoint)
          Sets the last known checkpoint of a backend.
 void setBlobFilter(AbstractBlobFilter filter)
          Set the BLOB filter to use for this database.
 void setCheckpoint(java.lang.String checkpointName)
          Set a checkpoint for this virtual database.
 void setMaxNbOfConnections(int maxNbOfConnections)
          Sets the maxNbOfConnections.
 void setMaxNbOfThreads(int maxNbOfThreads)
          Sets the maxNbOfThreads.
 void setMaxThreadIdleTime(long maxThreadIdleTime)
          Sets the maxThreadIdleTime.
 void setMinNbOfThreads(int minNbOfThreads)
          Sets the minNbOfThreads.
 void setMonitoringToActive(boolean active)
          If a monitoring section exists, we can set the monitoring on or off by calling this method.
 void setPoolConnectionThreads(boolean poolConnectionThreads)
          Sets the poolConnectionThreads.
 void setRequestManager(RequestManager requestManager)
          Sets a new request manager for this database.
 int setSavepoint(long transactionId)
          Sets a unnamed savepoint to a transaction given its id.
 void setSavepoint(long transactionId, java.lang.String name)
          Sets a savepoint given its desired name to a transaction given its id.
 void setSQLMonitor(SQLMonitoring sqlMonitor)
          Sets a new SQL Monitor
 void setStaticDatabaseSchema(DatabaseSchema schema)
          Sets a new static database schema for this database if no one exist or merge the given schema to the existing one.
 void setTotalOrderQueue(java.util.LinkedList newQueue)
          Sets the totalOrderQueue.
 void shutdown(int level)
          Shutdown this virtual database.
 void storeBackendsInfo()
          Write the checkpoints for all backends on the recovery log
 void transferBackend(java.lang.String backend, java.lang.String controllerDestination)
          Transfer the backend to the destinated controller.
 void transferDump(java.lang.String dumpName, java.lang.String remoteControllerName, boolean noCopy)
          Transfer specified dump over to specified vdb's controller, making it available for restore operation.
 void updateDumpPath(java.lang.String dumpName, java.lang.String newPath)
          Update the path of the dump for a given dumpName.
 java.util.ArrayList viewAllClientNames()
          Get all users connected to that database
 java.lang.String[] viewBackendInformation(java.lang.String backendName)
          Returns an array of information on this backend The method above is not used at the moment ...
 java.util.ArrayList viewCheckpointNames()
          Returns an array of names of all the checkpoint available in the recovery log of this virtual dabase.
 java.lang.String[] viewControllerList()
          Return the list of controllers defining this virtual database.
 java.util.Hashtable viewGroupBackends()
          Returns a mapping of controller jmx names with their backends.
 java.lang.String viewOwningController()
          Name of the controller owning this virtual database
 
Methods inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
addNotificationListener, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getNotificationInfo, getParameterName, getParameterName, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

name

protected java.lang.String name
Virtual database name


authenticationManager

protected AuthenticationManager authenticationManager
Authentification manager matching virtual database login/password to backends login/password


backends

protected java.util.ArrayList backends
ArrayList of DatabaseBackend objects


rwLock

protected ReadPrioritaryFIFOWriteLock rwLock
Read/Write lock for backend list


requestManager

protected RequestManager requestManager
The request manager to use for this database


totalOrderQueue

protected java.util.LinkedList totalOrderQueue
ArrayList to store the order of requests


logger

public Trace logger
Virtual database logger


requestLogger

protected Trace requestLogger

activeThreads

private java.util.ArrayList activeThreads

idleThreads

private int idleThreads

pendingConnections

private java.util.ArrayList pendingConnections

maxNbOfConnections

protected int maxNbOfConnections
Maximum number of concurrent accepted for this virtual database


poolConnectionThreads

protected boolean poolConnectionThreads
If false one worker thread is forked per connection else


maxThreadIdleTime

protected long maxThreadIdleTime
Maximum time a worker thread can remain idle before dying


minNbOfThreads

protected int minNbOfThreads
Minimum number of worker threads to keep in the pool if poolConnectionThreads is true


maxNbOfThreads

protected int maxNbOfThreads
Maximum number of worker threads to fork


currentNbOfThreads

protected int currentNbOfThreads
Current number of worker threads


metadata

protected VirtualDatabaseDynamicMetaData metadata
Virtual Database MetaData


staticMetadata

private VirtualDatabaseStaticMetaData staticMetadata

sqlMonitor

private SQLMonitoring sqlMonitor

CHECK_BACKEND_ENABLE

public static final int CHECK_BACKEND_ENABLE
Use for method getAndCheck

See Also:
Constant Field Values

CHECK_BACKEND_DISABLE

public static final int CHECK_BACKEND_DISABLE
Use for method getAndCheck

See Also:
Constant Field Values

NO_CHECK_BACKEND

public static final int NO_CHECK_BACKEND
Use for method getAndCheck

See Also:
Constant Field Values

sqlShortFormLength

private int sqlShortFormLength
Short form of SQL statements to include in traces and exceptions


blobFilter

private AbstractBlobFilter blobFilter
The filter used to store blobs in the database


controller

Controller controller
The controller we belong to


databaseProductNames

private java.lang.String databaseProductNames
Comma separated list of database product names (one instance per name)


shuttingDown

private boolean shuttingDown
Marker to see if the database is shutting down

Constructor Detail

VirtualDatabase

public VirtualDatabase(Controller controller,
                       java.lang.String name,
                       int maxConnections,
                       boolean pool,
                       int minThreads,
                       int maxThreads,
                       long maxThreadIdleTime,
                       int sqlShortFormLength,
                       AbstractBlobFilter blobFilter)
                throws javax.management.NotCompliantMBeanException,
                       JmxException
Creates a new VirtualDatabase instance.

Parameters:
name - the virtual database name.
maxConnections - maximum number of concurrent connections.
pool - should we use a pool of threads for handling connections?
minThreads - minimum number of threads in the pool
maxThreads - maximum number of threads in the pool
maxThreadIdleTime - maximum time a thread can remain idle before being removed from the pool.
sqlShortFormLength - maximum number of characters of an SQL statement to diplay in traces or exceptions
blobFilter - encoding method for blobs
controller - the controller we belong to
Throws:
javax.management.NotCompliantMBeanException - in case the bean does not comply with jmx
JmxException - could not register mbean
Method Detail

acquireReadLockBackendLists

public final void acquireReadLockBackendLists()
                                       throws java.lang.InterruptedException
Acquires a read lock on the backend lists (both enabled and disabled backends). This should be called prior traversing the backend ArrayList.

Throws:
java.lang.InterruptedException - if an error occurs

releaseReadLockBackendLists

public final void releaseReadLockBackendLists()
Releases the read lock on the backend lists (both enabled and disabled backends). This should be called after traversing the backend ArrayList.


isDistributed

public boolean isDistributed()
Is this virtual database distributed ?

Specified by:
isDistributed in interface VirtualDatabaseMBean
Returns:
false

checkUserAuthentication

public boolean checkUserAuthentication(java.lang.String virtualLogin,
                                       java.lang.String virtualPassword)
Checks if a given virtual login/password is ok.

Parameters:
virtualLogin - the virtual user login
virtualPassword - the virtual user password
Returns:
true if the login/password is known from the AuthenticationManager. Returns false if no AuthenticationManager is defined.

checkAdminAuthentication

public boolean checkAdminAuthentication(java.lang.String adminLogin,
                                        java.lang.String adminPassword)
Checks if a given admin login/password is ok.

Specified by:
checkAdminAuthentication in interface VirtualDatabaseMBean
Parameters:
adminLogin - admin user login
adminPassword - admin user password
Returns:
true if the login/password is known from the AuthenticationManager. Returns false if no AuthenticationManager is defined.

execReadRequest

public ControllerResultSet execReadRequest(SelectRequest request)
                                    throws java.sql.SQLException
Performs a read request and returns the reply.

Parameters:
request - the request to execute
Returns:
a ControllerResultSet value
Throws:
java.sql.SQLException - if the request fails

execWriteRequest

public int execWriteRequest(AbstractWriteRequest request)
                     throws java.sql.SQLException
Performs a write request and returns the number of rows affected.

Parameters:
request - the request to execute
Returns:
number of rows affected
Throws:
java.sql.SQLException - if the request fails

execWriteRequestWithKeys

public ControllerResultSet execWriteRequestWithKeys(AbstractWriteRequest request)
                                             throws java.sql.SQLException
Performs a write request and returns the auto generated keys.

Parameters:
request - the request to execute
Returns:
auto generated keys
Throws:
java.sql.SQLException - if the request fails

execReadStoredProcedure

public ControllerResultSet execReadStoredProcedure(StoredProcedure proc)
                                            throws java.sql.SQLException
Call a stored procedure that returns a ResultSet.

Parameters:
proc - the stored procedure call
Returns:
a java.sql.ResultSet value
Throws:
java.sql.SQLException - if an error occurs

execWriteStoredProcedure

protected int execWriteStoredProcedure(StoredProcedure proc)
                                throws java.sql.SQLException
Call a stored procedure that performs an update.

Parameters:
proc - the stored procedure call
Returns:
number of rows affected
Throws:
java.sql.SQLException - if an error occurs

begin

public long begin(java.lang.String login)
           throws java.sql.SQLException
Begins a new transaction and returns the corresponding transaction identifier. This method is called from the driver when Connection.setAutoCommit(boolean)is called with false argument.

Note that the transaction begin is not logged in the recovery log by this method, you will have to call logLazyTransactionBegin.

Parameters:
login - the login used by the connection
Returns:
an unique transaction identifier
Throws:
java.sql.SQLException - if an error occurs
See Also:
RequestManager.logLazyTransactionBegin(long)

abort

public void abort(long transactionId,
                  boolean logAbort)
           throws java.sql.SQLException
Abort a transaction that has been started but in which no query was executed. As we use lazy transaction begin, there is no need to rollback such transaction but just to cleanup the metadata associated with this not effectively started transaction.

Parameters:
transactionId - id of the transaction to abort
logAbort - true if the abort (in fact rollback) should be logged in the recovery log
Throws:
java.sql.SQLException - if an error occurs

commit

public void commit(long transactionId,
                   boolean logCommit)
            throws java.sql.SQLException
Commits a transaction given its id.

Parameters:
transactionId - the transaction id
logCommit - true if the commit should be logged in the recovery log
Throws:
java.sql.SQLException - if an error occurs

rollback

public void rollback(long transactionId,
                     boolean logRollback)
              throws java.sql.SQLException
Rollbacks a transaction given its id.

Parameters:
transactionId - the transaction id
logRollback - true if the rollback should be logged in the recovery log
Throws:
java.sql.SQLException - if an error occurs

rollback

public void rollback(long transactionId,
                     java.lang.String savepointName)
              throws java.sql.SQLException
Rollbacks a transaction given its id to a savepoint given its name

Parameters:
transactionId - the transaction id
savepointName - the name of the savepoint
Throws:
java.sql.SQLException - if an error occurs

setSavepoint

public int setSavepoint(long transactionId)
                 throws java.sql.SQLException
Sets a unnamed savepoint to a transaction given its id.

Parameters:
transactionId - the transaction id
Returns:
the savepoint id
Throws:
java.sql.SQLException - if an error occurs

setSavepoint

public void setSavepoint(long transactionId,
                         java.lang.String name)
                  throws java.sql.SQLException
Sets a savepoint given its desired name to a transaction given its id.

Parameters:
transactionId - the transaction id
name - the desired name of the savepoint
Throws:
java.sql.SQLException - if an error occurs

releaseSavepoint

public void releaseSavepoint(long transactionId,
                             java.lang.String name)
                      throws java.sql.SQLException
Releases a savepoint given its name from a transaction given its id.

Parameters:
transactionId - the transaction id
name - the name of the savepoint
Throws:
java.sql.SQLException - if an error occurs

addBackend

public void addBackend(DatabaseBackend db)
                throws VirtualDatabaseException
Add a backend to this virtual database.

Parameters:
db - the database backend to add
Throws:
VirtualDatabaseException - if an error occurs

addBackend

public void addBackend(DatabaseBackend db,
                       boolean checkForCompliance)
                throws VirtualDatabaseException
Add a backend to this virtual database.

Parameters:
db - the database backend to add
checkForCompliance - should load the driver ?
Throws:
VirtualDatabaseException - if an error occurs

forceDisableBackend

public void forceDisableBackend(java.lang.String backendName)
                         throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Disables a backend that is currently enabled on this virtual database (without further check).

Specified by:
forceDisableBackend in interface VirtualDatabaseMBean
Parameters:
backendName - The database backend logical name to enable
Throws:
VirtualDatabaseException - in case of communication-related error
See Also:
VirtualDatabaseMBean.forceDisableBackend(String)

disableAllBackends

public void disableAllBackends()
                        throws VirtualDatabaseException
Prepare this virtual database for shutdown. This turns off all the backends by cutting communication from this database. This does not prevents other virtual database to use shared backends. This doesn't create checkpoints either.

Specified by:
disableAllBackends in interface VirtualDatabaseMBean
Throws:
VirtualDatabaseException - if an error occurs

disableBackendWithCheckpoint

public void disableBackendWithCheckpoint(java.lang.String backendName)
                                  throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Disables a backend once all the pending write queries are executed. A checkpoint is inserted in the recovery log. The backend must belong to this virtual database and be in the enabled state.

Specified by:
disableBackendWithCheckpoint in interface VirtualDatabaseMBean
Parameters:
backendName - The database backend logical name to disable
Throws:
VirtualDatabaseException - in case of communication-related error
See Also:
VirtualDatabaseMBean.disableBackendWithCheckpoint(String)

disableAllBackendsWithCheckpoint

public void disableAllBackendsWithCheckpoint(java.lang.String checkpoint)
                                      throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Disable all backends and store a checkpoint

Specified by:
disableAllBackendsWithCheckpoint in interface VirtualDatabaseMBean
Parameters:
checkpoint - the name of the checkpoitn
Throws:
VirtualDatabaseException - if fails
See Also:
VirtualDatabaseMBean.disableAllBackendsWithCheckpoint(java.lang.String)

forceEnableBackend

public void forceEnableBackend(java.lang.String backendName)
                        throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Enables a backend that has been previously added to this virtual database and that is in the disabled state. The backend is enabled without further check.

Specified by:
forceEnableBackend in interface VirtualDatabaseMBean
Parameters:
backendName - The database backend logical name to enable
Throws:
VirtualDatabaseException - in case of communication-related error
See Also:
VirtualDatabaseMBean.forceEnableBackend(String)

enableBackendFromCheckpoint

public void enableBackendFromCheckpoint(java.lang.String backendName,
                                        java.lang.String checkpointName)
                                 throws VirtualDatabaseException
Enable the given backend from the given checkpoint. This method returns once the recovery is complete.

Parameters:
backendName - backend to enable
checkpointName - checkpoint to enable from
Throws:
VirtualDatabaseException - if an error occurs

enableBackendFromCheckpoint

public void enableBackendFromCheckpoint(java.lang.String backendName)
                                 throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Enable the given backend from its last known checkpoint

Specified by:
enableBackendFromCheckpoint in interface VirtualDatabaseMBean
Parameters:
backendName - the name of the backend to enable
Throws:
VirtualDatabaseException - if enable failed, or if there is no last known checkpoint
See Also:
VirtualDatabaseMBean.enableBackendFromCheckpoint(java.lang.String)

enableAllBackends

public void enableAllBackends()
                       throws VirtualDatabaseException
Enable all the backends without any check.

Specified by:
enableAllBackends in interface VirtualDatabaseMBean
Throws:
VirtualDatabaseException - if fails

enableAllBackendsFromCheckpoint

public void enableAllBackendsFromCheckpoint()
                                     throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Enable all backends from their last known states that has been recorded in the recovery log, and enable only the backends which where properly disabled.

Specified by:
enableAllBackendsFromCheckpoint in interface VirtualDatabaseMBean
Throws:
VirtualDatabaseException - if fails
See Also:
VirtualDatabaseMBean.enableAllBackendsFromCheckpoint()

forceEnableAllBackendsFromCheckpoint

public void forceEnableAllBackendsFromCheckpoint(java.lang.String checkpoint)
                                          throws VirtualDatabaseException
Prepare this virtual database for startup. This turns on all the backends from the given checkpoint. If the checkpoint is null or an empty String, the backends are enabled without further check else the backend states are overriden to use the provided checkpoint.

Parameters:
checkpoint - checkpoint for recovery log
Throws:
VirtualDatabaseException - if fails

getAllBackendNames

public java.util.ArrayList getAllBackendNames()
                                       throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Get a list of all DatabaseBackend names.

Specified by:
getAllBackendNames in interface VirtualDatabaseMBean
Returns:
ArrayList ArrayList of String representing database backend names
Throws:
VirtualDatabaseException - if an error occurs
See Also:
VirtualDatabaseMBean.getAllBackendNames()

getAndCheckBackend

public DatabaseBackend getAndCheckBackend(java.lang.String backendName,
                                          int testEnable)
                                   throws VirtualDatabaseException
Find the DatabaseBackend corresponding to the given backend name and check if it is possible to disable this backend. In the case enable, this method also updates the virtual database schema by merging it with the one provided by this backend.

Parameters:
backendName - backend to look for
testEnable - NO_CHECK_BACKEND no check is done, CHECK_BACKEND_DISABLE check if it is possible to disable the backend, CHECK_BACKEND_ENABLE check if it is possible to enable the backend
Returns:
the backend to disable
Throws:
VirtualDatabaseException - if an error occurs

replicateBackend

public void replicateBackend(java.lang.String backendName,
                             java.lang.String newBackendName,
                             java.util.Map parameters)
                      throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Add an additionnal backend to the virtual database with connection managers identical to the backend replicated.

Specified by:
replicateBackend in interface VirtualDatabaseMBean
Parameters:
backendName - the backend to replicate and to use parameters from.
newBackendName - the new backend name.
parameters - parameters to override or modify when replicating to the new backend
Throws:
VirtualDatabaseException - if cannot replicate backend
See Also:
VirtualDatabaseMBean.replicateBackend(java.lang.String, java.lang.String, java.util.Map)

removeBackend

public void removeBackend(java.lang.String backend)
                   throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Remove a backend from the virtual database list. Do not check whether it is enabled or not, and do not perform backup operation

Specified by:
removeBackend in interface VirtualDatabaseMBean
Parameters:
backend - the name of the backend to remove
Throws:
VirtualDatabaseException - if the backend does not exist
See Also:
VirtualDatabaseMBean.removeBackend(java.lang.String)

removeBackend

public void removeBackend(DatabaseBackend db)
                   throws VirtualDatabaseException
Remove a backend from this virtual database.

Parameters:
db - the database backend to remove
Throws:
VirtualDatabaseException - if an error occurs

transferBackend

public void transferBackend(java.lang.String backend,
                            java.lang.String controllerDestination)
                     throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Transfer the backend to the destinated controller. Note that this does nothing in a non-distributed environment

Specified by:
transferBackend in interface VirtualDatabaseMBean
Parameters:
backend - the backend to transfer
controllerDestination - the controller to copy the backend to
Throws:
VirtualDatabaseException - if transfer failed
See Also:
VirtualDatabaseMBean.transferBackend(java.lang.String, java.lang.String)

getBackuperNames

public java.lang.String[] getBackuperNames()
Description copied from interface: VirtualDatabaseMBean
Get the names of the Backupers available from this BackupManager.

Specified by:
getBackuperNames in interface VirtualDatabaseMBean
Returns:
an (possibly 0-sized) array of String representing the name of the Backupers
See Also:
VirtualDatabaseMBean.getBackuperNames()

getDumpFormatForBackuper

public java.lang.String getDumpFormatForBackuper(java.lang.String backuperName)
Description copied from interface: VirtualDatabaseMBean
Get the dump format associated to a given Backuper

Specified by:
getDumpFormatForBackuper in interface VirtualDatabaseMBean
Parameters:
backuperName - name associated to a Backuper
Returns:
the dump format associated to a given Backuper
See Also:
VirtualDatabaseMBean.getDumpFormatForBackuper(java.lang.String)

backupBackend

public void backupBackend(java.lang.String backendName,
                          java.lang.String login,
                          java.lang.String password,
                          java.lang.String dumpName,
                          java.lang.String backuperName,
                          java.lang.String path,
                          java.util.ArrayList tables)
                   throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Create a backup of a specific backend. Note the backend will be disabled if needed during backup, and will be put back to its previous state after backup.

Specified by:
backupBackend in interface VirtualDatabaseMBean
Parameters:
backendName - the target backend to backup
login - the login to use to connect to the database for the backup operation
password - the password to use to connect to the database for the backup operation
dumpName - the name of the dump to create
backuperName - the logical name of the backuper to use
path - the path where to store the dump
tables - the list of tables to backup, null means all tables
Throws:
VirtualDatabaseException - if the backup fails
See Also:
VirtualDatabaseMBean.backupBackend(String, String, String, String, String, String, ArrayList)

getAvailableDumps

public DumpInfo[] getAvailableDumps()
                             throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Get all available dump info for this virtual database

Specified by:
getAvailableDumps in interface VirtualDatabaseMBean
Returns:
an array of DumpInfo containing the available dump info for this virtual database. Cannot be null but can be empty.
Throws:
VirtualDatabaseException - if cannot retrieve dump informations
See Also:
VirtualDatabaseMBean.getAvailableDumps()

updateDumpPath

public void updateDumpPath(java.lang.String dumpName,
                           java.lang.String newPath)
                    throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Update the path of the dump for a given dumpName.

Specified by:
updateDumpPath in interface VirtualDatabaseMBean
Parameters:
dumpName - name of the dump
newPath - new path for the dump
Throws:
VirtualDatabaseException - if cannot update the path
See Also:
VirtualDatabaseMBean.updateDumpPath(java.lang.String, java.lang.String)

removeDump

public boolean removeDump(java.lang.String dumpName)
Description copied from interface: VirtualDatabaseMBean
Remove a dump from the controller repository

Specified by:
removeDump in interface VirtualDatabaseMBean
Parameters:
dumpName - name of the dump to remove
Returns:
true if the dump was removed, false otherwise
See Also:
VirtualDatabaseMBean.removeDump(String)

removeCheckpoint

public void removeCheckpoint(java.lang.String checkpointName)
                      throws VirtualDatabaseException
Remove a checkpoint from the recovery log of this virtual database

Specified by:
removeCheckpoint in interface VirtualDatabaseMBean
Parameters:
checkpointName - to remove
Throws:
VirtualDatabaseException - if an error occurs

restoreDumpOnBackend

public void restoreDumpOnBackend(java.lang.String databaseBackendName,
                                 java.lang.String login,
                                 java.lang.String password,
                                 java.lang.String dumpName,
                                 java.util.ArrayList tables)
                          throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Restore a dump on a specific backend. The proper Backuper is retrieved automatically according to the dump format stored in the recovery log dump table.

This method disables the backend and leave it disabled after recovery process. The user has to call the enableBackendFromCheckpoint after this.

Specified by:
restoreDumpOnBackend in interface VirtualDatabaseMBean
Parameters:
databaseBackendName - the name of the backend to restore
login - the login to use to connect to the database for the restore operation
password - the password to use to connect to the database for the restore operation
dumpName - the name of the dump to restore
tables - the list of tables to restore, null means all tables
Throws:
VirtualDatabaseException - if the restore operation failed
See Also:
VirtualDatabaseMBean.restoreDumpOnBackend(String, String, String, String, ArrayList)

setBackendLastKnownCheckpoint

public void setBackendLastKnownCheckpoint(java.lang.String backendName,
                                          java.lang.String checkpoint)
                                   throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Sets the last known checkpoint of a backend. This will also update the value in the recovery log

Specified by:
setBackendLastKnownCheckpoint in interface VirtualDatabaseMBean
Parameters:
backendName - backend
checkpoint - checkpoint
Throws:
VirtualDatabaseException - if fails
See Also:
VirtualDatabaseMBean.setBackendLastKnownCheckpoint(java.lang.String, java.lang.String)

viewCheckpointNames

public java.util.ArrayList viewCheckpointNames()
Description copied from interface: VirtualDatabaseMBean
Returns an array of names of all the checkpoint available in the recovery log of this virtual dabase.

Specified by:
viewCheckpointNames in interface VirtualDatabaseMBean
Returns:
ArrayList of checkpoint names. Can be empty
See Also:
VirtualDatabaseMBean.viewCheckpointNames()

addCurrentNbOfThread

public void addCurrentNbOfThread()
Adds one to currentNbOfThreads. Warning! This method is not synchronized.


addIdleThread

public void addIdleThread()
Method add an idle thread. Warning! This method must be called in a synchronized block on activeThreads.


getCurrentNbOfThreads

public int getCurrentNbOfThreads()
Description copied from interface: VirtualDatabaseMBean
Returns the currentNbOfThreads.

Specified by:
getCurrentNbOfThreads in interface VirtualDatabaseMBean
Returns:
int
See Also:
VirtualDatabaseMBean.getCurrentNbOfThreads()

getIdleThreads

public int getIdleThreads()
Returns the number of idle zorker threads. Warning! This method must be called in a synchronized block on activeThreads.

Returns:
int

getMaxNbOfThreads

public int getMaxNbOfThreads()
Returns the maxNbOfThreads.

Returns:
int maximum number of threads

getMaxThreadIdleTime

public long getMaxThreadIdleTime()
Returns the maxThreadIdleTime.

Returns:
long maximum thread idle time in ms

getMinNbOfThreads

public int getMinNbOfThreads()
Returns the minNbOfThreads.

Returns:
int minimum number of threads

isPoolConnectionThreads

public boolean isPoolConnectionThreads()
Returns the poolConnectionThreads.

Returns:
boolean true if threads are pooled

removeCurrentNbOfThread

public void removeCurrentNbOfThread()
Substract one to currentNbOfThreads. Warning! This method is not synchronized.


removeIdleThread

public void removeIdleThread()
Remove an idle thread. Warning! This method must be called in a synchronized block on activeThreads.


setMaxThreadIdleTime

public void setMaxThreadIdleTime(long maxThreadIdleTime)
Sets the maxThreadIdleTime.

Parameters:
maxThreadIdleTime - The maxThreadIdleTime to set

setMinNbOfThreads

public void setMinNbOfThreads(int minNbOfThreads)
Sets the minNbOfThreads.

Parameters:
minNbOfThreads - The minNbOfThreads to set

setPoolConnectionThreads

public void setPoolConnectionThreads(boolean poolConnectionThreads)
Sets the poolConnectionThreads.

Parameters:
poolConnectionThreads - The poolConnectionThreads to set

getActiveThreads

public java.util.ArrayList getActiveThreads()
Returns the activeThreads.

Returns:
ArrayList

getAuthenticationManager

public AuthenticationManager getAuthenticationManager()
Returns the authentication manager of this virtual database.

Returns:
an AuthenticationManager instance

getBackendInformation

public java.lang.String getBackendInformation(java.lang.String backendName)
                                       throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Return information about the specified backend.

Specified by:
getBackendInformation in interface VirtualDatabaseMBean
Parameters:
backendName - the backend logical name
Returns:
String the backend information
Throws:
VirtualDatabaseException - if an error occurs
See Also:
VirtualDatabaseMBean.getBackendInformation(String)

getBackends

public java.util.ArrayList getBackends()
Return the list of all backends

Returns:
ArrayList of DatabaseBackend Objects

getBackendSchema

public java.lang.String getBackendSchema(java.lang.String backendName)
                                  throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
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.

Specified by:
getBackendSchema in interface VirtualDatabaseMBean
Parameters:
backendName - the name of the backend to get the schema from
Returns:
an xml formatted string
Throws:
VirtualDatabaseException - if an error occurs while accessing the backend, or if the backend does not exist.
See Also:
VirtualDatabaseMBean.getBackendSchema(java.lang.String)

getBackendState

public java.lang.String getBackendState(java.lang.String backendName)
                                 throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Return the state of a given database backend

Specified by:
getBackendState in interface VirtualDatabaseMBean
Parameters:
backendName - the name of the backend
Returns:
String description of the database backend
Throws:
VirtualDatabaseException - if fails
See Also:
VirtualDatabaseMBean.getBackendState(java.lang.String)

getBlobFilter

public AbstractBlobFilter getBlobFilter()
Return the BLOB filter used for this database

Returns:
the BLOB filter used for this database.

getDatabaseName

public java.lang.String getDatabaseName()
Gets the virtual database name to be used by the client (C-JDBC driver) This method should be used for local references only (it is faster). For remote RMI calls, use getVirtualDatabaseName().

Returns:
the virtual database name
See Also:
getVirtualDatabaseName()

getDatabaseProductName

public java.lang.String getDatabaseProductName()
See Also:
DatabaseMetaData.getDatabaseProductName()

getDynamicMetaData

public VirtualDatabaseDynamicMetaData getDynamicMetaData()
Returns:
associated metada for this database
See Also:
DatabaseMetaData

getDatabaseSchemaFromActiveBackends

public DatabaseSchema getDatabaseSchemaFromActiveBackends()
                                                   throws java.sql.SQLException
Get the current database schema from merging the schemas of all active backends.

Returns:
the current database schema dynamically gathered
Throws:
java.sql.SQLException - if an error occurs

getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames

public DatabaseSchema getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames()
                                                                                 throws java.sql.SQLException
Get the current database schema from merging the schemas of all active backends. This is needed when a backend is disabled.

Returns:
the current database schema dynamically gathered
Throws:
java.sql.SQLException - if an error occurs

getMaxNbOfConnections

public int getMaxNbOfConnections()
Returns the maxNbOfConnections.

Returns:
int

getPendingConnections

public java.util.ArrayList getPendingConnections()
Returns the pendingConnections.

Returns:
ArrayList

getRequestManager

public RequestManager getRequestManager()
Gets the request manager associated to this database.

Returns:
a RequestManager instance

getStaticMetaData

public VirtualDatabaseStaticMetaData getStaticMetaData()
Get the whole static metadata for this virtual database. A new empty metadata object is created if there was none yet. It will be filled later by gatherStaticMetadata() when the backend is enabled.

Returns:
Virtual database static metadata

getVirtualDatabaseName

public java.lang.String getVirtualDatabaseName()
Gets the virtual database name to be used by the client (C-JDBC driver)

Specified by:
getVirtualDatabaseName in interface VirtualDatabaseMBean
Returns:
the virtual database name

getSQLMonitor

public SQLMonitoring getSQLMonitor()
Returns the current SQL monitor

Returns:
a SQLMonitoring instance or null if no monitor is defined

getSQLShortFormLength

public int getSQLShortFormLength()
Return the sql short form length to use when reporting an error.

Returns:
sql short form length
See Also:
AbstractRequest.getSQLShortForm(int)

getTotalOrderQueue

public java.util.LinkedList getTotalOrderQueue()
Returns the totalOrderQueue value.

Returns:
Returns the totalOrderQueue.

hasRecoveryLog

public boolean hasRecoveryLog()
Description copied from interface: VirtualDatabaseMBean
Indicate if there is a recovery log defined for this virtual database

Specified by:
hasRecoveryLog in interface VirtualDatabaseMBean
Returns:
true if the recovery log is defined and can be accessed, false otherwise
See Also:
VirtualDatabaseMBean.hasRecoveryLog()

hasResultCache

public boolean hasResultCache()
Description copied from interface: VirtualDatabaseMBean
Indicate if there is a result cache defined for this virtual database

Specified by:
hasResultCache in interface VirtualDatabaseMBean
Returns:
true if a request cache is defined and can be accessed, false otherwise
See Also:
VirtualDatabaseMBean.hasResultCache()

setAuthenticationManager

public void setAuthenticationManager(AuthenticationManager authenticationManager)
Sets the authentication manager for this virtual database.

Parameters:
authenticationManager - the AuthenticationManager to set

setBlobFilter

public void setBlobFilter(AbstractBlobFilter filter)
Set the BLOB filter to use for this database.

Parameters:
filter - the filter to use.

setStaticDatabaseSchema

public void setStaticDatabaseSchema(DatabaseSchema schema)
Sets a new static database schema for this database if no one exist or merge the given schema to the existing one. A static schema can only be replaced by another static schema.

Parameters:
schema - the new database shema

setMaxNbOfConnections

public void setMaxNbOfConnections(int maxNbOfConnections)
Sets the maxNbOfConnections.

Parameters:
maxNbOfConnections - The maxNbOfConnections to set

setMaxNbOfThreads

public void setMaxNbOfThreads(int maxNbOfThreads)
Sets the maxNbOfThreads.

Parameters:
maxNbOfThreads - The maxNbOfThreads to set

setRequestManager

public void setRequestManager(RequestManager requestManager)
Sets a new request manager for this database.

Parameters:
requestManager - the new request manager.

setSQLMonitor

public void setSQLMonitor(SQLMonitoring sqlMonitor)
Sets a new SQL Monitor

Parameters:
sqlMonitor - the new SQL monitor

setTotalOrderQueue

public void setTotalOrderQueue(java.util.LinkedList newQueue)
Sets the totalOrderQueue.

Parameters:
newQueue - the new queue to use

setMonitoringToActive

public void setMonitoringToActive(boolean active)
                           throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
If a monitoring section exists, we can set the monitoring on or off by calling this method. If monitoring is not defined we throw an exception.

Specified by:
setMonitoringToActive in interface VirtualDatabaseMBean
Parameters:
active - should set the monitor to on or off
Throws:
VirtualDatabaseException - if there is no monitor.
See Also:
VirtualDatabaseMBean.setMonitoringToActive(boolean)

equals

public boolean equals(java.lang.Object other)
Two virtual databases are equal if they have the same name and group.

Parameters:
other - the object to compare with
Returns:
true if the two virtual databases are equals

cleanMonitoringData

public void cleanMonitoringData()
                         throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Clean data collected by the current monitoring system, to avoid memory problems. Monitor does not have to be active.

Specified by:
cleanMonitoringData in interface VirtualDatabaseMBean
Throws:
VirtualDatabaseException - if there is no monitor.
See Also:
VirtualDatabaseMBean.cleanMonitoringData()

retrieveBackendsData

public java.lang.String[][] retrieveBackendsData()
                                          throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Retrieves an array of data on the backends for this virtual database

Specified by:
retrieveBackendsData in interface VirtualDatabaseMBean
Returns:
String[][] of formatted data for all backends
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.retrieveBackendsData()

getBackendStatistics

public BackendStatistics getBackendStatistics(java.lang.String backendName)
                                       throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Retrieves an array of statistics of the given backend for this virtual database

Specified by:
getBackendStatistics in interface VirtualDatabaseMBean
Parameters:
backendName - name of the backend
Returns:
BackendStatistics[] of formatted data for all backends or null if the backend does not exist
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.getBackendStatistics(java.lang.String)

isShuttingDown

public boolean isShuttingDown()
Return true if this database is shutting down.

Returns:
true if this database is shutting down.

shutdown

public void shutdown(int level)
Description copied from interface: VirtualDatabaseMBean
Shutdown this virtual database. Finish all threads and stop connection to backends

Specified by:
shutdown in interface VirtualDatabaseMBean
Parameters:
level - Constants.SHUTDOWN_WAIT, Constants.SHUTDOWN_SAFE or Constants.SHUTDOWN_FORCE
See Also:
VirtualDatabaseMBean.shutdown(int)

storeBackendsInfo

public void storeBackendsInfo()
Write the checkpoints for all backends on the recovery log


viewAllClientNames

public java.util.ArrayList viewAllClientNames()
Get all users connected to that database

Returns:
an ArrayList of strings containing the clients username

viewBackendInformation

public java.lang.String[] viewBackendInformation(java.lang.String backendName)
                                          throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Returns an array of information on this backend The method above is not used at the moment ... This one is by the GUI.

Specified by:
viewBackendInformation in interface VirtualDatabaseMBean
Parameters:
backendName - the name of the backend
Returns:
String[]
Throws:
VirtualDatabaseException - if an error occurs
See Also:
VirtualDatabaseMBean.viewBackendInformation(java.lang.String)

viewControllerList

public java.lang.String[] viewControllerList()
Description copied from interface: VirtualDatabaseMBean
Return the list of controllers defining this virtual database. If the database is not distributed this returns the same as viewOwningController otherwise returns an array of controller configuring this DistributedVirtualDatabase

Specified by:
viewControllerList in interface VirtualDatabaseMBean
Returns:
String[] of controller names.
See Also:
VirtualDatabaseMBean.viewControllerList()

viewGroupBackends

public java.util.Hashtable viewGroupBackends()
                                      throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Returns a mapping of controller jmx names with their backends. Note the method is only useful in distributed environment

Specified by:
viewGroupBackends in interface VirtualDatabaseMBean
Returns:
Hashtable of controllerName --> ArrayList[BackendInfo]
Throws:
VirtualDatabaseException - if cannot return the result
See Also:
VirtualDatabaseMBean.viewGroupBackends()

viewOwningController

public java.lang.String viewOwningController()
Description copied from interface: VirtualDatabaseMBean
Name of the controller owning this virtual database

Specified by:
viewOwningController in interface VirtualDatabaseMBean
Returns:
url of the controller
See Also:
VirtualDatabaseMBean.viewOwningController()

getAssociatedString

public java.lang.String getAssociatedString()
Description copied from class: AbstractStandardMBean
Allow to retrieve internationalization description on mbeans as well

Specified by:
getAssociatedString in class AbstractStandardMBean
Returns:
part of the key to look for in the translation file.
See Also:
AbstractStandardMBean.getAssociatedString()

getXml

public java.lang.String getXml()
Retrieves this VirtualDatabase object in xml format

Specified by:
getXml in interface VirtualDatabaseMBean
Returns:
xml formatted string that conforms to c-jdbc.dtd

getDistributionXml

protected java.lang.String getDistributionXml()
Get the XML dump of the Distribution element if any.

Returns:
""

deleteLogUpToCheckpoint

public void deleteLogUpToCheckpoint(java.lang.String checkpointName)
                             throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Deletes the recovery log (if any) from the begining upto the specified checkpoint.

Specified by:
deleteLogUpToCheckpoint in interface VirtualDatabaseMBean
Parameters:
checkpointName - the name of the checkpoint upto which to delete the recovery log.
Throws:
VirtualDatabaseException - if there is no recovery log, or in case of error.
See Also:
VirtualDatabaseMBean.deleteLogUpToCheckpoint(java.lang.String)

copyLogFromCheckpoint

public void copyLogFromCheckpoint(java.lang.String dumpName,
                                  java.lang.String controllerName)
                           throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Copies a chunk of the local virtual database recovery log onto a remote controller's peer virtual database log. The copy is performed from the checkpoint associated to the specified dump uptil 'now' (a new global checkpoint). The copy is sent to the specified remote node.

Specified by:
copyLogFromCheckpoint in interface VirtualDatabaseMBean
Parameters:
dumpName - the name of the dump (which gives associated checkpoint) from which to perform the copy.
controllerName - the remote controller to send the copy to
Throws:
VirtualDatabaseException - if there is no recovery log, or the virtual database is not distributed, or in case of error.
See Also:
VirtualDatabaseMBean.copyLogFromCheckpoint(java.lang.String, java.lang.String)

setCheckpoint

public void setCheckpoint(java.lang.String checkpointName)
                   throws VirtualDatabaseException
Set a checkpoint for this virtual database. This operation requires that a recovery log be defined for this vdb, as a checkpoint is a mark in the recovery log. This operation blocks writes vdb-wide (in scheduler), to allow a clean write of the checkpoint mark. This is the local part of the distributed, cluster-wide checkpoint procedure. Overriden with a distributed operation on all controllers recovery logs if the vdb is distributed.

Parameters:
checkpointName - the desired name of the checkpoint
Throws:
VirtualDatabaseException - in case of error. Wraps any error: local recovery log failure, comm failure, remote failure.

copyDump

public void copyDump(java.lang.String dumpName,
                     java.lang.String remoteControllerName)
              throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Copy a local dump over to a remote member of this distributed vdb, making it available for restore operation. Wants a recovery log to be enabled (stores dump info, and meaning less otherwize as no restore is possible without a recovery log). It is pointless (and an error) to use this on a non-distributed virtual db.

Specified by:
copyDump in interface VirtualDatabaseMBean
Parameters:
dumpName - the name of the dump to copy. Should exist locally, and not remotely.
remoteControllerName - the remote controller to talk to.
Throws:
VirtualDatabaseException - in case of error.
See Also:
VirtualDatabaseMBean.copyDump(java.lang.String, java.lang.String)

transferDump

public void transferDump(java.lang.String dumpName,
                         java.lang.String remoteControllerName,
                         boolean noCopy)
                  throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Transfer specified dump over to specified vdb's controller, making it available for restore operation. The local dump is not deleted and still available for local restore operations. This operation wants a recovery log to be enabled for the vdb (stores dump info, and meaning less otherwize as no restore is possible without a recovery log). It is pointless (and an error) to use this on a non-distributed virtual db.

Specified by:
transferDump in interface VirtualDatabaseMBean
Parameters:
dumpName - the name of the dump to copy. Should exist locally, and not remotely.
remoteControllerName - the remote controller to talk to.
noCopy - specifies whether or not to actually copy the dump. Default: false. No-copy is a useful option in case of NFS/shared dumps.
Throws:
VirtualDatabaseException - in case of error
See Also:
VirtualDatabaseMBean.transferDump(java.lang.String, java.lang.String, boolean)


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