org.apache.jackrabbit.spi
Interface PathFactory

All Known Implementing Classes:
PathFactoryImpl, PathFactoryLogger

public interface PathFactory

PathFactory...


Method Summary
 Path create(Name name)
          Creates a relative path based on a Name.
 Path create(Name name, int index)
          Creates a relative path based on a Name and a normalized index.
 Path create(Path.Element element)
          Creates a path from the given element.
 Path create(Path.Element[] elements)
          Create a new Path from the given elements.
 Path create(Path parent, Name name, boolean normalize)
          Creates a new Path out of the given parent path and the give name.
 Path create(Path parent, Name name, int index, boolean normalize)
          Creates a new Path out of the given parent path and the give name and normalized index.
 Path create(Path parent, Path relPath, boolean normalize)
          Return a new Path out of the given parent path and the given relative path.
 Path create(String pathString)
          Returns a Path holding the value of the specified string.
 Path.Element createElement(Name name)
          Creates a path element from the given name.
 Path.Element createElement(Name name, int index)
          Same as createElement(Name) except that an explicit index can be specified.
 Path.Element createElement(String identifier)
          Creates a path element from the given identifier.
 Path.Element getCurrentElement()
          Return the current element.
 Path.Element getParentElement()
          Return the parent element.
 Path.Element getRootElement()
          Return the root element.
 Path getRootPath()
          Return the Path of the root node.
 

Method Detail

create

Path create(Path parent,
            Path relPath,
            boolean normalize)
            throws IllegalArgumentException,
                   RepositoryException
Return a new Path out of the given parent path and the given relative path. If normalize is true, the returned path will be normalized (or canonicalized, if the parent path is absolute).

Parameters:
parent -
relPath -
normalize -
Returns:
Throws:
IllegalArgumentException - if relPath is absolute.
RepositoryException - If the normalized is true and the resulting path cannot be normalized.

create

Path create(Path parent,
            Name name,
            boolean normalize)
            throws RepositoryException
Creates a new Path out of the given parent path and the give name. If normalize is true, the returned path will be normalized (or canonicalized, if the parent path is absolute). Use create(Path, Name, int, boolean) in order to build a Path having an index with his name element.

Parameters:
parent - the parent path
name - the name of the new path element.
normalize - If true the Path is normalized before being returned.
Returns:
Throws:
RepositoryException - If the normalized is true and the resulting path cannot be normalized.

create

Path create(Path parent,
            Name name,
            int index,
            boolean normalize)
            throws IllegalArgumentException,
                   RepositoryException
Creates a new Path out of the given parent path and the give name and normalized index. See also create(Path, Name, boolean).

Parameters:
parent - the parent path.
name - the name of the new path element.
index - the index of the new path element.
normalize - If true the Path is normalized before being returned.
Returns:
Throws:
IllegalArgumentException - If the given index is lower than Path.INDEX_UNDEFINED.
RepositoryException - If the normalized is true and the resulting path cannot be normalized.

create

Path create(Name name)
            throws IllegalArgumentException
Creates a relative path based on a Name.

Parameters:
name - single Name for this relative path.
Returns:
the relative path created from name.
Throws:
IllegalArgumentException - if the name is null.

create

Path create(Name name,
            int index)
            throws IllegalArgumentException
Creates a relative path based on a Name and a normalized index. Same as create(Name) but allows to explicitely specify an index.

Parameters:
name - single Name for this relative path.
index - index of the single name element.
Returns:
the relative path created from name and normalizedIndex.
Throws:
IllegalArgumentException - if index is lower than Path.INDEX_UNDEFINED or if the name is not valid.

create

Path create(Path.Element element)
            throws IllegalArgumentException
Creates a path from the given element.

Parameters:
element - path element
Returns:
the created path
Throws:
IllegalArgumentException - if the given element is null

create

Path create(Path.Element[] elements)
            throws IllegalArgumentException
Create a new Path from the given elements.

Parameters:
elements -
Returns:
the Path created from the elements.
Throws:
IllegalArgumentException - If the given elements are null or have a length of 0 or would otherwise constitute an invalid path.

create

Path create(String pathString)
            throws IllegalArgumentException
Returns a Path holding the value of the specified string. The string must be in the format returned by the Path.getString() method.

Parameters:
pathString - a String containing the Path representation to be parsed.
Returns:
the Path represented by the argument
Throws:
IllegalArgumentException - if the specified string can not be parsed as a Path.
See Also:
Path.getString(), Path.DELIMITER

createElement

Path.Element createElement(Name name)
                           throws IllegalArgumentException
Creates a path element from the given name. The created path element does not contain an explicit index.

If the specified name denotes a special path element (either getParentElement(), getCurrentElement() or getRootElement()) then the associated constant is returned.

Parameters:
name - the name of the element
Returns:
a path element
Throws:
IllegalArgumentException - if the name is null

createElement

Path.Element createElement(Name name,
                           int index)
                           throws IllegalArgumentException
Same as createElement(Name) except that an explicit index can be specified.

Note that an IllegalArgumentException will be thrown if the specified name denotes a special path element (either getParentElement(), getCurrentElement() or getRootElement()) since an explicit index is not allowed in this context.

Parameters:
name - the name of the element
index - the index if the element.
Returns:
a path element
Throws:
IllegalArgumentException - if the name is null, if the given index is lower than Path.INDEX_UNDEFINED or if name denoting a special path element.

createElement

Path.Element createElement(String identifier)
                           throws IllegalArgumentException
Creates a path element from the given identifier.

Parameters:
identifier - Node identifier for which the path element should be created.
Returns:
a path element.
Throws:
IllegalArgumentException - If the identifier is null.
Since:
JCR 2.0

getCurrentElement

Path.Element getCurrentElement()
Return the current element.

Returns:
the current element.

getParentElement

Path.Element getParentElement()
Return the parent element.

Returns:
the parent element.

getRootElement

Path.Element getRootElement()
Return the root element.

Returns:
the root element.

getRootPath

Path getRootPath()
Return the Path of the root node.

Returns:
the Path of the root node.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.