|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.jasmine.monitoring.mbeancmd.CommandDispatcher
public class CommandDispatcher
This is the main class of the archive. It dispatches the processing of the command to the right class. The available commands in the current archive are retrieved by introspection of the archive. In order to execute a command, a dispatcher instance is created and initialized with the command's arguments. The command object gets a reference on its dispatcher, so it can report its state changes to the dispatcher. Then, the dispatcher sets status information in the thread executing the command.
| Nested Class Summary | |
|---|---|
static class |
CommandDispatcher.CommandStatus
|
| Field Summary | |
|---|---|
protected Command |
cmd
|
protected static org.ow2.util.log.Log |
logger
Logger. |
| Constructor Summary | |
|---|---|
protected |
CommandDispatcher()
Dummy constructor to avoid the class from being used in any other way than calling the CommandDispatcher.main method. |
| Method Summary | |
|---|---|
String[] |
getAvailableCommands()
Returns the names of the available commands in the archive. |
Command |
getCommand(String name)
Returns an instance of Command. |
protected InputStreamReader |
getInputStreamReader(String name)
Return an inputStreamReader for the specified resource, by using the context class loader. |
int |
init(String[] args)
The class is selected from the first argument. |
boolean |
isEmbedded()
Get the state of MBeanCmd. |
protected Class<?> |
loadClass(String cname)
Load and return a class for a given class name, by using the defining class loader of the current class. |
static void |
main(String[] args)
Main method. |
void |
setEmbedded(boolean isEmbedded)
Set the sate of MBeanCmd |
void |
setFailed()
|
void |
setFailed(String error)
|
void |
setRunning()
|
void |
setStarted()
Start method was called. |
void |
setStopped()
|
static int |
start(String[] args)
Start module when embedded in Jasmine |
void |
stopCommand()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Command cmd
protected static org.ow2.util.log.Log logger
| Constructor Detail |
|---|
protected CommandDispatcher()
| Method Detail |
|---|
public static void main(String[] args)
start(String[])(args)
followed by System.exit of the returned value.
IMPORTANT: This method calls System.exit !
args - See start(String[]).public static int start(String[] args)
args - Arguments of the command, including the command itself at the
first position.
public void stopCommand()
public int init(String[] args)
args - of the command, including the command itself at the
first position.
public Command getCommand(String name)
name - the name of the command.
public String[] getAvailableCommands()
protected InputStreamReader getInputStreamReader(String name)
throws IOException
name - the resource name
IOException - if an I/O exception occurs
protected Class<?> loadClass(String cname)
throws ClassNotFoundException
cname - a class name
ClassNotFoundException - if the class cannot be foundpublic boolean isEmbedded()
public void setEmbedded(boolean isEmbedded)
isEmbedded - The state to set.public void setStarted()
public void setFailed()
public void setFailed(String error)
public void setRunning()
public void setStopped()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||