001: package net.sourceforge.squirrel_sql.client.plugin;
002:
003: /*
004: * Copyright (C) 2001-2003 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: /**
022: * This class keeps information about a plugin.
023: *
024: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
025: */
026: public class PluginInfo {
027: /** Property names for this JavaBean. */
028: public interface IPropertyNames {
029: String AUTHOR = "author";
030: String CONTRIBUTORS = "contributors";
031: String DESCRIPTIVE_NAME = "descriptiveName";
032: String INTERNAL_NAME = "internalName";
033: String IS_LOADED = "isLoaded";
034: String PLUGIN_CLASS_NAME = "pluginClassName";
035: String VERSION = "version";
036: String WEB_SITE = "webSite";
037: }
038:
039: private String _pluginClassName;
040: private IPlugin _plugin;
041: private boolean _loaded;
042:
043: /**
044: * Default ctor.
045: *
046: * Should only be used to treat as a Javabean.
047: */
048: public PluginInfo() {
049: super ();
050: }
051:
052: PluginInfo(String pluginClassName) throws IllegalArgumentException {
053: super ();
054: if (pluginClassName == null) {
055: throw new IllegalArgumentException(
056: "pluginClassName == null");
057: }
058:
059: _pluginClassName = pluginClassName;
060: }
061:
062: public void assignFrom(PluginInfo pi)
063: throws IllegalArgumentException {
064: if (pi == null) {
065: throw new IllegalArgumentException("PluginInfo == null");
066: }
067:
068: if (this != pi) {
069: setPlugin(pi.getPlugin());
070: setLoaded(pi.isLoaded());
071: }
072: }
073:
074: public String getPluginClassName() {
075: return _pluginClassName;
076: }
077:
078: public boolean isLoaded() {
079: return _loaded;
080: }
081:
082: /**
083: * Returns the name by which this plugin is uniquely identified.
084: *
085: * @return the name by which this plugin is uniquely identified.
086: */
087: public String getInternalName() {
088: return _plugin.getInternalName();
089: }
090:
091: /**
092: * Returns the descriptive name for this plugin.
093: *
094: * @return the descriptive name for this plugin.
095: */
096: public String getDescriptiveName() {
097: return _plugin.getDescriptiveName();
098: }
099:
100: /**
101: * Returns the authors name.
102: *
103: * @return the authors name.
104: */
105: public String getAuthor() {
106: return _plugin.getAuthor();
107: }
108:
109: /**
110: * Returns a comma separated list of other contributors.
111: *
112: * @return Contributors names.
113: */
114: public String getContributors() {
115: return _plugin.getContributors();
116: }
117:
118: /**
119: * Returns the home page for this plugin.
120: *
121: * @return the home page for this plugin.
122: */
123: public String getWebSite() {
124: return _plugin.getWebSite();
125: }
126:
127: /**
128: * Returns the current version of this plugin.
129: *
130: * @return the current version of this plugin.
131: */
132: public String getVersion() {
133: return _plugin.getVersion();
134: }
135:
136: /**
137: * Returns the name of the Help file for the plugin. This should
138: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
139: * directory.
140: *
141: * @return the Help file name or <TT>null</TT> if plugin doesn't have
142: * a help file.
143: */
144: public String getHelpFileName() {
145: return _plugin.getHelpFileName();
146: }
147:
148: /**
149: * Returns the name of the change log for the plugin. This should
150: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
151: * directory.
152: *
153: * @return the changelog file name or <TT>null</TT> if plugin doesn't have
154: * a change log.
155: */
156: public String getChangeLogFileName() {
157: return _plugin.getChangeLogFileName();
158: }
159:
160: /**
161: * Returns the name of the licence file for the plugin. This should
162: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
163: * directory.
164: *
165: * @return the licence file name or <TT>null</TT> if plugin doesn't have
166: * a licence file.
167: */
168: public String getLicenceFileName() {
169: return _plugin.getLicenceFileName();
170: }
171:
172: /**
173: * Return the <TT>IPlugin</TT>. Warning this will be
174: * <TT>null</TT> if the plugin could not be
175: * instantiated.
176: *
177: * @return the <TT>IPlugin</TT>.
178: */
179: public IPlugin getPlugin() {
180: return _plugin;
181: }
182:
183: void setPlugin(IPlugin value) throws IllegalArgumentException {
184: if (value == null) {
185: throw new IllegalArgumentException("Null IPlugin passed");
186: }
187: _plugin = value;
188: }
189:
190: void setLoaded(boolean value) {
191: _loaded = value;
192: }
193: }
|