org.aitools.programd.interfaces
Class Console

java.lang.Object
  extended by org.aitools.programd.interfaces.Console

public class Console
extends java.lang.Object

Creating a Console essentially means that loggers (as configured) will (may) also print output to the console.

Since:
4.2
Author:
Noel Bush

Field Summary
private  Core core
          The Core to which this console is (may be) attached.
private  Shell shell
          The Shell that will (may) be activated for this console.
private  ConsoleStreamAppender stdErrAppender
          The stderr handler.
private  ConsoleStreamAppender stdOutAppender
          The stdout handler.
 
Constructor Summary
Console()
          Creates a Console with default output streams.
Console(java.io.PrintStream out, java.io.PrintStream err)
          Creates a Console with specified input, output and prompt streams (this implies that a shell will be enabled).
 
Method Summary
 void addShell(Shell shellToAdd, Core coreToUse)
          Adds the given Shell to the Console
 void attachTo(Core coreToUse)
          Attaches the console to the given core.
private  void initialize(java.io.PrintStream out, java.io.PrintStream err)
          Sets up the stdout and stderr appenders (if they are defined in the log4j configuration).
 void startShell()
          Starts the attached shell (if one exists and the shell is enabled).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

core

private Core core
The Core to which this console is (may be) attached.


stdOutAppender

private ConsoleStreamAppender stdOutAppender
The stdout handler.


stdErrAppender

private ConsoleStreamAppender stdErrAppender
The stderr handler.


shell

private Shell shell
The Shell that will (may) be activated for this console.

Constructor Detail

Console

public Console()
Creates a Console with default output streams.


Console

public Console(java.io.PrintStream out,
               java.io.PrintStream err)
Creates a Console with specified input, output and prompt streams (this implies that a shell will be enabled).

Parameters:
out - the stream to use for normal messages
err - the stream to use for error messages
Method Detail

initialize

private void initialize(java.io.PrintStream out,
                        java.io.PrintStream err)
Sets up the stdout and stderr appenders (if they are defined in the log4j configuration).

Parameters:
out - the stream to use for normal output messages
err - the stream to use for error messages

attachTo

public void attachTo(Core coreToUse)
Attaches the console to the given core.

Parameters:
coreToUse - the core to which to attach

addShell

public void addShell(Shell shellToAdd,
                     Core coreToUse)
Adds the given Shell to the Console

Parameters:
shellToAdd - the Shell to add
coreToUse - the core to which to attach the Shell

startShell

public void startShell()
Starts the attached shell (if one exists and the shell is enabled).