01: /*
02: * Copyright 2007 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.plugin;
17:
18: /**
19: * The place where plugins are registered.
20: */
21: public interface PluginRegistry {
22: /**
23: * Adds (registers) a plugin.
24: *
25: * @param pluginType type of the plugin (usually an interface)
26: * @param name a unique name (within a certain plugin type) for this plugin
27: * @param plugin the actual plugin implementation
28: */
29: <T> void addPlugin(Class<T> pluginType, String name, T plugin);
30:
31: /**
32: * Removes (unregisters) a plugin.
33: *
34: * <p>Plugins should only be removed by the components which register them.
35: */
36: <T> void removePlugin(Class<T> pluginType, String name, T plugin);
37:
38: /**
39: * Sets the user for a specific type of plugins.
40: *
41: * <p>There can be at most one user for each type of plugin.
42: *
43: * <p>Upon setting the plugin user, any plugins already available
44: * of that type are passed to the plugin user using {@link PluginUser#pluginAdded}.
45: *
46: * @param pluginType
47: * @param pluginUser
48: */
49: <T> void setPluginUser(Class<T> pluginType, PluginUser<T> pluginUser);
50:
51: <T> void unsetPluginUser(Class<T> pluginType,
52: PluginUser<T> pluginUser);
53: }
|