1 /*
2 Copyright (C) 2000 - 2007 Grid Systems, S.A.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17 package com.gridsystems.innergrid.kernel.plugin;
18
19 import java.util.Map;
20
21 import javax.activation.DataHandler;
22
23 import org.apache.log4j.Level;
24
25 import com.gridsystems.innergrid.kernel.KernelException;
26 import com.gridsystems.innergrid.kernel.event.KernelListener;
27 import com.gridsystems.innergrid.kernel.services.LicenseField;
28
29 /**
30 * Base interface for all plugin components.
31 *
32 * @author Rodrigo Ruiz
33 * @version 1.0
34 */
35 public interface Plugin extends KernelListener {
36 /**
37 * Gets the public name of this plugin.
38 * <p>
39 * Names must be unique along the server, so developers should use some
40 * standard strategy to afford this, like using a hierarchical naming convention.
41 * <p>
42 * For example, using the full class name can be a valid convention. Different
43 * implementations for the same plugin could share a common prefix, or add
44 * a suffix to the "implementation-independent" name.
45 *
46 * @return A public name for this plugin.
47 */
48 String getName();
49
50 /**
51 * Gets a human-readable description for this plugin. The objective of this
52 * field is to be shown in graphical interfaces, or edition tools.
53 *
54 * @return A short description for this plugin
55 */
56 String getDescription();
57
58 /**
59 * Gets the copyright string for this plugin.
60 *
61 * @return The string containing the copyright for this plugin
62 */
63 String getCopyright();
64
65 /**
66 * Gets the "public" version information of this plugin.
67 * <p>
68 * The returned data will be used for compatibility verification.
69 *
70 * @return A bean containing version info of this plugin
71 */
72 PluginVersion getVersion();
73
74 /**
75 * Gets a list of external plugin dependencies. Each entry in the returned map
76 * will be indexed by plugin name, and its value will be the minimal version
77 * required (as a PluginVersion instance) for this plugin to correctly function.
78 *
79 * @return A map containing external plugin names as the keys, and the minimal
80 * PluginVersion required for each one.
81 */
82 Map getDependencies();
83
84 /**
85 * Sets the log level for classes in this plugin.
86 * <p>This method should set a "global" level, common to all classes included
87 * in the plugin library. Plugins needing finer control, perhaps at API level,
88 * must implement it through their own public APIs.
89 *
90 * @param level The level to set
91 */
92 void setLogLevel(Level level);
93
94 /**
95 * Gets the log level defined for this plugin.
96 *
97 * @return The current Level for the logs from this plugin
98 */
99 Level getLogLevel();
100
101 /**
102 * Gets an array of (key, value) pairs containing license details.
103 *
104 * @return An array of license details
105 */
106 LicenseField[] getLicenseFields();
107
108 /**
109 * Provides a licence file for this plugin.
110 *
111 * @param handler the DataHandler used to retrieve the file sent.
112 *
113 * @throws KernelException in case of error.
114 */
115 void setLicense(DataHandler handler) throws KernelException;
116 }