Source code: com/virtuosotechnologies/lib/plugin/Framework.java
1 /*
2 ================================================================================
3
4 FILE: Framework.java
5
6 PROJECT:
7
8 Virtuoso Utilities
9
10 CONTENTS:
11
12 The framework entry point
13
14 PROGRAMMERS:
15
16 Daniel Azuma (DA) <dazuma@kagi.com>
17
18 COPYRIGHT:
19
20 Copyright (C) 2003 Daniel Azuma (dazuma@kagi.com)
21
22 This program is free software; you can redistribute it and/or
23 modify it under the terms of the GNU General Public License as
24 published by the Free Software Foundation; either version 2
25 of the License, or (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public
33 License along with this program; if not, write to
34 Free Software Foundation, Inc.
35 59 Temple Place, Suite 330
36 Boston, MA 02111-1307 USA
37
38 ================================================================================
39 */
40
41
42 package com.virtuosotechnologies.lib.plugin;
43
44
45 import java.util.Set;
46 import java.util.Collection;
47
48
49 /**
50 * The framework entry point
51 */
52 public interface Framework
53 {
54 public static final String FRAMEWORK_APINAME = "com.virtuosotechnologies.lib.plugin.Framework";
55 public static final APIVersion CURRENT_FRAMEWORK_APIVERSION =
56 new APIVersion(0, 0, 0);
57
58
59 /**
60 * Get the names of the currently available plugins as a snapshot Set.
61 *
62 * @return Set of Strings
63 */
64 public Set getCurrentPluginNames();
65
66
67 /**
68 * Get the description for the given plugin. Returns null if the plugin name
69 * is not present.
70 *
71 * @param plugin plugin name
72 * @return description String
73 */
74 public String getPluginDescription(
75 String plugin);
76
77
78 /**
79 * Get the names of the currently available APIs as a snapshot Set.
80 *
81 * @return Set of Strings
82 */
83 public Set getAvailableAPINames();
84
85
86 /**
87 * Get the currently available versions of the given API name, as a snapshot Set.
88 *
89 * @param name name of API to query
90 * @return Set of APIVersions, or the empty set.
91 */
92 public Set getAvailableAPIVersions(
93 String name);
94
95
96 /**
97 * Get the name of the plugin that provides the given API and version.
98 * You need to specify the exact API version.
99 *
100 * @param name name of API to query
101 * @param version version of API to query
102 * @return name of the plugin providing the API, or null if it's being provided
103 * directly through the framework.
104 * @exception APINotAvailableException the given api and version not provided.
105 */
106 public String getProvidingPluginFor(
107 String name,
108 APIVersion version)
109 throws
110 APINotAvailableException;
111
112
113 /**
114 * Attempt to plug in the given Plugins.
115 *
116 * @param info a collection of PluginInfo objects
117 * @exception PluginException couldn't start up the plugins
118 */
119 public void plug(
120 Collection info)
121 throws
122 PluginException;
123
124
125 /**
126 * Register an API with no providing plugin.
127 *
128 * @param name API name
129 * @param version API version
130 * @param description description String
131 * @param impl implementation object
132 * @return the newly-created APIProvider
133 * @exception DuplicateAPIException the given API version already exists.
134 */
135 public APIProvider provideAPI(
136 String name,
137 APIVersion version,
138 String description,
139 Object impl)
140 throws
141 DuplicateAPIException;
142
143
144 /**
145 * Register a listener on the Framework.
146 *
147 * @param listener the listener
148 */
149 public void addFrameworkListener(
150 FrameworkListener listener);
151
152
153 /**
154 * Remove a listener on the Framework.
155 *
156 * @param listener the listener
157 */
158 public void removeFrameworkListener(
159 FrameworkListener listener);
160 }