01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/event/tags/sakai_2-4-1/event-impl/impl/src/java/org/sakaiproject/event/impl/BasicEventTracking.java $
03: * $Id: BasicEventTracking.java 7319 2006-04-01 20:02:05Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.event.impl;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24: import org.sakaiproject.event.api.Event;
25:
26: /**
27: * <p>
28: * BasicEventTracking is a basic implementation of the EventTracking service.
29: * </p>
30: * <p>
31: * Events are just logged, and observers notified.
32: * </p>
33: */
34: public abstract class BasicEventTracking extends
35: BaseEventTrackingService {
36: /** Our logger. */
37: private static Log M_log = LogFactory
38: .getLog(BasicEventTracking.class);
39:
40: /** String used to identify this service in the logs */
41: protected static String m_logId = "EventTracking: ";
42:
43: /**********************************************************************************************************************************************************************************************************************************************************
44: * Event post / flow
45: *********************************************************************************************************************************************************************************************************************************************************/
46:
47: /**
48: * Cause this new event to get to wherever it has to go for persistence, etc.
49: *
50: * @param event
51: * The new event to post.
52: */
53: protected void postEvent(Event event) {
54: String reportId = null;
55: if (event.getSessionId() != null) {
56: reportId = event.getSessionId();
57: } else {
58: reportId = "~" + event.getUserId();
59: }
60:
61: M_log.info(m_logId + reportId + "@" + event);
62:
63: // notify observers, sending the event
64: notifyObservers(event, true);
65: }
66: }
|