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

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.conversion.PathParser

public class PathParser
extends Object

PathParser formats a Path using a NameResolver and a PathFactory.


Constructor Summary
PathParser()
           
 
Method Summary
static void checkFormat(String jcrPath)
          Check the format of the given jcr path.
static org.apache.jackrabbit.spi.Path parse(org.apache.jackrabbit.spi.Path parent, String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, org.apache.jackrabbit.spi.PathFactory factory)
          Parses the given jcrPath and returns a Path.
static org.apache.jackrabbit.spi.Path parse(org.apache.jackrabbit.spi.Path parent, String jcrPath, NameResolver resolver, org.apache.jackrabbit.spi.PathFactory factory)
          Parses the given jcrPath and returns a Path.
static org.apache.jackrabbit.spi.Path parse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, org.apache.jackrabbit.spi.PathFactory factory)
          Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs.
static org.apache.jackrabbit.spi.Path parse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, org.apache.jackrabbit.spi.PathFactory factory, boolean normalizeIdentifier)
          Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs.
static org.apache.jackrabbit.spi.Path parse(String jcrPath, NameResolver resolver, org.apache.jackrabbit.spi.PathFactory factory)
          Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathParser

public PathParser()
Method Detail

parse

public static org.apache.jackrabbit.spi.Path parse(String jcrPath,
                                                   NameResolver resolver,
                                                   org.apache.jackrabbit.spi.PathFactory factory)
                                            throws MalformedPathException,
                                                   IllegalNameException,
                                                   NamespaceException
Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs. If resolver is null this method only checks the format of the passed String and returns null.

Parameters:
jcrPath - the jcr path.
resolver - the namespace resolver.
factory - PathFactory to be used.
Returns:
A path object.
Throws:
MalformedPathException - If the jcrPath is malformed.
IllegalNameException - if any of the jcrNames is malformed.
NamespaceException - If an unresolvable prefix is encountered.

parse

public static org.apache.jackrabbit.spi.Path parse(String jcrPath,
                                                   NameResolver nameResolver,
                                                   IdentifierResolver identifierResolver,
                                                   org.apache.jackrabbit.spi.PathFactory factory)
                                            throws MalformedPathException,
                                                   IllegalNameException,
                                                   NamespaceException
Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs. If the specified jcrPath is an identifier based absolute path beginning with an identifier segment the specified IdentifierResolver will be used to resolve it to an absolute path.

If namResolver is null or if identifierResolver is null and the path starts with an identifier segment, this method only checks the format of the string and returns null.

Parameters:
jcrPath - the jcr path.
nameResolver - the namespace resolver.
identifierResolver - the resolver to validate any trailing identifier segment and resolve to an absolute path.
factory -
Returns:
A path object.
Throws:
MalformedPathException - If the jcrPath is malformed.
IllegalNameException - if any of the jcrNames is malformed.
NamespaceException - If an unresolvable prefix is encountered.
Since:
JCR 2.0

parse

public static org.apache.jackrabbit.spi.Path parse(String jcrPath,
                                                   NameResolver nameResolver,
                                                   IdentifierResolver identifierResolver,
                                                   org.apache.jackrabbit.spi.PathFactory factory,
                                                   boolean normalizeIdentifier)
                                            throws MalformedPathException,
                                                   IllegalNameException,
                                                   NamespaceException
Parses jcrPath into a Path object using resolver to convert prefixes into namespace URIs. If the specified jcrPath is an identifier based absolute path beginning with an identifier segment the specified IdentifierResolver will be used to resolve it to an absolute path.

If namResolver is null or if identifierResolver is null and the path starts with an identifier segment, this method only checks the format of the string and returns null.

Parameters:
jcrPath - the jcr path.
nameResolver - the namespace resolver.
identifierResolver - the resolver to validate any trailing identifier segment and resolve to an absolute path.
factory -
normalizeIdentifier -
Returns:
A path object.
Throws:
MalformedPathException - If the jcrPath is malformed.
IllegalNameException - if any of the jcrNames is malformed.
NamespaceException - If an unresolvable prefix is encountered.
Since:
JCR 2.0

parse

public static org.apache.jackrabbit.spi.Path parse(org.apache.jackrabbit.spi.Path parent,
                                                   String jcrPath,
                                                   NameResolver resolver,
                                                   org.apache.jackrabbit.spi.PathFactory factory)
                                            throws MalformedPathException,
                                                   IllegalNameException,
                                                   NamespaceException
Parses the given jcrPath and returns a Path. If parent is not null, it is prepended to the built path before it is returned. If resolver is null, this method only checks the format of the string and returns null.

Parameters:
parent - the parent path
jcrPath - the JCR path
resolver - the namespace resolver to get prefixes for namespace URIs.
factory -
Returns:
the Path object.
Throws:
MalformedPathException - If the jcrPath is malformed.
IllegalNameException - if any of the jcrNames is malformed.
NamespaceException - If an unresolvable prefix is encountered.

parse

public static org.apache.jackrabbit.spi.Path parse(org.apache.jackrabbit.spi.Path parent,
                                                   String jcrPath,
                                                   NameResolver nameResolver,
                                                   IdentifierResolver identifierResolver,
                                                   org.apache.jackrabbit.spi.PathFactory factory)
                                            throws MalformedPathException,
                                                   IllegalNameException,
                                                   NamespaceException
Parses the given jcrPath and returns a Path. If parent is not null, it is prepended to the built path before it is returned. If the specified jcrPath is an identifier based absolute path beginning with an identifier segment the given identifierResolver will be used to resolve it to an absolute path.

If nameResolver is null or if identifierResolver is null and the path starts with an identifier segment, this method only checks the format of the string and returns null.

Parameters:
parent - the parent path.
jcrPath - the jcr path.
nameResolver - the namespace resolver.
identifierResolver - the resolver to validate any trailing identifier segment and resolve it to an absolute path.
factory - The path factory.
Returns:
the Path object.
Throws:
MalformedPathException
IllegalNameException
NamespaceException

checkFormat

public static void checkFormat(String jcrPath)
                        throws MalformedPathException
Check the format of the given jcr path. Note, the neither name nor namespace validation (resolution of prefix to URI) is performed and therefore will not be detected.

Parameters:
jcrPath -
Throws:
MalformedPathException - If the jcrPath is malformed.


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