org.alfresco.bm.event
Interface EventService


public interface EventService

Interface for classes that handle persistence and retrieval of events.

Note that the next event is the event that should be processed next and not necessarily the event at the head of the queue.

Since:
1.0
Author:
Derek Hulley

Method Summary
 long count()
           
 boolean deleteEvent(Event event)
          Delete an event from the provider.
 List<Event> findEvents(String name, int skip, int limit)
          Find any event matching the given name, using the paging criteria
 Event lockEvent(String ownerId, Event event)
          Lock an event for processing by the given owner
 Event nextEvent(long latestScheduledTime, long latestStartTime)
          Retrieve the next event in the queue.
 Event putEvent(Event event)
          Adds an event to the provider.
 Event updateEvent(Event event)
          Update an event in the queue
 

Method Detail

count

long count()
Returns:
Returns the number of events in the queue

findEvents

List<Event> findEvents(String name,
                       int skip,
                       int limit)
Find any event matching the given name, using the paging criteria

Parameters:
name - find events with the given name
skip - the number of results to skip
limit - the maximum number of results to retrieve
Returns:
an event or null if not found

nextEvent

Event nextEvent(long latestScheduledTime,
                long latestStartTime)
Retrieve the next event in the queue.

This method must set the event owner ID and start time atomically.

Parameters:
latestScheduledTime - the event scheduled time must not be greater than this
Returns:
Returns the next event in the queue or null

lockEvent

Event lockEvent(String ownerId,
                Event event)
Lock an event for processing by the given owner

Parameters:
ownerId - the lock owner
Returns:
Returns the locked event or null if it could not be locked.

deleteEvent

boolean deleteEvent(Event event)
Delete an event from the provider. This can be done after the event has been fully processed and there is no further requirement for it.

NOTE: The data cannot be accessed after this event.

Parameters:
event - the event to delete
Returns:
true if the event was deleted otherwise false

putEvent

Event putEvent(Event event)
Adds an event to the provider. This is done to populate the queue with a new event to be processed.

Parameters:
event - the event to add (the event ID must be null

updateEvent

Event updateEvent(Event event)
Update an event in the queue

Parameters:
event - the event to update (the event ID must not be null


Copyright © 2012. All Rights Reserved.