org.apache.jackrabbit.spi.commons.conversion
Class ParsingPathResolver

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver
All Implemented Interfaces:
PathResolver

public class ParsingPathResolver
extends Object
implements PathResolver

Path resolver that parsers and formats prefixed JCR paths. A NameResolver is used for resolving the path element names.


Constructor Summary
ParsingPathResolver(PathFactory pathFactory, NameResolver resolver)
          Creates a parsing path resolver.
ParsingPathResolver(PathFactory pathFactory, NameResolver nameResolver, IdentifierResolver idResolver)
          Creates a parsing path resolver.
 
Method Summary
 String getJCRPath(Path path)
          Returns the JCR path representation for the given Path object.
 Path getQPath(String jcrPath)
          Parses the given JCR path into a Path object.
 Path getQPath(String jcrPath, boolean normalizeIdentifier)
          Calls PathParser.parse(String, NameResolver, IdentifierResolver, org.apache.jackrabbit.spi.PathFactory) from the given jcrPath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsingPathResolver

public ParsingPathResolver(PathFactory pathFactory,
                           NameResolver resolver)
Creates a parsing path resolver.

Parameters:
pathFactory - path factory.
resolver - name resolver

ParsingPathResolver

public ParsingPathResolver(PathFactory pathFactory,
                           NameResolver nameResolver,
                           IdentifierResolver idResolver)
Creates a parsing path resolver.

Parameters:
pathFactory - path factory.
nameResolver - name resolver.
idResolver - identifier resolver.
Since:
JCR 2.0
Method Detail

getQPath

public Path getQPath(String jcrPath)
              throws MalformedPathException,
                     IllegalNameException,
                     NamespaceException
Parses the given JCR path into a Path object.

Specified by:
getQPath in interface PathResolver
Parameters:
jcrPath - A JCR path String.
Returns:
A Path object.
Throws:
MalformedPathException - if the JCR path format is invalid.
IllegalNameException - if any of the JCR names contained in the path are invalid.
NamespaceException - if a namespace prefix can not be resolved

getQPath

public Path getQPath(String jcrPath,
                     boolean normalizeIdentifier)
              throws MalformedPathException,
                     IllegalNameException,
                     NamespaceException
Calls PathParser.parse(String, NameResolver, IdentifierResolver, org.apache.jackrabbit.spi.PathFactory) from the given jcrPath.

Specified by:
getQPath in interface PathResolver
Parameters:
jcrPath - prefixed JCR path
Returns:
a Path object.
Throws:
MalformedPathException - if the JCR path format is invalid.
IllegalNameException - if any of the JCR names contained in the path are invalid.
NamespaceException - if a namespace prefix can not be resolved.
See Also:
PathResolver.getQPath(String, boolean)

getJCRPath

public String getJCRPath(Path path)
                  throws NamespaceException
Returns the JCR path representation for the given Path object.

Specified by:
getJCRPath in interface PathResolver
Parameters:
path - A Path object.
Returns:
A JCR path String in the standard form.
Throws:
NamespaceException - if a namespace URI can not be resolved.
See Also:
PathResolver.getJCRPath(org.apache.jackrabbit.spi.Path)


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