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: import java.io.File;
022: import java.io.IOException;
023:
024: import net.sourceforge.squirrel_sql.client.IApplication;
025: import net.sourceforge.squirrel_sql.client.gui.db.aliasproperties.IAliasPropertiesPanelController;
026: import net.sourceforge.squirrel_sql.client.gui.db.SQLAlias;
027: import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
028: import net.sourceforge.squirrel_sql.client.preferences.INewSessionPropertiesPanel;
029:
030: /**
031: * Base interface for all plugins.
032: * <P>
033: * Plugins for specific DBMSs may need to create and register DataType handlers
034: * for non-standard data types defined by that DBMS.
035: * Instructions on this can be found in
036: * fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/CellComponentFactory.java.
037: */
038: public interface IPlugin {
039: /**
040: * Called on application startup before application started up.
041: *
042: * @param app Application API.
043: */
044: void load(IApplication app) throws PluginException;
045:
046: /**
047: * Called on application startup after application started.
048: */
049: void initialize() throws PluginException;
050:
051: /**
052: * Called when app shutdown.
053: * TODO: Put throws clause back in
054: */
055: void unload(); //throws PluginException;
056:
057: /**
058: * Returns the name by which this plugin is uniquely identified.
059: *
060: * @return the name by which this plugin is uniquely identified.
061: */
062: String getInternalName();
063:
064: /**
065: * Returns the descriptive name for this plugin.
066: *
067: * @return the descriptive name for this plugin.
068: */
069: String getDescriptiveName();
070:
071: /**
072: * Returns the authors name.
073: *
074: * @return the authors name.
075: */
076: String getAuthor();
077:
078: /**
079: * Returns a comma separated list of other contributors.
080: *
081: * @return Contributors names.
082: */
083: String getContributors();
084:
085: /**
086: * Returns the home page for this plugin.
087: *
088: * @return the home page for this plugin.
089: */
090: String getWebSite();
091:
092: /**
093: * Returns the current version of this plugin.
094: *
095: * @return the current version of this plugin.
096: */
097: String getVersion();
098:
099: /**
100: * Returns the name of the Help file for the plugin. This should
101: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
102: * directory.
103: *
104: * @return the Help file name or <TT>null</TT> if plugin doesn't have
105: * a help file.
106: */
107: String getHelpFileName();
108:
109: /**
110: * Returns the name of the change log for the plugin. This should
111: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
112: * directory.
113: *
114: * @return the changelog file name or <TT>null</TT> if plugin doesn't have
115: * a change log.
116: */
117: String getChangeLogFileName();
118:
119: /**
120: * Returns the name of the licence file for the plugin. This should
121: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
122: * directory.
123: *
124: * @return the licence file name or <TT>null</TT> if plugin doesn't have
125: * a change log.
126: */
127: String getLicenceFileName();
128:
129: /**
130: * Create panels for the Global Preferences dialog.
131: *
132: * @return Array of <TT>IGlobalPreferencesPanel</TT> objects. Return
133: * empty array of <TT>null</TT> if this plugin doesn't require
134: * any panels in the Global Preferences Dialog.
135: */
136: IGlobalPreferencesPanel[] getGlobalPreferencePanels();
137:
138: /**
139: * Creates Alias Prefs Controllers for this Plugin.
140: */
141: IAliasPropertiesPanelController[] getAliasPropertiesPanelControllers(
142: SQLAlias alias);
143:
144: /**
145: * Called when an Alias is copied. Should be overridden by Plugins
146: * that work with Alias properties.
147: */
148: void aliasCopied(SQLAlias source, SQLAlias target);
149:
150: /**
151: * Called when an Alias is removed. Should be overridden by Plugins
152: * that work with Alias properties.
153: */
154: void aliasRemoved(SQLAlias alias);
155:
156: /**
157: * Create panels for the New Session Properties dialog.
158: *
159: * @return Array of <TT>INewSessionPropertiesPanel</TT> objects. Return
160: * empty array of <TT>null</TT> if this plugin doesn't require
161: * any panels in the New Session Properties Dialog.
162: */
163: INewSessionPropertiesPanel[] getNewSessionPropertiesPanels();
164:
165: /**
166: * Return the folder with the Squirrel application folder
167: * that belongs to this plugin. If it doesn't exist then
168: * create it. This would normally be
169: * <PRE>
170: * <squirrel_app>/plugins/<plugin_internal_name>
171: * </PRE>
172: *
173: * @return Plugins application folder.
174: *
175: * @throws IllegalStateException
176: * if plugin doesn't have an internal name.
177: *
178: * @throws IOException
179: * An error occured retrieving/creating the folder.
180: */
181: File getPluginAppSettingsFolder() throws IOException,
182: IllegalStateException;
183:
184: /**
185: * Return the folder with the users home directory
186: * that belongs to this plugin. If it doesn't exist then
187: * create it. This would normally be
188: * <PRE>
189: * <user_home>/.squirrel-sql/plugins/<plugin_internal_name>
190: * </PRE>
191: *
192: * @return Plugins user folder.
193: *
194: * @throws IllegalStateException
195: * if plugin doesn't have an internal name.
196: *
197: * @throws IOException
198: * An error occured retrieving/creating the folder.
199: */
200: File getPluginUserSettingsFolder() throws IllegalStateException,
201: IOException;
202:
203: /**
204: * Allows a plugin to provide services to other plugins.
205: * @see PluginManager.bindExternalPluginService();
206: */
207: Object getExternalService();
208:
209: }
|