org.apache.chemistry.opencmis.jcr
Class PathManager

java.lang.Object
  extended by org.apache.chemistry.opencmis.jcr.PathManager

public class PathManager
extends Object

Utility class for mapping JCR paths to CMIS paths


Field Summary
static String CMIS_ROOT_ID
          Identifier of the root folder
static String CMIS_ROOT_PATH
          Root path
 
Constructor Summary
PathManager(String jcrRootPath)
          Create a new PathManager instance for the given JCR root path.
 
Method Summary
static String createCmisPath(String cmisPath, String child)
          Create a CMIS path from a parent path and a child element
 String getJcrRootPath()
           
 String getPath(javax.jcr.Node node)
          Determine the CMIS path given a JCR Node.
static boolean isAbsolute(String cmisPath)
           
 boolean isRoot(javax.jcr.Node node)
          Determines whether a JCR Node is the root node wrt.
static boolean isRoot(String cmisPath)
           
static String relativize(String prefix, String cmisPath)
          Relativize an CMIS path wrt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMIS_ROOT_ID

public static final String CMIS_ROOT_ID
Identifier of the root folder

See Also:
Constant Field Values

CMIS_ROOT_PATH

public static final String CMIS_ROOT_PATH
Root path

See Also:
Constant Field Values
Constructor Detail

PathManager

public PathManager(String jcrRootPath)
Create a new PathManager instance for the given JCR root path.

Parameters:
jcrRootPath -
Method Detail

getJcrRootPath

public String getJcrRootPath()
Returns:
the JCR root path

isRoot

public boolean isRoot(javax.jcr.Node node)
Determines whether a JCR Node is the root node wrt. to this PathManager instance. That is, whether the path of the node is equal to this instance's JCR root path.

Parameters:
node -
Returns:
true iff node is the root node wrt. to this PathManager instance.

getPath

public String getPath(javax.jcr.Node node)
Determine the CMIS path given a JCR Node.

Parameters:
node -
Returns:
Throws:
IllegalArgumentException - when node is not part of the hierarchy

isRoot

public static boolean isRoot(String cmisPath)
Parameters:
cmisPath -
Returns:
true iff cmisPath equals CMIS_ROOT_PATH

isAbsolute

public static boolean isAbsolute(String cmisPath)
Parameters:
cmisPath -
Returns:
true iff cmisPath

createCmisPath

public static String createCmisPath(String cmisPath,
                                    String child)
Create a CMIS path from a parent path and a child element

Parameters:
cmisPath - parent path
child - child element
Returns:

relativize

public static String relativize(String prefix,
                                String cmisPath)
Relativize an CMIS path wrt. to a prefix.

Parameters:
prefix -
cmisPath -
Returns:
a string r such that prefix + r = cmisPath
Throws:
IllegalArgumentException - if prefix is not a prefix of cmisPath


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.