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.

Author:
Felix Meschberger

Method Summary
static long getLastModificationTime(Property prop)
          Returns the last modification time of the property.
static Property getProperty(Item item)
          Resolves the given item to a Property.
 
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 ItemNotFoundException,
                                   ValueFormatException,
                                   RepositoryException
Resolves the given item to a Property. If the item is a node, the getPrimaryItem method is called repeatedly until a property is returned or until no more primary item is available. 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.
Throws:
ItemNotFoundException - If the item is a node which cannot be resolved to a property through (repeated) calls to Node.getPrimaryItem.
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. If the property's parent node is a nt:resource the long value of the jcr:lastModified property of the parent node is returned. Otherwise 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 property is not a child of an nt:resource node.
Throws:
ItemNotFoundException - If the parent node of the property cannot be retrieved.
PathNotFoundException - If the "jcr:lastModified" property of the parent node cannot be retrieved. This exception is unlikely in a correctly configured repository as the jcr:lastModified property has to be present in a node of type nt:resource.
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.


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