KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > core > event > RelationEventBroker


1 /*
2  * Created on 7-sep-2005
3  * This software is OSI Certified Open Source Software.
4  * OSI Certified is a certification mark of the Open Source Initiative. The
5  * license (Mozilla version 1.0) can be read at the MMBase site. See
6  * http://www.MMBase.org/license
7  */

8 package org.mmbase.core.event;
9
10 import java.util.Properties JavaDoc;
11 import org.mmbase.module.core.*;
12 import org.mmbase.util.logging.*;
13
14 /**
15  * This class is the event broker implementation for the RelationEvent
16  *
17  * @author Ernst Bunders
18  * @since MMBase-1.8
19  */

20 public class RelationEventBroker extends AbstractEventBroker {
21
22     private static Logger log = Logging.getLoggerInstance(RelationEventBroker.class);
23
24     /**
25      * use this property to make shure your listener only gets the relation
26      * events where the node number matches the given value.
27      */

28     public static final String JavaDoc PROPERTY_NODETYPE = "nodetype";
29
30     /*
31      * (non-Javadoc)
32      *
33      * @see event.AbstractEventBroker#canBrokerFor(event.EventListener)
34      */

35     public boolean canBrokerForListener(EventListener listener) {
36         // if(listener.getClass().equals(RelationEventListener.class))return
37
// true;
38
return listener instanceof RelationEventListener;
39     }
40
41     /*
42      * (non-Javadoc)
43      *
44      * @see event.AbstractEventBroker#shouldNotifyForEvent(event.Event)
45      */

46     public boolean canBrokerForEvent(Event event) {
47         return event instanceof RelationEvent;
48     }
49
50     /*
51      * (non-Javadoc)
52      *
53      * @see event.AbstractEventBroker#notifyEventListener(event.Event,
54      * event.EventListener)
55      */

56     protected void notifyEventListener(Event event, EventListener listener) throws ClassCastException JavaDoc {
57         RelationEvent re = (RelationEvent) event;
58         RelationEventListener rel = (RelationEventListener) listener;
59         rel.notify(re);
60     }
61
62     /* (non-Javadoc)
63      * @see org.mmbase.core.event.AbstractEventBroker#toString()
64      */

65     public String JavaDoc toString() {
66         return "RelationEvent Broker";
67     }
68
69 }
70
Popular Tags