001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/event/tags/sakai_2-4-1/event-api/api/src/java/org/sakaiproject/event/api/EventTrackingService.java $
003: * $Id: EventTrackingService.java 7036 2006-03-27 00:31:07Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.event.api;
021:
022: import java.util.Observer;
023:
024: /**
025: * <p>
026: * The event tracking service provides activity event tracking and monitoring.<br />
027: * Objects act as event generators, posting events to the service.<br />
028: * Other objects act as event monitors, and are notified by the service when certain events occur.<br />
029: * Events posted are also stored in event archives by the service.
030: * </p>
031: */
032: public interface EventTrackingService {
033: /** This string can be used to find the service in the service manager. */
034: static final String SERVICE_NAME = EventTrackingService.class
035: .getName();
036:
037: /**
038: * Construct a Event object.
039: *
040: * @param event
041: * The Event id.
042: * @param resource
043: * The resource reference.
044: * @param modify
045: * Set to true if this event caused a resource modification, false if it was just an access.
046: * @return A new Event object that can be used with this service.
047: */
048: Event newEvent(String event, String resource, boolean modify);
049:
050: /**
051: * Construct a Event object.
052: *
053: * @param event
054: * The Event id.
055: * @param resource
056: * The resource reference.
057: * @param modify
058: * Set to true if this event caused a resource modification, false if it was just an access.
059: * @param priority
060: * The Event's notification priority.
061: * @return A new Event object that can be used with this service.
062: */
063: Event newEvent(String event, String resource, boolean modify,
064: int priority);
065:
066: /**
067: * Post an event
068: *
069: * @param event
070: * The event object (created with newEvent()). Note: the current session user will be used as the user responsible for the event.
071: */
072: void post(Event event);
073:
074: /**
075: * Post an event on behalf of a user's session
076: *
077: * @param event
078: * The event object (created with newEvent()).
079: * @param session
080: * The usage session object of the user session responsible for the event.
081: */
082: void post(Event event, UsageSession session);
083:
084: /**
085: * Add an observer of events. The observer will be notified whenever there are new events.
086: *
087: * @param observer
088: * The class observing.
089: */
090: void addObserver(Observer observer);
091:
092: /**
093: * Add an observer of events. The observer will be notified whenever there are new events. Priority observers get notified first, before normal observers.
094: *
095: * @param observer
096: * The class observing.
097: */
098: void addPriorityObserver(Observer observer);
099:
100: /**
101: * 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.
102: *
103: * @param observer
104: * The class observing.
105: */
106: void addLocalObserver(Observer observer);
107:
108: /**
109: * Delete an observer of events.
110: *
111: * @param observer
112: * The class observing to delete.
113: */
114: void deleteObserver(Observer observer);
115: }
|