Package org.apache.jackrabbit.core
Class ItemManager
- java.lang.Object
-
- org.apache.jackrabbit.core.ItemManager
-
- All Implemented Interfaces:
ItemStateListener
public class ItemManager extends Object implements ItemStateListener
There's oneItemManagerinstance perSessioninstance. It is the factory forNodeandPropertyinstances.The
ItemManager's responsibilities are:- providing access to
Iteminstances byItemIdwhereasNodeandItemare only providing relative access. - returning the instance of an existing
NodeorProperty, given its absolute path. - creating the per-session instance of a
NodeorPropertythat doesn't exist yet and needs to be created first. - guaranteeing that there aren't multiple instances representing the same
NodeorPropertyassociated with the sameSessioninstance. - maintaining a cache of the item instances it created.
- respecting access rights of associated
Sessionin all methods.
If the parent
Sessionis anXASession, there is oneItemManagerinstance per started global transaction.
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionImplsessionprotected SessionContextsessionContextComponent context of the associated session.
-
Constructor Summary
Constructors Modifier Constructor Description protectedItemManager(SessionContext sessionContext)Creates a new per-session instanceItemManagerinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ItemImplgetItem(ItemId id)ItemImplgetItem(Path path)Deprecated.As of JSR 283, aPathdoesn't anymore uniquely identify anItem, thereforegetNode(Path)andgetProperty(Path)should be used instead.NodeImplgetNode(NodeId id, NodeId parentId)Returns a node with a given id and parent id.NodeImplgetNode(Path path)PropertyImplgetProperty(Path path)voiditemDestroyed(ItemId id, ItemData data)booleanitemExists(ItemId id)Checks if the item with the given id exists.booleanitemExists(Path path)Deprecated.As of JSR 283, aPathdoesn't anymore uniquely identify anItem, thereforenodeExists(Path)andpropertyExists(Path)should be used instead.voiditemInvalidated(ItemId id, ItemData data)booleannodeExists(Path path)Checks whether a node exists at the specified path.booleanpropertyExists(Path path)Checks whether a property exists at the specified path.voidstateCreated(ItemState created)Called when anItemStatehas successfully been created (i.e.voidstateDestroyed(ItemState destroyed)Called when anItemStatehas successfully been removed (i.e.voidstateDiscarded(ItemState discarded)Called when anItemStatehas been discarded (i.e.voidstateModified(ItemState modified)Called when anItemStatehas successfully been modified (i.e.StringtoString()
-
-
-
Field Detail
-
sessionContext
protected final SessionContext sessionContext
Component context of the associated session.
-
session
protected final SessionImpl session
-
-
Constructor Detail
-
ItemManager
protected ItemManager(SessionContext sessionContext)
Creates a new per-session instanceItemManagerinstance.- Parameters:
sessionContext- component context of the associated session
-
-
Method Detail
-
itemExists
@Deprecated public boolean itemExists(Path path)
Deprecated.As of JSR 283, aPathdoesn't anymore uniquely identify anItem, thereforenodeExists(Path)andpropertyExists(Path)should be used instead.Checks whether an item exists at the specified path.- Parameters:
path- path to the item to be checked- Returns:
- true if the specified item exists
-
nodeExists
public boolean nodeExists(Path path)
Checks whether a node exists at the specified path.- Parameters:
path- path to the node to be checked- Returns:
- true if a node exists at the specified path
-
propertyExists
public boolean propertyExists(Path path)
Checks whether a property exists at the specified path.- Parameters:
path- path to the property to be checked- Returns:
- true if a property exists at the specified path
-
itemExists
public boolean itemExists(ItemId id)
Checks if the item with the given id exists.- Parameters:
id- id of the item to be checked- Returns:
- true if the specified item exists
-
getItem
@Deprecated public ItemImpl getItem(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
Deprecated.As of JSR 283, aPathdoesn't anymore uniquely identify anItem, thereforegetNode(Path)andgetProperty(Path)should be used instead.Returns the node at the specified absolute path in the workspace. If no such node exists, then it returns the property at the specified path. If no such property exists aPathNotFoundExceptionis thrown.- Parameters:
path-- Returns:
- Throws:
PathNotFoundExceptionAccessDeniedExceptionRepositoryException
-
getNode
public NodeImpl getNode(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
- Parameters:
path-- Returns:
- Throws:
PathNotFoundExceptionAccessDeniedExceptionRepositoryException
-
getProperty
public PropertyImpl getProperty(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
- Parameters:
path-- Returns:
- Throws:
PathNotFoundExceptionAccessDeniedExceptionRepositoryException
-
getItem
public ItemImpl getItem(ItemId id) throws ItemNotFoundException, AccessDeniedException, RepositoryException
- Parameters:
id-- Returns:
- Throws:
RepositoryExceptionItemNotFoundExceptionAccessDeniedException
-
getNode
public NodeImpl getNode(NodeId id, NodeId parentId) throws ItemNotFoundException, AccessDeniedException, RepositoryException
Returns a node with a given id and parent id. If the indicated node is shareable, there might be multiple nodes associated with the same id, but there'is only one node with the given parent id.- Parameters:
id- node idparentId- parent node id- Returns:
- node
- Throws:
RepositoryException- if an error occursItemNotFoundExceptionAccessDeniedException
-
stateCreated
public void stateCreated(ItemState created)
Called when anItemStatehas successfully been created (i.e. its underlying persistent state was created).- Specified by:
stateCreatedin interfaceItemStateListener- Parameters:
created- theItemStatethat has been 'created'
-
stateModified
public void stateModified(ItemState modified)
Called when anItemStatehas successfully been modified (i.e. its underlying persistent state has changed).- Specified by:
stateModifiedin interfaceItemStateListener- Parameters:
modified- theItemStatethat has been 'modified'
-
stateDestroyed
public void stateDestroyed(ItemState destroyed)
Called when anItemStatehas successfully been removed (i.e. its underlying persistent state has been destroyed).- Specified by:
stateDestroyedin interfaceItemStateListener- Parameters:
destroyed- theItemStatethat has been 'destroyed'
-
stateDiscarded
public void stateDiscarded(ItemState discarded)
Called when anItemStatehas been discarded (i.e. it has been rendered 'invalid').- Specified by:
stateDiscardedin interfaceItemStateListener- Parameters:
discarded- theItemStatethat has been discarded- See Also:
ItemState.discard()
-
-