org.objectweb.cjdbc.console.text.module
Class AbstractConsoleModule

java.lang.Object
  extended byorg.objectweb.cjdbc.console.text.module.AbstractConsoleModule
Direct Known Subclasses:
ControllerConsole, MonitorConsole, VirtualDatabaseAdmin, VirtualDatabaseConsole

public abstract class AbstractConsoleModule
extends java.lang.Object

This class defines a AbstractConsoleModule

Version:
1.0
Author:
Nicolas Modrzyk , Mathieu Peltier

Field Summary
(package private)  java.util.TreeSet commands
           
(package private)  Console console
           
(package private)  java.util.LinkedList history
           
private static int HISTORY_MAX
           
(package private)  boolean quit
           
 
Constructor Summary
AbstractConsoleModule(Console console)
          Creates a new AbstractConsoleModule.java object
 
Method Summary
 java.util.TreeSet getCommands()
          Get all the commands for this module
 Console getConsole()
          Get access to the console
abstract  java.lang.String getDescriptionString()
          Text description of this module
 java.util.Hashtable getHashCommands()
          Get the list of commands as strings for this module
 java.util.LinkedList getHistory()
          Returns the history value.
abstract  java.lang.String getPromptString()
          Get the prompt string for this module
 void handleCommandLine(java.lang.String commandLine, java.util.Hashtable hashCommands)
          Handle module command
 void handlePrompt()
          Handle a serie of commands
 void help()
          Display help for this module
protected abstract  void loadCommands()
          Loads the commands for this module
protected  void loadCompletor()
           
abstract  void login(java.lang.String[] params)
          Handles login in this module
 void manageHistory(java.lang.String command)
          Add the command to the history.
 void quit()
          Quit this module
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

Console console

commands

java.util.TreeSet commands

quit

boolean quit

history

java.util.LinkedList history

HISTORY_MAX

private static final int HISTORY_MAX
See Also:
Constant Field Values
Constructor Detail

AbstractConsoleModule

public AbstractConsoleModule(Console console)
Creates a new AbstractConsoleModule.java object

Parameters:
console - to refer from
Method Detail

loadCommands

protected abstract void loadCommands()
Loads the commands for this module


loadCompletor

protected void loadCompletor()

getDescriptionString

public abstract java.lang.String getDescriptionString()
Text description of this module

Returns:
String description to display

help

public void help()
Display help for this module


quit

public void quit()
Quit this module


getCommands

public java.util.TreeSet getCommands()
Get all the commands for this module

Returns:
TreeSet of commands (commandName|commandObject)

getPromptString

public abstract java.lang.String getPromptString()
Get the prompt string for this module

Returns:
String to place before prompt

handlePrompt

public void handlePrompt()
Handle a serie of commands


getHashCommands

public final java.util.Hashtable getHashCommands()
Get the list of commands as strings for this module

Returns:
Hashtable list of String objects

handleCommandLine

public final void handleCommandLine(java.lang.String commandLine,
                                    java.util.Hashtable hashCommands)
                             throws java.lang.Exception
Handle module command

Parameters:
commandLine - the command line to handle
hashCommands - the list of commands available for this module
Throws:
java.lang.Exception - if fails

manageHistory

public final void manageHistory(java.lang.String command)
Add the command to the history. Removes the first item in the list if the history is too large.

Parameters:
command - taken from the command line

login

public abstract void login(java.lang.String[] params)
                    throws java.lang.Exception
Handles login in this module

Parameters:
params - parameters to use to login in this module
Throws:
java.lang.Exception - if fails

getConsole

public Console getConsole()
Get access to the console

Returns:
Console instace

getHistory

public java.util.LinkedList getHistory()
Returns the history value.

Returns:
Returns the history.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.