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, wait
setNodeReferences
protected 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.RepositoryException
public boolean hasItemState(ItemId id)
hasItemState
in interface ItemStateManager
id
- item idtrue
if an item state exists,
otherwise false
public ItemState getItemState(ItemId id) throws NoSuchItemStateException, ItemStateException
getItemState
in interface ItemStateManager
id
- item idNoSuchItemStateException
- if the item does not existItemStateException
- if an error occurspublic NodeReferences getNodeReferences(NodeId id) throws NoSuchItemStateException, ItemStateException
getNodeReferences
in interface ItemStateManager
id
- target idNoSuchItemStateException
- if the item does not existItemStateException
- if an error occurspublic boolean hasNodeReferences(NodeId id)
hasNodeReferences
in interface ItemStateManager
id
- target idtrue
if a node reference object exists for the given
id, otherwise false
.public boolean isVirtualRoot(ItemId id)
isVirtualRoot
in interface VirtualItemStateProvider
true
if it is the rootpublic NodeId getVirtualRootId()
getVirtualRootId
in interface VirtualItemStateProvider
public NodeId[] getVirtualRootIds()
getVirtualRootIds
in interface VirtualItemStateProvider
public 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
- NoSuchItemStateException
ItemStateException
protected boolean internalHasPropertyState(PropertyId id)
id
- true
if it has the property stateprotected VirtualPropertyState internalGetPropertyState(PropertyId id) throws NoSuchItemStateException, ItemStateException
id
- NoSuchItemStateException
ItemStateException
public VirtualPropertyState createPropertyState(VirtualNodeState parent, Name name, int type, boolean multiValued) throws javax.jcr.RepositoryException
createPropertyState
in interface VirtualItemStateProvider
javax.jcr.RepositoryException
public VirtualNodeState createNodeState(VirtualNodeState parent, Name name, NodeId id, Name nodeTypeName) throws javax.jcr.RepositoryException
createNodeState
in interface VirtualItemStateProvider
id
- (must not be null)javax.jcr.RepositoryException
public void addListener(ItemStateListener listener)
ItemStateListener
addListener
in interface VirtualItemStateProvider
listener
- the new listener to be informed on modificationspublic void removeListener(ItemStateListener listener)
ItemStateListener
removeListener
in interface VirtualItemStateProvider
listener
- 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.RepositoryException
protected QNodeDefinition getApplicableChildNodeDef(NodeState parent, Name nodeName, Name nodeTypeName) throws javax.jcr.RepositoryException
parent
- The parent state.nodeName
- nodeTypeName
- javax.jcr.RepositoryException
protected EffectiveNodeType getEffectiveNodeType(NodeState parent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
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()
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.