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

All Known Implementing Classes:
VirtualDatabase

public interface VirtualDatabaseMBean

JMX Interface to remotely manage a Virtual Databases.

Version:
1.0
Author:
Emmanuel Cecchet , Nicolas Modrzyk

Method Summary
 void backupBackendWithCheckpoint(java.lang.String backendName, java.lang.String checkpointName, java.util.ArrayList tables)
          Create a back up of a specific backend Note the backend will be disabled during backup, and will be put back to its previous state after backup.
 void callBackupManager(boolean backup, java.lang.String backendName, java.lang.String checkpoint, java.util.ArrayList tables, boolean enableAfter, BackupListener listener)
          Call the backup manager on the given backend.
 boolean checkAdminAuthentication(java.lang.String adminLogin, java.lang.String adminPassword)
          Authenticate a user for a given virtual database
 void cleanMonitoringData()
          Clean data collected by the current monitoring system, to avoid memory problems.
 void disableAllBackend()
          Disable all backends for this virtual database
 void disableAllBackendForCheckpoint(java.lang.String checkpoint)
          Disable all backends and store a checkpoint
 void disableBackend(java.lang.String databaseBackendName)
          Disables a backend that is currently enabled on this virtual database (without further check).
 void disableBackendForCheckpoint(java.lang.String databaseBackendName, java.lang.String checkpointName)
          Disables a backend once all the pending write queries are executed.
 void enableAllBackend()
          Prepare this virtual database for startup.
 void enableAllBackend(java.lang.String checkpoint)
          Prepare this virtual database for startup.
 void enableAllBackendsFromRecovery(java.lang.String checkpoint)
          This emulates the method enableAllBackend() except it tries to get previous backend states from the recovery log, and enable only the backends with a recorded state of enable.
 void enableBackend(java.lang.String databaseBackendName)
          Enables a backend that has been previously added to this virtual database and that is in the disabled state.
 void enableBackendFromCheckpoint(java.lang.String databaseBackendName, java.lang.String checkpointName)
          Plays all the queries since the given checkpoint and enables the backend when it is completely synchronized.
 void enableBackendFromCheckpoint(java.lang.String databaseBackendName, java.lang.String checkpointName, boolean threaded)
          Plays all the queries since the given checkpoint and enables the backend when it is completely synchronized.
 void enableBackendFromLastCheckpoint(java.lang.String backendName)
          Enable the given backend from its last known checkpoint
 java.lang.String getBackendInformation(java.lang.String backendName)
          Return information about the specified backend.
 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
 AbstractBlobFilter getBlobFilter()
          Returns the blobFilter associated to this virtual database
 int getCurrentNbOfThreads()
          Returns the currentNbOfThreads.
 java.lang.String getName()
          Gets the virtual database name to be used by the client (C-JDBC driver)
 boolean hasRecoveryLog()
          Indicate whether there is a recovery log defined for this virtual database
 boolean isDistributed()
          Tells whether this database is distributed or not
 void removeBackend(java.lang.String backend)
          Remove a backend from the virtual database list.
 void removeCheckpoint(java.lang.String checkpoint)
          Disable all backends and store a checkpoint
 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 restoreBackendFromBackupCheckpoint(java.lang.String databaseBackendName, java.lang.String checkpointName)
          Recopy all the data of a previous dump recorded by octopus into the named backend.
 java.lang.String[][] retrieveBackendsData()
          Retrieves an array of data on the backends 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)
          Sets the blob encoder
 void setMonitoringToActive(boolean active)
          If a monitoring section exists, we can set the monitoring on or off by calling this method.
 void shutdown()
          Shutdown a virtual database in fast mode, disconnect clients
 void transferBackend(java.lang.String backend, java.lang.String controllerDestination)
          Transfer the backend to the destinated controller.
 java.util.ArrayList viewAllBackendNames()
          Get the name of all DatabaseBackend names.
 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 Note the method is only useful in distributed environment
 java.lang.String viewOwningController()
          Name of the controller owning this virtual database
 

Method Detail

backupBackendWithCheckpoint

public void backupBackendWithCheckpoint(java.lang.String backendName,
                                        java.lang.String checkpointName,
                                        java.util.ArrayList tables)
                                 throws VirtualDatabaseException
Create a back up of a specific backend Note the backend will be disabled during backup, and will be put back to its previous state after backup.

Parameters:
backendName - to backup
checkpointName - to associate this backup with
tables - to copy or null if copy all
Throws:
VirtualDatabaseException - if fails

getBackendInformation

public java.lang.String getBackendInformation(java.lang.String backendName)
                                       throws VirtualDatabaseException
