Class RatControl

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, RESTPlugin, Serializable

    public class RatControl
    extends AbstractRESTPluginWithFlowContext
    Controls Rat actors in flows with RatControl actors.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      RatControl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String command​(int id, String cmd, String ratpath)
      Sends a command to a Rat actor.
      String flows()
      Returns the list of flow IDs currently running.
      protected adams.flow.core.Actor getFlow​(int id, adams.core.MessageCollection errors)
      Retrieves the running flow with the specified ID.
      String globalInfo()
      Returns a string describing the object.
      String status​(int id)
      Returns the status of the Rat actors in the specified flow.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
    • Constructor Detail

      • RatControl

        public RatControl()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • getFlow

        protected adams.flow.core.Actor getFlow​(int id,
                                                adams.core.MessageCollection errors)
        Retrieves the running flow with the specified ID.
        Parameters:
        id - the ID, use -1 for only running flow
        errors - for collecting errors
        Returns:
        the flow, null if failed to retrieve
      • flows

        @GET
        @Path("/rats/control/flows")
        public String flows()
        Returns the list of flow IDs currently running.
      • status

        @GET
        @Path("/rats/control/status/{id}")
        public String status​(@PathParam("id")
                             int id)
        Returns the status of the Rat actors in the specified flow. You can use -1 as shortcut to retrieve the data from the only flow running.
        Parameters:
        id - the flow ID, use -1 for only one running
        Returns:
        the status of the Rat actors or error message
      • command

        @GET
        @Path("/rats/control/command/{id}/{cmd}")
        public String command​(@PathParam("id")
                              int id,
                              @PathParam("cmd")
                              String cmd,
                              @FormParam("rat")
                              String ratpath)
        Sends a command to a Rat actor.
        Parameters:
        id - the flow ID, use -1 for only one running
        cmd - the command, see SendRatControlCommand.Command (in lower case)
        ratpath - the full path of the rat actor this command is for
        Returns:
        SendRatControlCommand.RESPONSE_SUCCESS if successful, otherwise error message