Class CliAgent

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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.
    • Constructor Detail

      • CliAgent

        public CliAgent()
    • 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 interface ICliService
        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 interface IInternalCliService
        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 interface IInternalCliService
        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 interface IInternalCliService
        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.