Return information about the specified backend.

Parameters:
backendName - the backend logical name
Returns:
String the backend information
Throws:
VirtualDatabaseException - if an error occurs

hasRecoveryLog

public boolean hasRecoveryLog()
Indicate whether there is a recovery log defined for this virtual database

Returns:
true if the recovery log is defined and can be accessed, false otherwise

viewBackendInformation

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

Parameters:
backendName - the name of the backend
Returns:
String[]
Throws:
VirtualDatabaseException - if an error occurs

enableBackend

public void enableBackend(java.lang.String databaseBackendName)
                   throws VirtualDatabaseException
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.

Parameters:
databaseBackendName - The database backend logical name to enable
Throws:
VirtualDatabaseException - in case of communication-related error

enableBackendFromLastCheckpoint

public void enableBackendFromLastCheckpoint(java.lang.String backendName)
                                     throws VirtualDatabaseException
Enable the given backend from its last known checkpoint

Parameters:
backendName - the name of the backend to enable
Throws:
VirtualDatabaseException - if enable failed, or if there is no last known checkpoint

enableBackendFromCheckpoint

public void enableBackendFromCheckpoint(java.lang.String databaseBackendName,
                                        java.lang.String checkpointName)
                                 throws VirtualDatabaseException
Plays all the queries since the given checkpoint and enables the backend when it is completely synchronized. The backend must have been previously added to this virtual database and be in the disabled state

Parameters:
databaseBackendName - The database backend logical name to enable
checkpointName - the checkpoint name to restart from
Throws:
VirtualDatabaseException - in case of communication-related error

enableBackendFromCheckpoint

public void enableBackendFromCheckpoint(java.lang.String databaseBackendName,
                                        java.lang.String checkpointName,
                                        boolean threaded)
                                 throws VirtualDatabaseException
Plays all the queries since the given checkpoint and enables the backend when it is completely synchronized. The backend must have been previously added to this virtual database and be in the disabled state

Parameters:
databaseBackendName - The database backend logical name to enable
checkpointName - the checkpoint name to restart from
threaded - if true do not wait for the end of the execution before returning, and do not throw any Exception. Any message or error will be reported through jmx notification. if false, the method is blocked until the recovery is finished.
Throws:
VirtualDatabaseException - in case of communication-related error

disableBackend

public void disableBackend(java.lang.String databaseBackendName)
                    throws VirtualDatabaseException
Disables a backend that is currently enabled on this virtual database (without further check).

Parameters:
databaseBackendName - The database backend logical name to enable
Throws:
VirtualDatabaseException - in case of communication-related error

restoreBackendFromBackupCheckpoint

public void restoreBackendFromBackupCheckpoint(java.lang.String databaseBackendName,
                                               java.lang.String checkpointName)
                                        throws VirtualDatabaseException,
                                               BackupException,
                                               OctopusException
Recopy all the data of a previous dump recorded by octopus into the named backend. This disables the backend and leave it disable after recovery process. The user has to call the enableBackendFromCheckpoint after this.

Parameters:
databaseBackendName - the name of the backend to restore
checkpointName - the name of the checkpoint that has a dump
Throws:
VirtualDatabaseException - if cannot access the backend from its name
OctopusException - if backup failed while in octopus mode
BackupException - if backup failed for other reasons

disableBackendForCheckpoint

public void disableBackendForCheckpoint(java.lang.String databaseBackendName,
                                        java.lang.String checkpointName)
                                 throws VirtualDatabaseException
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.

Parameters:
databaseBackendName - The database backend logical name to disable
checkpointName - the checkpoint name to store
Throws:
VirtualDatabaseException - in case of communication-related error

getName

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

Returns:
the virtual database name

viewCheckpointNames

public java.util.ArrayList viewCheckpointNames()
Returns an array of names of all the checkpoint available in the recovery log of this virtual dabase.

Returns:
ArrayList of checkpoint names. Can be empty

getBackendState

public java.lang.String getBackendState(java.lang.String backendName)
                                 throws VirtualDatabaseException
Return the state of a given database backend

Parameters:
backendName - the name of the backend
Returns:
String description of the database backend
Throws:
VirtualDatabaseException - if fails

viewAllBackendNames

public java.util.ArrayList viewAllBackendNames()
                                        throws VirtualDatabaseException
Get the name of all DatabaseBackend names.

Returns:
ArrayList ArrayList of String representing database backend names
Throws:
VirtualDatabaseException - if an error occurs

viewGroupBackends

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

Returns:
Hashtable of controllerName --> ArrayList of backend names
Throws:
VirtualDatabaseException - if cannot return the result

