KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > java > plugin > registry > ExtensionPoint


1 /*****************************************************************************
2  * Java Plug-in Framework (JPF)
3  * Copyright (C) 2004-2005 Dmitry Olshansky
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *****************************************************************************/

19 package org.java.plugin.registry;
20
21 import java.util.Collection JavaDoc;
22
23 /**
24  * This interface abstracts the extension point - a place where the
25  * functionality of plug-in can be extended.
26  * <p>
27  * Extension point UID is a combination of declaring plug-in ID and extension
28  * point ID that is unique within whole set of registered plug-ins.
29  * </p>
30  *
31  * @version $Id: ExtensionPoint.java,v 1.4 2006/08/19 17:37:22 ddimon Exp $
32  */

33 public interface ExtensionPoint extends UniqueIdentity, PluginElement {
34     /**
35      * Extension point multiplicity constant.
36      */

37     String JavaDoc EXT_MULT_ANY = "any"; //$NON-NLS-1$
38

39     /**
40      * Extension point multiplicity constant.
41      */

42     String JavaDoc EXT_MULT_ONE = "one"; //$NON-NLS-1$
43

44     /**
45      * Extension point multiplicity constant.
46      */

47     String JavaDoc EXT_MULT_ONE_PER_PLUGIN = "one-per-plugin"; //$NON-NLS-1$
48

49     /**
50      * Extension point multiplicity constant.
51      */

52     String JavaDoc EXT_MULT_NONE = "none"; //$NON-NLS-1$
53

54     /**
55      * @return multiplicity of this extension point
56      */

57     String JavaDoc getMultiplicity();
58
59     /**
60      * Returns collection of all top level parameter definitions declared
61      * in this extension point and all it parents.
62      * @return collection of {@link ExtensionPoint.ParameterDefinition} objects
63      */

64     Collection JavaDoc getParameterDefinitions();
65     
66     /**
67      * @param id ID of parameter definition to look for
68      * @return parameter definition with given ID
69      */

70     ParameterDefinition getParameterDefinition(String JavaDoc id);
71
72     /**
73      * Returns a collection of all extensions that available for this point.
74      * @return collection of {@link Extension} objects
75      */

76     Collection JavaDoc getAvailableExtensions();
77     
78     /**
79      * @param uniqueId unique ID of extension
80      * @return extension that is available for this point
81      */

82     Extension getAvailableExtension(String JavaDoc uniqueId);
83     
84     /**
85      * Checks if extension is available for this extension point. If this method
86      * returns <code>true</code>, the method
87      * {@link #getAvailableExtension(String)} should return valid extension for
88      * the same UID.
89      * @param uniqueId unique ID of extension
90      * @return <code>true</code> if extension is available for this extension
91      * point
92      */

93     boolean isExtensionAvailable(String JavaDoc uniqueId);
94
95     /**
96      * Returns a collection of all extensions that was successfully "connected"
97      * to this point.
98      * @return collection of {@link Extension} objects
99      */

100     Collection JavaDoc getConnectedExtensions();
101     
102     /**
103      * @param uniqueId unique ID of extension
104      * @return extension that was successfully "connected" to this point
105      */

106     Extension getConnectedExtension(String JavaDoc uniqueId);
107     
108     /**
109      * Checks if extension is in valid state and successfully "connected"
110      * to this extension point. If this method returns <code>true</code>,
111      * the method {@link #getConnectedExtension(String)} should return
112      * valid extension for the same UID.
113      * @param uniqueId unique ID of extension
114      * @return <code>true</code> if extension was successfully "connected" to
115      * this extension point
116      */

117     boolean isExtensionConnected(String JavaDoc uniqueId);
118     
119     /**
120      * @return <code>true</code> if extension point is considered to be valid
121      */

122     boolean isValid();
123     
124     /**
125      * @return parent extension point plug-in ID or <code>null</code>
126      */

127     String JavaDoc getParentPluginId();
128     
129     /**
130      * @return parent extension point ID or <code>null</code>
131      */

132     String JavaDoc getParentExtensionPointId();
133     
134     /**
135      * @param extensionPoint extension point
136      * @return <code>true</code> if this point is successor of given extension
137      * point
138      */

139     boolean isSuccessorOf(ExtensionPoint extensionPoint);
140     
141     /**
142      * Looks for all available (valid) successors of this extension point.
143      * The search should be done recursively including all descendants of this
144      * extension point.
145      * @return collection of {@link ExtensionPoint} objects
146      */

147     Collection JavaDoc getDescendants();
148
149     /**
150      * This interface abstracts parameter definition - a parameter
151      * "type declaration".
152      * @version $Id: ExtensionPoint.java,v 1.4 2006/08/19 17:37:22 ddimon Exp $
153      */

154     interface ParameterDefinition extends PluginElement {
155         /**
156          * Parameter definition type constant.
157          */

158         String JavaDoc TYPE_STRING = "string"; //$NON-NLS-1$
159

160         /**
161          * Parameter definition type constant.
162          */

163         String JavaDoc TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$
164

165         /**
166          * Parameter definition type constant.
167          */

168         String JavaDoc TYPE_NUMBER = "number"; //$NON-NLS-1$
169

170         /**
171          * Parameter definition type constant.
172          */

173         String JavaDoc TYPE_DATE = "date"; //$NON-NLS-1$
174

175         /**
176          * Parameter definition type constant.
177          */

178         String JavaDoc TYPE_TIME = "time"; //$NON-NLS-1$
179

180         /**
181          * Parameter definition type constant.
182          */

183         String JavaDoc TYPE_DATETIME = "date-time"; //$NON-NLS-1$
184

185         /**
186          * Parameter definition type constant.
187          */

188         String JavaDoc TYPE_NULL = "null"; //$NON-NLS-1$
189

190         /**
191          * Parameter definition type constant.
192          */

193         String JavaDoc TYPE_ANY = "any"; //$NON-NLS-1$
194

195         /**
196          * Parameter definition type constant.
197          */

198         String JavaDoc TYPE_PLUGIN_ID = "plugin-id"; //$NON-NLS-1$
199

200         /**
201          * Parameter definition type constant.
202          */

203         String JavaDoc TYPE_EXTENSION_POINT_ID = "extension-point-id"; //$NON-NLS-1$
204

205         /**
206          * Parameter definition type constant.
207          */

208         String JavaDoc TYPE_EXTENSION_ID = "extension-id"; //$NON-NLS-1$
209

210         /**
211          * Parameter definition type constant.
212          */

213         String JavaDoc TYPE_FIXED = "fixed"; //$NON-NLS-1$
214

215         /**
216          * Parameter definition type constant.
217          */

218         String JavaDoc TYPE_RESOURCE = "resource"; //$NON-NLS-1$
219

220         /**
221          * Parameter definition multiplicity constant.
222          */

223         String JavaDoc MULT_ONE = "one"; //$NON-NLS-1$
224

225         /**
226          * Parameter definition multiplicity constant.
227          */

228         String JavaDoc MULT_ANY = "any"; //$NON-NLS-1$
229

230         /**
231          * Parameter definition multiplicity constant.
232          */

233         String JavaDoc MULT_NONE_OR_ONE = "none-or-one"; //$NON-NLS-1$
234

235         /**
236          * Parameter definition multiplicity constant.
237          */

238         String JavaDoc MULT_ONE_OR_MORE = "one-or-more"; //$NON-NLS-1$
239

240         /**
241          * @return multiplicity of parameter, that can be defined according
242          * to this definition
243          */

244         String JavaDoc getMultiplicity();
245
246         /**
247          * @return value type of parameter, that can be defined according
248          * to this definition
249          */

250         String JavaDoc getType();
251         
252         /**
253          * @return custom data for additional customization of some types
254          */

255         String JavaDoc getCustomData();
256
257         /**
258          * Returns collection of all parameter sub-definitions declared
259          * in this parameter definition.
260          * @return collection of {@link ExtensionPoint.ParameterDefinition}
261          * objects
262          */

263         Collection JavaDoc getSubDefinitions();
264
265         /**
266          * @param id ID of parameter sub-definition to look for
267          * @return parameter sub-definition with given ID
268          */

269         ParameterDefinition getSubDefinition(String JavaDoc id);
270
271         /**
272          * @return extension point, this definition belongs to
273          */

274         ExtensionPoint getDeclaringExtensionPoint();
275         
276         /**
277          * @return parameter definition, of which this one is child or
278          * <code>null</code> if this is top level parameter definition
279          */

280         ParameterDefinition getSuperDefinition();
281         
282         /**
283          * @return default parameter value as it is defined in manifest
284          */

285         String JavaDoc getDefaultValue();
286     }
287 }
Popular Tags