01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.event;
18:
19: import org.apache.avalon.framework.component.Component;
20: import org.apache.cocoon.ProcessingException;
21:
22: /**
23: * This component manages the event handling mechanism in the portal.
24: * The event mechanism is based on the publisher/subscriber principle.
25: * An interested component (a {@link org.apache.cocoon.portal.event.Receiver}
26: * can subscribe itself for a specific class (or classes) of events.
27: * All Events have a common ancestor type {@link Event} and the event types are
28: * identified by a (sub)class
29: *
30: * The old design which is now deprecated has been inspired by the paper by
31: * Gupta, S., J. M. Hartkopf, and S. Ramaswamy, in Java Report, Vol. 3, No. 7, July 1998, 19-36,
32: * "Event Notifier: A Pattern for Event Notification".
33: *
34: * EventManager brokers events between a <tt>Publisher</tt>, which produces events,
35: * and a <tt>Subscriber</tt>, which handles the notification of events.
36: * A <tt>Filter</tt> discards events not of interest to a subscriber.
37: *
38: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
39: * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
40: * @author Mauro Talevi
41: *
42: * @version CVS $Id: EventManager.java 433543 2006-08-22 06:22:54Z crossley $
43: */
44: public interface EventManager extends Component {
45:
46: /**
47: * Represents the role of the service
48: */
49: String ROLE = EventManager.class.getName();
50:
51: /**
52: * Returns the Publisher with which events can be published.
53: * @deprecated Use {@link #send(Event)} instead.
54: */
55: Publisher getPublisher();
56:
57: /**
58: * Returns the Register with which subscribers can
59: * subscribe and unsubscribe interest to given Events.
60: * @deprecated Use {@link #subscribe(Receiver)} and {@link #unsubscribe(Receiver)}.
61: */
62: Register getRegister();
63:
64: /**
65: * Process the events
66: */
67: void processEvents() 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: }
|