org.overlord.sramp.shell
Class InteractiveShellCommandReader

java.lang.Object
  extended by org.overlord.sramp.shell.AbstractShellCommandReader
      extended by org.overlord.sramp.shell.InteractiveShellCommandReader
All Implemented Interfaces:
ShellContextEventHandler, ShellCommandReader

public class InteractiveShellCommandReader
extends AbstractShellCommandReader
implements ShellContextEventHandler

An implementation of the ShellCommandReader that uses JLine to provide a rich console experience to the user, complete with history, tab completion, and ansi output.

Author:
eric.wittmann@redhat.com

Constructor Summary
InteractiveShellCommandReader(ShellCommandFactory factory, ShellContextImpl context)
          Constructor.
 
Method Summary
 void close()
          Called by the shell when exiting.
protected  Writer getCommandOutput()
          Gets the output stream that should be used by commands when they need to print a message to the console.
 void onVariableAdded(QName variableName, Object value)
           
 void onVariableChanged(QName variableName, Object value)
           
 void onVariableRemoved(QName variableName)
           
 void open()
          Called to open the shell command reader.
protected  String readLine()
          Reads a single line from the input source (e.g.
 
Methods inherited from class org.overlord.sramp.shell.AbstractShellCommandReader
getContext, getFactory, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractiveShellCommandReader

public InteractiveShellCommandReader(ShellCommandFactory factory,
                                     ShellContextImpl context)
Constructor.

Parameters:
factory -
context -
Method Detail

open

public void open()
          throws IOException
Description copied from interface: ShellCommandReader
Called to open the shell command reader.

Specified by:
open in interface ShellCommandReader
Specified by:
open in class AbstractShellCommandReader
Throws:
IOException
See Also:
org.overlord.sramp.common.shell.AbstractShellCommandReader#open()

readLine

protected String readLine()
                   throws IOException
Description copied from class: AbstractShellCommandReader
Reads a single line from the input source (e.g. user input) and returns it.

Specified by:
readLine in class AbstractShellCommandReader
Throws:
IOException
See Also:
org.overlord.sramp.common.shell.AbstractShellCommandReader#readLine()

getCommandOutput

protected Writer getCommandOutput()
Description copied from class: AbstractShellCommandReader
Gets the output stream that should be used by commands when they need to print a message to the console.

Overrides:
getCommandOutput in class AbstractShellCommandReader
See Also:
org.overlord.sramp.common.shell.AbstractShellCommandReader#getCommandOutput()

close

public void close()
           throws IOException
Description copied from interface: ShellCommandReader
Called by the shell when exiting.

Specified by:
close in interface ShellCommandReader
Overrides:
close in class AbstractShellCommandReader
Throws:
IOException
See Also:
org.overlord.sramp.common.shell.ShellCommandReader#close()

onVariableAdded

public void onVariableAdded(QName variableName,
                            Object value)
Specified by:
onVariableAdded in interface ShellContextEventHandler
See Also:
shell.ShellContextEventHandler

onVariableChanged

public void onVariableChanged(QName variableName,
                              Object value)
Specified by:
onVariableChanged in interface ShellContextEventHandler
See Also:
shell.ShellContextEventHandler

onVariableRemoved

public void onVariableRemoved(QName variableName)
Specified by:
onVariableRemoved in interface ShellContextEventHandler
See Also:
shell.ShellContextEventHandler


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.