|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.management.StandardMBean
org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
org.objectweb.cjdbc.controller.core.Controller
The C-JDBC controller main class. It registers itself in the RMI registry and waits for C-JDBC driver requests.
Nested Class Summary |
Nested classes inherited from class javax.management.StandardMBean |
|
Field Summary | |
private int |
backlogSize
|
private java.util.Hashtable |
configuration
Hashtable of options |
private ControllerServerThread |
connectionThread
Thread that listens for driver connections |
private java.lang.String |
ipAddress
The IP address to bind the controller to. |
private boolean |
isShuttingDown
|
(package private) static Trace |
logger
Logger instance. |
private int |
portNumber
C-JDBC controller port number listening for driver connections |
private ReportManager |
report
Report Manager |
private ControllerSecurityManager |
security
Security Manager |
private java.util.Hashtable |
virtualDatabases
Hashtable of VirtualDatabase objects. |
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_DB, XML_VERSION |
Constructor Summary | |
Controller(java.lang.String ipAddress,
int port,
int backlog)
Creates a new Controller instance. |
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 |
addVirtualDatabase(VirtualDatabase vdb)
Registers a new VirtualDatabase in this controller. |
void |
addVirtualDatabase(VirtualDatabase vdb,
int autoLoad,
java.lang.String checkPoint)
Add the virtual database with the specified options |
void |
addVirtualDatabases(java.lang.String xml)
Register a VirtualDatabase with default options |
void |
addVirtualDatabases(java.lang.String xml,
java.lang.String virtualName,
int autoLoad,
java.lang.String checkPoint)
Registers one or several virtual databases in the controller. |
void |
endOfController(java.lang.Exception fatal)
Create report about fatal error |
java.lang.String |
generateLogReport()
Generate a log report on the controller now |
java.lang.String |
generateReport()
Generate a report on the controller now |
java.lang.String |
getAssociatedString()
Allow to retrieve internationalization description on mbeans as well |
int |
getBacklogSize()
Get the controller socket backlog size. |
java.util.Hashtable |
getConfiguration()
Get current configuration options |
ControllerServerThread |
getConnectionThread()
Access the connection thread. |
java.lang.String |
getIPAddress()
Get the IP address to bind the controller to |
boolean |
getIsShuttingDown()
Is the controller shutting down ? |
boolean |
getJmxEnable()
Returns jmx enable |
java.lang.String |
getJmxName()
Return the jmx name of this controller (hostname:rmiport) |
java.lang.String |
getName()
Returns the controller name. |
int |
getPortNumber()
Get the controller port number |
ReportManager |
getReport()
Returns the report value. |
ControllerSecurityManager |
getSecurity()
|
static java.lang.String |
getVersion()
Returns Version as a long String |
java.lang.String |
getVersionNumber()
Gets the controller version. |
VirtualDatabase |
getVirtualDatabase(java.lang.String virtualDatabaseName)
Gets the VirtualDatabase object corresponding to a virtual
database name. |
java.util.ArrayList |
getVirtualDatabases()
Returns information about the available virtual databases. |
java.lang.String |
getXml()
Get xml formatted representation of this cjdbc component |
java.lang.String |
getXmlController()
Return the xml version of the controller.xml file without doc type declaration, just data. |
java.lang.String |
getXmlVirtualDatabases()
Same as above but for the virtual databases. |
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)
|
boolean |
isSecurityEnabled()
Check whether security is enabled or not |
void |
launch()
Actively launch the controller Add startup actions here to
avoid them in |
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)
Read a XML configuration file for a set of virtual databases |
java.lang.String |
loadXmlConfiguration(java.lang.String filename,
java.lang.String virtualName,
int autoLoad,
java.lang.String checkPoint)
Read a XML configuration file and load only the VirtualDatabase specified in the arguments list |
static void |
main(java.lang.String[] args)
Launches the C-JDBC controller and bind it with RMI registry. |
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 |
void |
setBacklogSize(int size)
Set the controller socket backlog size. |
void |
setConfiguration(java.util.Hashtable configuration)
Sets the configuration value. |
void |
setIPAddress(java.lang.String ipAddress)
Set the IP address to bind the controller to |
void |
setJmxEnable(boolean enable)
set enable JMX |
void |
setPortNumber(int port)
Set the controller backlog size. |
void |
setReport(ReportManager report)
Sets the report value. |
void |
setSecurity(ControllerSecurityManager security)
|
void |
shutdown()
Turns the controller down by using default shutdown level |
void |
shutdown(int level)
Turns the controller down by using default shutdown level |
void |
shutdown(int level,
boolean systemExit)
|
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 |
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int portNumber
private int backlogSize
private java.lang.String ipAddress
private ControllerServerThread connectionThread
static Trace logger
private java.util.Hashtable virtualDatabases
VirtualDatabase
objects.
private java.util.Hashtable configuration
private ControllerSecurityManager security
private ReportManager report
private boolean isShuttingDown
Constructor Detail |
public Controller(java.lang.String ipAddress, int port, int backlog) throws javax.management.NotCompliantMBeanException, JmxException
Controller
instance.
ipAddress
- bind the controller to this ipAddressport
- bind the controller to listen to this portbacklog
- backlog connection size
javax.management.NotCompliantMBeanException
- in case the bean does not comply with
jmx
JmxException
- the bean could not be registeredMethod Detail |
public java.lang.String getAssociatedString()
AbstractStandardMBean
getAssociatedString
in class AbstractStandardMBean
AbstractStandardMBean.getAssociatedString()
public boolean getIsShuttingDown()
ControllerMBean
getIsShuttingDown
in interface ControllerMBean
ControllerMBean.getIsShuttingDown()
public void addVirtualDatabases(java.lang.String xml, java.lang.String virtualName, int autoLoad, java.lang.String checkPoint) throws ControllerException
ControllerMBean
This function expects the content of an XML file conforming to the C-JDBC
DTD to be given as a single String
object.
addVirtualDatabases
in interface ControllerMBean
xml
- XML code to parsevirtualName
- name of the virtual databaseautoLoad
- specify if should be enabled as soon as it is addedcheckPoint
- the checkpoint to use to enable the database
ControllerException
- if an error occurs while interpreting XMLControllerMBean.addVirtualDatabases(String,
String, int, String)
public void addVirtualDatabases(java.lang.String xml) throws ControllerException
addVirtualDatabases
in interface ControllerMBean
xml
- XML code to parse
ControllerException
- if an error occurs while interpreting XMLControllerMBean.addVirtualDatabases(String)
public void addVirtualDatabase(VirtualDatabase vdb) throws ControllerException
VirtualDatabase
in this controller.
vdb
- the VirtualDatabase
to register
ControllerException
- if an error occurspublic void addVirtualDatabase(VirtualDatabase vdb, int autoLoad, java.lang.String checkPoint) throws ControllerException
vdb
- the VirtualDatabase
object to addautoLoad
- specified if backends should be enabledcheckPoint
- specified the checkPoint to recover from, leave null if
no recovery speficied
ControllerException
- if database already exists on the specified
Controller
objectpublic java.lang.String viewInfo() throws java.lang.Exception
ControllerMBean
viewInfo
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.viewInfo()
public java.lang.String viewConfiguration() throws java.lang.Exception
ControllerMBean
viewConfiguration
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.viewConfiguration()
public java.lang.String viewDatabases() throws java.lang.Exception
ControllerMBean
viewDatabases
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.viewDatabases()
public java.lang.String viewDatabasesXml() throws java.lang.Exception
ControllerMBean
viewDatabasesXml
in interface ControllerMBean
java.lang.Exception
- if an error occursControllerMBean.viewDatabasesXml()
public java.lang.String removeVirtualDatabase(java.lang.String virtualname) throws ControllerException
ControllerMBean
removeVirtualDatabase
in interface ControllerMBean
virtualname
- the virtual database name to remove
ControllerException
ControllerMBean.removeVirtualDatabase(String)
public void addDriver(byte[] bytes) throws java.lang.Exception
ControllerMBean
addDriver
in interface ControllerMBean
bytes
- the data in a byte array
java.lang.Exception
- if failsControllerMBean.addDriver(byte[])
public VirtualDatabase getVirtualDatabase(java.lang.String virtualDatabaseName)
VirtualDatabase
object corresponding to a virtual
database name.
virtualDatabaseName
- the virtual database name
VirtualDatabase
object or null if not foundpublic void refreshLogConfiguration() throws ControllerException
ControllerMBean
log4j.properties
file.
refreshLogConfiguration
in interface ControllerMBean
ControllerException
- if the log4j.properties
file
cannot be found in classpathControllerMBean.refreshLogConfiguration()
public java.lang.String getVersionNumber()
ControllerMBean
getVersionNumber
in interface ControllerMBean
String
value containing the version numberControllerMBean.getVersionNumber()
public java.lang.String getXml()
XmlComponent
getXml
in interface XmlComponent
XmlComponent.getXml()
public java.lang.String getXmlController()
public java.lang.String getXmlVirtualDatabases()
public ControllerServerThread getConnectionThread()
connectionThread
public void shutdown() throws ControllerException
ControllerException
ControllerMBean.shutdown(int)
public void shutdown(int level) throws ControllerException
ControllerMBean
shutdown
in interface ControllerMBean
level
- Smart,Fast or Immediate.
ControllerException
- if unknown level or other error occurs.ControllerMBean.shutdown(int)
public void shutdownDatabase(java.lang.String databaseName, int level) throws ControllerException
ControllerMBean
shutdownDatabase
in interface ControllerMBean
databaseName
- the database to shut downlevel
- the level of shutdown define in ControllerConstants
ControllerException
- if failsControllerMBean.shutdownDatabase(String,
int)
public void shutdown(int level, boolean systemExit) throws ControllerException
ControllerException
ControllerMBean.shutdown(int)
public java.lang.String saveConfiguration() throws VirtualDatabaseException
saveConfiguration
in interface ControllerMBean
VirtualDatabaseException
- if an error occursControllerConstants.getSaveFile(java.lang.String)
public boolean hasVirtualDatabase(java.lang.String name)
VirtualDatabase
of a given name exists in this
controller.
hasVirtualDatabase
in interface ControllerMBean
name
- the virtual database name
true
if the virtual database existspublic static void main(java.lang.String[] args) throws java.lang.Exception
-h
or --help
<port>
:
displays usage informations.-j
or --jmx
<port>
:
optinal JMX server HTTP adaptor port number.-n
or --name
<name>
:
optional controller name.-i
or --ip
<ip>
:
optional IP address to beind the controller to.-r
or --rmi
<port>
:
optional RMI registry port number.-v
or --version
: displays version
informations.The controller starts listening for socket connections on the default port. Jmx is configured, and a virtual database can be added.
ControllerConstants.DEFAULT_PORT
Default Listening port
args
- command line arguments (see above)
java.lang.Exception
- when everything goes wrongpublic void endOfController(java.lang.Exception fatal)
fatal
- the cause of the fatal errorpublic void launch()
controller
Add startup actions here to
avoid them in
public java.lang.String getName()
getName
in interface ControllerMBean
public java.lang.String loadXmlConfiguration(java.lang.String filename, java.lang.String virtualName, int autoLoad, java.lang.String checkPoint) throws java.lang.Exception
VirtualDatabase
specified in the arguments list
loadXmlConfiguration
in interface ControllerMBean
filename
- XML configuration file name to take info on
VirtualDatabase
virtualName
- the only database to load, null if should load allautoLoad
- specifies if the backends should be enabled automatically
after loadingcheckPoint
- checkPoint to recover from when enabling backends. Leave
null
if no recovery option is needed.
java.lang.Exception
- if an error occurspublic java.lang.String loadXML(java.lang.String filename) throws java.lang.Exception
loadXML
in interface ControllerMBean
filename
- XML configuration file name
java.lang.Exception
- if an error occurspublic java.lang.String addDriver(java.lang.String filename) throws java.lang.Exception
addDriver
in interface ControllerMBean
filename
- name of the file
java.lang.Exception
- if an error occurspublic java.util.ArrayList getVirtualDatabases()
public java.lang.String getIPAddress()
public void setIPAddress(java.lang.String ipAddress)
ipAddress
- the IP address to usepublic int getPortNumber()
getPortNumber
in interface ControllerMBean
public void setPortNumber(int port)
port
- the port number to setpublic int getBacklogSize()
ControllerMBean
getBacklogSize
in interface ControllerMBean
ControllerMBean.getBacklogSize()
public void setBacklogSize(int size)
ControllerMBean
setBacklogSize
in interface ControllerMBean
size
- backlog sizeControllerMBean.setBacklogSize(int)
public boolean getJmxEnable()
public java.lang.String getJmxName()
getJmxName
in interface ControllerMBean
public void setJmxEnable(boolean enable)
enable
- true if jmx should be enable.public static java.lang.String getVersion()
public java.util.Hashtable getConfiguration()
Hashtable
with controller optionspublic boolean isSecurityEnabled()
public ControllerSecurityManager getSecurity()
public void setSecurity(ControllerSecurityManager security)
security
- The security to set.public java.util.ArrayList listVirtualDatabases()
ControllerMBean
listVirtualDatabases
in interface ControllerMBean
ArrayList
containing String
object
representing the virtual database namesControllerMBean.listVirtualDatabases()
public java.lang.String generateReport() throws java.lang.Exception
ControllerMBean
generateReport
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.generateReport()
public java.util.ArrayList listBackends(java.lang.String virtualDbName) throws java.lang.Exception
ControllerMBean
listBackends
in interface ControllerMBean
virtualDbName
- name of the virtual database
ArrayList
of String
of the names of
the backends
java.lang.Exception
- if fails to access the backendsControllerMBean.listBackends(java.lang.String)
public java.util.ArrayList listDatabaseClients(java.lang.String virtualDbName) throws java.lang.Exception
ControllerMBean
VirtualDatabaseWorkerThread
clients of the given
database
listDatabaseClients
in interface ControllerMBean
virtualDbName
- the name of the virtual database
ArrayList
of
java.lang.Exception
- if failsControllerMBean.listDatabaseClients(java.lang.String)
public boolean isCacheEnableForDatabase(java.lang.String virtualDbName) throws java.lang.Exception
ControllerMBean
isCacheEnableForDatabase
in interface ControllerMBean
virtualDbName
- name of the VirtualDatabase
java.lang.Exception
- if database does not existsControllerMBean.isCacheEnableForDatabase(java.lang.String)
public void setConfiguration(java.util.Hashtable configuration)
configuration
- The configuration to set.public java.lang.String viewDatabaseXml(java.lang.String databaseName) throws java.lang.Exception
ControllerMBean
viewDatabaseXml
in interface ControllerMBean
databaseName
- name of the database
java.lang.Exception
- if failsControllerMBean.viewDatabaseXml(java.lang.String)
public java.lang.String generateLogReport() throws java.lang.Exception
ControllerMBean
generateLogReport
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.generateLogReport()
public java.io.File[] listAvailableDumpFiles()
ControllerMBean
listAvailableDumpFiles
in interface ControllerMBean
File
denoting the available files.
Cannot be null but can be empty.ControllerMBean.listAvailableDumpFiles()
public boolean removeDumpFile(java.io.File dumpFile)
ControllerMBean
removeDumpFile
in interface ControllerMBean
dumpFile
- the file reference of the dumpFile
ControllerMBean.removeDumpFile(java.io.File)
public java.lang.String viewLogConfigurationFile() throws java.io.IOException
ControllerMBean
viewLogConfigurationFile
in interface ControllerMBean
String
java.io.IOException
- if IO problemsControllerMBean.viewLogConfigurationFile()
public void updateLogConfigurationFile(java.lang.String newConfiguration) throws java.io.IOException, ControllerException
ControllerMBean
refreshLogConfiguration
method
updateLogConfigurationFile
in interface ControllerMBean
newConfiguration
- the content of the new log4j configuration
ControllerException
- if could not refresh the logs
java.io.IOException
- if cannot access the log4j fileControllerMBean.updateLogConfigurationFile(java.lang.String)
public boolean isDistributedVirtualDatabase(java.lang.String databaseName)
isDistributedVirtualDatabase
in interface ControllerMBean
ControllerMBean.isDistributedVirtualDatabase(java.lang.String)
public ReportManager getReport()
public void setReport(ReportManager report)
report
- The report to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |