org.apache.jackrabbit.classloader
Class Util

java.lang.Object
  extended by org.apache.jackrabbit.classloader.Util

public class Util
extends Object

The Util provides helper methods for the repository classloader and its class path entry and resource classes.

This class may not be extended or instantiated, it just contains static utility methods.


Method Summary
static long getLastModificationTime(Property prop)
          Returns the last modification time of the property, which is the long value of the jcr:lastModified property of the parent node of prop.
static Property getProperty(Item item)
          Resolves the given item to a Property from which contents can be read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProperty

public static Property getProperty(Item item)
                            throws ValueFormatException,
                                   RepositoryException
Resolves the given item to a Property from which contents can be read.

The following mechanism is used to derive the contents:

  1. If the item is a property, this property is used
  2. If the item is a node, three steps are tested:
    1. If the node has a jcr:content child node, use that child node in the next steps. Otherwise continue with the node.
    2. Check for a jcr:data property and use that property if existing.
    3. Otherwise call getPrimaryItem method repeatedly until a property is returned or until no more primary item is available.
If no property can be resolved using the above algorithm or if the resulting property is a multivalue property, null is returned. Otherwise if the resulting property is a REFERENCE property, the node referred to is retrieved and this method is called recursively with the node. Otherwise, the resulting property is returned.

Parameters:
item - The Item to resolve to a Property.
Returns:
The resolved Property or null if the resolved property is a multi-valued property or the item is a node which cannot be resolved to a data property.
Throws:
ValueFormatException - If the item resolves to a single-valued REFERENCE type property which cannot be resolved to the node referred to.
RepositoryException - if another error occurrs accessing the repository.

getLastModificationTime

public static long getLastModificationTime(Property prop)
                                    throws ItemNotFoundException,
                                           PathNotFoundException,
                                           AccessDeniedException,
                                           RepositoryException
Returns the last modification time of the property, which is the long value of the jcr:lastModified property of the parent node of prop. If the parent node does not have a jcr:lastModified property the current system time is returned.

Parameters:
prop - The property for which to return the last modification time.
Returns:
The last modification time of the resource or the current time if the parent node of the property does not have a jcr:lastModified property.
Throws:
ItemNotFoundException - If the parent node of the property cannot be retrieved.
AccessDeniedException - If (read) access to the parent node is denied.
RepositoryException - If any other error occurrs accessing the repository to retrieve the last modification time.
PathNotFoundException


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