public class Util extends Object
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.
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytes(javax.jcr.Node node)
Returns the resource as an array of bytes
|
static javax.jcr.Property |
getProperty(javax.jcr.Item item)
Resolves the given
item to a Property from
which contents can be read. |
public static javax.jcr.Property getProperty(javax.jcr.Item item) throws javax.jcr.ValueFormatException, javax.jcr.RepositoryException
item
to a Property
from
which contents can be read.
The following mechanism is used to derive the contents:
item
is a property, this property is useditem
is a node, three steps are tested:
jcr:content
child node, use that
child node in the next steps. Otherwise continue with the node.jcr:data
property and use that property
if existing.getPrimaryItem
method repeatedly until
a property is returned or until no more primary item is available.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.item
- The Item
to resolve to a Property
.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.javax.jcr.ValueFormatException
- If the item
resolves to a
single-valued REFERENCE
type property which
cannot be resolved to the node referred to.javax.jcr.RepositoryException
- if another error occurrs accessing the
repository.public static byte[] getBytes(javax.jcr.Node node) throws IOException, javax.jcr.RepositoryException
IOException
javax.jcr.RepositoryException
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.