001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.api.plugin;
019:
020: import java.io.File;
021: import java.io.InputStream;
022: import java.net.URL;
023: import java.util.Enumeration;
024:
025: /**
026: * Plugin manager is a singleton registry for all plugins and all
027: * extension handlers.
028: *
029: * @author fdietz
030: *
031: */
032: public interface IPluginManager {
033:
034: /**
035: * Add extension handler to manager.
036: *
037: * @param id handler id
038: * @param handler extension handler
039: */
040: public void addExtensionHandler(String id, IExtensionHandler handler);
041:
042: /**
043: * Retrieve extension handler.
044: *
045: * @param id extension handler id
046: * @return extension handler
047: * @throws PluginHandlerNotFoundException
048: */
049: public IExtensionHandler getExtensionHandler(String id)
050: throws PluginHandlerNotFoundException;
051:
052: /**
053: * Add internal plugin to plugin manager. This plugin is already in the
054: * classpath usually (example: contact, mail components).
055: *
056: * @param resourcePath "/" separated path to resource on the classpath
057: * @return plugin id
058: */
059: public String addPlugin(String resourcePath);
060:
061: /**
062: * Add external plugin to plugin manager. External, meaning that this plugin
063: * resides in the plugin/ directory, which is not on the classpath.
064: *
065: * @param folder directory containing folder
066: * @return plugin id
067: */
068: public String addPlugin(File folder);
069:
070: /**
071: * Get plugin config file (config.xml).
072: *
073: * @param id plugin id
074: * @return plugin config file
075: */
076: public File getPluginConfigFile(String id);
077:
078: /**
079: * Get plugin metadata
080: *
081: * @param id plugin id
082: * @return plugin metadata
083: */
084: public PluginMetadata getPluginMetadata(String id);
085:
086: /**
087: * Get URL pointing to the Readme file shipped with the plugin.
088: *
089: * @param id plugin id
090: * @return URL to readme file
091: */
092: public URL getInfoURL(String id);
093:
094: /**
095: * Get enumeration of plugin metadata.
096: *
097: * @return plugin metadata enumeration
098: */
099: public Enumeration getPluginMetadataEnumeration();
100:
101: /**
102: * Initialize external externsion handlers
103: * <p>
104: * Lookup extensionhandler.xml in all plugin directories and
105: * register them.
106: */
107: public void initExternalExtensionHandlers();
108:
109: /**
110: * Initialize all external plugins in "/plugin" folder.
111: * <p>
112: * Parse <code>plugin.xml</code> and register all extension.
113: */
114: public void initExternalPlugins();
115:
116: /**
117: * Add internal handlers from resource path pointing to a
118: * <code>extensionhandler.xml</code>.
119: *
120: * @param resourcePath path to a resource inside the classpath
121: */
122: public void addExtensionHandlers(String resourcePath);
123:
124: /**
125: * Add external handlers from inputstream of a <code>extensionhandler.xml</code>
126: * file.
127: *
128: * @param is inputstream to extensionhandler.xml
129: */
130: public void addExtensionHandlers(InputStream is);
131: }
|