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.InputStream;
021: import java.util.Enumeration;
022:
023: /**
024: * Extension handler is a registry for extensions and resembles a hook
025: * to extend Columba's functionality.
026: *
027: * @author fdietz
028: *
029: */
030: public interface IExtensionHandler {
031:
032: /**
033: * Add new extension to handler.
034: *
035: * @param id extension id, unique for this extension handler
036: *
037: * @param extension extension
038: */
039: public void addExtension(String id, IExtension extension);
040:
041: /**
042: * Add many extensions at once using a xml file.
043: *
044: * @param is xml file path
045: */
046: public void loadExtensionsFromStream(InputStream is);
047:
048: /**
049: * Add many extensions at once using a xml file. In this case
050: * these are all extensions which can only be loaded using
051: * the plugin classloader.
052: *
053: * @param is xml file path
054: */
055: public void loadExternalExtensionsFromStream(
056: PluginMetadata pluginMetadata, InputStream is);
057:
058: /**
059: * Check if extension exists.
060: *
061: * @param id extension id
062: * @return true, if extension exists. False, otherwise.
063: */
064: public boolean exists(String id);
065:
066: /**
067: * Get extension.
068: *
069: * @param id extension id
070: * @return extension
071: */
072: public IExtension getExtension(String id);
073:
074: /**
075: * Retrieve enumeration of all extensions.
076: *
077: * @return enumeration of IExtension
078: */
079: public Enumeration<IExtension> getExtensionEnumeration();
080:
081: /**
082: * Retrieve enumeration of all external extensions.
083: *
084: * @return enumeration of IExtension
085: */
086: public Enumeration getExternalExtensionsEnumeration();
087:
088: /**
089: * Retrieve array of all extension ids.
090: *
091: * @return String array of ids
092: */
093: public String[] getPluginIdList();
094:
095: /**
096: * Get id of this extension handler.
097: *
098: * @return extension handler id
099: */
100: public String getId();
101: }
|