public class Action
extends Object
Task, which in turn is a child element of the
Scenario. A MINER action is a central building block of a MINER
scenario. An action defines which tool to use, how to configure the tool, on
which ToolProxies the tool has to be executed, which results a tool has to
produce etc. The following table lists the required and optional properties
of an action.
| Required? | Name | Description | Quantity |
|---|---|---|---|
| yes | proxy | The Toolproxies on which the action runs | 1..N |
| yes | tool | The fully qualified name of the Tool | 1 |
| yes | toolconfig | The XML configuration for the Tool | 1 |
| no | name | The name of the action | 0..1 |
| no | description | The description of the action | 0..1 |
| no | deltaStart | Start offset of the action w.r.t its parent task | 0..1 |
| no | duration | The duration of the action | 0..1 |
| no | keyword | The keywords of the action | 0..N |
| no | resultHandle | A resultHandle is created for each result that the action's tool must
produce, see produce(String) and produce(String, String) |
0..N | no | condition | The condition associated with a resultHandle | 0..N |
| Constructor and Description |
|---|
Action()
Default Constructor.
|
Action(String name)
Creates a new action and sets its name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActivationEvent(Event... events)
Adds events that activate this action.
|
Condition |
addCondition(Condition condition)
Set a condition to the action.
|
Condition |
addCondition(String operator)
Creates a new condition with the given logical
operator and
adds it to this action. |
void |
addDeactivationEvent(Event... events)
Sets the events that deactivate this action.
|
void |
addKeyword(String keyword)
Adds a keyword for this action.
|
void |
addProxies(String... proxyNames) |
Proxy |
addProxy(String name)
Adds a ToolProxy on which this action is executed.
|
List<Event> |
getActivationEvents()
Gets the list of events that activate this action.
|
Collection<Condition> |
getConditions()
Gets the conditions that are set for this action.
|
Date |
getCreated()
Gets the date when the action was initially created.
|
List<Event> |
getDeactivationEvents()
Gets the list of events that deactivate this action.
|
double |
getDeltaStart()
Gets the offset in [s] between the start time of the parent task
and this action.
|
String |
getDescription()
Gets the description of the action.
|
double |
getDuration()
Gets the duration in [s] of this action.
|
int |
getID()
Gets the identifier that identifies the action at the MINER core.
|
List<String> |
getKeywords()
Gets the keywords of this action.
|
Date |
getModified()
Gets the date when the action was last modified.
|
String |
getName()
Gets the name of the Action.
|
Collection<Proxy> |
getProxies()
Gets the list of ToolProxies on which this action is executed.
|
Proxy |
getProxy(String proxyName)
Gets a proxy instance.
|
ResultHandle |
getResultHandle(String name)
Gets the handle for a result called
name. |
ResultHandle |
getResultHandle(String name,
String selector)
Gets the handle for a result called
name with a given
selector. |
Collection<ResultHandle> |
getResultHandles()
Gets all result handles that have been created by previous
produce calls. |
String |
getTool()
Gets the name of the Tool used in this action.
|
org.w3c.dom.Element |
getToolconfig()
Gets the XML configuration of the Tool.
|
ResultHandle |
produce(String name)
Defines that the action's tool must produce the result called
name. |
ResultHandle |
produce(String name,
String selector)
Defines that the action's tool must produce the result called
name with selector selector. |
void |
setDeltaStart(double deltaStart)
Specifies that the action should start
deltaStart [s]
later than its parent task. |
void |
setDescription(String description)
Sets the description of the Action.
|
void |
setDuration(double duration)
Sets the duration of this action in [s].
|
void |
setName(String name)
Sets the name of the Action.
|
void |
setTool(String toolName)
Sets the Tool which is used for this action.
|
void |
setToolconfig(org.w3c.dom.Document toolConfig)
Sets the XML configuration of the Tool via a Document.
|
void |
setToolconfig(org.w3c.dom.Element toolConfig)
Sets the XML configuration of the Tool via an Element.
|
void |
setToolconfig(java.io.File file)
Sets the XML configuration of the Tool via a File.
|
void |
setToolconfig(String config)
Sets the XML configuration of the Tool via a String.
|
public Action()
public Action(String name)
name - the namepublic void addProxies(String... proxyNames)
public Proxy addProxy(String name)
name - the name of the ToolProxypublic Collection<Proxy> getProxies()
public Proxy getProxy(String proxyName)
proxyName - the name of the requested proxy.public void setTool(String toolName)
action.setToolName("at.srfg.miner.tool.SampleTool.SampleTool");toolName - the fully qualified classname of a Toolpublic String getTool()
public void setToolconfig(org.w3c.dom.Document toolConfig)
toolConfig - the configuration documentpublic void setToolconfig(org.w3c.dom.Element toolConfig)
toolConfig - the configuration elementpublic void setToolconfig(String config)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
config - the configuration string in XML formatjava.io.IOExceptionorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionException - if the string is not well-formed XMLpublic void setToolconfig(java.io.File file)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
file - the configuration file in XML formatjava.io.IOExceptionorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionException - if the file can't be openend or if it's not a well-formed XML
filepublic org.w3c.dom.Element getToolconfig()
public void setName(String name)
name - the namepublic String getName()
public void setDescription(String description)
description - the descriptionpublic String getDescription()
public void setDeltaStart(double deltaStart)
deltaStart [s]
later than its parent task. If this method is not used (or if
deltaStart==0) the parent task and this action start at the
same time.deltaStart - the offset in secondspublic double getDeltaStart()
public void setDuration(double duration)
duration==0) then the action runs as long as its parent
task.duration - the duration in secondspublic double getDuration()
public void addKeyword(String keyword)
keyword - the keywordpublic List<String> getKeywords()
public ResultHandle produce(String name)
name. If this method is called more than once for the same
name, an IllegalArgumentException will be thrown.name - the result nameExecution and Query classes.IllegalArgumentException - if produce has been called before with the same
name argument.public ResultHandle produce(String name, String selector)
name with selector selector. If this method is
called more than once for the same name and
selector, an IllegalArgumentException will be thrown.name - the result nameselector - the selectorExecution and Query classes.IllegalArgumentException - if produce has been called before with the same
name and selector argument.public Collection<ResultHandle> getResultHandles()
produce calls.public ResultHandle getResultHandle(String name)
name. Note that if there
are multiple result handles with the same name but varying selectors,
then one of these result handles is returned.name - the name of the Tool's ResultResourcepublic ResultHandle getResultHandle(String name, String selector)
name with a given
selector.name - the name of the Tool's ResultResourceselector - the selector for the result handlepublic Condition addCondition(String operator)
operator and
adds it to this action.operator - the logical operator, see Condition.ALL and
Condition.ANYpublic Condition addCondition(Condition condition)
condition - the conditionconditionpublic Collection<Condition> getConditions()
public Date getCreated()
public Date getModified()
public int getID()
public void addActivationEvent(Event... events)
events - public List<Event> getActivationEvents()
public void addDeactivationEvent(Event... events)
events - public List<Event> getDeactivationEvents()
Copyright (c) Salzburg Research Forschungsgesellschaft mbH. All rights reserved.