Package jadex.platform.service.cli
Class CliShell
- java.lang.Object
-
- jadex.platform.service.cli.ACliShell
-
- jadex.platform.service.cli.CliShell
-
public class CliShell extends ACliShell
The cli shell contains the commands and allows for executing a command. Use addAllCommandsFromClassPath() to add all commands from the current classpath or addCommand() to add them manually.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoaderclThe class loader.protected java.util.Map<java.lang.String,ICliCommand>commandsThe commands.protected CliContextcontextThe context.protected java.lang.StringpromptThe prompt.protected ACliShellsubshellThe subshells.-
Fields inherited from class jadex.platform.service.cli.ACliShell
sessionid, workingdir
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>addAllCommandsFromClassPath()Add all commands from classpath.IFuture<java.lang.Void>addCommand(ICliCommand cmd)Add a command.voidaddSubshell(ACliShell subshell)Add a subshell.IFuture<java.lang.String>doExecuteCommand(java.lang.String line)Do execute a command line command and get back the results.IFuture<java.lang.String>executeCommand(java.lang.String line)Execute a command line command and get back the results.java.util.Map<java.lang.String,ICliCommand>getCommands()Get the commands.java.lang.StringgetPrompt()Get the promt only for this shell part.IFuture<java.lang.String>internalGetShellPrompt()Get the complete prompt (internal method).IFuture<java.lang.Boolean>removeSubshell()Remove a subshell.-
Methods inherited from class jadex.platform.service.cli.ACliShell
getSessionId, getShellPrompt, getWorkingDir, setWorkingDir
-
-
-
-
Field Detail
-
commands
protected java.util.Map<java.lang.String,ICliCommand> commands
The commands.
-
context
protected CliContext context
The context.
-
subshell
protected ACliShell subshell
The subshells.
-
prompt
protected java.lang.String prompt
The prompt.
-
cl
protected java.lang.ClassLoader cl
The class loader.
-
-
Constructor Detail
-
CliShell
public CliShell(java.lang.Object context, java.lang.String prompt, Tuple2<java.lang.String,java.lang.Integer> sessionid, java.lang.ClassLoader cl)Create a new cli.
-
-
Method Detail
-
addAllCommandsFromClassPath
public IFuture<java.lang.Void> addAllCommandsFromClassPath()
Add all commands from classpath.- Specified by:
addAllCommandsFromClassPathin classACliShell- Parameters:
cl- The classloader to use.
-
addCommand
public IFuture<java.lang.Void> addCommand(ICliCommand cmd)
Add a command.- Specified by:
addCommandin classACliShell- Parameters:
cmd- The command.
-
getCommands
public java.util.Map<java.lang.String,ICliCommand> getCommands()
Get the commands.- Specified by:
getCommandsin classACliShell- Returns:
- The commands.
-
executeCommand
public IFuture<java.lang.String> executeCommand(java.lang.String line)
Execute a command line command and get back the results.- Specified by:
executeCommandin classACliShell- Parameters:
command- The command.- Returns:
- The result of the command.
-
doExecuteCommand
public IFuture<java.lang.String> doExecuteCommand(java.lang.String line)
Do execute a command line command and get back the results.- Parameters:
command- The command.- Returns:
- The result of the command.
-
addSubshell
public void addSubshell(ACliShell subshell)
Add a subshell.- Specified by:
addSubshellin classACliShell
-
removeSubshell
public IFuture<java.lang.Boolean> removeSubshell()
Remove a subshell.- Specified by:
removeSubshellin classACliShell
-
internalGetShellPrompt
public IFuture<java.lang.String> internalGetShellPrompt()
Get the complete prompt (internal method). Calls subshells getPrompt().- Specified by:
internalGetShellPromptin classACliShell- Returns:
- the complete prompt;
-
getPrompt
public java.lang.String getPrompt()
Get the promt only for this shell part.- Returns:
- The local promt part.
-
-