PluginSocket.java
上传用户:qing5858
上传日期:2015-10-27
资源大小:6056k
文件大小:2k
源码类别:

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.core.dispatch.impl;
  2. import net.javacoding.jspider.api.event.EventSink;
  3. import net.javacoding.jspider.api.event.JSpiderEvent;
  4. import net.javacoding.jspider.core.dispatch.EventDispatcher;
  5. import net.javacoding.jspider.core.util.config.PropertySet;
  6. import net.javacoding.jspider.spi.Plugin;
  7. /**
  8.  * Proxy class that enables event filtering for a plugin.  If the plugin is
  9.  * configured for local event filtering, an instance of this class will wrap
  10.  * the real plugin instance and filter the incoming dispatched events.
  11.  *
  12.  * $Id: PluginSocket.java,v 1.9 2003/04/03 16:24:51 vanrogu Exp $
  13.  *
  14.  * @author G黱ther Van Roey
  15.  */
  16. public class PluginSocket implements Plugin {
  17.     protected Plugin plugin;
  18.     protected EventDispatcher dispatcher;
  19.     public PluginSocket ( Plugin plugin, PropertySet props) {
  20.        this.plugin = plugin;
  21.        EventSink[] sinks = new EventSink[1];
  22.        sinks[0] = plugin;
  23.        dispatcher = new EventDispatcherImpl("EventDispatcher for Plugin '" + plugin.getName() + "'", sinks, props);
  24.     }
  25.     public void initialize() {
  26.         dispatcher.initialize ( );
  27.     }
  28.     public void shutdown() {
  29.         dispatcher.shutdown();
  30.     }
  31.     public String getName() {
  32.         return plugin.getName ( );
  33.     }
  34.     public String getVersion() {
  35.         return plugin.getVersion ( );
  36.     }
  37.     public String getDescription() {
  38.         return plugin.getDescription ( );
  39.     }
  40.     public String getVendor() {
  41.         return plugin.getVendor ( );
  42.     }
  43.     public synchronized void notify(JSpiderEvent event) {
  44.         dispatcher.dispatch(event);
  45.     }
  46. }