org.apache.jackrabbit.name
Class Path

java.lang.Object
  extended byorg.apache.jackrabbit.name.Path

public final class Path
extends Object

Content path. Instances of this class are used to represent item paths within a JCR content repository.

A path instance consists of a sequence of path elements, that are resolved one by one in the specified order to reach the target item from a given context item.

Once created, a path instance is immutable.

See Also:
PathElement, PathParser, PathBuilder

Method Summary
static Path parse(Session session, String path)
          Parses the given JCR path string.
 Item resolve(Item item)
          Resolves this path starting from the given context item.
static Item resolve(Item item, String path)
          Resolves the given JCR path from the given context item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resolve

public Item resolve(Item item)
             throws PathNotFoundException,
                    RepositoryException
Resolves this path starting from the given context item. Returns the result of the path resolution.

Parameters:
item - the context item from which to resolve this path
Returns:
the resolved target item
Throws:
PathNotFoundException - if the path can not be resolved
RepositoryException - if another error occurs

parse

public static Path parse(Session session,
                         String path)
                  throws IllegalArgumentException,
                         RepositoryException
Parses the given JCR path string. Namespace prefixes within the path are resolved using the current session.

Parameters:
session - current session
path - JCR path
Returns:
path instance
Throws:
IllegalArgumentException - if the given path is invalid
RepositoryException - if another error occurs
See Also:
PathParser

resolve

public static Item resolve(Item item,
                           String path)
                    throws IllegalArgumentException,
                           PathNotFoundException,
                           RepositoryException
Resolves the given JCR path from the given context item. Returns the result of the path resolution. Namespace prefixes within the path are resolved using the session associated with the context item.

Parameters:
item - context item
path - JCR path
Returns:
target item
Throws:
IllegalArgumentException - if the given path is invalid
PathNotFoundException - if the given path can not be resolved
RepositoryException - if another error occurs


Copyright © 2004-2005 . All Rights Reserved.