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

All Known Implementing Classes:
Controller

public interface ControllerMBean

JMX Interface of the C-JDBC Controller.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier

Method Summary
 void addDriver(byte[] bytes)
          Reads a driver binary data
 java.lang.String addDriver(java.lang.String filename)
          Reads a driver JAR file.
 void addVirtualDatabases(java.lang.String xml)
          Registers one or several virtual databases in the controller.
 void addVirtualDatabases(java.lang.String xml, java.lang.String virtualName, int autoEnable, java.lang.String checkPoint)
          Registers one or several virtual databases in the controller.
 java.lang.String generateLogReport()
          Generate a log report on the controller now
 java.lang.String generateReport()
          Generate a report on the controller now
 int getBacklogSize()
          Get the controller socket backlog size.
 boolean getIsShuttingDown()
          Is the controller shutting down ?
 java.lang.String getJmxName()
          Gets the jmx name of the controller.
 java.lang.String getName()
          Gets the controller name.
 int getPortNumber()
          Return this controller port number
 java.lang.String getVersionNumber()
          Gets the controller version.
 boolean hasVirtualDatabase(java.lang.String name)
          Tests if a VirtualDatabase of a given name exists in this controller.
 boolean isCacheEnableForDatabase(java.lang.String virtualDbNAme)
          Tell whether the database has some cache enabled
 boolean isDistributedVirtualDatabase(java.lang.String databaseName)
           
 java.io.File[] listAvailableDumpFiles()
          List all the available dump files on this controller
 java.util.ArrayList listBackends(java.lang.String virtualDbName)
          Returns the list of backends for a given database name
 java.util.ArrayList listDatabaseClients(java.lang.String virtualDbName)
          Get the VirtualDatabaseWorkerThread clients of the given database
 java.util.ArrayList listVirtualDatabases()
          Gets the name of the available virtual databases.
 java.lang.String loadXML(java.lang.String filename)
          Reads a XML configuration file.
 java.lang.String loadXmlConfiguration(java.lang.String filename, java.lang.String virtualName, int autoEnable, java.lang.String checkPoint)
          Reads an xml configuration file and search information to load the specified database
 void refreshLogConfiguration()
          Refreshs the logging system configuration by re-reading the log4j.properties file.
 boolean removeDumpFile(java.io.File dumpFile)
          Delete a dump file from the controller repository
 java.lang.String removeVirtualDatabase(java.lang.String virtualname)
          Prevent the controller from accessing a virtual database thereafter
 java.lang.String saveConfiguration()
          Save current configuration of the controller to a default file location.
 void setBacklogSize(int size)
          Set the controller socket backlog size.
 void shutdown(int level)
          Turns the controller down by using default shutdown level
 void shutdownDatabase(java.lang.String databaseName, int level)
          Shutdown a database in the given mode.
 void updateLogConfigurationFile(java.lang.String newConfiguration)
          Update the log4j configuration file with the given content Also call refreshLogConfiguration method
 java.lang.String viewConfiguration()
          Retrieve the configuration about this controller in text format.
 java.lang.String viewDatabases()
          Make a separation between the configuration of the controller and the virtual databases
 java.lang.String viewDatabasesXml()
          View xml configuration of the databases without transformation
 java.lang.String viewDatabaseXml(java.lang.String databaseName)
          View the xml configuration of the given database
 java.lang.String viewInfo()
          Retrieve the information about this controller in xml format.
 java.lang.String viewLogConfigurationFile()
          Retrieve the content of the log4j configuration file
 

Method Detail

getName

public java.lang.String getName()
Gets the controller name.

Returns:
a String value containing the controller name.

getJmxName

public java.lang.String getJmxName()
Gets the jmx name of the controller.

Returns:
a String value containing the jmx name of the controller

getPortNumber

public int getPortNumber()
Return this controller port number

Returns:
a int containing the port code number

getBacklogSize

public int getBacklogSize()
Get the controller socket backlog size.

Returns:
the backlog size

setBacklogSize

public void setBacklogSize(int size)
Set the controller socket backlog size.

Parameters:
size - backlog size

getIsShuttingDown

