org.objectweb.cjdbc.console.text
Class Console

java.lang.Object
  extended byorg.objectweb.cjdbc.console.text.Console

public class Console
extends java.lang.Object

This is the C-JDBC controller console that allows remote administration and monitoring of any C-JDBC controller.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier , Nicolas Modrzyk

Field Summary
private  VirtualDatabaseAdmin adminModule
          Virtual database administration console.
private  VirtualDatabaseConsole consoleModule
          Virtual database console.
private  jline.ConsoleReader consoleReader
          ConsoleReader allowing to reading input.
private  ControllerConsole controllerModule
          Controller Console
private  boolean debug
          Debug Mode
private  boolean interactive
          true if the console is used in interactive mode.
private  RmiJmxClient jmxClient
           
private  MonitorConsole monitorModule
          Monitoring console
private static java.lang.Character PASSWORD_CHAR
           
private  boolean printColor
          true if colors should be displayed in interactive mode (work only on non Windows system).
 
Constructor Summary
Console(RmiJmxClient jmxClient, java.io.InputStream in, boolean interactive, boolean debug)
          Creates a new Console instance.
 
Method Summary
 VirtualDatabaseAdmin getAdminModule()
          Returns the adminModule value.
 VirtualDatabaseConsole getConsoleModule()
          Returns the consoleModule value.
 jline.ConsoleReader getConsoleReader()
          Returns the consoleReader value.
 ControllerConsole getControllerModule()
          Returns the controllerModule value.
 RmiJmxClient getJmxClient()
          Returns the jmxClient value.
 MonitorConsole getMonitorModule()
          Returns the monitorModule value.
 void handlePrompt()
          Main menu prompt handling.
 boolean isInteractive()
          Returns the interactive value.
private  jline.History loadJLineHistory()
           
 void print(java.lang.String s)
           
 void print(java.lang.String s, int color)
           
 void printError(java.lang.String message)
           
 void printError(java.lang.String message, java.lang.Exception e)
          Display an error and stack trace if in debug mode.
 void printInfo(java.lang.String message)
           
 void println()
           
 void println(java.lang.String s)
           
 void println(java.lang.String s, int color)
          Print in color
 java.lang.String readLine(java.lang.String prompt)
           
 java.lang.String readPassword(java.lang.String prompt)
           
 void setPrintColor(boolean b)
          Should this console display color in interactive mode?
 void showInfo(java.lang.String[][] info, InfoViewer viewer)
          Show a table of info in a formatted way
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASSWORD_CHAR

private static final java.lang.Character PASSWORD_CHAR

consoleReader

private jline.ConsoleReader consoleReader
ConsoleReader allowing to reading input.


interactive

private boolean interactive
true if the console is used in interactive mode.


jmxClient

private RmiJmxClient jmxClient

adminModule

private VirtualDatabaseAdmin adminModule
Virtual database administration console.


monitorModule

private MonitorConsole monitorModule
Monitoring console


consoleModule

private VirtualDatabaseConsole consoleModule
Virtual database console.


controllerModule

private ControllerConsole controllerModule
Controller Console


debug

private boolean debug
Debug Mode


printColor

private boolean printColor
true if colors should be displayed in interactive mode (work only on non Windows system).

Constructor Detail

Console

public Console(RmiJmxClient jmxClient,
               java.io.InputStream in,
               boolean interactive,
               boolean debug)
Creates a new Console instance.

Parameters:
jmxClient - to connect to the jmxServer
in - the input stream to get the command from
interactive - if set to true will display prompt
debug - true if debug mode should be activated.
Method Detail

loadJLineHistory

private jline.History loadJLineHistory()

setPrintColor

public void setPrintColor(boolean b)
Should this console display color in interactive mode? Warning, colors only work on non Windows system.

Parameters:
b - true if the console should display color (ignored on Windows system).

isInteractive

public boolean isInteractive()
Returns the interactive value.

Returns:
Returns the interactive.

handlePrompt

public void handlePrompt()
Main menu prompt handling.


readLine

public java.lang.String readLine(java.lang.String prompt)
                          throws ConsoleException
Throws:
ConsoleException
See Also:
readLine(java.lang.String)

readPassword

public java.lang.String readPassword(java.lang.String prompt)
                              throws ConsoleException
Throws:
ConsoleException
See Also:
readPassword(java.lang.String)

print

public void print(java.lang.String s)
See Also:
print(java.lang.String)

print

public void print(java.lang.String s,
                  int color)
See Also:
print(java.lang.String)

println

public void println(java.lang.String s)
See Also:
println(java.lang.String)

println

public void println(java.lang.String s,
                    int color)
Print in color

Parameters:
s - the message to display
color - the color to use

println

public void println()
See Also:
println()

printError

public void printError(java.lang.String message)
See Also:
printError(java.lang.String)

printInfo

public void printInfo(java.lang.String message)
See Also:
println()

printError

public void printError(java.lang.String message,
                       java.lang.Exception e)
Display an error and stack trace if in debug mode.

Parameters:
message - error message
e - exception that causes the error

showInfo

public void showInfo(java.lang.String[][] info,
                     InfoViewer viewer)
Show a table of info in a formatted way

Parameters:
info - the data to display
viewer - the viewer to use to get the name of the columns and the format of data

getJmxClient

public RmiJmxClient getJmxClient()
Returns the jmxClient value.

Returns:
Returns the jmxClient.

getAdminModule

public VirtualDatabaseAdmin getAdminModule()
Returns the adminModule value.

Returns:
Returns the adminModule.

getConsoleModule

public VirtualDatabaseConsole getConsoleModule()
Returns the consoleModule value.

Returns:
Returns the consoleModule.

getControllerModule

public ControllerConsole getControllerModule()
Returns the controllerModule value.

Returns:
Returns the controllerModule.

getMonitorModule

public MonitorConsole getMonitorModule()
Returns the monitorModule value.

Returns:
Returns the monitorModule.

getConsoleReader

public final jline.ConsoleReader getConsoleReader()
Returns the consoleReader value.

Returns:
Returns the consoleReader.


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