KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > model > PluginModel


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.model;
12
13 import org.eclipse.core.runtime.PluginVersionIdentifier;
14
15 /**
16  * An object which represents the user-defined contents of a plug-in model
17  * (either a descriptor or a fragment) in a plug-in manifest.
18  * <p>
19  * This class may not be instantiated, but may be further subclassed.
20  * </p>
21  * @deprecated In Eclipse 3.0 the runtime was refactored and all
22  * non-essential elements removed. This class provides facilities primarily intended
23  * for tooling. As such it has been removed and no directly substitutable API provided.
24  */

25 public abstract class PluginModel extends PluginModelObject {
26
27     /**
28      * Manifest schema version. The version number is canonicalized.
29      * May be <code>null</code>.
30      *
31      * @since 3.0
32      */

33     private String JavaDoc schemaVersion = null;
34
35     // DTD properties (included in plug-in manifest)
36
private String JavaDoc id = null;
37     private String JavaDoc providerName = null;
38     private String JavaDoc version = null;
39     private LibraryModel[] runtime = null;
40     private ExtensionPointModel[] extensionPoints = null;
41     private ExtensionModel[] extensions = null;
42     private PluginPrerequisiteModel[] requires = null;
43
44     // transient properties (not included in plug-in manifest)
45
private PluginRegistryModel registry = null;
46     private String JavaDoc location = null;
47
48     /**
49      * Creates a new plug-in descriptor model in which all fields
50      * are <code>null</code>.
51      */

52     public PluginModel() {
53         super();
54     }
55
56     /**
57      * Returns the extension points in this plug-in descriptor.
58      *
59      * @return the extension points in this plug-in descriptor or <code>null</code>
60      */

61     public ExtensionPointModel[] getDeclaredExtensionPoints() {
62         return extensionPoints;
63     }
64
65     /**
66      * Returns the extensions in this plug-in descriptor.
67      *
68      * @return the extensions in this plug-in descriptor or <code>null</code>
69      */

70     public ExtensionModel[] getDeclaredExtensions() {
71         return extensions;
72     }
73
74     /**
75      * Returns the unique identifier of this plug-in model
76      * or <code>null</code>.
77      * This identifier is a non-empty string and is unique
78      * within the plug-in registry.
79      *
80      * @return the unique identifier of this plugin model
81      * (e.g. <code>"com.example"</code>) or <code>null</code>.
82      */

83     public String JavaDoc getId() {
84         return id;
85     }
86
87     /**
88      * Returns the location of the plug-in corresponding to this plug-in
89      * descriptor. The location is in the form of a URL.
90      *
91      * @return the location of this plug-in descriptor or <code>null</code>.
92      */

93     public String JavaDoc getLocation() {
94         return location;
95     }
96
97     /**
98      * Returns the unique identifier of the plug-in related to this model
99      * or <code>null</code>.
100      * This identifier is a non-empty string and is unique
101      * within the plug-in registry.
102      *
103      * @return the unique identifier of the plug-in related to this model
104      * (e.g. <code>"com.example"</code>) or <code>null</code>.
105      */

106     public abstract String JavaDoc getPluginId();
107
108     /**
109      * Returns the name of the provider who authored this plug-in.
110      *
111      * @return name of the provider who authored this plug-in or <code>null</code>
112      */

113     public String JavaDoc getProviderName() {
114         return providerName;
115     }
116
117     /**
118      * Returns the plug-in registry of which this plug-in descriptor is a member.
119      *
120      * @return the registry in which this descriptor has been installed or
121      * <code>null</code> if none.
122      */

123     public PluginRegistryModel getRegistry() {
124         return registry;
125     }
126
127     /**
128      * Returns the prerequisites of this plug-in.
129      *
130      * @return the prerequisites of this plug-in or <code>null</code>
131      */

132     public PluginPrerequisiteModel[] getRequires() {
133         return requires;
134     }
135
136     /**
137      * Returns the libraries configured for this plug-in.
138      *
139      * @return the libraries configured for this plug-in or <code>null</code>
140      */

141     public LibraryModel[] getRuntime() {
142         return runtime;
143     }
144
145     /**
146      * Returns the version name of this plug-in.
147      *
148      * @return the version name of this plug-in or <code>null</code>
149      */

150     public String JavaDoc getVersion() {
151         return version;
152     }
153
154     /**
155      * Sets this model object and all of its descendents to be read-only.
156      * Subclasses may extend this implementation.
157      *
158      * @see #isReadOnly()
159      */

160     public void markReadOnly() {
161         super.markReadOnly();
162         if (runtime != null)
163             for (int i = 0; i < runtime.length; i++)
164                 runtime[i].markReadOnly();
165         if (extensionPoints != null)
166             for (int i = 0; i < extensionPoints.length; i++)
167                 extensionPoints[i].markReadOnly();
168         if (extensions != null)
169             for (int i = 0; i < extensions.length; i++)
170                 extensions[i].markReadOnly();
171         if (requires != null)
172             for (int i = 0; i < requires.length; i++)
173                 requires[i].markReadOnly();
174     }
175
176     /**
177      * Sets the extension points in this plug-in descriptor.
178      * This object must not be read-only.
179      *
180      * @param value the extension points in this plug-in descriptor.
181      * May be <code>null</code>.
182      */

183     public void setDeclaredExtensionPoints(ExtensionPointModel[] value) {
184         assertIsWriteable();
185         extensionPoints = value;
186     }
187
188     /**
189      * Sets the extensions in this plug-in descriptor.
190      * This object must not be read-only.
191      *
192      * @param value the extensions in this plug-in descriptor.
193      * May be <code>null</code>.
194      */

195     public void setDeclaredExtensions(ExtensionModel[] value) {
196         assertIsWriteable();
197         extensions = value;
198     }
199
200     /**
201      * Sets the unique identifier of this plug-in model.
202      * The identifier is a non-empty string and is unique
203      * within the plug-in registry.
204      * This object must not be read-only.
205      *
206      * @param value the unique identifier of the plug-in model (e.g. <code>"com.example"</code>).
207      * May be <code>null</code>.
208      */

209     public void setId(String JavaDoc value) {
210         assertIsWriteable();
211         id = value;
212     }
213
214     /**
215      * Optimization to replace a non-localized key with its localized value. Avoids having
216      * to access resource bundles for further lookups.
217      *
218      * @param value the localized provider name for this model object
219      */

220     public void setLocalizedProviderName(String JavaDoc value) {
221         providerName = value;
222     }
223
224     /**
225      * Sets the location of the plug-in manifest file (e.g., <code>plugin.xml</code>)
226      * which corresponds to this plug-in descriptor. The location is in the
227      * form of a URL.
228      * This object must not be read-only.
229      *
230      * @param value the location of this plug-in descriptor. May be <code>null</code>.
231      */

232     public void setLocation(String JavaDoc value) {
233         assertIsWriteable();
234         location = value;
235     }
236
237     /**
238      * Sets the name of the provider who authored this plug-in.
239      * This object must not be read-only.
240      *
241      * @param value name of the provider who authored this plug-in.
242      * May be <code>null</code>.
243      */

244     public void setProviderName(String JavaDoc value) {
245         assertIsWriteable();
246         providerName = value;
247     }
248
249     /**
250      * Sets the registry with which this plug-in descriptor is associated.
251      * This object must not be read-only.
252      *
253      * @param value the registry with which this plug-in is associated.
254      * May be <code>null</code>.
255      */

256     public void setRegistry(PluginRegistryModel value) {
257         assertIsWriteable();
258         registry = value;
259     }
260
261     /**
262      * Sets the prerequisites of this plug-in.
263      * This object must not be read-only.
264      *
265      * @param value the prerequisites of this plug-in. May be <code>null</code>.
266      */

267     public void setRequires(PluginPrerequisiteModel[] value) {
268         assertIsWriteable();
269         requires = value;
270     }
271
272     /**
273      * Sets the libraries configured for this plug-in.
274      * This object must not be read-only.
275      *
276      * @param value the libraries configured for this plug-in. May be <code>null</code>.
277      */

278     public void setRuntime(LibraryModel[] value) {
279         assertIsWriteable();
280         runtime = value;
281     }
282
283     /**
284      * Sets the version name of this plug-in. The version number
285      * is canonicalized.
286      * This object must not be read-only.
287      *
288      * @param value the version name of this plug-in.
289      * May be <code>null</code>.
290      */

291     public void setVersion(String JavaDoc value) {
292         assertIsWriteable();
293         version = new PluginVersionIdentifier(value).toString();
294     }
295
296     /**
297      * Returns the manifest schema version of this plug-in. The version number is
298      * canonicalized.
299      * <p>
300      * The manifest schema version indicates which shape of plug-in manifest this is.
301      * This was introduced in 3.0; plug-ins created prior to then did not explicitly
302      * declare a manifest schema version.
303      * </p>
304      *
305      * @return the manifest schema version of this plug-in.
306      * May be <code>null</code>.
307      * @since 3.0
308      */

309     public String JavaDoc getSchemaVersion() {
310         return schemaVersion;
311     }
312
313     /**
314      * Sets the manifest schema version of this plug-in. The version number is
315      * canonicalized. This object must not be read-only.
316      * <p>
317      * The manifest schema version indicates which shape of plug-in manifest this is.
318      * This was introduced in 3.0; plug-ins created prior to then did not explicitly
319      * declare a manifest schema version.
320      * </p>
321      *
322      * @param value the manifest schema version of this plug-in.
323      * May be <code>null</code>.
324      * @since 3.0
325      */

326     public void setSchemaVersion(String JavaDoc value) {
327         assertIsWriteable();
328         if (value == null)
329             schemaVersion = null;
330         else
331             schemaVersion = new PluginVersionIdentifier(value).toString();
332     }
333
334 }
335
Popular Tags