public class ItemManager extends Object implements ItemStateListener
ItemManager
instance per Session
instance. It is the factory for Node
and Property
instances.
The ItemManager
's responsibilities are:
Item
instances by ItemId
whereas Node
and Item
are only providing relative access.
Node
or Property
,
given its absolute path.
Node
or Property
that doesn't exist yet and needs to be created first.
Node
or Property
associated with the same
Session
instance.
Session
in all methods.
If the parent Session
is an XASession
, there is
one ItemManager
instance per started global transaction.
Modifier and Type | Field and Description |
---|---|
protected SessionImpl |
session |
protected SessionContext |
sessionContext
Component context of the associated session.
|
Modifier | Constructor and Description |
---|---|
protected |
ItemManager(SessionContext sessionContext)
Creates a new per-session instance
ItemManager instance. |
Modifier and Type | Method and Description |
---|---|
ItemImpl |
getItem(ItemId id) |
ItemImpl |
getItem(Path path)
Deprecated.
As of JSR 283, a
Path doesn't anymore uniquely
identify an Item , therefore getNode(Path) and
getProperty(Path) should be used instead. |
NodeImpl |
getNode(NodeId id,
NodeId parentId)
Returns a node with a given id and parent id.
|
NodeImpl |
getNode(Path path) |
PropertyImpl |
getProperty(Path path) |
void |
itemDestroyed(ItemId id,
ItemData data) |
boolean |
itemExists(ItemId id)
Checks if the item with the given id exists.
|
boolean |
itemExists(Path path)
Deprecated.
As of JSR 283, a
Path doesn't anymore uniquely
identify an Item , therefore nodeExists(Path) and
propertyExists(Path) should be used instead. |
void |
itemInvalidated(ItemId id,
ItemData data) |
boolean |
nodeExists(Path path)
Checks whether a node exists at the specified path.
|
boolean |
propertyExists(Path path)
Checks whether a property exists at the specified path.
|
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. |
String |
toString() |
protected final SessionContext sessionContext
protected final SessionImpl session
protected ItemManager(SessionContext sessionContext)
ItemManager
instance.sessionContext
- component context of the associated sessionpublic boolean itemExists(Path path)
Path
doesn't anymore uniquely
identify an Item
, therefore nodeExists(Path)
and
propertyExists(Path)
should be used instead.path
- path to the item to be checkedpublic boolean nodeExists(Path path)
path
- path to the node to be checkedpublic boolean propertyExists(Path path)
path
- path to the property to be checkedpublic boolean itemExists(ItemId id)
id
- id of the item to be checkedpublic ItemImpl getItem(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
Path
doesn't anymore uniquely
identify an Item
, therefore getNode(Path)
and
getProperty(Path)
should be used instead.PathNotFoundException
is thrown.path
- PathNotFoundException
AccessDeniedException
RepositoryException
public NodeImpl getNode(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
path
- PathNotFoundException
AccessDeniedException
RepositoryException
public PropertyImpl getProperty(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException
path
- PathNotFoundException
AccessDeniedException
RepositoryException
public ItemImpl getItem(ItemId id) throws ItemNotFoundException, AccessDeniedException, RepositoryException
id
- RepositoryException
ItemNotFoundException
AccessDeniedException
public NodeImpl getNode(NodeId id, NodeId parentId) throws ItemNotFoundException, AccessDeniedException, RepositoryException
id
- node idparentId
- parent node idRepositoryException
- if an error occursItemNotFoundException
AccessDeniedException
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–2021 The Apache Software Foundation. All rights reserved.