|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.state.SharedItemStateManager
Shared ItemStateManager
(SISM). Caches objects returned from a
PersistenceManager
. Objects returned by this item state
manager are shared among all sessions.
PersistenceManager
(PM) that is used to load and store the item states. Additionally, a SISM can
have VirtualItemStateProvider
s (VISP) that are used to provide
additional, non-persistent, read-only states. Examples of VISP are the
content representation of the NodeTypes (/jcr:system/jcr:nodeTypes) and the
version store (/jcr:system/jcr:versionStore). those 2 VISP are added to the
SISM during initialization of a workspace. i.e. they are 'mounted' to all
workspaces. we assume, that VISP cannot be added dynamically, neither during
runtime nor by configuration.
The states from the VISP are readonly. by the exception for node references.
remember that the referrers are stored in a NodeReferences
state,
having the ID of the target state.
NodeReferences
support multiple referrers with
the same PropertyId. So the number of references can be tracked (an example
of multi-workspace-refferres is a version referenced by the jcr:baseVersion
of several (corresponding) nodes in multiple workspaces).
Constructor Summary | |
SharedItemStateManager(PersistenceManager persistMgr,
NodeId rootNodeId,
NodeTypeRegistry ntReg,
boolean usesReferences)
Creates a new SharedItemStateManager instance. |
Method Summary | |
void |
addVirtualItemStateProvider(VirtualItemStateProvider prov)
Adds a new virtual item state provider. NOTE: This method is not synchronized, because it is called right after creation only by the same thread and therefore concurrency issues do not occur. |
org.apache.jackrabbit.core.state.SharedItemStateManager.Update |
beginUpdate(ChangeLog local,
EventStateCollectionFactory factory,
VirtualItemStateProvider virtualProvider)
Begin update operation. |
protected void |
checkReferentialIntegrity(ChangeLog changes)
Verifies that no referenceable nodes are deleted if they are still being referenced targets of modified node references exist |
void |
dispose()
Disposes this SharedItemStateManager and frees resources. |
void |
dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes. |
ItemState |
getItemState(ItemId id)
Return an item state, given its item id. |
NodeReferences |
getNodeReferences(NodeReferencesId id)
Return a node references object, given its target id |
boolean |
hasItemState(ItemId id)
Return a flag indicating whether an item state for a given item id exists. |
boolean |
hasNodeReferences(NodeReferencesId id)
Return a flag indicating whether a node references object for a given target id exists. |
void |
stateCreated(ItemState created)
Called when an ItemState has successfully
been created (i.e. its underlying persistent state was created). |
void |
stateDestroyed(ItemState destroyed)
Called when an ItemState has successfully been
removed (i.e. its underlying persistent state has been destroyed). |
void |
stateDiscarded(ItemState discarded)
Called when an ItemState has been discarded (i.e. it has
been rendered 'invalid'). |
void |
stateModified(ItemState modified)
Called when an ItemState has successfully
been modified (i.e. its underlying persistent state has changed). |
void |
update(ChangeLog local,
EventStateCollectionFactory factory)
Store modifications registered in a ChangeLog . |
protected void |
updateReferences(ChangeLog changes,
VirtualItemStateProvider virtualProvider)
Updates the target node references collections based on the modifications in the change log (i.e. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SharedItemStateManager(PersistenceManager persistMgr, NodeId rootNodeId, NodeTypeRegistry ntReg, boolean usesReferences) throws ItemStateException
SharedItemStateManager
instance.
persistMgr
- rootNodeId
- ntReg
- Method Detail |
public ItemState getItemState(ItemId id) throws NoSuchItemStateException, ItemStateException
getItemState
in interface ItemStateManager
id
- item id
NoSuchItemStateException
- if the item does not exist
ItemStateException
- if an error occurspublic boolean hasItemState(ItemId id)
hasItemState
in interface ItemStateManager
id
- item id
true
if an item state exists,
otherwise false
public NodeReferences getNodeReferences(NodeReferencesId id) throws NoSuchItemStateException, ItemStateException
getNodeReferences
in interface ItemStateManager
id
- target id
ItemStateException
- if an error occurs
NoSuchItemStateException
- if the item does not existpublic boolean hasNodeReferences(NodeReferencesId id)
hasNodeReferences
in interface ItemStateManager
id
- target id
true
if a node reference object exists for the given
id, otherwise false
.public void stateCreated(ItemState created)
ItemState
has successfully
been created (i.e. its underlying persistent state was created).
stateCreated
in interface ItemStateListener
created
- the ItemState
that has been 'created'public void stateModified(ItemState modified)
ItemState
has successfully
been modified (i.e. its underlying persistent state has changed).
stateModified
in interface ItemStateListener
modified
- the ItemState
that has been 'modified'public void stateDestroyed(ItemState destroyed)
ItemState
has successfully been
removed (i.e. its underlying persistent state has been destroyed).
stateDestroyed
in interface ItemStateListener
destroyed
- the ItemState
that has been 'destroyed'public void stateDiscarded(ItemState discarded)
ItemState
has been discarded (i.e. it has
been rendered 'invalid').
stateDiscarded
in interface ItemStateListener
discarded
- the ItemState
that has been discardedItemState.discard()
public void dump(PrintStream ps)
dump
in interface Dumpable
ps
- stream to dump state topublic void dispose()
SharedItemStateManager
and frees resources.
public void addVirtualItemStateProvider(VirtualItemStateProvider prov)
prov
- public org.apache.jackrabbit.core.state.SharedItemStateManager.Update beginUpdate(ChangeLog local, EventStateCollectionFactory factory, VirtualItemStateProvider virtualProvider) throws ReferentialIntegrityException, StaleItemStateException, ItemStateException
ReferentialIntegrityException
StaleItemStateException
ItemStateException
public void update(ChangeLog local, EventStateCollectionFactory factory) throws ReferentialIntegrityException, StaleItemStateException, ItemStateException
ChangeLog
. The items
contained in the ChangeLog are not states returned by this
item state manager but rather must be reconnected to items provided
by this state manager.
After successfully storing the states the observation manager is informed
about the changes, if an observation manager is passed to this method.
NOTE: This method is not synchronized, because all methods it invokes
on instance members (such as PersistenceManager.store(org.apache.jackrabbit.core.state.ChangeLog)
are
considered to be thread-safe. Should this ever change, the
synchronization status has to be re-examined.
local
- change log containing local itemsfactory
- event state collection factory
ReferentialIntegrityException
- if a new or modified REFERENCE
property refers to a non-existent
target or if a removed node is still
being referenced
StaleItemStateException
- if at least one of the affected item
states has become stale
ItemStateException
- if another error occursprotected void updateReferences(ChangeLog changes, VirtualItemStateProvider virtualProvider) throws ItemStateException
REFERENCE
properties).
Important node: For consistency reasons this method must only be
called once per change log and the change log should not be modified
anymore afterwards.
changes
- change logvirtualProvider
- virtual provider that may already contain a
node references object
ItemStateException
- if an error occursprotected void checkReferentialIntegrity(ChangeLog changes) throws ReferentialIntegrityException, ItemStateException
changes
- change log
ReferentialIntegrityException
- if a new or modified REFERENCE
property refers to a non-existent
target or if a removed node is still
being referenced
ItemStateException
- if another error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |