Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CommandHandlerImpl Class Reference

Inheritance diagram for CommandHandlerImpl:

Inheritance graph
[legend]
Collaboration diagram for CommandHandlerImpl:

Collaboration graph
[legend]
List of all members.

Detailed Description

CommandHandlerImpl.java is an implementation of CommandHandlerIfc.

This class has capability of handling set of basic commands from user such as: 'gc' for System.gc(), 'mem' for Runtime.totalMemory() and Runtime.freeMemory(), 'get', 'set' for property handling (not implemented yet). I am not sure what kind of more commands I could put here. if you have any ideas please feel free to send suggestions to me.

Created: Fri Jan 11 10:42:14 2002

Author:
Artur Hefczyc
Version:
Revision
1.1

Definition at line 45 of file CommandHandlerImpl.java.

Public Methods

 CommandHandlerImpl ()
 Creates a new CommandHandlerImpl instance and do nothing more.

String handleCommand (String command)
 handleCommand method handles set of basic remotecons commands.

String help ()
 help method returns information about provided commands.

String help (String command)
 help method should return detailed info about given command.

CommandHandlerIfc getInstance ()
 getInstance method returns instance of this command handler.


Protected Methods

String externalCommand (String comm)
 externalCommand method performs action for running external (system) commands from remote console.


Protected Attributes

String last_command = null
 Variable last_command remembers one previous command received from user.


Constructor & Destructor Documentation

CommandHandlerImpl   [inline]
 

Creates a new CommandHandlerImpl instance and do nothing more.

Definition at line 64 of file CommandHandlerImpl.java.


Member Function Documentation

String externalCommand String    comm [inline, protected]
 

externalCommand method performs action for running external (system) commands from remote console.

In other words it calls Runtime.exec(String[]) with given parameters and returns output produced by external command.

Parameters:
comm a String value input given from user but without leading 'exec' String.
Returns:
a String value which contains sumary standard and error output given from execuded external command or stack trace if executing command was not successful.

Definition at line 162 of file CommandHandlerImpl.java.

CommandHandlerIfc getInstance   [inline]
 

getInstance method returns instance of this command handler.

For more details see CommandHandlerIfc description.

See also:
CommandHandlerIfc#getInstance
Returns:
a CommandHandlerIfc value which is new instance of this class.

Implements CommandHandlerIfc.

Definition at line 209 of file CommandHandlerImpl.java.

String handleCommand String    command [inline]
 

handleCommand method handles set of basic remotecons commands.

Please see help() content for details.

See also:
CommandHandlerImpl#help()
Parameters:
command a String value is a full string given by a user on the other connection side.
Returns:
a String value which is result of processed command. If command not found returns empty String, if command found but no output is given returns "
"
.

Implements CommandHandlerIfc.

Definition at line 79 of file CommandHandlerImpl.java.

String help String    command [inline]
 

help method should return detailed info about given command.

But at the time it is not supported yet. I am going to add it in next version.

Parameters:
command a String value contains command which should be described without leading 'help' string.
Returns:
a String value should return detailed information about given command. At the moment returns only empty String.

Implements CommandHandlerIfc.

Definition at line 146 of file CommandHandlerImpl.java.

String help   [inline]
 

help method returns information about provided commands.

Only small set of basic commands suppoerted at the moment.

Returns:
a String value which contains full description about all supported command.

Implements CommandHandlerIfc.

Definition at line 122 of file CommandHandlerImpl.java.


Member Data Documentation

String last_command = null [protected]
 

Variable last_command remembers one previous command received from user.

At the moment it is used for ensuring that user really wants to exit from JVM.

I can see more advantages of remembering last command. I am going to extend command shell with more featuser like: command history, shortcut for repeatig last command, command history searching and so on. I wish to create shell as efficient as bash interpreter. :-)

Definition at line 58 of file CommandHandlerImpl.java.


The documentation for this class was generated from the following file:
Generated on Thu Dec 19 21:00:47 2002 for WTTools - Remote Console by doxygen1.3-rc2