Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CommandHandlerIfc Interface Reference

Inheritance diagram for CommandHandlerIfc:

Inheritance graph
[legend]
List of all members.

Detailed Description

CommandHandlerIfc.java defines interface for all command handlers.

You should implement your own command handler in your application to allow handle more commands than are implemented in remotecons package.

It is even possible to create many command handlers and use them at the same time. You can put to remote console List containing many implementation of this interface - command handlers and remotecons will use them all. Every command received from the network is passed to all command handlers and result from all handlers are displayed. So be aware for implementing command with the same name in many command handlers. It can produce some side effects and in other cases may be very useful.

Created: Fri Jan 11 10:42:39 2002

Author:
Artur Hefczyc
Version:
Revision
1.1

Definition at line 45 of file CommandHandlerIfc.java.

Public Methods

String handleCommand (String command)
 handleCommand handle and process given command as a String here.

String help ()
 help method should return string containing help for all commands provided by this command handler.

String help (String command)
 help method should return string describing in detail command given as a parameter or empty string if there is no such command in this command handler.

CommandHandlerIfc getInstance ()
 getInstance method should return instance of defined implementation for this instance.


Member Function Documentation

CommandHandlerIfc getInstance  
 

getInstance method should return instance of defined implementation for this instance.

Common implementation should lookds like following:

 public class MyCommandHandler implements remotecons.ifc.CommandHandlerIfc
 {
 
   (... other methods definition  ...)

   public remotecons.ifc.CommandHandlerIfc getInstance()
   { return new MyCommandHandler();  }
 }
 
It is necessary for cases when you create commands handlers which are inner classes. Maybe it is not good practice but very useful for developing and debuging applications which works long time.

Returns:
a CommandHandlerIfc value of instance your command handler implementation.

Implemented in CommandHandlerImpl, InternalCommands, and SampleCommandHandler.

String handleCommand String    command
 

handleCommand handle and process given command as a String here.

If you will return null or empty string it will be treated as 'Command was not understand.'

To get next command prompt on user side you must return string ended with "
" characters. If you don't it will be treated as command in progress and require additional info from user so command prompt will not be printed out but only your returned string. Next imput from user will be passed to all command handlers.

Parameters:
command a String value typed by the user.
Returns:
a String value of output produced by command handler.

Implemented in CommandHandlerImpl, InternalCommands, and SampleCommandHandler.

String help String    command
 

help method should return string describing in detail command given as a parameter or empty string if there is no such command in this command handler.

Parameters:
command a String value
Returns:
a String value

Implemented in CommandHandlerImpl, InternalCommands, and SampleCommandHandler.

String help  
 

help method should return string containing help for all commands provided by this command handler.

Returns:
a String value with help for all commands.

Implemented in CommandHandlerImpl, InternalCommands, and SampleCommandHandler.


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