org.inria.ns.reflex.modules.io
Class CloseAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.modules.io.CloseAction
All Implemented Interfaces:
Executable, Presentable, NamespaceContextFactory

public class CloseAction
extends AbstractAction

At runtime, the <io:close> element, closes the file specified by the stream attribute.

*** OutputStreams must be closed by IOHelper#close(OutputStream) that will prevent unexpected closing of PrintStreams. This action force closing PrintStreams. ***

Author:
Philippe Poulard
See Also:
IOHelper.close(OutputStream)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
CloseAction(Expression file, Node node, AbstractAction parent)
          Creates a new instance of CloseAction.
 
Method Summary
 void runAction(DataSet dataSet)
          Execute the action by closing the file
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for CloseAction.
 
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CloseAction

public CloseAction(Expression file,
                   Node node,
                   AbstractAction parent)
Creates a new instance of CloseAction.

Parameters:
file - The file to close.
node - The node from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for CloseAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
Returns:
The CloseAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

runAction

public void runAction(DataSet dataSet)
               throws ExecutionException,
                      XPathException
Execute the action by closing the file

Overrides:
runAction in class AbstractAction
Parameters:
dataSet - The set of datas used when the action is running.
Throws:
ExecutionException - If the action can't be performed.
XPathException