org.sonatype.gshell.shell
Class ShellImpl

java.lang.Object
  extended by org.sonatype.gshell.shell.ShellImpl
All Implemented Interfaces:
Shell

public class ShellImpl
extends Object
implements Shell

The default Shell component.

Since:
2.0
Author:
Jason Dillon

Constructor Summary
ShellImpl(EventManager events, CommandExecutor executor, Branding branding, IO io, Variables variables)
           
 
Method Summary
 void close()
           
 Object execute(CharSequence line)
           
 Object execute(CharSequence command, Object[] args)
           
 Object execute(Object... args)
           
 Branding getBranding()
           
 History getHistory()
           
 IO getIo()
           
 Variables getVariables()
           
 void installCompleters(jline.console.completer.Completer c1, jline.console.completer.Completer c2)
           
 boolean isInteractive()
          Check if the shell can be run interactively.
 boolean isLoadInteractiveScripts()
           
 boolean isLoadProfileScripts()
           
 boolean isOpened()
           
protected  void loadInteractiveScripts()
           
protected  void loadProfileScripts()
           
protected  void loadScript(File file)
           
protected  void loadSharedScript(String fileName)
           
protected  void loadUserScript(String fileName)
           
protected  void renderGoodbyeMessage(IO io)
           
protected  void renderWelcomeMessage(IO io)
           
 void run(Object... args)
          Run the shell interactively.
 void setCompleters(jline.console.completer.Completer... completers)
           
 void setCompleters(List<jline.console.completer.Completer> completers)
           
 void setErrorHandler(ConsoleErrorHandler errorHandler)
           
 void setLoadInteractiveScripts(boolean enable)
           
 void setLoadProfileScripts(boolean enable)
           
 void setPrompt(ConsolePrompt prompt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellImpl

@Inject
public ShellImpl(EventManager events,
                        CommandExecutor executor,
                        Branding branding,
                        IO io,
                        Variables variables)
          throws IOException
Throws:
IOException
Method Detail

getBranding

public Branding getBranding()
Specified by:
getBranding in interface Shell

getIo

public IO getIo()
Specified by:
getIo in interface Shell

getVariables

public Variables getVariables()
Specified by:
getVariables in interface Shell

getHistory

public History getHistory()
Specified by:
getHistory in interface Shell

setPrompt

@Inject
public void setPrompt(ConsolePrompt prompt)

setErrorHandler

@Inject
public void setErrorHandler(ConsoleErrorHandler errorHandler)

setCompleters

public void setCompleters(List<jline.console.completer.Completer> completers)

setCompleters

public void setCompleters(jline.console.completer.Completer... completers)

installCompleters

@Inject
public void installCompleters(jline.console.completer.Completer c1,
                                     jline.console.completer.Completer c2)

isLoadProfileScripts

public boolean isLoadProfileScripts()

setLoadProfileScripts

public void setLoadProfileScripts(boolean enable)

isLoadInteractiveScripts

public boolean isLoadInteractiveScripts()

setLoadInteractiveScripts

public void setLoadInteractiveScripts(boolean enable)

isOpened

public boolean isOpened()
Specified by:
isOpened in interface Shell

close

public void close()
Specified by:
close in interface Shell

isInteractive

public boolean isInteractive()
Description copied from interface: Shell
Check if the shell can be run interactively.

Specified by:
isInteractive in interface Shell
Returns:
True if the shell is interactive.

execute

public Object execute(CharSequence line)
               throws Exception
Specified by:
execute in interface Shell
Throws:
Exception

execute

public Object execute(CharSequence command,
                      Object[] args)
               throws Exception
Specified by:
execute in interface Shell
Throws:
Exception

execute

public Object execute(Object... args)
               throws Exception
Specified by:
execute in interface Shell
Throws:
Exception

run

public void run(Object... args)
         throws Exception
Description copied from interface: Shell
Run the shell interactively.

Specified by:
run in interface Shell
Parameters:
args - The initial commands to execute interactively.
Throws:
Exception - Failed to execute commands.
UnsupportedOperationException - The shell does not support interactive execution.

renderWelcomeMessage

protected void renderWelcomeMessage(IO io)

renderGoodbyeMessage

protected void renderGoodbyeMessage(IO io)

loadProfileScripts

protected void loadProfileScripts()
                           throws Exception
Throws:
Exception

loadInteractiveScripts

protected void loadInteractiveScripts()
                               throws Exception
Throws:
Exception

loadScript

protected void loadScript(File file)
                   throws Exception
Throws:
Exception

loadUserScript

protected void loadUserScript(String fileName)
                       throws Exception
Throws:
Exception

loadSharedScript

protected void loadSharedScript(String fileName)
                         throws Exception
Throws:
Exception


Copyright © 2008-2011 Sonatype. All Rights Reserved.