org.inria.ns.reflex.modules.io
Class ReadAction
java.lang.Object
org.inria.ns.reflex.processor.core.AbstractAction
org.inria.ns.reflex.processor.core.AbstractSetAction
org.inria.ns.reflex.modules.io.ReadAction
- All Implemented Interfaces:
- Computable, Executable, Presentable, NamespaceContextFactory
public class ReadAction
- extends AbstractSetAction
At runtime, the <io:read> element, reads datas in the input stream
specified by the input
attribute.
The mode
attribute specify the amount of datas to read :
A new property with the name specified in the name
attribute
that contains the data read, is added to the data set.
<io:read name="myLine" input="{ expression }" mode ="line"
xmlns:io="http://ns.inria.org/active-tags/io"/>
<io:read name="myChar" input="{ expression }" mode ="char"
xmlns:io="http://ns.inria.org/active-tags/io"/>
<io:read name="myByte" input="{ expression }" mode ="byte"
xmlns:io="http://ns.inria.org/active-tags/io"/>
- Author:
- Philippe Poulard
- See Also:
OpenAction
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction |
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString |
ReadAction
public ReadAction(Expression file,
int mode,
Element element,
AbstractAction parent)
throws XMLException
- Create a new instance of
ReadAction
.
- Parameters:
file
- The file to read, that will be the value of the property, as
an Expression
.mode
- The amount of datas to read.element
- The element from which the action has been unmarshalled. Used
for namespace prefix resolution when performing XPath
expressions.parent
- The action depending from.
- Throws:
XMLException
unmarshal
public static AbstractAction unmarshal(AbstractAction parent,
Element e)
throws XMLException
- XML unmarshaller for
ReadAction
.
- Parameters:
parent
- The action depending frome
- The XML element to unmarshall.
- Returns:
- The
ReadAction
created.
- Throws:
UnmarshalException
- When the element and its content is not those expected.
XMLException
getComputedValue
public Object getComputedValue(DataSet dataSet)
throws ExecutionException,
XPathException
- Return the computed value of the property, by reading a file.
- Specified by:
getComputedValue
in interface Computable
- Specified by:
getComputedValue
in class AbstractSetAction
- Parameters:
dataSet
- The set of data used when the name is computed.
- Returns:
- The computed value of the property.
- Throws:
ExecutionException
- If the computation can't be performed.
XPathException