KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > dispatch > impl > PluginSocket


1 package net.javacoding.jspider.core.dispatch.impl;
2
3 import net.javacoding.jspider.api.event.EventSink;
4 import net.javacoding.jspider.api.event.JSpiderEvent;
5 import net.javacoding.jspider.core.dispatch.EventDispatcher;
6 import net.javacoding.jspider.core.util.config.PropertySet;
7 import net.javacoding.jspider.spi.Plugin;
8
9 /**
10  * Proxy class that enables event filtering for a plugin. If the plugin is
11  * configured for local event filtering, an instance of this class will wrap
12  * the real plugin instance and filter the incoming dispatched events.
13  *
14  * $Id: PluginSocket.java,v 1.9 2003/04/03 16:24:51 vanrogu Exp $
15  *
16  * @author Günther Van Roey
17  */

18 public class PluginSocket implements Plugin {
19
20     protected Plugin plugin;
21     protected EventDispatcher dispatcher;
22
23     public PluginSocket ( Plugin plugin, PropertySet props) {
24        this.plugin = plugin;
25        EventSink[] sinks = new EventSink[1];
26        sinks[0] = plugin;
27        dispatcher = new EventDispatcherImpl("EventDispatcher for Plugin '" + plugin.getName() + "'", sinks, props);
28     }
29
30     public void initialize() {
31         dispatcher.initialize ( );
32     }
33
34     public void shutdown() {
35         dispatcher.shutdown();
36     }
37
38     public String JavaDoc getName() {
39         return plugin.getName ( );
40     }
41
42     public String JavaDoc getVersion() {
43         return plugin.getVersion ( );
44     }
45
46     public String JavaDoc getDescription() {
47         return plugin.getDescription ( );
48     }
49
50     public String JavaDoc getVendor() {
51         return plugin.getVendor ( );
52     }
53
54     public synchronized void notify(JSpiderEvent event) {
55         dispatcher.dispatch(event);
56     }
57
58 }
59
Popular Tags