KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > context > event > ApplicationEventMulticaster


1  /*
2  * Copyright 2002-2005 the original author or authors.
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
17 package org.springframework.context.event;
18
19 import org.springframework.context.ApplicationEvent;
20 import org.springframework.context.ApplicationListener;
21
22 /**
23  * Interface to be implemented by objects that can manage a number
24  * of ApplicationListeners, and publish events to them. An example
25  * of such an object is an ApplicationEventPublisher, typically
26  * the ApplicationContext, which can use an ApplicationEventMulticaster
27  * as a helper to publish events to listeners.
28  *
29  * @author Rod Johnson
30  */

31 public interface ApplicationEventMulticaster {
32
33     /**
34      * Add a listener to be notified of all events.
35      * @param listener the listener to add
36      */

37     void addApplicationListener(ApplicationListener listener);
38
39     /**
40      * Remove a listener from the notification list.
41      * @param listener the listener to remove
42      */

43     void removeApplicationListener(ApplicationListener listener);
44
45     /**
46      * Remove all listeners registered with this multicaster.
47      * It will perform no action on event notification until more
48      * listeners are registered.
49      */

50     void removeAllListeners();
51
52     /**
53      * Multicast the given application event to appropriate listeners.
54      * @param event the event to multicast
55      */

56     void multicastEvent(ApplicationEvent event);
57
58 }
59
Popular Tags