org.dspace.browse
Class BrowseConsumer

java.lang.Object
  extended by org.dspace.browse.BrowseConsumer
All Implemented Interfaces:
Consumer

public class BrowseConsumer
extends Object
implements Consumer

Class for updating browse system from content events. Prototype: only Item events recognized. XXX FIXME NOTE: The Browse Consumer is INCOMPLETE because the deletion of an Item CANNOT be implemented as an event consumer: When an Item is deleted, the browse tables must be updated immediately, within the same transaction, to maintain referential consistency. It cannot be handled in an Event consumer since by definition that runs after the transaction is committed. Perhaps this can be addressed if the Browse system is replaced. To handle create/modify events: accumulate Sets of Items to be added and updated out of the event stream. Process them in endEvents() filter out update requests for Items that were just created. Recommended filter: Item+Create|Modify|Modify_Metadata:Collection+Add|Remove

Version:
$Revision: 3736 $

Constructor Summary
BrowseConsumer()
           
 
Method Summary
 void consume(Context ctx, Event event)
          Consume an event; events may get filtered at the dispatcher level, hiding it from the consumer.
 void end(Context ctx)
          Signal that there are no more events queued in this event stream and event processing for the preceding consume calls should be finished up.
 void finish(Context ctx)
          Finish - free any allocated resources.
 void initialize()
          Initialize - allocate any resources required to operate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrowseConsumer

public BrowseConsumer()
Method Detail

initialize

public void initialize()
                throws Exception
Description copied from interface: Consumer
Initialize - allocate any resources required to operate. This may include initializing any pooled JMS resources. Called ONCE when created by the dispatcher pool. This should be used to set up expensive resources that will remain for the lifetime of the consumer.

Specified by:
initialize in interface Consumer
Throws:
Exception

consume

public void consume(Context ctx,
                    Event event)
             throws Exception
Description copied from interface: Consumer
Consume an event; events may get filtered at the dispatcher level, hiding it from the consumer. This behavior is based on the dispatcher/consumer configuration. Should include logic to initialize any resources required for a batch of events.

Specified by:
consume in interface Consumer
Parameters:
ctx - the execution context object
event - the content event
Throws:
Exception

end

public void end(Context ctx)
         throws Exception
Description copied from interface: Consumer
Signal that there are no more events queued in this event stream and event processing for the preceding consume calls should be finished up.

Specified by:
end in interface Consumer
Throws:
Exception

finish

public void finish(Context ctx)
Description copied from interface: Consumer
Finish - free any allocated resources. Called when consumer (via it's parent dispatcher) is going to be destroyed by the dispatcher pool.

Specified by:
finish in interface Consumer


Copyright © 2010 DuraSpace. All Rights Reserved.