|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limitless.nmc.Prototype1.CommandProcessor
public class CommandProcessor
This provides the command dispatcher. It doesn't actually parse commands, but rather, it maps keywords to command objects that will do the job. To add a command, put a map entry in this class's constructor.
| Nested Class Summary | |
|---|---|
static class |
CommandProcessor.UnknownCommandException
A command was given that isn't defined. |
| Field Summary | |
|---|---|
Command |
Command
|
private java.util.Map |
commandMap
This holds (String,Command). |
private CommandParser |
commandParser
The command-parser worker (stateless object). |
private static CommandProcessor |
instance
Singleton instance variable. |
private static org.apache.log4j.Logger |
logger
|
private boolean |
shutdownRequested
This goes to true when a shutdown/exit request is given. |
| Constructor Summary | |
|---|---|
private |
CommandProcessor()
This populates the map of commands to command-objects. |
| Method Summary | |
|---|---|
Command |
fetchCommand(java.lang.String command)
This is used to gain access to the command that would be dispatched. |
(package private) java.util.Collection |
fetchDefinedCommands()
|
static CommandProcessor |
Instance()
Fetch the object to do the work. |
void |
invoke(java.lang.String rawInput)
This is given an input command and causes it to be called. |
boolean |
isShutdownRequested()
This returns true if a shutdown request was made. |
(package private) void |
requestShutdown()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static org.apache.log4j.Logger logger
private CommandParser commandParser
private java.util.Map commandMap
private static CommandProcessor instance
private boolean shutdownRequested
public Command Command
| Constructor Detail |
|---|
private CommandProcessor()
| Method Detail |
|---|
void requestShutdown()
public boolean isShutdownRequested()
public static CommandProcessor Instance()
public Command fetchCommand(java.lang.String command)
throws CommandProcessor.UnknownCommandException
command - Raw string of a single command line
CommandProcessor.UnknownCommandException
public void invoke(java.lang.String rawInput)
throws CommandProcessor.UnknownCommandException
rawInput - String for the command.
CommandProcessor.UnknownCommandExceptionjava.util.Collection fetchDefinedCommands()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||