org.crsh.shell.impl.command
Class CRaSHSession

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Object>
          extended by org.crsh.shell.impl.command.CRaSHSession
All Implemented Interfaces:
Closeable, Serializable, Cloneable, Map<String,Object>, RuntimeContext, Shell

public class CRaSHSession
extends HashMap<String,Object>
implements Shell, Closeable, RuntimeContext

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
(package private) static Logger accessLog
          .
(package private)  CRaSH crash
          .
private  groovy.lang.GroovyShell groovyShell
          .
(package private) static Logger log
          .
(package private)  Principal user
          .
 
Constructor Summary
CRaSHSession(CRaSH crash, Principal user)
           
 
Method Summary
 void close()
           
 CompletionMatch complete(String prefix)
          For now basic implementation
 ShellProcess createProcess(String request)
          Process a request.
private  String eval(String name, String def)
           
 Map<String,Object> getAttributes()
          Returns the current attributes.
 groovy.lang.GroovyShell getGroovyShell()
          Used for testing purposes.
 GroovyScript getLifeCycle(String name)
           
 String getPrompt()
          Returns the shell prompt.
 Map<String,Object> getSession()
          Returns the current session.
 String getWelcome()
          Returns the welcome message.
(package private)  ClassLoader setCRaSHLoader()
           
(package private)  void setPreviousLoader(ClassLoader previous)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

log

static final Logger log
.


accessLog

static final Logger accessLog
.


groovyShell

private groovy.lang.GroovyShell groovyShell
.


crash

final CRaSH crash
.


user

final Principal user
.

Constructor Detail

CRaSHSession

CRaSHSession(CRaSH crash,
             Principal user)
Method Detail

getGroovyShell

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

Returns:
a groovy shell operating on the session attributes

getLifeCycle

public GroovyScript getLifeCycle(String name)
                          throws NoSuchCommandException,
                                 NullPointerException
Throws:
NoSuchCommandException
NullPointerException

getSession

public Map<String,Object> getSession()
Description copied from interface: RuntimeContext
Returns the current session.

Specified by:
getSession in interface RuntimeContext
Returns:
the session map

getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: RuntimeContext
Returns the current attributes.

Specified by:
getAttributes in interface RuntimeContext
Returns:
the attributes map

close

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

eval

private String eval(String name,
                    String def)

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 CompletionMatch 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

setCRaSHLoader

ClassLoader setCRaSHLoader()

setPreviousLoader

void setPreviousLoader(ClassLoader previous)


Copyright © 2014 eXo Platform SAS. All Rights Reserved.