org.objectweb.cjdbc.controller.core
Class ControllerFactory

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byorg.objectweb.cjdbc.controller.core.ControllerFactory
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ControllerFactory
extends java.util.Hashtable

The ControllerFactory class prepares a Controller object by configurating ports, security, loaded databases.

Version:
1.0
Author:
Emmanuel Cecchet , Nicolas Modrzyk , Duncan Smith
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Field Summary
static java.lang.String ADD_DRIVER_ENABLE
          Add driver enable
private  Controller controller
           
static java.lang.String CONTROLLER_BACKLOG
          The controller backlog size
static java.lang.String CONTROLLER_IP
          The NIC IP address to bind the controller to
static java.lang.String CONTROLLER_PORT
          The controller port number
static java.lang.String JMX_ENABLE
          The jmx enable value
static java.lang.String JMX_PORT
          The jmx port value
(package private) static Trace logger
          Logger instance.
static java.lang.String RMI_PORT
          The Rmi port value
private static long serialVersionUID
           
static java.lang.String XML_FILE
          The xml file possibly used to configure controller
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
ControllerFactory(java.lang.String[] args)
          Configure the controller with parameters
 
Method Summary
private static org.apache.commons.cli.Options createOptions()
          Creates Options object that contains all available options that can be used launching C-JDBC controller.
 Controller getController()
          Retrieve the controller associated with this ControllerFactory instance.
private static void printUsage(org.apache.commons.cli.Options options)
          Displays usage message.
private  Controller setup()
          Test if there is a file to take configuration from, if so call setUpByXml()
 void setUpByXml(java.lang.String filename)
          This method is going to call a ControllerParser object to configure controller while parsing file.
 void setUpJmx()
          Start up the jmx services if enabled.
 void setUpSecurity(ControllerSecurityManager security)
          Set up security settings if needed here.
 void setUpVirtualDatabase(java.lang.String filePath, java.lang.String virtualName, int autoLoad, java.lang.String checkPoint)
          Will load the VirtualDatabase configuration into the controller.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

RMI_PORT

public static final java.lang.String RMI_PORT
The Rmi port value

See Also:
Constant Field Values

JMX_PORT

public static final java.lang.String JMX_PORT
The jmx port value

See Also:
Constant Field Values

JMX_ENABLE

public static final java.lang.String JMX_ENABLE
The jmx enable value

See Also:
Constant Field Values

XML_FILE

public static final java.lang.String XML_FILE
The xml file possibly used to configure controller

See Also:
Constant Field Values

CONTROLLER_IP

public static final java.lang.String CONTROLLER_IP
The NIC IP address to bind the controller to

See Also:
Constant Field Values

CONTROLLER_PORT

public static final java.lang.String CONTROLLER_PORT
The controller port number

See Also:
Constant Field Values

CONTROLLER_BACKLOG

public static final java.lang.String CONTROLLER_BACKLOG
The controller backlog size

See Also:
Constant Field Values

ADD_DRIVER_ENABLE

public static final java.lang.String ADD_DRIVER_ENABLE
Add driver enable

See Also:
Constant Field Values

logger

static Trace logger
Logger instance.


controller

private Controller controller
Constructor Detail

ControllerFactory

public ControllerFactory(java.lang.String[] args)
Configure the controller with parameters

Parameters:
args - parameters from the command line
Method Detail

setUpByXml

public void setUpByXml(java.lang.String filename)
                throws java.lang.Exception
This method is going to call a ControllerParser object to configure controller while parsing file. This method will call setUpRmi() and setUpJmx() as well as setUpVirtualDatabases while parsing.

Parameters:
filename - path to the xml file to parse from
Throws:
java.lang.Exception - if configuration fails

setup

private Controller setup()
                  throws java.lang.Exception
Test if there is a file to take configuration from, if so call setUpByXml()

Returns:
an instanciated and configured object of class Controller
Throws:
java.lang.Exception - if configuration fails

getController

public Controller getController()
                         throws java.lang.Exception
Retrieve the controller associated with this ControllerFactory instance.

Returns:
Controller object. Can be null if this method is called before setup
Throws:
java.lang.Exception - if an error occurs

setUpJmx

public void setUpJmx()
              throws JmxException
Start up the jmx services if enabled.

Throws:
JmxException - an exception

setUpSecurity

public void setUpSecurity(ControllerSecurityManager security)
Set up security settings if needed here.

Parameters:
security - to enforce

setUpVirtualDatabase

public void setUpVirtualDatabase(java.lang.String filePath,
                                 java.lang.String virtualName,
                                 int autoLoad,
                                 java.lang.String checkPoint)
Will load the VirtualDatabase configuration into the controller.

Parameters:
filePath - the path to xml definition of the virtual database
virtualName - the name of the virtualDatabase to load
autoLoad - specified if backend should be enabled.
checkPoint - the check point to load the database from.

printUsage

private static void printUsage(org.apache.commons.cli.Options options)
Displays usage message.

Parameters:
options - available command line options

createOptions

private static org.apache.commons.cli.Options createOptions()
Creates Options object that contains all available options that can be used launching C-JDBC controller.

Returns:
an Options instance


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