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

java.lang.Object
  extended by org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
      extended by org.inria.ns.reflex.modules.io.ResolveURIFunction
All Implemented Interfaces:
XPathFunction

public class ResolveURIFunction
extends XPathFunction.NamedXPathFunction
implements XPathFunction

The io:resolve-uri() function resolves an URI against another base URI or relocates an URI regarding a base URI to a target base URI.

2 arguments

Resolving more-path/to/file upon file:///path/to/base/ will give file:///path/to/base/more-path/to/file.

3 arguments

Relocating the URI file:///path/to/base/more-path/to/file upon the base file:///path/to/base/ to the target http://www.somehost.org/somepath/ will give http://www.somehost.org/somepath/more-path/to/file.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction
XPathFunction.NamedXPathFunction
 
Constructor Summary
ResolveURIFunction()
           
 
Method Summary
static URI evaluate(Object base, Object uri)
          Return a resolved URI.
static URI evaluate(Object base, Object uri, Object baseTarget)
          Return a resolved URI.
 Object evaluate(XPathContext context, List args)
          Perform the function.
static URI getURI(Object uri)
          Convert an object to an URI
 
Methods inherited from class org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
getQName, setQName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction
getQName
 

Constructor Detail

ResolveURIFunction

public ResolveURIFunction()
Method Detail

evaluate

public Object evaluate(XPathContext context,
                       List args)
                throws XPathFunctionException
Perform the function.

Specified by:
evaluate in interface XPathFunction
Parameters:
context - The context of the function.
args - The list of arguments of this function.
Returns:
The result of the evaluation.
Throws:
XPathFunctionException - When this function fails to be evaluated.
See Also:
XPathFunction.evaluate(org.inria.ns.reflex.xml.xpath.XPathContext, java.util.List)

evaluate

public static URI evaluate(Object base,
                           Object uri)
                    throws XPathFunctionException
Return a resolved URI.

Parameters:
base - The base URI.
uri - The URI to resolve against the base URI.
Returns:
The URI resolved.
Throws:
XPathFunctionException

evaluate

public static URI evaluate(Object base,
                           Object uri,
                           Object baseTarget)
                    throws XPathFunctionException
Return a resolved URI.

Parameters:
base - The base URI.
uri - The URI to resolve against the base URI.
Returns:
The URI resolved.
Throws:
XPathFunctionException

getURI

public static URI getURI(Object uri)
                  throws URISyntaxException
Convert an object to an URI

Parameters:
uri - The object to convert.
Returns:
An URI.
Throws:
URISyntaxException - When the object can't be convert to a valid URI.