org.crsh.shell.impl.command
Class CRaSH

java.lang.Object
  extended by org.crsh.shell.impl.command.CRaSH

public class CRaSH
extends Object


Field Summary
(package private)  HashMap<String,CommandManager> activeManagers
          .
private  Map<String,TimestampedObject<CommandResolution>> commandCache
          .
(package private)  PluginContext context
          .
private static HashMap<String,Class<? extends BaseCommand>> systemCommands
          .
 
Constructor Summary
CRaSH(PluginContext context)
          Create a new CRaSH.
 
Method Summary
private
<C extends BaseCommand>
CommandResolution
createCommand(Class<C> commandClass)
           
 CRaSHSession createSession(Principal user)
           
 ShellCommand<?> getCommand(String name)
          Attempt to obtain a command instance.
 String getCommandDescription(String name)
          Attempt to obtain a command description.
 Iterable<String> getCommandNames()
           
 PluginContext getContext()
          Returns the plugin context.
private  CommandResolution resolveCommand(CommandManager manager, String name, Resource script)
           
 CommandResolution resolveCommand(String name)
          Attempt to obtain a command instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemCommands

private static final HashMap<String,Class<? extends BaseCommand>> systemCommands
.


context

final PluginContext context
.


activeManagers

final HashMap<String,CommandManager> activeManagers
.


commandCache

private final Map<String,TimestampedObject<CommandResolution>> commandCache
.

Constructor Detail

CRaSH

public CRaSH(PluginContext context)
      throws NullPointerException
Create a new CRaSH.

Parameters:
context - the plugin context
Throws:
NullPointerException - if the context argument is null
Method Detail

createSession

public CRaSHSession createSession(Principal user)

getContext

public PluginContext getContext()
Returns the plugin context.

Returns:
the plugin context

getCommandDescription

public String getCommandDescription(String name)
                             throws CommandCreationException,
                                    NullPointerException
Attempt to obtain a command description. Null is returned when such command does not exist.

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

getCommand

public ShellCommand<?> getCommand(String name)
                           throws CommandCreationException,
                                  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:
CommandCreationException - if an error occured preventing the command creation
NullPointerException - if the name argument is null

resolveCommand

public CommandResolution resolveCommand(String name)
                                 throws CommandCreationException,
                                        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:
CommandCreationException - if an error occured preventing the command creation
NullPointerException - if the name argument is null

getCommandNames

public Iterable<String> getCommandNames()

resolveCommand

private CommandResolution resolveCommand(CommandManager manager,
                                         String name,
                                         Resource script)
                                  throws CommandCreationException
Throws:
CommandCreationException

createCommand

private <C extends BaseCommand> CommandResolution createCommand(Class<C> commandClass)


Copyright © 2014 eXo Platform SAS. All Rights Reserved.