Package jadex.platform.service.cli
Class CliAgent
- java.lang.Object
-
- jadex.platform.service.cli.CliAgent
-
- All Implemented Interfaces:
ICliService
,IInternalCliService
public class CliAgent extends java.lang.Object implements ICliService, IInternalCliService
The client agent allows for executing command line commands. It offers the executeCommand() method via the ICliService.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
aborted
Flag if the agent is killed.protected IInternalAccess
agent
The agent.protected boolean
console
The console flag.protected boolean
gui
The gui flag.protected java.util.Map<Tuple2<java.lang.String,java.lang.Integer>,Tuple2<ACliShell,java.lang.Long>>
shells
The shells per session.protected long
shelltimeout
The shell timeout.
-
Constructor Summary
Constructors Constructor Description CliAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
addAllCommandsFromClassPath(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Add all commands from classpath.IFuture<java.lang.Void>
addCommand(ICliCommand cmd, Tuple2<java.lang.String,java.lang.Integer> sessionid)
Add a specific command.void
body()
The agent body.protected void
createConsole()
Create a console reader.protected void
createGui()
Create a gui frame for console in and out.IFuture<java.lang.String>
executeCommand(java.lang.String line, Tuple2<java.lang.String,java.lang.Integer> sessionid)
Execute a command line command and get back the results.ACliShell
getShell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Get the shell.IFuture<java.lang.String>
internalGetShellPrompt(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Get the shell prompt.void
killed()
Called when the agent is killed.void
removeShell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Remove a shell.IFuture<java.lang.Boolean>
removeSubshell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Remove a subshell.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
The agent.
-
gui
protected boolean gui
The gui flag.
-
console
protected boolean console
The console flag.
-
shelltimeout
protected long shelltimeout
The shell timeout.
-
shells
protected java.util.Map<Tuple2<java.lang.String,java.lang.Integer>,Tuple2<ACliShell,java.lang.Long>> shells
The shells per session.
-
aborted
protected boolean aborted
Flag if the agent is killed.
-
-
Method Detail
-
body
public void body()
The agent body.
-
killed
public void killed()
Called when the agent is killed.
-
createGui
protected void createGui()
Create a gui frame for console in and out.
-
createConsole
protected void createConsole()
Create a console reader.
-
executeCommand
public IFuture<java.lang.String> executeCommand(java.lang.String line, Tuple2<java.lang.String,java.lang.Integer> sessionid)
Execute a command line command and get back the results.- Specified by:
executeCommand
in interfaceICliService
- Parameters:
command
- The command.- Returns:
- The result of the command.
-
internalGetShellPrompt
public IFuture<java.lang.String> internalGetShellPrompt(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Get the shell prompt.- Specified by:
internalGetShellPrompt
in interfaceIInternalCliService
- Parameters:
sessionid
- The session id.- Returns:
- The prompt.
-
removeSubshell
public IFuture<java.lang.Boolean> removeSubshell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Remove a subshell.- Specified by:
removeSubshell
in interfaceIInternalCliService
- Parameters:
sessionid
- The session id.- Returns:
- True, if could be removed.
-
addAllCommandsFromClassPath
public IFuture<java.lang.Void> addAllCommandsFromClassPath(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Add all commands from classpath.- Specified by:
addAllCommandsFromClassPath
in interfaceIInternalCliService
- Parameters:
sessionid
- The session id.
-
addCommand
public IFuture<java.lang.Void> addCommand(ICliCommand cmd, Tuple2<java.lang.String,java.lang.Integer> sessionid)
Add a specific command.- Specified by:
addCommand
in interfaceIInternalCliService
- Parameters:
sessionid
- The session id.
-
getShell
public ACliShell getShell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Get the shell.- Parameters:
session
- The session.- Returns:
- The shell.
-
removeShell
public void removeShell(Tuple2<java.lang.String,java.lang.Integer> sessionid)
Remove a shell.- Parameters:
session
- The session.
-
-