KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > core > event > EventGateway


1 /*
2  * Copyright (C) 2003 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: EventGateway.java,v 1.8 2004/02/01 05:16:28 christianc Exp $
19  */

20 package org.enhydra.barracuda.core.event;
21
22 import java.util.*;
23
24 /**
25  * An EventGateway simply represents a gateway to a set of event
26  * handlers within a system.
27  *
28  * Gateways are heirarchical in that they may contain other
29  * EventGateways, and may have a parent gateway. Invoking register
30  * on a gateway should cause it to
31  *
32  * a) register all known enties that are interested in receiving
33  * events from the EventBroker
34  * b) invoke register for any gateways it contains
35  *
36  * Invoking deregister has the opposite effect.
37  */

38 public interface EventGateway {
39
40     /**
41      * Set the parent event gateway. Null indicates its the root.
42      *
43      * @param eg the parent event gateway
44      */

45     public void setParent(EventGateway eg);
46
47     /**
48      * Get the parent event gateway. Returns null if it's the root.
49      *
50      * @return the parent event gateway
51      */

52     public EventGateway getParent();
53
54     /**
55      * Add an event gateway to this one
56      *
57      * @param eg the event gateway to be added
58      */

59     public void add(EventGateway eg);
60
61     /**
62      * Remove an event gateway from this one
63      *
64      * @param eg the event gateway to be removed
65      */

66     public void remove(EventGateway eg);
67
68     /**
69      * Get a list of child gateways
70      *
71      * @return a list of child gateways
72      */

73     public List getChildren();
74
75     /**
76      * Ask all interested parties to register with
77      * the EventBroker
78      *
79      * @param eb the event broker this gateway should use to
80      * register for events
81      */

82     public void register(EventBroker eb);
83
84     /**
85      * Ask all interested parties to de-register with
86      * the EventBroker
87      *
88      * @param eb the event broker this gateway should use to
89      * de-register for events
90      */

91     public void deregister(EventBroker eb);
92
93     /**
94      * Register any local interests in the EventBroker
95      *
96      * @param eb the event broker this gateway should use to
97      * register for local events
98      */

99     public void registerLocalEventInterests(EventBroker eb);
100
101     /**
102      * Deregister any local interests in the EventBroker
103      *
104      * @param eb the event broker this gateway should use to
105      * de-register for local events
106      */

107     public void deregisterLocalEventInterests(EventBroker eb);
108
109     /**
110      * Register any local event aliases in the EventBroker
111      *
112      * @param eb the event broker this gateway should use to
113      * register aliases for local events
114      */

115     public void registerLocalEventAliases(EventBroker eb);
116
117     /**
118      * Rather than overriding the registerLocalEventInterests
119      * method, you can just invoke this method instead for each
120      * interest you'd like to register. The gateway will keep track
121      * of all factories specified, and register/deregister when
122      * appropriate (so you don't have to worry about it). Notice that
123      * this method registers just the listener id (not for a specific
124      * class of event).
125      *
126      * The only real reason for using the registerLocalEventInterests
127      * method would be if you actually need access to the EventBroker.
128      *
129      * Note that if the event class is not an instance of BaseEvent, the
130      * request is just silently ignored (unlike the event broker, which
131      * throws an exception).
132      *
133      * @param factory the factory we wish to register with the event broker
134      */

135     public void specifyLocalEventInterests(ListenerFactory factory);
136
137     /**
138      * Rather than overriding the registerLocalEventInterests
139      * method, you can just invoke this method instead for each
140      * interest you'd like to register. The gateway will keep track
141      * of all factories specified, and register/deregister when
142      * appropriate (so you don't have to worry about it).
143      *
144      * The only real reason for using the registerLocalEventInterests
145      * method would be if you actually need access to the EventBroker.
146      *
147      * Note that if the event class is not an instance of BaseEvent, the
148      * request is just silently ignored (unlike the event broker, which
149      * throws an exception).
150      *
151      * @param factory the factory we wish to register with the event broker
152      * @param event the class of events we are interested in
153      */

154     public void specifyLocalEventInterests(ListenerFactory factory, Class JavaDoc event);
155
156     /**
157      * Rather than overriding the registerLocalEventAliases
158      * method, you can just invoke this method instead for type
159      * of event you want to manually alias.
160      *
161      * The only real reason for using the registerLocalEventAliases
162      * method would be if you actually need access to the EventBroker.
163      *
164      * Note that if the event class is not an instance of BaseEvent, the
165      * request is just silently ignored (unlike the event broker, which
166      * throws an exception).
167      *
168      * @param event the class of events we are interested in registering
169      * aliases for
170      */

171     public void specifyLocalEventAliases(Class JavaDoc event);
172
173 }
174
Popular Tags