public boolean getIsShuttingDown()
Is the controller shutting down ?

Returns:
true if the controller is no more accepting connection

hasVirtualDatabase

public boolean hasVirtualDatabase(java.lang.String name)
Tests if a VirtualDatabase of a given name exists in this controller.

Parameters:
name - the virtual database name
Returns:
true if the virtual database exists

getVersionNumber

public java.lang.String getVersionNumber()
                                  throws java.rmi.RemoteException
Gets the controller version.

Returns:
a String value containing the version number
Throws:
java.rmi.RemoteException - if an error occurs

listVirtualDatabases

public java.util.ArrayList listVirtualDatabases()
                                         throws java.lang.Exception
Gets the name of the available virtual databases.

Returns:
ArrayList containing String object representing the virtual database names
Throws:
java.lang.Exception - if an error occurs

listBackends

public java.util.ArrayList listBackends(java.lang.String virtualDbName)
                                 throws java.lang.Exception
Returns the list of backends for a given database name

Parameters:
virtualDbName - name of the virtual database
Returns:
ArrayList of String of the names of the backends
Throws:
java.lang.Exception - if fails to access the backends

listDatabaseClients

public java.util.ArrayList listDatabaseClients(java.lang.String virtualDbName)
                                        throws java.lang.Exception
Get the VirtualDatabaseWorkerThread clients of the given database

Parameters:
virtualDbName - the name of the virtual database
Returns:
ArrayList of
Throws:
java.lang.Exception - if fails

isCacheEnableForDatabase

public boolean isCacheEnableForDatabase(java.lang.String virtualDbNAme)
                                 throws java.lang.Exception
Tell whether the database has some cache enabled

Parameters:
virtualDbNAme - name of the VirtualDatabase
Returns:
true if cache is enabled
Throws:
java.lang.Exception - if database does not exists

addVirtualDatabases

public void addVirtualDatabases(java.lang.String xml)
                         throws ControllerException
Registers one or several virtual databases in the controller. The description of each Virtual Database must contain the definition of the backends and components (cache, scheduler, load balancer) to use.

This function expects the content of an XML file conforming to the C-JDBC DTD to be given as a single String object.

Parameters:
xml - XML code to parse
Throws:
ControllerException - if an error occurs while interpreting XML

addVirtualDatabases

public void addVirtualDatabases(java.lang.String xml,
                                java.lang.String virtualName,
                                int autoEnable,
                                java.lang.String checkPoint)
                         throws ControllerException
Registers one or several virtual databases in the controller. The description of each Virtual Database must contain the definition of the backends and components (cache, scheduler, load balancer) to use.

This function expects the content of an XML file conforming to the C-JDBC DTD to be given as a single String object.

Parameters:
xml - XML code to parse
virtualName - name of the virtual database
autoEnable - specify if should be enabled as soon as it is added
checkPoint - the checkpoint to use to enable the database
Throws:
ControllerException - if an error occurs while interpreting XML

refreshLogConfiguration

public void refreshLogConfiguration()
                             throws ControllerException
Refreshs the logging system configuration by re-reading the log4j.properties file.

Throws:
ControllerException - if the log4j.properties file cannot be found in classpath

loadXML

public java.lang.String loadXML(java.lang.String filename)
                         throws java.lang.Exception
Reads a XML configuration file.

Parameters:
filename - XML configuration file name
Returns:
a diagnostic message
Throws:
java.lang.Exception - if an error occurs

loadXmlConfiguration

public java.lang.String loadXmlConfiguration(java.lang.String filename,
                                             java.lang.String virtualName,
                                             int autoEnable,
                                             java.lang.String checkPoint)
                                      throws java.lang.Exception
Reads an xml configuration file and search information to load the specified database

Parameters:
filename - the path to the xml file
virtualName - the virtual database we want to load
autoEnable - Specifiy whether the backends should be enabled
checkPoint - Recover from specified checkpoint if needed
Returns:
a diagnostic message
Throws:
java.lang.Exception - if an error occurs

shutdown

public void shutdown(int level)
              throws ControllerException
Turns the controller down by using default shutdown level

