public class Jcr
extends java.lang.Object
null
when something is not found. This is especially useful when writing user
interfaces (such as with SWT) where listeners and callbacks expect unchecked
exceptions. Loosely inspired by Java's Files singleton.| Modifier and Type | Method and Description |
|---|---|
static void |
addPrivilege(Node node,
java.lang.String principal,
java.lang.String privilege)
Add a single privilege to a node.
|
static void |
checkin(Node node) |
static void |
checkout(Node node) |
static void |
checkpoint(Node node) |
static java.lang.String |
get(Node node,
java.lang.String property)
Get property as
String. |
static java.lang.String |
get(Node node,
java.lang.String property,
java.lang.String defaultValue)
Get property as a
String. |
static <T> T |
getAs(Node node,
java.lang.String property,
T defaultValue)
Get property doing a best effort to cast it as the target object.
|
static Version |
getBaseVersion(Node node)
Get the base
Version related to this node. |
static long |
getBinarySize(Binary binaryArg)
Returns the size of this
Binary. |
static long |
getFileSize(Node fileNode)
Returns the size of this file.
|
static Node |
getFrozenNode(Version version)
The frozen node related to this
Version. |
static java.lang.String |
getIdentifier(Node node) |
static java.util.List<Version> |
getLinearVersions(VersionHistory versionHistory)
The linear versions of this version history in reverse order and without the
root version.
|
static java.lang.String |
getName(Node node) |
static Node |
getNode(Node node,
java.lang.String child) |
static Node |
getNode(Session session,
java.lang.String path) |
static Node |
getNodeById(Session session,
java.lang.String id) |
static java.util.List<Node> |
getNodes(Node node) |
static Node |
getParent(Node node) |
static java.lang.String |
getPath(Node node) |
static Value |
getValue(Node node,
java.lang.String property)
Get property as a
Value. |
static VersionHistory |
getVersionHistory(Node node)
Get the
VersionHistory related to this node. |
static boolean |
hasNodes(Node node) |
static boolean |
isCheckedOut(Node node)
Get checked out status.
|
static boolean |
isNodeType(Node node,
java.lang.String nodeTypeName) |
static boolean |
isRoot(Node node)
Whether this node is the root node.
|
static java.lang.Iterable<Node> |
iterate(NodeIterator nodeIterator)
Accesses a
NodeIterator as an Iterable. |
static Session |
login(Repository repository,
java.lang.String workspace)
Login to a JCR repository.
|
static void |
logout(Session session)
Safely and silently logs out a session.
|
static java.lang.Iterable<Node> |
nodes(Node node) |
static void |
save(Node node)
Saves the
Session related to this node. |
static Session |
session(Node node)
Retrieves the
Session related to this node. |
static void |
set(Node node,
java.lang.String property,
java.lang.Object value)
Set a property to the given value, or remove it if the value is
null. |
static VersionManager |
versionManager(Node node)
Get the
VersionManager related to this node. |
public static boolean isNodeType(Node node, java.lang.String nodeTypeName)
java.lang.IllegalStateException - caused by RepositoryExceptionNode.isNodeType(String)public static boolean hasNodes(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionNode.hasNodes()public static Node getParent(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionItem.getParent()public static boolean isRoot(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionpublic static java.lang.String getPath(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionItem.getPath()public static java.lang.String getIdentifier(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionNode.getIdentifier()public static java.lang.String getName(Node node)
java.lang.IllegalStateException - caused by RepositoryExceptionItem.getName()public static java.lang.Iterable<Node> iterate(NodeIterator nodeIterator)
NodeIterator as an Iterable.public static java.lang.Iterable<Node> nodes(Node node)
Iterable for use in for-each llops.java.lang.IllegalStateException - caused by RepositoryExceptionNode.getNodes()public static java.util.List<Node> getNodes(Node node)
List.java.lang.IllegalStateException - caused by RepositoryExceptionNode.getNodes()public static Node getNode(Node node, java.lang.String child)
null if not foundjava.lang.IllegalStateException - caused by RepositoryExceptionNode.getNode(String)public static Node getNode(Session session, java.lang.String path)
null if not foundjava.lang.IllegalStateException - caused by RepositoryExceptionSession.getNode(String)public static Node getNodeById(Session session, java.lang.String id)
null if not foundjava.lang.IllegalStateException - caused by RepositoryExceptionSession.getNodeByIdentifier(String)public static void set(Node node, java.lang.String property, java.lang.Object value)
null.java.lang.IllegalStateException - caused by RepositoryExceptionpublic static java.lang.String get(Node node, java.lang.String property)
String.Node.getProperty(String).Property.getString() or
null if the property does not exist.java.lang.IllegalStateException - caused by RepositoryExceptionpublic static java.lang.String get(Node node, java.lang.String property, java.lang.String defaultValue)
String.Node.getProperty(String).Property.getString() or
defaultValue if the property does not exist.java.lang.IllegalStateException - caused by RepositoryExceptionpublic static Value getValue(Node node, java.lang.String property)
Value.Node.getProperty(String) or null if the property
does not exist.java.lang.IllegalStateException - caused by RepositoryExceptionpublic static <T> T getAs(Node node, java.lang.String property, T defaultValue)
Node.getProperty(String) or
defaultValue if the property does not exist.java.lang.IllegalArgumentException - if the value could not be castjava.lang.IllegalStateException - in case of unexpected
RepositoryExceptionpublic static void save(Node node)
Session related to this node. Note that all other unrelated
modifications in this session will also be saved.public static Session login(Repository repository, java.lang.String workspace)
public static void logout(Session session)
public static void addPrivilege(Node node, java.lang.String principal, java.lang.String privilege)
Privilegepublic static boolean isCheckedOut(Node node)
public static void checkpoint(Node node)
VersionManager.checkpoint(String)public static void checkin(Node node)
VersionManager.checkin(String)public static void checkout(Node node)
VersionManager.checkout(String)public static VersionManager versionManager(Node node)
VersionManager related to this node.public static VersionHistory getVersionHistory(Node node)
VersionHistory related to this node.public static java.util.List<Version> getLinearVersions(VersionHistory versionHistory)
public static Node getFrozenNode(Version version)
Version.public static Version getBaseVersion(Node node)
Version related to this node.public static long getFileSize(Node fileNode)
NodeType.NT_FILECopyright © 2007–2020. All rights reserved.