1 package org.djutils.event;
2
3 import java.io.Serializable;
4 import java.rmi.RemoteException;
5 import java.util.List;
6 import java.util.Set;
7
8 import org.djutils.event.reference.Reference;
9 import org.djutils.event.reference.ReferenceType;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public class LocalEventProducer implements EventProducer, Serializable
37 {
38
39 private static final long serialVersionUID = 20200207;
40
41
42 private EventListenerMap eventListenerMap = new EventListenerMap();
43
44 @Override
45 public EventListenerMap getEventListenerMap()
46 {
47 return this.eventListenerMap;
48 }
49
50
51
52
53
54 @Override
55 public boolean addListener(final EventListener listener, final EventType eventType, final int position,
56 final ReferenceType referenceType)
57 {
58 try
59 {
60 return EventProducer.super.addListener(listener, eventType, position, referenceType);
61 }
62 catch (RemoteException exception)
63 {
64 throw new RuntimeException(exception);
65 }
66 }
67
68 @Override
69 public boolean addListener(final EventListener listener, final EventType eventType)
70 {
71 try
72 {
73 return EventProducer.super.addListener(listener, eventType);
74 }
75 catch (RemoteException exception)
76 {
77 throw new RuntimeException(exception);
78 }
79 }
80
81 @Override
82 public boolean addListener(final EventListener listener, final EventType eventType, final ReferenceType referenceType)
83 {
84 try
85 {
86 return EventProducer.super.addListener(listener, eventType, referenceType);
87 }
88 catch (RemoteException exception)
89 {
90 throw new RuntimeException(exception);
91
92 }
93 }
94
95 @Override
96 public boolean addListener(final EventListener listener, final EventType eventType, final int position)
97 {
98 try
99 {
100 return EventProducer.super.addListener(listener, eventType, position);
101 }
102 catch (RemoteException exception)
103 {
104 throw new RuntimeException(exception);
105
106 }
107 }
108
109 @Override
110 public int removeAllListeners()
111 {
112 try
113 {
114 return EventProducer.super.removeAllListeners();
115 }
116 catch (RemoteException exception)
117 {
118 throw new RuntimeException(exception);
119
120 }
121 }
122
123 @Override
124 public int removeAllListeners(final Class<?> ofClass)
125 {
126 try
127 {
128 return EventProducer.super.removeAllListeners(ofClass);
129 }
130 catch (RemoteException exception)
131 {
132 throw new RuntimeException(exception);
133
134 }
135 }
136
137 @Override
138 public boolean removeListener(final EventListener listener, final EventType eventType)
139 {
140 try
141 {
142 return EventProducer.super.removeListener(listener, eventType);
143 }
144 catch (RemoteException exception)
145 {
146 throw new RuntimeException(exception);
147
148 }
149 }
150
151 @Override
152 public boolean hasListeners()
153 {
154 try
155 {
156 return EventProducer.super.hasListeners();
157 }
158 catch (RemoteException exception)
159 {
160 throw new RuntimeException(exception);
161
162 }
163 }
164
165 @Override
166 public int numberOfListeners(final EventType eventType)
167 {
168 try
169 {
170 return EventProducer.super.numberOfListeners(eventType);
171 }
172 catch (RemoteException exception)
173 {
174 throw new RuntimeException(exception);
175
176 }
177 }
178
179 @Override
180 public List<Reference<EventListener>> getListenerReferences(final EventType eventType)
181 {
182 try
183 {
184 return EventProducer.super.getListenerReferences(eventType);
185 }
186 catch (RemoteException exception)
187 {
188 throw new RuntimeException(exception);
189
190 }
191 }
192
193 @Override
194 public Set<EventType> getEventTypesWithListeners()
195 {
196 try
197 {
198 return EventProducer.super.getEventTypesWithListeners();
199 }
200 catch (RemoteException exception)
201 {
202 throw new RuntimeException(exception);
203
204 }
205 }
206
207 @Override
208 public void fireEvent(final Event event)
209 {
210 try
211 {
212 EventProducer.super.fireEvent(event);
213 }
214 catch (RemoteException exception)
215 {
216 throw new RuntimeException(exception);
217
218 }
219 }
220
221 @Override
222 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final TimedEvent<C> event)
223 {
224 try
225 {
226 EventProducer.super.fireTimedEvent(event);
227 }
228 catch (RemoteException exception)
229 {
230 throw new RuntimeException(exception);
231
232 }
233 }
234
235 @Override
236 public void fireEvent(final EventType eventType)
237 {
238 try
239 {
240 EventProducer.super.fireEvent(eventType);
241 }
242 catch (RemoteException exception)
243 {
244 throw new RuntimeException(exception);
245
246 }
247 }
248
249 @Override
250 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final EventType eventType, final C time)
251 {
252 try
253 {
254 EventProducer.super.fireTimedEvent(eventType, time);
255 }
256 catch (RemoteException exception)
257 {
258 throw new RuntimeException(exception);
259
260 }
261 }
262
263 @Override
264 public void fireEvent(final EventType eventType, final Serializable value)
265 {
266 try
267 {
268 EventProducer.super.fireEvent(eventType, value);
269 }
270 catch (RemoteException exception)
271 {
272 throw new RuntimeException(exception);
273
274 }
275 }
276
277 @Override
278 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final EventType eventType, final Serializable value,
279 final C time)
280
281 {
282 try
283 {
284 EventProducer.super.fireTimedEvent(eventType, value, time);
285 }
286 catch (RemoteException exception)
287 {
288 throw new RuntimeException(exception);
289
290 }
291 }
292
293 @Override
294 public void fireUnverifiedEvent(final EventType eventType)
295 {
296 try
297 {
298 EventProducer.super.fireUnverifiedEvent(eventType);
299 }
300 catch (RemoteException exception)
301 {
302 throw new RuntimeException(exception);
303
304 }
305 }
306
307 @Override
308 public <C extends Comparable<C> & Serializable> void fireUnverifiedTimedEvent(final EventType eventType, final C time)
309
310 {
311 try
312 {
313 EventProducer.super.fireUnverifiedTimedEvent(eventType, time);
314 }
315 catch (RemoteException exception)
316 {
317 throw new RuntimeException(exception);
318
319 }
320 }
321
322 @Override
323 public void fireUnverifiedEvent(final EventType eventType, final Serializable value)
324 {
325 try
326 {
327 EventProducer.super.fireUnverifiedEvent(eventType, value);
328 }
329 catch (RemoteException exception)
330 {
331 throw new RuntimeException(exception);
332
333 }
334 }
335
336 @Override
337 public <C extends Comparable<C> & Serializable> void fireUnverifiedTimedEvent(final EventType eventType,
338 final Serializable value, final C time)
339 {
340 try
341 {
342 EventProducer.super.fireUnverifiedTimedEvent(eventType, value, time);
343 }
344 catch (RemoteException exception)
345 {
346 throw new RuntimeException(exception);
347
348 }
349 }
350
351 }