@Immutable public final class NodeKey extends Object implements Serializable, Comparable<NodeKey>
repository
's database
.
A node key consists of three parts:
This class contains methods for
Modifier and Type | Field and Description |
---|---|
static Comparator<NodeKey> |
COMPARATOR |
protected static int |
SOURCE_LENGTH |
protected static int |
WORKSPACE_LENGTH |
Constructor and Description |
---|
NodeKey(String key)
Reconstitute a node key from the supplied string.
|
NodeKey(String sourceKey,
String workspaceKey,
String identifier)
Reconstitute a node key from the supplied source key, workspace key, and node identifier.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(NodeKey that) |
boolean |
equals(Object obj) |
String |
getIdentifier()
Get the multi-character key representing the JCR identifier of a node, which is usually a UUID.
|
String |
getIdentifierHash()
Get the SHA-1 hash of the
identifier . |
String |
getSourceKey()
Get the multi-character key uniquely identifying the repository's storage source in which this node appears.
|
String |
getWorkspaceKey()
Get the multi-character key uniquely identifying the workspace in which the node appears.
|
int |
hashCode() |
static boolean |
isValidFormat(String key)
Determine if the supplied string may be a valid identifier.
|
static boolean |
isValidRandomIdentifier(String identifier)
Determine if the supplied string is known to be a valid
random node key identifier. |
static String |
keyForSourceName(String name) |
static String |
keyForWorkspaceName(String name) |
static String |
sourceKey(String key) |
String |
toString() |
NodeKey |
withId(String identifier) |
NodeKey |
withRandomId() |
NodeKey |
withRandomIdAndWorkspace(String workspaceKey) |
NodeKey |
withSourceKeyAndId(String sourceKey,
String identifier) |
NodeKey |
withWorkspaceKey(String workspaceKey) |
NodeKey |
withWorkspaceKeyAndId(String workspaceKey,
String identifier) |
public static final Comparator<NodeKey> COMPARATOR
protected static final int SOURCE_LENGTH
protected static final int WORKSPACE_LENGTH
public NodeKey(String key)
key
- the string representation of the key; may not be nullpublic NodeKey(String sourceKey, String workspaceKey, String identifier)
sourceKey
- the source key; may not be null and must be 4 charactersworkspaceKey
- the workspace key; may not be null and must be 4 charactersidentifier
- the node identifier; may not be null and must be at least 1 characterpublic static boolean isValidFormat(String key)
key
- public static boolean isValidRandomIdentifier(String identifier)
random
node key identifier.identifier
- the identifierpublic String getSourceKey()
public String getWorkspaceKey()
public String getIdentifier()
public String getIdentifierHash()
identifier
.public int compareTo(NodeKey that)
compareTo
in interface Comparable<NodeKey>
public NodeKey withRandomId()
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.