01: /*
02: * This software is OSI Certified Open Source Software.
03: * OSI Certified is a certification mark of the Open Source Initiative. The
04: * license (Mozilla version 1.0) can be read at the MMBase site. See
05: * http://www.MMBase.org/license
06: */
07: package org.mmbase.core.event;
08:
09: /**
10: * This class is the event broker implementation for the RelationEvent
11: *
12: * @author Ernst Bunders
13: * @since MMBase-1.8
14: * @author Ernst Bunders
15: * @version $Id: RelationEventBroker.java,v 1.13 2007/07/26 11:45:54 michiel Exp $
16: */
17: public class RelationEventBroker extends AbstractEventBroker {
18:
19: /**
20: * use this property to make shure your listener only gets the relation
21: * events where the node number matches the given value.
22: */
23: public static final String PROPERTY_NODETYPE = "nodetype";
24:
25: /*
26: * (non-Javadoc)
27: *
28: * @see event.AbstractEventBroker#canBrokerFor(event.EventListener)
29: */
30: public boolean canBrokerForListener(EventListener listener) {
31: // if(listener.getClass().equals(RelationEventListener.class))return
32: // true;
33: return listener instanceof RelationEventListener;
34: }
35:
36: /*
37: * (non-Javadoc)
38: *
39: * @see event.AbstractEventBroker#shouldNotifyForEvent(event.Event)
40: */
41: public boolean canBrokerForEvent(Event event) {
42: return event instanceof RelationEvent;
43: }
44:
45: /*
46: * (non-Javadoc)
47: *
48: * @see event.AbstractEventBroker#notifyEventListener(event.Event,
49: * event.EventListener)
50: */
51: protected void notifyEventListener(Event event,
52: EventListener listener) throws ClassCastException {
53: RelationEvent re = (RelationEvent) event;
54: RelationEventListener rel = (RelationEventListener) listener;
55: rel.notify(re);
56: }
57:
58: /* (non-Javadoc)
59: * @see org.mmbase.core.event.AbstractEventBroker#toString()
60: */
61: public String toString() {
62: return "RelationEvent Broker";
63: }
64:
65: }
|