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 booleanabortedFlag if the agent is killed.protected IInternalAccessagentThe agent.protected booleanconsoleThe console flag.protected booleanguiThe gui flag.protected java.util.Map<Tuple2<java.lang.String,java.lang.Integer>,Tuple2<ACliShell,java.lang.Long>>shellsThe shells per session.protected longshelltimeoutThe 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.voidbody()The agent body.protected voidcreateConsole()Create a console reader.protected voidcreateGui()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.ACliShellgetShell(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.voidkilled()Called when the agent is killed.voidremoveShell(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:
executeCommandin 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:
internalGetShellPromptin 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:
removeSubshellin 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:
addAllCommandsFromClassPathin 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:
addCommandin 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.
-
-