org.crsh.shell.impl
Class CRaSHSession

java.lang.Object
  extended by org.crsh.shell.impl.CRaSHSession
All Implemented Interfaces:
Closeable, Shell

public class CRaSHSession
extends Object
implements Shell, Closeable

Version:
$Revision$
Author:
Julien Viet

Field Summary
(package private)  Map<String,Object> attributes
          .
private  CRaSH crash
          .
private  groovy.lang.GroovyShell groovyShell
          .
(package private) static org.slf4j.Logger log
          .
 
Constructor Summary
CRaSHSession(CRaSH crash)
           
 
Method Summary
 void close()
           
 CommandCompletion complete(String prefix)
          For now basic implementation
 ShellProcess createProcess(String request)
          Process a request.
 Object getAttribute(String name)
           
 ShellCommand getCommand(String name)
          Attempt to obtain a command instance.
 groovy.lang.GroovyShell getGroovyShell()
          Used for testing purposes.
 groovy.lang.Script getLifeCycle(String name)
           
 String getPrompt()
          Returns the shell prompt.
 String getWelcome()
          Returns the welcome message.
 void setAttribute(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static final org.slf4j.Logger log
.


groovyShell

private groovy.lang.GroovyShell groovyShell
.


crash

private final CRaSH crash
.


attributes

final Map<String,Object> attributes
.

Constructor Detail

CRaSHSession

CRaSHSession(CRaSH crash)
Method Detail

getGroovyShell

public groovy.lang.GroovyShell getGroovyShell()
Used for testing purposes.

Returns:
a groovy shell operating on the session attributes

getCommand

public ShellCommand getCommand(String name)
                        throws CreateCommandException,
                               NullPointerException
Attempt to obtain a command instance. Null is returned when such command does not exist.

Parameters:
name - the command name
Returns:
a command instance
Throws:
CreateCommandException - if an error occured preventing the command creation
NullPointerException - if the name argument is null

getLifeCycle

public groovy.lang.Script getLifeCycle(String name)
                                throws CreateCommandException,
                                       NullPointerException
Throws:
CreateCommandException
NullPointerException

getAttribute

public Object getAttribute(String name)

setAttribute

public void setAttribute(String name,
                         Object value)

close

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

getWelcome

public String getWelcome()
Description copied from interface: Shell
Returns the welcome message.

Specified by:
getWelcome in interface Shell
Returns:
the welcome message

getPrompt

public String getPrompt()
Description copied from interface: Shell
Returns the shell prompt.

Specified by:
getPrompt in interface Shell
Returns:
the shell prompt

createProcess

public ShellProcess createProcess(String request)
Description copied from interface: Shell
Process a request.

Specified by:
createProcess in interface Shell
Parameters:
request - the request to process
Returns:
the process

complete

public CommandCompletion complete(String prefix)
For now basic implementation

Specified by:
complete in interface Shell
Parameters:
prefix - the prefix to complete
Returns:
the sorted list of available suffixes


Copyright © 2012 eXo Platform SAS. All Rights Reserved.