|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.controller.Controller
The C-JDBC controller main class. It registers itself in the RMI registry and waits for C-JDBC driver requests.
| Field Summary | |
private int |
backlogSize
|
private static java.util.Hashtable |
configure
Hashtable of options |
private ControllerServerThread |
connectionThread
Thread that listens for driver connections |
private static Controller |
controller
Controller static |
private java.lang.String |
controllerName
C-JDBC controller name . |
private java.lang.String |
ipAddress
The IP address to bind the controller to. |
private static CjdbcJmxAgent |
jmxAgent
JMX agent that starts the JMX server, adaptors and registers the MBeans. |
(package private) static Trace |
logger
Logger instance. |
private int |
portNumber
C-JDBC controller port number listening for driver connections |
private java.util.Hashtable |
virtualDatabases
Hashtable of VirtualDatabase objects. |
| Constructor Summary | |
Controller()
Creates a new Controller instance. |
|
Controller(java.lang.String name)
Creates a new Controller instance with the specified
controllerName |
|
| 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,
boolean autoEnable,
java.lang.String checkPoint)
Add the virtual database with the specified options |
void |
addVirtualDatabases(java.lang.String xml)
Register a VirtualDatabase via RMI with default options |
void |
addVirtualDatabases(java.lang.String xml,
java.lang.String virtualName,
boolean autoEnable,
java.lang.String checkPoint)
Registers one or several virtual databases in the controller. |
static void |
endOfController(java.lang.Exception fatal)
Create report about fatal error |
static boolean |
getAllowAddDriver()
get allow add driver |
int |
getBacklogSize()
Get the controller socket backlog size. |
java.lang.String |
getBindName()
Returns the controller name. |
static java.util.Hashtable |
getConfiguration()
Get current configuration options |
ControllerServerThread |
getConnectionThread()
Access the connection thread. |
java.lang.String |
getInformation()
|
java.lang.String |
getIPAddress()
Get the IP address to bind the controller to |
JmxAgent |
getJmxAgent()
Returns the jmxAgent. |
static boolean |
getJmxEnable()
Returns jmx enable |
int |
getPortNumber()
Get the controller port number |
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.util.ArrayList |
getVirtualDatabasesInfo()
Returns the available virtual databases. |
java.lang.String |
getXmlInformation()
Return the controller information in XML format. |
boolean |
hasVirtualDatabase(java.lang.String name)
Tests if a VirtualDatabase of a given name exists in this
controller. |
void |
launch()
Actively launch the controller Add startup actions here to
avoid them in |
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,
boolean autoEnable,
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 |
java.lang.String |
saveConfiguration(java.lang.String filepath)
Save current configuration to the file specified as argument. |
static void |
setAllowAddDriver(boolean enable)
Set allow add driver |
void |
setBacklogSize(int size)
Set the controller socket backlog size. |
void |
setBindName(java.lang.String controllerName)
Sets the controller name |
void |
setIPAddress(java.lang.String ipAddress)
Set the IP address to bind the controller to |
void |
setJMXAgent(CjdbcJmxAgent agent)
Set the JmxAgent |
static void |
setJmxEnable(boolean enable)
set enable JMX |
void |
setPortNumber(int port)
Set the controller backlog size. |
void |
shutdown()
Turns the controller down by using default shutdown level |
void |
shutdown(int level)
Turns the controller down by using default shutdown level |
java.lang.String |
viewConfiguration()
Retrieve the configuration about this controller in xml format. |
java.lang.String |
viewInfo()
Retrieve the information about this controller in xml format. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.lang.String controllerName
private int portNumber
private int backlogSize
private java.lang.String ipAddress
private ControllerServerThread connectionThread
private static CjdbcJmxAgent jmxAgent
MBeans.
static Trace logger
private java.util.Hashtable virtualDatabases
VirtualDatabase objects.
private static java.util.Hashtable configure
private static Controller controller
| Constructor Detail |
public Controller(java.lang.String name)
Controller instance with the specified
controllerName
name - the controllerName to register the controller withpublic Controller()
Controller instance.
| Method Detail |
public void addVirtualDatabases(java.lang.String xml,
java.lang.String virtualName,
boolean autoEnable,
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 ControllerMBeanxml - XML code to parsevirtualName - name of the virtual databaseautoEnable - 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 XMLorg.objectweb.cjdbc.controller.ControllerInterface#addVirtualDatabases(java.lang.String)
public void addVirtualDatabases(java.lang.String xml)
throws ControllerException
addVirtualDatabases in interface ControllerMBeanxml - XML code to parse
ControllerException - if an error occurs while interpreting XMLorg.objectweb.cjdbc.controller.ControllerInterface#addVirtualDatabases(java.lang.String)
public void addVirtualDatabase(VirtualDatabase vdb)
throws ControllerException
VirtualDatabase in this controller.
vdb - the VirtualDatabase to register
ControllerException - if an error occurs
public void addVirtualDatabase(VirtualDatabase vdb,
boolean autoEnable,
java.lang.String checkPoint)
throws ControllerException
vdb - the VirtualDatabase object to addautoEnable - 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 object
public java.lang.String viewInfo()
throws java.lang.Exception
ControllerMBean
viewInfo in interface ControllerMBeanjava.lang.Exception - if failsControllerMBean.viewInfo()
public java.lang.String viewConfiguration()
throws java.lang.Exception
ControllerMBean
viewConfiguration in interface ControllerMBeanjava.lang.Exception - if failsControllerMBean.viewConfiguration()
public java.lang.String removeVirtualDatabase(java.lang.String virtualname)
throws ControllerException
ControllerMBean
removeVirtualDatabase in interface ControllerMBeanvirtualname - the virtual database name to remove
ControllerExceptionControllerMBean.removeVirtualDatabase(java.lang.String)
public void addDriver(byte[] bytes)
throws java.lang.Exception
ControllerMBean
addDriver in interface ControllerMBeanbytes - 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 found
public void refreshLogConfiguration()
throws ControllerException
ControllerMBeanlog4j.properties
file.
refreshLogConfiguration in interface ControllerMBeanControllerException - if the log4j.properties file
cannot be found in classpathControllerMBean.refreshLogConfiguration()public java.lang.String getVersionNumber()
ControllerMBean
getVersionNumber in interface ControllerMBeanString value containing the version numberControllerMBean.getVersionNumber()
public java.lang.String getXmlInformation()
throws VirtualDatabaseException
VirtualDatabaseException - if an error occurspublic ControllerServerThread getConnectionThread()
connectionThread
public void shutdown()
throws ControllerException
ControllerExceptionControllerMBean.shutdown(int)
public void shutdown(int level)
throws ControllerException
ControllerMBean
shutdown in interface ControllerMBeanlevel - Smart,Fast or Immediate.
ControllerException - if unknown level or other error occurs.ControllerMBean.shutdown(int)
public java.lang.String saveConfiguration()
throws java.io.IOException,
VirtualDatabaseException
saveConfiguration in interface ControllerMBeanVirtualDatabaseException - if an error occurs
java.io.IOException - if writing failedControllerConstants.getSaveConfigurationFile()
public java.lang.String saveConfiguration(java.lang.String filepath)
throws VirtualDatabaseException
filepath - path to save file
VirtualDatabaseException - if error occurspublic java.lang.String getInformation()
org.objectweb.cjdbc.controller.ControllerInterface#getInformation()public boolean hasVirtualDatabase(java.lang.String name)
VirtualDatabase of a given name exists in this
controller.
name - the virtual database name
true if the virtual database existspublic static void main(java.lang.String[] args)
-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.If the RMI registry does not exist, a RMI registry that accepts requests on the specified port is automatically started. The controller is registered in the registry under the '/C-JDBC/Controller/name' name, name being the specified controller name.
If no port number or controller name are specified, else the default
org.objectweb.cjdbc.controller.ControllerConstants#DEFAULT_RMI_PORT
RMI port value, default
org.objectweb.cjdbc.controller.ControllerConstants#DEFAULT_JMX_PORT
JMX port value, and the default 'ControllerConstants.DEFAULT_NAME'
controller name are used.
args - command line arguments (see above)public static 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 getBindName()
getBindName in interface ControllerMBeanpublic void setBindName(java.lang.String controllerName)
controllerName - The controller name
public java.lang.String loadXmlConfiguration(java.lang.String filename,
java.lang.String virtualName,
boolean autoEnable,
java.lang.String checkPoint)
throws java.lang.Exception
VirtualDatabase
specified in the arguments list
loadXmlConfiguration in interface ControllerMBeanfilename - XML configuration file name to take info on VirtualDatabasevirtualName - the only database to loadautoEnable - 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 occurs
public java.lang.String loadXML(java.lang.String filename)
throws java.lang.Exception
loadXML in interface ControllerMBeanfilename - XML configuration file name
java.lang.Exception - if an error occurs
public java.lang.String addDriver(java.lang.String filename)
throws java.lang.Exception
addDriver in interface ControllerMBeanfilename - name of the file
java.lang.Exception - if an error occurs
public java.util.ArrayList getVirtualDatabasesInfo()
throws java.lang.Exception
java.lang.Exception - if an error occurs
public java.util.ArrayList getVirtualDatabases()
throws java.lang.Exception
getVirtualDatabases in interface ControllerMBeanjava.lang.Exception - if an error occurspublic java.lang.String getIPAddress()
public void setIPAddress(java.lang.String ipAddress)
ipAddress - the IP address to usepublic int getPortNumber()
getPortNumber in interface ControllerMBeanpublic void setPortNumber(int port)
port - the port number to setpublic int getBacklogSize()
public void setBacklogSize(int size)
size - backlog sizepublic JmxAgent getJmxAgent()
public void setJMXAgent(CjdbcJmxAgent agent)
agent - the jmx agentpublic static boolean getJmxEnable()
public static void setJmxEnable(boolean enable)
enable - true if jmx should be enable.public static void setAllowAddDriver(boolean enable)
enable - true/falsepublic static boolean getAllowAddDriver()
public static java.lang.String getVersion()
public static java.util.Hashtable getConfiguration()
Hashtable with controller options
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||