org.apache.jackrabbit.core.observation
Class EventStateCollection

java.lang.Object
  extended by org.apache.jackrabbit.core.observation.EventStateCollection

public final class EventStateCollection
extends Object

The EventStateCollection class implements how EventState objects are created based on the ItemStates passed to the createEventStates(org.apache.jackrabbit.core.NodeId, org.apache.jackrabbit.core.state.ChangeLog, org.apache.jackrabbit.core.state.ItemStateManager) method.

The basic sequence of method calls is:


Constructor Summary
EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher dispatcher, SessionImpl session, Path pathPrefix)
          Creates a new empty EventStateCollection.
 
Method Summary
 void addAll(Collection c)
          Adds all event states in the given collection to this collection
 void createEventStates(NodeId rootNodeId, ChangeLog changes, ItemStateManager stateMgr)
          Creates EventState instances from ItemState changes.
 void dispatch()
          Dispatches the events to the EventListeners.
 List getEvents()
          Return the list of events.
 Path getPathPrefix()
          Returns the path prefix for this event state collection or null if no path prefix was set in the constructor of this collection.
 void prepare()
          Prepares already added events for dispatching.
 void prepareDeleted(ChangeLog changes)
          Prepares deleted items from changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventStateCollection

public EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher dispatcher,
                            SessionImpl session,
                            Path pathPrefix)
Creates a new empty EventStateCollection.

Because the item state manager in createEventStates(org.apache.jackrabbit.core.NodeId, org.apache.jackrabbit.core.state.ChangeLog, org.apache.jackrabbit.core.state.ItemStateManager) may represent only a subset of the over all item state hierarchy, this constructor also takes a path prefix argument. If non null all events created by this collection are prefixed with this path.

Parameters:
dispatcher - event dispatcher
session - the session that created these events.
pathPrefix - the path to prefix the event paths or null if no prefix should be used.
Method Detail

createEventStates

public void createEventStates(NodeId rootNodeId,
                              ChangeLog changes,
                              ItemStateManager stateMgr)
                       throws ItemStateException
Creates EventState instances from ItemState changes.

Parameters:
rootNodeId - the id of the root node.
changes - the changes on ItemStates.
stateMgr - an ItemStateManager to provide ItemState of items that are not contained in the changes collection.
Throws:
ItemStateException - if an error occurs while creating events states for the item state changes.

addAll

public void addAll(Collection c)
Adds all event states in the given collection to this collection

Parameters:
c -

prepare

public void prepare()
Prepares already added events for dispatching.


prepareDeleted

public void prepareDeleted(ChangeLog changes)
Prepares deleted items from changes.

Parameters:
changes - the changes to prepare.

dispatch

public void dispatch()
Dispatches the events to the EventListeners.


getPathPrefix

public Path getPathPrefix()
Returns the path prefix for this event state collection or null if no path prefix was set in the constructor of this collection. See also EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher, org.apache.jackrabbit.core.SessionImpl, org.apache.jackrabbit.spi.Path).

Returns:
the path prefix for this event state collection.

getEvents

public List getEvents()
Return the list of events.

Returns:
list of events


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