org.nodal.nav
Class Paths

java.lang.Object
  extended byorg.nodal.nav.Paths

public final class Paths
extends java.lang.Object

Top level class for creating and managing Path instances. The only public methods here should be static factory methods.

Author:
Lee Iverson

Method Summary
static PathOperator createDirElementOp(java.lang.String str)
          Create a PathOperator that selects a Document within a Directory.
static PathOperator createOp(java.lang.String name)
          Create a PathOperator by name.
static PathOperator createOp(java.lang.String name, java.lang.String[] args)
          Create a PathOperator by name and arguments.
static PathOperator createPropertyOp(java.lang.Object prop)
          Create a "property" PathOperator that selects a property of the parent.
static PathOperator createRangeOp(int start, int end)
          Create a "range" PathOperator with the given start and end values.
static Path directPath(Node node, Path docPath, Name nid)
          Create a direct, bound Path to a given Node.
static java.lang.String encodeURLComponent(java.lang.String s)
          Encode a URL component as a String.
static Path parse(java.lang.String s)
          Parse a URL string to produce an interpreted Path.
static Path parseURI(java.net.URI uri)
          Parse a URI to produce an interpreted Path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

directPath

public static Path directPath(Node node,
                              Path docPath,
                              Name nid)
Create a direct, bound Path to a given Node. This is done by creating a NodeOp that accesses the named Node in the given document context. This should be called from the Node creation itself.

Parameters:
node - a Node that we are creating the direct Path for
docPath - a Path to a document that provides a naming context
nid - the Name of the Node within this context
Returns:
a bound Path that accesses the Node directly

encodeURLComponent

public static java.lang.String encodeURLComponent(java.lang.String s)
Encode a URL component as a String.

Parameters:
s - the unencoded string
Returns:
a URL-encoded string

parse

public static Path parse(java.lang.String s)
                  throws Path.Failure
Parse a URL string to produce an interpreted Path.

Parameters:
s - the URL string
Returns:
a Path that corresponds to the given URL
Throws:
Path.Failure - if this string produces an invalid Path

parseURI

public static Path parseURI(java.net.URI uri)
                     throws Path.Failure
Parse a URI to produce an interpreted Path.

Parameters:
uri - the URI of the resource
Returns:
a Path that corresponds to the given URI
Throws:
Path.Failure - if this URI produces an invalid Path

createOp

public static PathOperator createOp(java.lang.String name)
                             throws Path.Failure
Create a PathOperator by name.

Throws:
Path.Failure

createOp

public static PathOperator createOp(java.lang.String name,
                                    java.lang.String[] args)
                             throws Path.Failure
Create a PathOperator by name and arguments.

Throws:
Path.Failure

createPropertyOp

public static PathOperator createPropertyOp(java.lang.Object prop)
Create a "property" PathOperator that selects a property of the parent.


createDirElementOp

public static PathOperator createDirElementOp(java.lang.String str)
Create a PathOperator that selects a Document within a Directory.

Returns:
a PathOperator to select the Document of that Name

createRangeOp

public static PathOperator createRangeOp(int start,
                                         int end)
Create a "range" PathOperator with the given start and end values.

Parameters:
start - the start index of the range
end - the end index of the range
Returns:
an new "range" PathOperator