KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > api > plugin > IPluginManager


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.api.plugin;
19
20 import java.io.File JavaDoc;
21 import java.io.InputStream JavaDoc;
22 import java.net.URL JavaDoc;
23 import java.util.Enumeration JavaDoc;
24
25
26 /**
27  * Plugin manager is a singleton registry for all plugins and all
28  * extension handlers.
29  *
30  * @author fdietz
31  *
32  */

33 public interface IPluginManager {
34
35     /**
36      * Add extension handler to manager.
37      *
38      * @param id handler id
39      * @param handler extension handler
40      */

41     public void addExtensionHandler(String JavaDoc id, IExtensionHandler handler);
42     
43     /**
44      * Retrieve extension handler.
45      *
46      * @param id extension handler id
47      * @return extension handler
48      * @throws PluginHandlerNotFoundException
49      */

50     public IExtensionHandler getExtensionHandler(String JavaDoc id) throws PluginHandlerNotFoundException;
51     
52     /**
53      * Add internal plugin to plugin manager. This plugin is already in the
54      * classpath usually (example: contact, mail components).
55      *
56      * @param resourcePath "/" separated path to resource on the classpath
57      * @return plugin id
58      */

59     public String JavaDoc addPlugin(String JavaDoc resourcePath);
60     
61     /**
62      * Add external plugin to plugin manager. External, meaning that this plugin
63      * resides in the plugin/ directory, which is not on the classpath.
64      *
65      * @param folder directory containing folder
66      * @return plugin id
67      */

68     public String JavaDoc addPlugin(File JavaDoc folder);
69     
70     /**
71      * Get plugin config file (config.xml).
72      *
73      * @param id plugin id
74      * @return plugin config file
75      */

76     public File JavaDoc getPluginConfigFile(String JavaDoc id);
77     
78     /**
79      * Get plugin metadata
80      *
81      * @param id plugin id
82      * @return plugin metadata
83      */

84     public PluginMetadata getPluginMetadata(String JavaDoc id);
85     
86     /**
87      * Get URL pointing to the Readme file shipped with the plugin.
88      *
89      * @param id plugin id
90      * @return URL to readme file
91      */

92     public URL JavaDoc getInfoURL(String JavaDoc id);
93     
94     /**
95      * Get enumeration of plugin metadata.
96      *
97      * @return plugin metadata enumeration
98      */

99     public Enumeration JavaDoc 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     /**
118      * Add internal handlers from resource path pointing to a
119      * <code>extensionhandler.xml</code>.
120      *
121      * @param resourcePath path to a resource inside the classpath
122      */

123     public void addExtensionHandlers(String JavaDoc resourcePath);
124     
125     /**
126      * Add external handlers from inputstream of a <code>extensionhandler.xml</code>
127      * file.
128      *
129      * @param is inputstream to extensionhandler.xml
130      */

131     public void addExtensionHandlers(InputStream JavaDoc is);
132 }
133
Popular Tags