Class PathParser
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.conversion.PathParser
-
public class PathParser extends Object
-
-
Constructor Summary
Constructors Constructor Description PathParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckFormat(String jcrPath)Check the format of the given jcr path.static Pathparse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, PathFactory factory)ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs.static Pathparse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, PathFactory factory, boolean normalizeIdentifier)ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs.static Pathparse(String jcrPath, NameResolver resolver, PathFactory factory)ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs.static Pathparse(Path parent, String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, PathFactory factory)Parses the givenjcrPathand returns aPath.static Pathparse(Path parent, String jcrPath, NameResolver resolver, PathFactory factory)Parses the givenjcrPathand returns aPath.
-
-
-
Method Detail
-
parse
public static Path parse(String jcrPath, NameResolver resolver, PathFactory factory) throws MalformedPathException, IllegalNameException, NamespaceException
ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs. If resolver isnullthis method only checks the format of the passed String and returnsnull.- Parameters:
jcrPath- the jcr path.resolver- the namespace resolver.factory-PathFactoryto be used.- Returns:
- A path object.
- Throws:
MalformedPathException- If thejcrPathis malformed.IllegalNameException- if any of the jcrNames is malformed.NamespaceException- If an unresolvable prefix is encountered.
-
parse
public static Path parse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, PathFactory factory) throws MalformedPathException, IllegalNameException, NamespaceException
ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs. If the specifiedjcrPathis an identifier based absolute path beginning with an identifier segment the specifiedIdentifierResolverwill be used to resolve it to an absolute path.If
namResolverisnullor ifidentifierResolverisnulland the path starts with an identifier segment, this method only checks the format of the string and returnsnull.- 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 thejcrPathis malformed.IllegalNameException- if any of the jcrNames is malformed.NamespaceException- If an unresolvable prefix is encountered.- Since:
- JCR 2.0
-
parse
public static Path parse(String jcrPath, NameResolver nameResolver, IdentifierResolver identifierResolver, PathFactory factory, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException
ParsesjcrPathinto aPathobject usingresolverto convert prefixes into namespace URIs. If the specifiedjcrPathis an identifier based absolute path beginning with an identifier segment the specifiedIdentifierResolverwill be used to resolve it to an absolute path.If
namResolverisnullor ifidentifierResolverisnulland the path starts with an identifier segment, this method only checks the format of the string and returnsnull.- 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 thejcrPathis malformed.IllegalNameException- if any of the jcrNames is malformed.NamespaceException- If an unresolvable prefix is encountered.- Since:
- JCR 2.0
-
parse
public static Path parse(Path parent, String jcrPath, NameResolver resolver, PathFactory factory) throws MalformedPathException, IllegalNameException, NamespaceException
Parses the givenjcrPathand returns aPath. Ifparentis notnull, it is prepended to the built path before it is returned. Ifresolverisnull, this method only checks the format of the string and returnsnull.- Parameters:
parent- the parent pathjcrPath- the JCR pathresolver- the namespace resolver to get prefixes for namespace URIs.factory-- Returns:
- the
Pathobject. - Throws:
MalformedPathException- If thejcrPathis 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 nameResolver, IdentifierResolver identifierResolver, PathFactory factory) throws MalformedPathException, IllegalNameException, NamespaceException
Parses the givenjcrPathand returns aPath. Ifparentis notnull, it is prepended to the built path before it is returned. If the specifiedjcrPathis an identifier based absolute path beginning with an identifier segment the givenidentifierResolverwill be used to resolve it to an absolute path.If
nameResolverisnullor ifidentifierResolverisnulland the path starts with an identifier segment, this method only checks the format of the string and returnsnull.- 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
Pathobject. - Throws:
MalformedPathExceptionIllegalNameExceptionNamespaceException
-
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 thejcrPathis malformed.
-
-