Parameters:
level - Smart,Fast or Immediate.
Throws:
ControllerException - if unknown level or other error occurs.

addDriver

public java.lang.String addDriver(java.lang.String filename)
                           throws java.lang.Exception
Reads a driver JAR file.

Parameters:
filename - name of the file
Returns:
a diagnostic message
Throws:
java.lang.Exception - if an error occurs

addDriver

public void addDriver(byte[] bytes)
               throws java.lang.Exception
Reads a driver binary data

Parameters:
bytes - the data in a byte array
Throws:
java.lang.Exception - if fails

removeVirtualDatabase

public java.lang.String removeVirtualDatabase(java.lang.String virtualname)
                                       throws java.lang.Exception
Prevent the controller from accessing a virtual database thereafter

Parameters:
virtualname - the virtual database name to remove
Returns:
description message
Throws:
java.lang.Exception - if fails

viewInfo

public java.lang.String viewInfo()
                          throws java.lang.Exception
Retrieve the information about this controller in xml format.

Returns:
the complete xml formatted description of this controller
Throws:
java.lang.Exception - if fails

viewConfiguration

public java.lang.String viewConfiguration()
                                   throws java.lang.Exception
Retrieve the configuration about this controller in text format.

Returns:
the complete xml formatted description of this controller
Throws:
java.lang.Exception - if fails

viewDatabases

public java.lang.String viewDatabases()
                               throws java.lang.Exception
Make a separation between the configuration of the controller and the virtual databases

Returns:
databases info in text format
Throws:
java.lang.Exception - if fails

saveConfiguration

public java.lang.String saveConfiguration()
                                   throws java.lang.Exception
Save current configuration of the controller to a default file location.

Returns:
status message
Throws:
java.lang.Exception - if fails

viewDatabasesXml

public java.lang.String viewDatabasesXml()
                                  throws java.lang.Exception
View xml configuration of the databases without transformation

Returns:
xml formatted text
Throws:
java.lang.Exception - if an error occurs

viewDatabaseXml

public java.lang.String viewDatabaseXml(java.lang.String databaseName)
                                 throws java.lang.Exception
View the xml configuration of the given database

Parameters:
databaseName - name of the database
Returns:
xml formatted text
Throws:
java.lang.Exception - if fails

generateReport

public java.lang.String generateReport()
                                throws java.lang.Exception
Generate a report on the controller now

Returns:
the content of the report
Throws:
java.lang.Exception - if fails

generateLogReport

public java.lang.String generateLogReport()
                                   throws java.lang.Exception
Generate a log report on the controller now

Returns:
the content of the logreport
Throws:
java.lang.Exception - if fails

shutdownDatabase

public void shutdownDatabase(java.lang.String databaseName,
                             int level)
                      throws ControllerException
Shutdown a database in the given mode. This shuts down the backends and make backups depending on the shutdown level

Parameters:
databaseName - the database to shut down
level - the level of shutdown define in ControllerConstants
Throws:
ControllerException - if fails

listAvailableDumpFiles

public java.io.File[] listAvailableDumpFiles()
List all the available dump files on this controller

Returns:
an array of File denoting the available files. Cannot be null but can be empty.

removeDumpFile

public boolean removeDumpFile(java.io.File dumpFile)
Delete a dump file from the controller repository

Parameters:
dumpFile - the file reference of the dumpFile
Returns:
true deletion was completed, false otherwise

viewLogConfigurationFile

public java.lang.String viewLogConfigurationFile()
                                          throws java.io.IOException
Retrieve the content of the log4j configuration file

Returns:
String
Throws:
java.io.IOException - if IO problems

updateLogConfigurationFile

public void updateLogConfigurationFile(java.lang.String newConfiguration)
                                throws java.io.IOException,
                                       ControllerException
Update the log4j configuration file with the given content Also call refreshLogConfiguration method

Parameters:
newConfiguration - the content of the new log4j configuration
Throws:
java.io.IOException - if cannot access the log4j file
ControllerException - if could not refresh the logs

isDistributedVirtualDatabase

public boolean isDistributedVirtualDatabase(java.lang.String databaseName)
See Also:
VirtualDatabaseMBean.isDistributed()


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