001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/search/tags/sakai_2-4-1/search-impl/impl/src/java/org/sakaiproject/search/component/service/impl/SearchNotificationAction.java $
003: * $Id: SearchNotificationAction.java 9109 2006-05-08 14:44:04Z ian@caret.cam.ac.uk $
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.search.component.service.impl;
021:
022: import org.apache.commons.logging.Log;
023: import org.apache.commons.logging.LogFactory;
024: import org.sakaiproject.event.api.Event;
025: import org.sakaiproject.event.api.Notification;
026: import org.sakaiproject.event.api.NotificationAction;
027: import org.sakaiproject.search.api.SearchIndexBuilder;
028: import org.w3c.dom.Element;
029:
030: /**
031: * This action pushes the Event and Notification to the SearchIndexBuilder That
032: * manages the update of the search indexes.
033: *
034: * @author ieb
035: */
036: public class SearchNotificationAction implements NotificationAction {
037:
038: private static Log dlog = LogFactory
039: .getLog(SearchNotificationAction.class);
040:
041: private SearchIndexBuilder searchIndexBuilder;
042:
043: public SearchNotificationAction() {
044: dlog.debug("Constructor()");
045: }
046:
047: public SearchNotificationAction(
048: SearchIndexBuilder searchIndexBuilder) {
049: dlog.debug("Constructory()" + searchIndexBuilder);
050: this .searchIndexBuilder = searchIndexBuilder;
051: }
052:
053: /**
054: * @{inheritDoc}
055: */
056: public void set(Element arg0) {
057: dlog.debug("set element");
058: // copy the element contents to this action
059:
060: }
061:
062: /**
063: * @{inheritDoc}
064: */
065: public void set(NotificationAction arg0) {
066: dlog.debug("set action");
067: // copy the notifiation action to this notification action
068:
069: }
070:
071: /**
072: * @{inheritDoc}
073: */
074: public NotificationAction getClone() {
075: dlog.debug("Clone");
076: SearchNotificationAction clone = new SearchNotificationAction(
077: searchIndexBuilder);
078: clone.set(this );
079:
080: return clone;
081: }
082:
083: /**
084: * @{inheritDoc}
085: */
086: public void toXml(Element arg0) {
087: // Serialise to XML
088:
089: }
090:
091: /**
092: * The notify operation will come in with an event that we are registerd to
093: * recieve, and notification.
094: *
095: * @{inheritDoc}
096: */
097: public void notify(Notification notification, Event event) {
098: dlog.debug("Notify " + event.getEvent());
099: // This is done so that we can persist the Actions if we want without
100: // having to keep a reference to the SearchIndexBuilder
101: searchIndexBuilder.addResource(notification, event);
102: }
103:
104: }
|