enableAllBackend

public void enableAllBackend()
                      throws VirtualDatabaseException
Prepare this virtual database for startup. This turns on all the backends

Throws:
VirtualDatabaseException - if fails

enableAllBackend

public void enableAllBackend(java.lang.String checkpoint)
                      throws VirtualDatabaseException
Prepare this virtual database for startup. This turns on all the backends

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

enableAllBackendsFromRecovery

public void enableAllBackendsFromRecovery(java.lang.String checkpoint)
                                   throws VirtualDatabaseException
This emulates the method enableAllBackend() except it tries to get previous backend states from the recovery log, and enable only the backends with a recorded state of enable.

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

disableAllBackend

public void disableAllBackend()
                       throws VirtualDatabaseException
Disable all backends for this virtual database

Throws:
VirtualDatabaseException - if fails

disableAllBackendForCheckpoint

public void disableAllBackendForCheckpoint(java.lang.String checkpoint)
                                    throws VirtualDatabaseException
Disable all backends and store a checkpoint

Parameters:
checkpoint - the name of the checkpoitn
Throws:
VirtualDatabaseException - if fails

removeCheckpoint

public void removeCheckpoint(java.lang.String checkpoint)
                      throws VirtualDatabaseException
Disable all backends and store a checkpoint

Parameters:
checkpoint - the name of the checkpoitn
Throws:
VirtualDatabaseException - if fails

checkAdminAuthentication

public boolean checkAdminAuthentication(java.lang.String adminLogin,
                                        java.lang.String adminPassword)
                                 throws VirtualDatabaseException
Authenticate a user for a given virtual database

Parameters:
adminLogin - username
adminPassword - password
Returns:
true if authentication is a success, false otherwise
Throws:
VirtualDatabaseException - if database does not exists

shutdown

public void shutdown()
              throws VirtualDatabaseException
Shutdown a virtual database in fast mode, disconnect clients

Throws:
VirtualDatabaseException - if fails

setBackendLastKnownCheckpoint

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

Parameters:
backendName - backend
checkpoint - checkpoint
Throws:
VirtualDatabaseException - if fails

viewOwningController

public java.lang.String viewOwningController()
Name of the controller owning this virtual database

Returns:
url of the controller

isDistributed

public boolean isDistributed()
Tells whether this database is distributed or not

Returns:
true if the database is distributed among multiple controllers false if it exists on a single controller only

replicateBackend

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

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

retrieveBackendsData

public java.lang.String[][] retrieveBackendsData()
                                          throws java.lang.Exception
Retrieves an array of data on the backends for this virtual database

Returns:
String[][] of formatted data for all backends
Throws:
java.lang.Exception - if fails

viewControllerList

public java.lang.String[] viewControllerList()
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

Returns:
String[] of controller names.

removeBackend

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

Parameters:
backend - the name of the backend to remove
Throws:
VirtualDatabaseException - if the backend does not exist

transferBackend

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

Parameters:
backend - the backend to transfer
controllerDestination - the controller to copy the backend to
Throws:
VirtualDatabaseException - if transfer failed

callBackupManager

public void callBackupManager(boolean backup,
                              java.lang.String backendName,
                              java.lang.String checkpoint,
                              java.util.ArrayList tables,
                              boolean enableAfter,
                              BackupListener listener)
                       throws VirtualDatabaseException
Call the backup manager on the given backend. Start a fire and forget thread for backup or recovery. The only two ways to get the results is to wait for jmx notifications, or the listener given as a parameter.

Parameters:
backup - true if this is a backup, false if this is a restore process
backendName - the name of the backend
checkpoint - the name of the checkpoint associated with the process
tables - the tables to consider while performing the copy
enableAfter - should be enable the backend automatically after
listener - callback object to notify of the end of the process
Throws:
VirtualDatabaseException - if fails

getBackendSchema

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

setBlobFilter

public void setBlobFilter(AbstractBlobFilter filter)
Sets the blob encoder

Parameters:
filter - blob encode

getBlobFilter

public AbstractBlobFilter getBlobFilter()
Returns the blobFilter associated to this virtual database

Returns:
Returns the blobFilter.

getCurrentNbOfThreads

public int getCurrentNbOfThreads()
Returns the currentNbOfThreads.

Returns:
int

setMonitoringToActive

public void setMonitoringToActive(boolean active)
                           throws VirtualDatabaseException
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.

Parameters:
active - should set the monitor to on or off
Throws:
VirtualDatabaseException - if there is no monitor.

cleanMonitoringData

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

Throws:
VirtualDatabaseException - if there is no monitor.


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