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 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 getName() { 39 return plugin.getName ( ); 40 } 41 42 public String getVersion() { 43 return plugin.getVersion ( ); 44 } 45 46 public String getDescription() { 47 return plugin.getDescription ( ); 48 } 49 50 public String getVendor() { 51 return plugin.getVendor ( ); 52 } 53 54 public synchronized void notify(JSpiderEvent event) { 55 dispatcher.dispatch(event); 56 } 57 58 } 59 | Popular Tags |