Package adams.flow.rest.control
Class RatControl
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.rest.AbstractRESTPlugin
-
- adams.flow.rest.AbstractRESTPluginWithFlowContext
-
- adams.flow.rest.control.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 withRatControl
actors.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.flow.rest.AbstractRESTPluginWithFlowContext
m_FlowContext
-
-
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.flow.rest.AbstractRESTPluginWithFlowContext
getFlowContext, setFlowContext
-
Methods inherited from class adams.flow.rest.AbstractRESTPlugin
getAdditionalInformation
-
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
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 flowerrors
- 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 runningcmd
- the command, seeSendRatControlCommand.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
-
-