public class SystemContent extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GENERATED_PREFIX |
protected static Pattern |
GENERATED_PREFIX_PATTERN |
Modifier and Type | Method and Description |
---|---|
protected Iterable<?> |
all(CachedNode node,
Name propertyName) |
SessionCache |
cache() |
protected Object |
first(CachedNode node,
Name propertyName) |
protected Object |
first(CachedNode node,
Name propertyName,
Object defaultValue) |
boolean |
hasVersionHistory(NodeKey versionableNodeKey) |
NodeKey |
indexesKey() |
CachedNode |
indexesNode() |
protected MutableCachedNode |
initializeVersionStorage(NodeKey versionableNodeKey,
NodeKey versionHistoryKey,
NodeKey versionKey,
Name primaryTypeName,
Set<Name> mixinTypeNames,
Path versionHistoryPath,
NodeKey originalVersionKey,
DateTime now)
Create and initialize the version history structure for a versionable node with the supplied UUID.
|
protected NodeKey |
keyForNamespaceUri(String namespaceUri) |
NodeKey |
locksKey() |
CachedNode |
locksNode() |
MutableCachedNode |
mutableIndexesNode() |
MutableCachedNode |
mutableLocksNode() |
MutableCachedNode |
mutableNamespacesNode() |
MutableCachedNode |
mutableNodeTypesNode() |
MutableCachedNode |
mutableSystemNode() |
MutableCachedNode |
mutableVersionStorageNode() |
NodeKey |
namespacesKey() |
CachedNode |
namespacesNode() |
protected Name |
nextNameForVersionNode(Property predecessors,
ChildReferences historyChildren)
Compute the name for the next version node in the given history.
|
NodeKey |
nodeTypesKey() |
CachedNode |
nodeTypesNode() |
protected int |
propertyType(Object value) |
List<IndexDefinition> |
readAllIndexDefinitions(Set<String> providerNames,
Set<String> indexNames)
Read from system storage the index definitions.
|
Collection<NamespaceRegistry.Namespace> |
readAllNamespaces() |
List<NodeTypeDefinition> |
readAllNodeTypes()
Read from system storage all of the node type definitions.
|
protected NodeDefinition |
readChildNodeDefinition(CachedNode childDefn) |
IndexColumnDefinition |
readIndexColumnDefinition(CachedNode indexColumnDefn) |
IndexDefinition |
readIndexDefinition(CachedNode indexDefn,
Name providerName) |
String |
readNamespacePrefix(String namespaceUri,
boolean generateIfMissing) |
NodeTypeDefinition |
readNodeTypeDefinition(CachedNode nodeType) |
List<NodeTypeDefinition> |
readNodeTypes(Set<Name> nodeTypesToRefresh)
Read from system storage the node type definitions with the supplied names.
|
protected PropertyDefinition |
readPropertyDefinition(CachedNode propDefn) |
MutableCachedNode |
recordNewVersion(CachedNode versionableNode,
SessionCache cacheForVersionableNode,
Path versionHistoryPath,
NodeKey originalVersionKey,
Collection<Property> versionableProperties,
DateTime now,
AtomicReference<MutableCachedNode> frozenNodeOutput)
The method efficiently updates the JCR version history and storage with a new version of a node being checked in.
|
Set<String> |
registerNamespaces(Map<String,String> newUrisByPrefix) |
void |
remove(IndexDefinition indexDefn) |
void |
save() |
protected void |
store(IndexDefinition indexDefn,
boolean updateExisting) |
void |
store(Iterable<org.modeshape.jcr.JcrNodeType> nodeTypes,
boolean updateExisting)
Stores the node types in the system area under
/jcr:system/jcr:nodeTypes . |
void |
store(org.modeshape.jcr.JcrNodeType nodeType,
boolean updateExisting)
Stores the node type in the system area under
/jcr:system/jcr:nodeTypes . |
NodeKey |
systemKey() |
CachedNode |
systemNode() |
protected boolean |
unregisterNamespace(String namespaceUri) |
protected void |
unregisterNodeTypes(org.modeshape.jcr.JcrNodeType... nodeTypes) |
NodeKey |
versionHistoryNodeKeyFor(NodeKey versionableNodeKey) |
NodeKey |
versionStorageKey() |
CachedNode |
versionStorageNode() |
public static final String GENERATED_PREFIX
protected static final Pattern GENERATED_PREFIX_PATTERN
public void save()
public final SessionCache cache()
public NodeKey systemKey()
public NodeKey nodeTypesKey()
public NodeKey indexesKey()
public NodeKey namespacesKey()
public NodeKey locksKey()
public NodeKey versionStorageKey()
public CachedNode systemNode()
public CachedNode nodeTypesNode()
public CachedNode namespacesNode()
public CachedNode indexesNode()
public CachedNode locksNode()
public CachedNode versionStorageNode()
public MutableCachedNode mutableNodeTypesNode()
public MutableCachedNode mutableNamespacesNode()
public MutableCachedNode mutableIndexesNode()
public MutableCachedNode mutableLocksNode()
public MutableCachedNode mutableVersionStorageNode()
public MutableCachedNode mutableSystemNode()
public void store(Iterable<org.modeshape.jcr.JcrNodeType> nodeTypes, boolean updateExisting)
/jcr:system/jcr:nodeTypes
.
For each node type, a node is created with primary type of nt:nodeType
and a name that corresponds to the node
type's name. All other properties and child nodes for the newly created node are added in a manner consistent with the
guidance provided in section 6.7.22 of the JCR 1.0 specification and section 4.7.24 of the JCR 2.0 specification where
possible.
nodeTypes
- the node types to write out; may not be nullupdateExisting
- a boolean flag denoting whether the new node type definition should be overwrite an existing node
type definitionpublic void store(org.modeshape.jcr.JcrNodeType nodeType, boolean updateExisting)
/jcr:system/jcr:nodeTypes
.
The stored content will contain a node with a primary type of nt:nodeType
and a name that corresponds to the
node type's name. All other properties and child nodes for the newly created node are added in a manner consistent with the
guidance provided in section 6.7.22 of the JCR 1.0 specification and section 4.7.24 of the JCR 2.0 specification where
possible.
nodeType
- the node type to write; may not be nullupdateExisting
- a boolean flag denoting whether the new node type definition should be overwrite an existing node
type definitionpublic IndexDefinition readIndexDefinition(CachedNode indexDefn, Name providerName)
public IndexColumnDefinition readIndexColumnDefinition(CachedNode indexColumnDefn)
public List<IndexDefinition> readAllIndexDefinitions(Set<String> providerNames, Set<String> indexNames)
enabled
only if the definition's named provider is in the
supplied set and the name of the index definition is present in the repository's indexes configuration;
otherwise, the definition will be marked as disabled.providerNames
- the names of the providers that should be used to determine which index definitions are
enabled
; may be null if not known and all index definitions will be
enabled
indexNames
- the names of the indexes that should be used according to the repository's indexes configurationpublic void remove(IndexDefinition indexDefn)
protected void store(IndexDefinition indexDefn, boolean updateExisting)
public List<NodeTypeDefinition> readNodeTypes(Set<Name> nodeTypesToRefresh)
nodeTypesToRefresh
- public List<NodeTypeDefinition> readAllNodeTypes()
public NodeTypeDefinition readNodeTypeDefinition(CachedNode nodeType)
protected PropertyDefinition readPropertyDefinition(CachedNode propDefn) throws ConstraintViolationException
ConstraintViolationException
protected NodeDefinition readChildNodeDefinition(CachedNode childDefn) throws ConstraintViolationException
ConstraintViolationException
protected final int propertyType(Object value)
protected final Iterable<?> all(CachedNode node, Name propertyName)
protected final Object first(CachedNode node, Name propertyName)
protected final Object first(CachedNode node, Name propertyName, Object defaultValue)
public Collection<NamespaceRegistry.Namespace> readAllNamespaces()
public String readNamespacePrefix(String namespaceUri, boolean generateIfMissing)
protected boolean unregisterNamespace(String namespaceUri)
protected void unregisterNodeTypes(org.modeshape.jcr.JcrNodeType... nodeTypes)
public boolean hasVersionHistory(NodeKey versionableNodeKey)
protected MutableCachedNode initializeVersionStorage(NodeKey versionableNodeKey, NodeKey versionHistoryKey, NodeKey versionKey, Name primaryTypeName, Set<Name> mixinTypeNames, Path versionHistoryPath, NodeKey originalVersionKey, DateTime now)
Given a NodeKey for a node that has an identifier part of "fae2b929-c5ef-4ce5-9fa1-514779ca0ae3", the SHA-1 hash of this identifier part is "b46dde8905f76361779339fa3ccacc4f47664255". The path to the version history for this node is as follows:
+ jcr:system + jcr:versionStorage {jcr:primaryType = mode:versionStorage} + b4 {jcr:primaryType = mode:versionHistoryFolder} + 6d {jcr:primaryType = mode:versionHistoryFolder} + de {jcr:primaryType = mode:versionHistoryFolder} + 298905f76361779339fa3ccacc4f47664255 {jcr:primaryType = nt:versionHistory} + jcr:versionLabels {jcr:primaryType = nt:versionLabels} + jcr:rootVersion {jcr:primaryType = nt:version} - jcr:uuid = ... - jcr:created = ... + jcr:frozenNode {jcr:primaryType = nt:frozenNode} - jcr:frozenUuid - jcr:frozenPrimaryType - jcr:frozenMixinTypesNote that the path between "/jcr:system/jcr:versionStorage" and the "nt:versionHistory" node is shown as being
hiearchical
.versionableNodeKey
- the identifier of the versionable node for which the history is to be created; may not be nullversionHistoryKey
- the key to the version history node; may not be nullversionKey
- the key to be used for the initial version; may be null if the key should be generatedprimaryTypeName
- the name of the primary type of the versionable node; may not be nullmixinTypeNames
- the names of the mixin types for the versionable node; may be null or emptyversionHistoryPath
- the path of the version history node; may not be nulloriginalVersionKey
- the key of the original node from which the new versionable node was copied; may be nullnow
- the current date time; may not be nullpublic MutableCachedNode recordNewVersion(CachedNode versionableNode, SessionCache cacheForVersionableNode, Path versionHistoryPath, NodeKey originalVersionKey, Collection<Property> versionableProperties, DateTime now, AtomicReference<MutableCachedNode> frozenNodeOutput)
Note that this method will initialize the version history for the node if the version history does not already exist.
The names of the different versions has changed since 2.x, and now follows the same convention and algorithm as used in the
reference implementation. See
nextNameForVersionNode(org.modeshape.jcr.value.Property, org.modeshape.jcr.cache.ChildReferences)
for details.
versionableNode
- the versionable node for which a new version is to be created in the node's version history; may not
be nullcacheForVersionableNode
- the cache used to access the versionable node and any descendants; may not be nullversionHistoryPath
- the path of the version history node; may not be nulloriginalVersionKey
- the key of the original node from which the new versionable node was copied; may be nullversionableProperties
- the versionable node's properties that should be record in the version history (on the frozen
node); may be null or emptynow
- the current date time; may not be nullfrozenNodeOutput
- the reference that should be set upon successful completion to the frozen node created under the
new version; may not be nullprotected Name nextNameForVersionNode(Property predecessors, ChildReferences historyChildren)
The basic rules are as follows:
jcr:rootVersion | | 1.0 2.0 | 1.1 | 1.2 ---\ ------\ | \ \ 1.3 1.2.0 1.2.0.0 | | 1.4 1.2.1 ----\ | | \ 1.5 1.2.2 1.2.1.0 | | | 1.6 | 1.2.1.1 |------/ 1.7
predecessors
- the 'jcr:predecessors' property; may not be nullhistoryChildren
- the child references under the version history for the nodeCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.