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

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.URIAction
All Implemented Interfaces:
CatalogEntry, Executable, Presentable, NamespaceContextFactory
Direct Known Subclasses:
PublicAction, SystemAction

public class URIAction
extends AbstractIdentifierAction

At runtime, the <cat:uri> element is used to test if an identifier matches an URI. Works both for Active Catalogs and OASIS Catalogs.

Author:
Philippe Poulard

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
URIAction(Expression name, Expression uri, QName selector, Element element, AbstractAction parent)
          Creates a new instance of URIAction.
 
Method Summary
 void feedContext(DataSet dataSet, Object alternate)
          Feeds the context with an alternate URI, that is to say a String or a XFile if possible ; if the alternate URI is relative, it is resolved regarding to xml:base.
 Object getCandidateURI(DataSet dataSet)
          Return the candidate URI.
 boolean isMatching(DataSet dataSet)
          Check if a key matches this action.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for URIAction.
 
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

URIAction

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

Parameters:
name - The URI to match.
uri - The alternate uri.
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 URIAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
Returns:
The URIAction 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.

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:
URISyntaxException - If the URI is not well formed.
XPathException - If the action can't be performed.
ExecutionException - If the candidate catalog key can't be checked.
See Also:
CatalogEntry.isMatching(org.inria.ns.reflex.processor.DataSet)

getCandidateURI

public Object getCandidateURI(DataSet dataSet)
Return the candidate URI.

Parameters:
dataSet - The set of datas used when the action is running.
Returns:
The value of the $cat:uri property, that shouldn't be null.

feedContext

public void feedContext(DataSet dataSet,
                        Object alternate)
                 throws XPathException,
                        ExecutionException
Feeds the context with an alternate URI, that is to say a String or a XFile if possible ; if the alternate URI is relative, it is resolved regarding to xml:base.

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)