KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > plugin > Plugin


1 /*
2  * Copyright (c) 2003 The Nutch Organization. All rights reserved. Use subject
3  * to the conditions in http://www.nutch.org/LICENSE.txt.
4  */

5 package net.nutch.plugin;
6 /**
7  * A nutch-plugin is an container for a set of custom logic that provide
8  * extensions to the nutch core functionality or a other plugin that proides a
9  * API for extending. A plugin can provide one or a set of extensions.
10  * Extensions are components that can be dynamically installed as a kind of
11  * listener to extension points. Extension points are a kind of publisher that
12  * provide a API and invoke one or a set of installed extensions.
13  *
14  * Each plugin may extend the base <code>Plugin</code>. <code>Plugin</code>
15  * instances are used as the point of life cycle managemet of plugin related
16  * functionality.
17  *
18  * The <code>Plugin</code> will be startuped and shutdown by the nutch plugin
19  * management system.
20  *
21  * A possible usecase of the <code>Plugin</code> implementation is to create
22  * or close a database connection.
23  *
24  * @author joa23
25  */

26 public class Plugin {
27   private PluginDescriptor fDescriptor;
28   /**
29    * Constructor
30    *
31    */

32   public Plugin(PluginDescriptor pDescriptor) {
33     setDescriptor(pDescriptor);
34   }
35   /**
36    * Will be invoked until plugin start up. Since the nutch-plugin system use
37    * lazy loading the start up is invoked until the first time a extension is
38    * used.
39    *
40    * @throws PluginRuntimeException
41    * If the startup was without successs.
42    */

43   public void startUp() throws PluginRuntimeException {}
44   /**
45    * Shutdown the plugin. This happens until nutch will be stopped.
46    *
47    * @throws PluginRuntimeException
48    * if a problems occurs until shutdown the plugin.
49    */

50   public void shutDown() throws PluginRuntimeException {}
51   /**
52    * Returns the plugin descriptor
53    *
54    * @return PluginDescriptor
55    */

56   public PluginDescriptor getDescriptor() {
57     return fDescriptor;
58   }
59   /**
60    * @param descriptor
61    * The descriptor to set
62    */

63   private void setDescriptor(PluginDescriptor descriptor) {
64     fDescriptor = descriptor;
65   }
66   /*
67    * (non-Javadoc)
68    *
69    * @see java.lang.Object#finalize()
70    */

71   protected void finalize() throws Throwable JavaDoc {
72     super.finalize();
73     shutDown();
74   }
75 }
76
Popular Tags