KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > event > EventManager


1 /*
2  * Copyright 1999-2002,2004-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.event;
17
18 import org.apache.avalon.framework.component.Component;
19 import org.apache.cocoon.ProcessingException;
20
21 /**
22  * This component manages the event handling mechanism in the portal.
23  * The event mechanism is based on the publisher/subscriber principle.
24  * An interested component (a {@link org.apache.cocoon.portal.event.Receiver}
25  * can subscribe itself for a specific class (or classes) of events.
26  * All Events have a common ancestor type {@link Event} and the event types are
27  * identified by a (sub)class
28  *
29  * The old design which is now deprecated has been inspired by the paper by
30  * Gupta, S., J. M. Hartkopf, and S. Ramaswamy, in Java Report, Vol. 3, No. 7, July 1998, 19-36,
31  * "Event Notifier: A Pattern for Event Notification".
32  *
33  * EventManager brokers events between a <tt>Publisher</tt>, which produces events,
34  * and a <tt>Subscriber</tt>, which handles the notification of events.
35  * A <tt>Filter</tt> discards events not of interest to a subscriber.
36  *
37  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
38  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
39  * @author Mauro Talevi
40  *
41  * @version CVS $Id: EventManager.java 219049 2005-07-14 15:11:52Z cziegeler $
42  */

43 public interface EventManager extends Component {
44  
45     /**
46      * Represents the role of the service
47      */

48     String JavaDoc ROLE = EventManager.class.getName();
49     
50      /**
51       * Returns the Publisher with which events can be published.
52       * @deprecated Use {@link #send(Event)} instead.
53       */

54     Publisher getPublisher();
55     
56      /**
57       * Returns the Register with which subscribers can
58       * subscribe and unsubscribe interest to given Events.
59       * @deprecated Use {@link #subscribe(Receiver)} and {@link #unsubscribe(Receiver)}.
60       */

61     Register getRegister();
62
63     /**
64      * Process the events
65      */

66     void processEvents()
67     throws ProcessingException;
68
69     /**
70      * Publish an event. All registered receivers get notified.
71      * @param event The event to broadcast.
72      */

73     void send(Event event);
74
75     /**
76      * Subscribes a receiver for a specific type of event.
77      */

78     void subscribe(Receiver receiver);
79
80     /**
81      * Unsubscribes a receiver for all events.
82      */

83     void unsubscribe(Receiver receiver);
84
85 }
86
Popular Tags