org.inria.ns.reflex.processor.catalog
Class ResourceAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.catalog.GroupAction
          extended by org.inria.ns.reflex.processor.catalog.AbstractIdentifierAction
              extended by org.inria.ns.reflex.processor.catalog.ResourceAction
All Implemented Interfaces:
CatalogEntry, Executable, Presentable, NamespaceContextFactory

public class ResourceAction
extends AbstractIdentifierAction
implements CatalogEntry

At runtime, the <cat:resource> element is used to test if an identifier matches a resource identifier. See $cat:resource and $cat:selector.

Author:
Philippe Poulard
See Also:
AbstractIdentifierAction

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
ResourceAction(QExpression name, Expression alternate, QName selector, Element element, AbstractAction parent)
          Creates a new instance of ResourceAction.
 
Method Summary
 void feedContext(DataSet dataSet, Object alternate)
          Feeds the context with an alternate resource with no additional process, that is to say any Object should replace the candidate.
 boolean isMatching(DataSet dataSet)
          Check if a key matches this action.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for ResourceAction.
 
Methods inherited from class org.inria.ns.reflex.processor.catalog.AbstractIdentifierAction
runAction
 
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

ResourceAction

public ResourceAction(QExpression name,
                      Expression alternate,
                      QName selector,
                      Element element,
                      AbstractAction parent)
               throws XPathException
Creates a new instance of ResourceAction.

Parameters:
name - The name of the resource to match.
alternate - The alternate name of the resource.
selector - The selector.
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:
XPathException
Method Detail

unmarshal

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

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

isMatching

public boolean isMatching(DataSet dataSet)
                   throws ExecutionException
Check if a key matches this action.

Specified by:
isMatching in interface CatalogEntry
Parameters:
dataSet - The set of datas used when the action is running.
Returns:
true if the key matches the identifier of this action, false otherwise.
Throws:
ExecutionException - If the candidate catalog key can't be checked.
See Also:
CatalogEntry.isMatching(org.inria.ns.reflex.processor.DataSet)

feedContext

public void feedContext(DataSet dataSet,
                        Object alternate)
                 throws XPathException,
                        ExecutionException
Feeds the context with an alternate resource with no additional process, that is to say any Object should replace the candidate.

Specified by:
feedContext in interface CatalogEntry
Parameters:
dataSet - The set of datas used when the action is running.
alternate - The alternate resource that will feed the context as-is.
Throws:
XPathException
ExecutionException
See Also:
CatalogEntry.feedContext(DataSet, Object)