|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.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_CONTROLLER, 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)
Adds a driver jar file sent in its binary form in the drivers directory of the controller. |
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 vdbName,
int autoEnable,
java.lang.String checkpoint)
Adds virtual databases contained in the XML document given as a String. |
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 |
getControllerName()
Returns the controller name. |
java.lang.String |
getIPAddress()
Get the IP address to bind the controller to |
boolean |
getJmxEnable()
Returns jmx enable |
java.lang.String |
getJmxName()
Return the jmx name of this controller (hostname:rmiport) |
java.lang.String |
getLoggingConfiguration()
Get the configuration of the logging now. |
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 |
getVirtualDatabaseNames()
Returns the names of currently available virtual databases. |
java.util.ArrayList |
getVirtualDatabases()
Returns information about the available virtual databases. |
java.lang.String |
getXml()
Return the xml version of the controller.xml file without doc type declaration, just data. |
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 |
isSecurityEnabled()
Check whether security is enabled or not |
boolean |
isShuttingDown()
Is the controller shutting down ? |
void |
launch()
Actively launch the controller . |
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. |
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(int level)
Turns the controller down by using default shutdown level |
void |
updateLogConfigurationFile(java.lang.String newConfiguration)
Update the log4j configuration file with the given content Also call refreshLogConfiguration method |
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 void addVirtualDatabases(java.lang.String xml, java.lang.String vdbName, int autoEnable, java.lang.String checkpoint) throws ControllerException
xml
- XML configuration file contentvdbName
- optional virtual database name to autoloadautoEnable
- autoenable backend mode for virtual databasecheckpoint
- checkpoint name if autoEnable is set to force
ControllerException
- if an error occurspublic 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 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 java.util.ArrayList getVirtualDatabaseNames()
ControllerMBean
getVirtualDatabaseNames
in interface ControllerMBean
String
objects.ControllerMBean.getVirtualDatabaseNames()
public java.util.ArrayList getVirtualDatabases()
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 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 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
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 saveConfiguration() throws VirtualDatabaseException
saveConfiguration
in interface ControllerMBean
VirtualDatabaseException
- if an error occursControllerConstants.getSaveFile(java.lang.String)
public void endOfController(java.lang.Exception fatal)
fatal
- the cause of the fatal errorpublic ControllerServerThread getConnectionThread()
connectionThread
public boolean isShuttingDown()
ControllerMBean
isShuttingDown
in interface ControllerMBean
ControllerMBean.isShuttingDown()
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 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 launch()
controller
. Add startup actions here to
avoid them in
public java.lang.String getControllerName()
getControllerName
in interface ControllerMBean
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.lang.String generateReport() throws java.lang.Exception
ControllerMBean
generateReport
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.generateReport()
public java.lang.String getLoggingConfiguration() throws java.lang.Exception
ControllerMBean
getLoggingConfiguration
in interface ControllerMBean
String
representing the logging configuration
java.lang.Exception
- if the logging configuration can not be returnedControllerMBean.getLoggingConfiguration()
public void setConfiguration(java.util.Hashtable configuration)
configuration
- The configuration to set.public java.lang.String getVersionNumber()
ControllerMBean
getVersionNumber
in interface ControllerMBean
String
value containing the version numberControllerMBean.getVersionNumber()
public java.lang.String getAssociatedString()
AbstractStandardMBean
getAssociatedString
in class AbstractStandardMBean
AbstractStandardMBean.getAssociatedString()
public java.lang.String getXml()
ControllerMBean
getXml
in interface ControllerMBean
XmlComponent.getXml()
public java.lang.String getXmlController()
public java.lang.String getXmlVirtualDatabases()
public java.lang.String generateLogReport() throws java.lang.Exception
ControllerMBean
generateLogReport
in interface ControllerMBean
java.lang.Exception
- if failsControllerMBean.generateLogReport()
public 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 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
java.io.IOException
- if cannot access the log4j file
ControllerException
- if could not refresh the logsControllerMBean.updateLogConfigurationFile(java.lang.String)
public java.lang.String viewLogConfigurationFile() throws java.io.IOException
ControllerMBean
viewLogConfigurationFile
in interface ControllerMBean
String
java.io.IOException
- if IO problemsControllerMBean.viewLogConfigurationFile()
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 |