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.ClassLoader
cl
The class loader.protected java.util.Map<java.lang.String,ICliCommand>
commands
The commands.protected CliContext
context
The context.protected java.lang.String
prompt
The prompt.protected ACliShell
subshell
The 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.void
addSubshell(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.String
getPrompt()
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:
addAllCommandsFromClassPath
in classACliShell
- Parameters:
cl
- The classloader to use.
-
addCommand
public IFuture<java.lang.Void> addCommand(ICliCommand cmd)
Add a command.- Specified by:
addCommand
in classACliShell
- Parameters:
cmd
- The command.
-
getCommands
public java.util.Map<java.lang.String,ICliCommand> getCommands()
Get the commands.- Specified by:
getCommands
in 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:
executeCommand
in 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:
addSubshell
in classACliShell
-
removeSubshell
public IFuture<java.lang.Boolean> removeSubshell()
Remove a subshell.- Specified by:
removeSubshell
in classACliShell
-
internalGetShellPrompt
public IFuture<java.lang.String> internalGetShellPrompt()
Get the complete prompt (internal method). Calls subshells getPrompt().- Specified by:
internalGetShellPrompt
in classACliShell
- Returns:
- the complete prompt;
-
getPrompt
public java.lang.String getPrompt()
Get the promt only for this shell part.- Returns:
- The local promt part.
-
-