public abstract class AbstractVISProvider extends Object implements VirtualItemStateProvider, ItemStateListener
| Modifier and Type | Field and Description |
|---|---|
protected NodeTypeRegistry |
ntReg
the node type registry
|
protected NodeId |
rootNodeId
the root node id
|
| Constructor and Description |
|---|
AbstractVISProvider(NodeTypeRegistry ntReg,
NodeId rootNodeId)
Creates an abstract virtual item state provider
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ItemStateListener listener)
Add an
ItemStateListener |
protected NodeState |
cache(NodeState state)
adds the node state to the cache
|
VirtualNodeState |
createNodeState(VirtualNodeState parent,
Name name,
NodeId id,
Name nodeTypeName)
Creates a new virtual node state
|
VirtualPropertyState |
createPropertyState(VirtualNodeState parent,
Name name,
int type,
boolean multiValued)
Creats a new virtual property state
|
protected abstract VirtualNodeState |
createRootNodeState()
Creates the root node state.
|
protected void |
discardAll()
Discards all virtual item states and prepares for the root state
to be recreated when next accessed.
|
protected void |
evict(NodeId id)
removes the node state from the cache
|
protected QNodeDefinition |
getApplicableChildNodeDef(NodeState parent,
Name nodeName,
Name nodeTypeName)
Retrieves the node definition for the given constraints.
|
protected QPropertyDefinition |
getApplicablePropertyDef(NodeState parent,
Name propertyName,
int type,
boolean multiValued)
retrieves the property definition for the given constraints
|
protected EffectiveNodeType |
getEffectiveNodeType(NodeState parent)
Returns the effective (i.e.
|
ItemState |
getItemState(ItemId id)
Return an item state, given its item id.
|
NodeReferences |
getNodeReferences(NodeId id)
Return a node references object, given its target id
|
protected NodeTypeRegistry |
getNodeTypeRegistry()
returns the node type manager
|
NodeState |
getRootState()
Returns the root state
|
NodeId |
getVirtualRootId()
Returns the id of the root node of the virtual tree.
|
NodeId[] |
getVirtualRootIds()
Returns the ids of the root nodes of the virtual tree.
|
boolean |
hasItemState(ItemId id)
Return a flag indicating whether an item state for a given
item id exists.
|
boolean |
hasNodeReferences(NodeId id)
Return a flag indicating whether a node references object
for a given target id exists.
|
protected abstract VirtualNodeState |
internalGetNodeState(NodeId id)
Retrieves the node state with the given node id
|
protected VirtualPropertyState |
internalGetPropertyState(PropertyId id)
Retrieves the property state for the given id
|
protected abstract boolean |
internalHasNodeState(NodeId id)
Checks if this provide has the node state of the given node id
|
protected boolean |
internalHasPropertyState(PropertyId id)
Checks if this provider has the property state of the given id.
|
void |
invalidateItem(ItemId id,
boolean recursive)
invalidates the item
|
boolean |
isVirtualRoot(ItemId id)
Checks if the id refers to the root of a virtual tree.
|
void |
removeListener(ItemStateListener listener)
Remove an
ItemStateListener |
void |
stateCreated(ItemState created)
Called when an
ItemState has successfully
been created (i.e. |
void |
stateDestroyed(ItemState destroyed)
Called when an
ItemState has successfully been
removed (i.e. |
void |
stateDiscarded(ItemState discarded)
Called when an
ItemState has been discarded (i.e. |
void |
stateModified(ItemState modified)
Called when an
ItemState has successfully
been modified (i.e. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetNodeReferencesprotected final NodeId rootNodeId
protected final NodeTypeRegistry ntReg
public AbstractVISProvider(NodeTypeRegistry ntReg, NodeId rootNodeId)
ntReg - rootNodeId - protected abstract VirtualNodeState createRootNodeState() throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic boolean hasItemState(ItemId id)
hasItemState in interface ItemStateManagerid - item idtrue if an item state exists,
otherwise falsepublic ItemState getItemState(ItemId id) throws NoSuchItemStateException, ItemStateException
getItemState in interface ItemStateManagerid - item idNoSuchItemStateException - if the item does not existItemStateException - if an error occurspublic NodeReferences getNodeReferences(NodeId id) throws NoSuchItemStateException, ItemStateException
getNodeReferences in interface ItemStateManagerid - target idNoSuchItemStateException - if the item does not existItemStateException - if an error occurspublic boolean hasNodeReferences(NodeId id)
hasNodeReferences in interface ItemStateManagerid - target idtrue if a node reference object exists for the given
id, otherwise false.public boolean isVirtualRoot(ItemId id)
isVirtualRoot in interface VirtualItemStateProvidertrue if it is the rootpublic NodeId getVirtualRootId()
getVirtualRootId in interface VirtualItemStateProviderpublic NodeId[] getVirtualRootIds()
getVirtualRootIds in interface VirtualItemStateProviderpublic NodeState getRootState() throws ItemStateException
ItemStateException - If the root node state does not exist and its
creation fails.protected void discardAll()
protected abstract boolean internalHasNodeState(NodeId id)
id - true if it has the node stateprotected abstract VirtualNodeState internalGetNodeState(NodeId id) throws NoSuchItemStateException, ItemStateException
id - NoSuchItemStateExceptionItemStateExceptionprotected boolean internalHasPropertyState(PropertyId id)
id - true if it has the property stateprotected VirtualPropertyState internalGetPropertyState(PropertyId id) throws NoSuchItemStateException, ItemStateException
id - NoSuchItemStateExceptionItemStateExceptionpublic VirtualPropertyState createPropertyState(VirtualNodeState parent, Name name, int type, boolean multiValued) throws javax.jcr.RepositoryException
createPropertyState in interface VirtualItemStateProviderjavax.jcr.RepositoryExceptionpublic VirtualNodeState createNodeState(VirtualNodeState parent, Name name, NodeId id, Name nodeTypeName) throws javax.jcr.RepositoryException
createNodeState in interface VirtualItemStateProviderid - (must not be null)javax.jcr.RepositoryExceptionpublic void addListener(ItemStateListener listener)
ItemStateListeneraddListener in interface VirtualItemStateProviderlistener - the new listener to be informed on modificationspublic void removeListener(ItemStateListener listener)
ItemStateListenerremoveListener in interface VirtualItemStateProviderlistener - an existing listenerprotected NodeTypeRegistry getNodeTypeRegistry()
protected NodeState cache(NodeState state)
state - protected void evict(NodeId id)
id - public void invalidateItem(ItemId id, boolean recursive)
id - recursive - protected QPropertyDefinition getApplicablePropertyDef(NodeState parent, Name propertyName, int type, boolean multiValued) throws javax.jcr.RepositoryException
parent - The parent node state.propertyName - The name of the property.type - multiValued - javax.jcr.RepositoryExceptionprotected QNodeDefinition getApplicableChildNodeDef(NodeState parent, Name nodeName, Name nodeTypeName) throws javax.jcr.RepositoryException
parent - The parent state.nodeName - nodeTypeName - javax.jcr.RepositoryExceptionprotected EffectiveNodeType getEffectiveNodeType(NodeState parent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void stateCreated(ItemState created)
ItemState has successfully
been created (i.e. its underlying persistent state was created).stateCreated in interface ItemStateListenercreated - 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 ItemStateListenermodified - 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 ItemStateListenerdestroyed - 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 ItemStateListenerdiscarded - the ItemState that has been discardedItemState.discard()Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.