|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class defines a ComponentManagerInterface. This class is used to start,
stop, management configuration of classes that implements the
ComponentInterface
interface.
Typically, this will be used to start database backends and controller,
load database configuration (virtual or not) and simulate failure by
stopping the component straight away or after a given time.
Method Summary | |
java.lang.String |
getDefaultConfigurationFile()
The default configuration file to use with this component manager. |
ComponentInterface |
instanciateProcess(java.lang.String port)
Instaciate a process managed by this component manager on the given port This used the default configuration file returned by the getDefaultConfigurationFile method |
ComponentInterface |
instanciateProcess(java.lang.String port,
java.lang.String configurationFile)
Instaciate a process managed by this component manager on the given port |
boolean |
isStarted(java.lang.String port)
Check if can open a connection on localhost on the given port |
void |
loaddatabase(java.lang.String port)
fill the database with raidb1 default configuration |
void |
loaddatabase(java.lang.String port,
java.lang.String templateName)
Load the database with a given input file |
void |
release()
release files and processes owned by manager |
void |
simulateFailure(int port,
long wait,
boolean rand)
Simulate a failure of the component by stopping it after the given time. |
void |
simulateFailure(java.lang.String port,
long wait,
boolean rand)
Simulate a failure of the component by stopping it after the given time. |
ComponentInterface |
start(java.lang.String port)
Starts database component on the given port with the default configuration |
ComponentInterface |
start(java.lang.String port,
java.lang.String database)
Starts database component on the given port with the given database |
ComponentInterface |
startComponent(java.lang.String port)
Starts component on the given port |
ComponentInterface |
startComponent(java.lang.String port,
java.lang.String database)
Starts component on the given port with the given database |
void |
stop(ComponentInterface process)
Stop Hsql. |
void |
stop(int port)
Same as stop(String) |
void |
stop(java.lang.String componentOnPort)
Stop a component from its unique port number |
void |
stopAll()
Stops all process contained in this manager |
void |
waitForStarted(java.lang.String port)
Check if can open a connection on localhost on the given port |
void |
waitForStopped(java.lang.String port)
Wait for the component to stop |
Method Detail |
public ComponentInterface instanciateProcess(java.lang.String port) throws java.lang.Exception
getDefaultConfigurationFile
method
port
- port to start the process on
java.lang.Exception
- if failspublic ComponentInterface instanciateProcess(java.lang.String port, java.lang.String configurationFile) throws java.lang.Exception
port
- port to start the process onconfigurationFile
- used to instanciate the process
java.lang.Exception
- if failspublic java.lang.String getDefaultConfigurationFile()
public ComponentInterface startComponent(java.lang.String port, java.lang.String database) throws java.lang.Exception
port
- to run hsql ondatabase
- to load component with
java.lang.Exception
- if fails to create processpublic ComponentInterface startComponent(java.lang.String port) throws java.lang.Exception
port
- to run component on
java.lang.Exception
- if fails to create processpublic void waitForStarted(java.lang.String port) throws java.lang.Exception
port
- to open a socket for check
java.lang.Exception
- if failspublic void waitForStopped(java.lang.String port) throws java.lang.Exception
port
- to check the connection on
java.lang.Exception
- if failspublic boolean isStarted(java.lang.String port)
port
- to open a socket for check
public void loaddatabase(java.lang.String port) throws java.lang.Exception
port
- of the database
java.lang.Exception
- if failspublic void loaddatabase(java.lang.String port, java.lang.String templateName) throws java.lang.Exception
port
- of the database to loadtemplateName
- name of the file to load(NO PATH!)
java.lang.Exception
- if failspublic void stop(ComponentInterface process)
process
- to stoppublic void stop(java.lang.String componentOnPort)
componentOnPort
- port number of the component to stoppublic void stop(int port)
port
- port numberpublic void simulateFailure(java.lang.String port, long wait, boolean rand)
port
- the port of the component to stopwait
- the wait time before stopping itrand
- should we use a random time, if so, the previous argument is
used as a rangepublic void simulateFailure(int port, long wait, boolean rand)
port
- the port of the component to stopwait
- the wait time before stopping itrand
- should we use a random time, if so, the previous argument is
used as a rangepublic void stopAll()
public ComponentInterface start(java.lang.String port, java.lang.String database) throws java.lang.Exception
port
- to run component ondatabase
- to load component with
java.lang.Exception
- if fails to create processpublic ComponentInterface start(java.lang.String port) throws java.lang.Exception
port
- to run component on
java.lang.Exception
- if fails to create processpublic void release()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |