public interface PersistenceManager
Each workspace of a Jackrabbit content repository uses separate persistence manager to store the content in that workspace. Also the Jackrabbit version handler uses a separate persistence manager. The persistence managers in use are configured in the Jackrabbit XML configuration files. The configured persistence managers are instantiated and initialized using the JavaBeans conventions.
The life cycle of a persistence manager instance contains four phases:
init
method
is invoked to bind the persistence manager with a given
context
.
close
method is invoked
to close the persistence manager and release all acquired
resources.
A persistence manager instance should be thread-safe and guarantee that
the store(ChangeLog)
method calls are atomic. Any load() or
exists() calls started after a store() call has returned must access
the updated content. The client accessing a persistence manager must
guarantee that no two concurrent store(ChangeLog)
calls will
modify the same items.
Modifier and Type | Method and Description |
---|---|
void |
checkConsistency(String[] uuids,
boolean recursive,
boolean fix)
Perform a consistency check of the data.
|
void |
close()
Closes the persistence manager.
|
NodeState |
createNew(NodeId id)
Creates a new node state instance with the given id.
|
PropertyState |
createNew(PropertyId id)
Creates a new property state instance with the given id.
|
boolean |
exists(NodeId id)
Checks whether the identified node exists.
|
boolean |
exists(PropertyId id)
Checks whether the identified property exists.
|
boolean |
existsReferencesTo(NodeId targetId)
Checks whether references of the identified target node exist.
|
void |
init(PMContext context)
Initializes the persistence manager.
|
NodeState |
load(NodeId id)
Load the persistent members of a node state.
|
PropertyState |
load(PropertyId id)
Load the persistent members of a property state.
|
NodeReferences |
loadReferencesTo(NodeId id)
Load the persisted references to the node with the given identifier.
|
void |
store(ChangeLog changeLog)
Atomically saves the given set of changes.
|
void init(PMContext context) throws Exception
An appropriate exception is thrown if the persistence manager initialization fails for whatever reason. In this case the state of the persistence manager is undefined and the instance should be discarded.
context
- persistence manager contextException
- if the persistence manager initialization failedvoid close() throws Exception
An appropriate exception is thrown if the persistence manager could not be closed properly. In this case the state of the persistence manager is undefined and the instance should be discarded.
Exception
- if the persistence manager failed to close properlyNodeState createNew(NodeId id)
id
- node idPropertyState createNew(PropertyId id)
id
- property idNodeState load(NodeId id) throws NoSuchItemStateException, ItemStateException
id
- node idNoSuchItemStateException
- if the node state does not existItemStateException
- if another error occursPropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException
id
- property idNoSuchItemStateException
- if the property state does not existItemStateException
- if another error occursNodeReferences loadReferencesTo(NodeId id) throws NoSuchItemStateException, ItemStateException
id
- reference target node idNoSuchItemStateException
- if the target node does not existItemStateException
- if another error occursboolean exists(NodeId id) throws ItemStateException
id
- node idtrue
if the node exists,
false
otherwiseItemStateException
- on persistence manager errorsboolean exists(PropertyId id) throws ItemStateException
id
- property idtrue
if the property exists,
false
otherwiseItemStateException
- on persistence manager errorsboolean existsReferencesTo(NodeId targetId) throws ItemStateException
targetId
- target node idtrue
if the references exist,
false
otherwiseItemStateException
- on persistence manager errorsvoid store(ChangeLog changeLog) throws ItemStateException
changeLog
- change log containing states that were changedItemStateException
- if the changes could not be savedvoid checkConsistency(String[] uuids, boolean recursive, boolean fix)
uuids
- list of UUIDs of nodes to be checked. if null, all nodes will
be checkedrecursive
- if true, the tree(s) below the given node(s) will be traversed
and checked as wellfix
- if true, any problems found that can be repaired will be
repaired. if false, no data will be modified, instead all
inconsistencies will only get loggedCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.