01 /*
02 * Copyright 2009-2012 the original author or authors.
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
17 package griffon.core;
18
19 import java.util.Map;
20
21 /**
22 * Helper class capable of dealing with addons.
23 *
24 * @author Andres Almiray
25 * @since 0.9.2
26 */
27 public interface AddonManager extends ApplicationHandler {
28 void initialize();
29
30 void registerAddon(GriffonAddonDescriptor addonDescriptor);
31
32 /**
33 * Returns a read-only view of all available addons
34 *
35 * @return a non-null Map of addons keyed by name
36 */
37 Map<String, GriffonAddon> getAddons();
38
39 /**
40 * Returns a read-only view of all available addon descriptors
41 *
42 * @return a non-null Map of addon descriptors keyed by name
43 */
44 Map<String, GriffonAddonDescriptor> getAddonDescriptors();
45
46 /**
47 * Finds an addon by name.<p>
48 * Example: findAddon("miglayout") will return a GriffonAddon that
49 * represents the contibutions of the MigLayout plugin.
50 *
51 * @param name the name of the addon to search for
52 * @return an addon instance if there's a match, null otherwise
53 */
54 GriffonAddon findAddon(String name);
55
56 /**
57 * Finds an addon descriptor by name.<p>
58 * Example: findAddonDescriptor("miglayout") will return a GriffonAddonDescriptor that
59 * represents the contibutions of the MigLayout plugin.
60 *
61 * @param name the name of the addon to search for
62 * @return an addon descriptor instance if there's a match, null otherwise
63 */
64 GriffonAddonDescriptor findAddonDescriptor(String name);
65
66 /**
67 * Finds all addon descriptors that are registered with the specified prefix.<p>
68 * Example: findAddonDescriptors("foo") will return al addon descriptors that use 'foo as a prefix.<p>
69 * A null or blank prefix should return all addon descriptors registered with the 'root'
70 * prefix.
71 *
72 * @param prefix the prefix to search for
73 * @return a non-null Map of matching addon descriptors keyed by name
74 */
75 Map<String, GriffonAddonDescriptor> findAddonDescriptors(String prefix);
76 }
|