org.sakaiproject.component.legacy.event
Class BaseEventTrackingService

java.lang.Object
  extended byorg.sakaiproject.component.legacy.event.BaseEventTrackingService
All Implemented Interfaces:
EventTrackingService
Direct Known Subclasses:
BasicEventTracking, ClusterEventTracking, JGroupsClusterEventTracking

public abstract class BaseEventTrackingService
extends Object
implements EventTrackingService

BaseEventTrackingService is the base implmentation for the EventTracking CHEF event tracking service.

The event tracking service provides activity event tracking and monitoring. Objects act as event generators, posting events to the service. Other objects act as event monitors, and are notified by the service when certain events occur. Events posted are also stored in event archives by the service.

Each event is represented by a core Event object

Version:
$Revision:
Author:
University of Michigan, CHEF Software Development Team

Nested Class Summary
protected  class BaseEventTrackingService.BaseEvent
          BaseEvent is the implementation of the core Event interface.
protected  class BaseEventTrackingService.MyObservable
          Extend Observable to "public"ize setChanges, so we can set it.
 
Field Summary
protected  BaseEventTrackingService.MyObservable m_localObservableHelper
          An observable object helper for see-only-local-events observers.
protected  Logger m_logger
          Dependency: logging service.
protected  BaseEventTrackingService.MyObservable m_observableHelper
          An observable object helper.
protected  BaseEventTrackingService.MyObservable m_priorityObservableHelper
          An observable object helper for see-it-first priority observers.
 
Fields inherited from interface org.sakaiproject.service.legacy.event.EventTrackingService
SERVICE_NAME
 
Constructor Summary
BaseEventTrackingService()
           
 
Method Summary
 void addLocalObserver(Observer observer)
          Add an observer of events.
 void addObserver(Observer observer)
          Add an observer of events.
 void addPriorityObserver(Observer observer)
          Add an observer of events.
 void deleteObserver(Observer observer)
          Delete an observer of events.
 void destroy()
          Final cleanup.
 void init()
          Final initialization, once all dependencies are set.
 Event newEvent(String event, String resource, boolean modify)
          Construct a Event object.
 Event newEvent(String event, String resource, boolean modify, int priority)
          Construct a Event object.
protected  void notifyObservers(Event event, boolean local)
          Send notification about a new event to observers.
 void post(Event event)
          Post an event
 void post(Event event, UsageSession session)
          Post an event on behalf of a user's session
 void post(Event event, User user)
          Post an event on behalf of a user.
protected abstract  void postEvent(Event event)
          Cause this new event to get to wherever it has to go for persistence, etc.
 void setLogger(Logger service)
          Dependency: logging service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_observableHelper

protected BaseEventTrackingService.MyObservable m_observableHelper
An observable object helper.


m_priorityObservableHelper

protected BaseEventTrackingService.MyObservable m_priorityObservableHelper
An observable object helper for see-it-first priority observers.


m_localObservableHelper

protected BaseEventTrackingService.MyObservable m_localObservableHelper
An observable object helper for see-only-local-events observers.


m_logger

protected Logger m_logger
Dependency: logging service.

Constructor Detail

BaseEventTrackingService

public BaseEventTrackingService()
Method Detail

postEvent

protected abstract void postEvent(Event event)
Cause this new event to get to wherever it has to go for persistence, etc.

Parameters:
event - The new event to post.

notifyObservers

protected void notifyObservers(Event event,
                               boolean local)
Send notification about a new event to observers.

Parameters:
event - The event to send notification about.
local - True if the event originated on this server, false if it came from another server.

setLogger

public void setLogger(Logger service)
Dependency: logging service


init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Final cleanup.


newEvent

public Event newEvent(String event,
                      String resource,
                      boolean modify)
Construct a Event object.

Specified by:
newEvent in interface EventTrackingService
Parameters:
event - The Event id.
resource - The resource reference.
modify - Set to true if this event caused a resource modification, false if it was just an access.
Returns:
A new Event object that can be used with this service.

newEvent

public Event newEvent(String event,
                      String resource,
                      boolean modify,
                      int priority)
Construct a Event object.

Specified by:
newEvent in interface EventTrackingService
Parameters:
event - The Event id.
resource - The resource reference.
modify - Set to true if this event caused a resource modification, false if it was just an access.
priority - The Event's notification priority.
Returns:
A new Event object that can be used with this service.

post

public void post(Event event)
Post an event

Specified by:
post in interface EventTrackingService
Parameters:
event - The event object (created with newEvent()). Note: the current session user will be used as the user responsible for the event.

post

public void post(Event event,
                 UsageSession session)
Post an event on behalf of a user's session

Specified by:
post in interface EventTrackingService
Parameters:
event - The event object (created with newEvent()).
session - The usage session object of the user session responsible for the event.

post

public void post(Event event,
                 User user)
Post an event on behalf of a user.

Parameters:
event - The event object (created with newEvent()).
user - The User object of the user responsible for the event.

addObserver

public void addObserver(Observer observer)
Add an observer of events. The observer will be notified whenever there are new events.

Specified by:
addObserver in interface EventTrackingService
Parameters:
observer - The class observing.

addPriorityObserver

public void addPriorityObserver(Observer observer)
Add an observer of events. The observer will be notified whenever there are new events. Priority observers get notified first, before normal observers.

Specified by:
addPriorityObserver in interface EventTrackingService
Parameters:
observer - The class observing.

addLocalObserver

public void addLocalObserver(Observer observer)
Add an observer of events. The observer will be notified whenever there are new events. Local observers get notified only of event generated on this application server, not on those generated elsewhere.

Specified by:
addLocalObserver in interface EventTrackingService
Parameters:
observer - The class observing.

deleteObserver

public void deleteObserver(Observer observer)
Delete an observer of events.

Specified by:
deleteObserver in interface EventTrackingService
Parameters:
observer - The class observing to delete.