org.apache.jackrabbit.core
Class ItemManager

java.lang.Object
  extended byorg.apache.jackrabbit.core.ItemManager
All Implemented Interfaces:
Dumpable, ItemLifeCycleListener
Direct Known Subclasses:
XAItemManager

public class ItemManager
extends Object
implements ItemLifeCycleListener, Dumpable

There's one ItemManager instance per Session instance. It is the factory for Node and Property instances.

The ItemManager's responsabilities are:

If the parent Session is an XASession, there is one ItemManager instance per started global transaction.


Field Summary
protected  SessionImpl session
           
 
Constructor Summary
protected ItemManager(ItemStateManager itemStateProvider, HierarchyManager hierMgr, SessionImpl session, NodeDefinition rootNodeDef, NodeId rootNodeId)
          Creates a new per-session instance ItemManager instance.
 
Method Summary
protected  AbstractVersionHistory createVersionHistoryInstance(NodeId id, NodeState state, NodeDefinition def, ItemLifeCycleListener[] listeners)
          Create a version history instance.
protected  AbstractVersion createVersionInstance(NodeId id, NodeState state, NodeDefinition def, ItemLifeCycleListener[] listeners)
          Create a version instance.
 void dump(PrintStream ps)
          Dumps the state of this instance in a human readable format for diagnostic purposes.
 ItemImpl getItem(ItemId id)
           
 ItemImpl getItem(Path path)
           
 void itemCreated(ItemImpl item)
          Called when an ItemImpl instance has been created.
 void itemDestroyed(ItemId id, ItemImpl item)
          Called when an ItemImpl instance has been destroyed (i.e. it has been permanently rendered 'invalid').

Note that most Item, Node and Property methods will throw an InvalidItemStateException when called on a 'destroyed' item.

 boolean itemExists(ItemId id)
          Checks if the item with the given id exists.
 boolean itemExists(Path path)
          Checks if the item with the given path exists.
 void itemInvalidated(ItemId id, ItemImpl item)
          Called when an ItemImpl instance has been invalidated (i.e. it has been temporarily rendered 'invalid').

Note that most Item, Node and Property methods will throw an InvalidItemStateException when called on an 'invalidated' item.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected final SessionImpl session
Constructor Detail

ItemManager

protected ItemManager(ItemStateManager itemStateProvider,
                      HierarchyManager hierMgr,
                      SessionImpl session,
                      NodeDefinition rootNodeDef,
                      NodeId rootNodeId)
Creates a new per-session instance ItemManager instance.

Parameters:
itemStateProvider - the item state provider associated with the new instance
session - the session associated with the new instance
rootNodeDef - the definition of the root node
rootNodeId - the id of the root node
Method Detail

itemExists

public boolean itemExists(Path path)
Checks if the item with the given path exists.

Parameters:
path - path to the item to be checked
Returns:
true if the specified item exists

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

public ItemImpl getItem(Path path)
                 throws PathNotFoundException,
                        AccessDeniedException,
                        RepositoryException
Parameters:
path -
Returns:
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException

getItem

public ItemImpl getItem(ItemId id)
                 throws ItemNotFoundException,
                        AccessDeniedException,
                        RepositoryException
Parameters:
id -
Returns:
Throws:
RepositoryException
ItemNotFoundException
AccessDeniedException

createVersionInstance

protected AbstractVersion createVersionInstance(NodeId id,
                                                NodeState state,
                                                NodeDefinition def,
                                                ItemLifeCycleListener[] listeners)
                                         throws RepositoryException
Create a version instance.

Parameters:
id - node id
state - node state
def - node definition
listeners - listeners
Returns:
version instance
Throws:
RepositoryException - if an error occurs

createVersionHistoryInstance

protected AbstractVersionHistory createVersionHistoryInstance(NodeId id,
                                                              NodeState state,
                                                              NodeDefinition def,
                                                              ItemLifeCycleListener[] listeners)
                                                       throws RepositoryException
Create a version history instance.

Parameters:
id - node id
state - node state
def - node definition
listeners - listeners
Returns:
version instance
Throws:
RepositoryException - if an error occurs

itemCreated

public void itemCreated(ItemImpl item)
Called when an ItemImpl instance has been created.

Specified by:
itemCreated in interface ItemLifeCycleListener
Parameters:
item - the instance which has been created

itemInvalidated

public void itemInvalidated(ItemId id,
                            ItemImpl item)
Called when an ItemImpl instance has been invalidated (i.e. it has been temporarily rendered 'invalid').

Note that most Item, Node and Property methods will throw an InvalidItemStateException when called on an 'invalidated' item.

Specified by:
itemInvalidated in interface ItemLifeCycleListener
Parameters:
id - the id of the instance that has been discarded
item - the instance which has been discarded

itemDestroyed

public void itemDestroyed(ItemId id,
                          ItemImpl item)
Called when an ItemImpl instance has been destroyed (i.e. it has been permanently rendered 'invalid').

Note that most Item, Node and Property methods will throw an InvalidItemStateException when called on a 'destroyed' item.

Specified by:
itemDestroyed in interface ItemLifeCycleListener
Parameters:
id - the id of the instance that has been destroyed
item - the instance which has been destroyed

dump

public void dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes.

Specified by:
dump in interface Dumpable
Parameters:
ps - stream to dump state to


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.