Class BaseCommandProcessor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<Command> commands  
      private java.util.Map<java.lang.String,​java.lang.String> parameters  
      private boolean running  
      private Session session  
      private static java.lang.Void VOID  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addCommands​(CommandRegistry reg)  
      void destroy()
      Component lifecycle hook.
      (package private) Command getCommand​(java.lang.String name)  
      java.util.List<Command> getCommands()  
      java.lang.String getName()
      Returns a name for the component.
      java.util.Map<java.lang.String,​java.lang.String> getParameters()
      Returns the parameters used to initialize this Component, and can also be used to modify parameters.
      Session getSession()
      Returns the Session used to initialize this Component.
      void init​(Session session, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Component lifecycle hook.
      abstract void processCommand()  
      void schedule​(java.util.concurrent.ScheduledExecutorService executor)  
      void terminate()  
      • Methods inherited from class java.lang.Object

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

      • VOID

        private static final java.lang.Void VOID
      • commands

        private java.util.List<Command> commands
      • parameters

        private java.util.Map<java.lang.String,​java.lang.String> parameters
      • running

        private boolean running
    • Constructor Detail

      • BaseCommandProcessor

        public BaseCommandProcessor()
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Component
        Returns a name for the component. These names are not guaranteed to be unique, and are intended for display and logging. Generally this is the class name of the Component object, without package information.
        Specified by:
        getName in interface Component
        Returns:
        name of the component
      • init

        public void init​(Session session,
                         java.util.Map<java.lang.String,​java.lang.String> parameters)
                  throws OpenAS2Exception
        Description copied from interface: Component
        Component lifecycle hook. After creating a Component object, this method should be called to set any parameters used by the component. Component implementations typically have required parameter checking and code to start timers and threads within this method.
        Specified by:
        init in interface Component
        Parameters:
        session - the component uses this object to access other components
        parameters - configuration values for the component
        Throws:
        OpenAS2Exception - If an error occurs while initializing the component
        See Also:
        Session
      • getParameters

        public java.util.Map<java.lang.String,​java.lang.String> getParameters()
        Description copied from interface: Component
        Returns the parameters used to initialize this Component, and can also be used to modify parameters.
        Specified by:
        getParameters in interface Component
        Returns:
        map of parameter name to parameter value
      • getSession

        public Session getSession()
        Description copied from interface: Component
        Returns the Session used to initialize this Component. The returned session is also used to locate other components if needed.
        Specified by:
        getSession in interface Component
        Returns:
        this component's session
      • getCommand

        @Nullable
        Command getCommand​(java.lang.String name)
      • processCommand

        public abstract void processCommand()
                                     throws java.lang.Exception
        Specified by:
        processCommand in interface CommandProcessor
        Throws:
        java.lang.Exception
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Specified by:
        terminate in interface CommandProcessor
        Throws:
        java.lang.Exception
      • destroy

        public void destroy()
                     throws java.lang.Exception
        Description copied from interface: Component
        Component lifecycle hook. If lifecycle of Component requires a destroy function this method can be used.
        Specified by:
        destroy in interface Component
        Throws:
        java.lang.Exception - Something went wrong
        See Also:
        Component.init(Session, Map), Session