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 Path parse(Path parent, String jcrPath, NameResolver resolver, PathFactory factory)
          Parses the give jcrPath and returns a Path.
static Path parse(String jcrPath, NameResolver resolver, PathFactory factory)
          Parses jcrPath into a qualified path using resolver to convert prefixes into namespace URI's.
 
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 Path parse(String jcrPath,
                         NameResolver resolver,
                         PathFactory factory)
                  throws MalformedPathException,
                         IllegalNameException,
                         NamespaceException
Parses jcrPath into a qualified path using resolver to convert prefixes into namespace URI's.

Parameters:
jcrPath - the jcr path.
resolver - the namespace resolver.
factory -
Returns:
qualified path.
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 Path parse(Path parent,
                         String jcrPath,
                         NameResolver resolver,
                         PathFactory factory)
                  throws MalformedPathException,
                         IllegalNameException,
                         NamespaceException
Parses the give jcrPath and returns a Path. If parent is not null, it is prepended to the returned list. 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 URI's.
factory -
Returns:
the fully qualified Path.
Throws:
MalformedPathException - If the jcrPath is malformed.
IllegalNameException - if any of the jcrNames is malformed.
NamespaceException - If an unresolvable prefix is encountered.

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-2009 The Apache Software Foundation. All Rights Reserved.