KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > IPluginPrerequisite


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;
12
13 import org.eclipse.osgi.service.resolver.State;
14 import org.eclipse.osgi.util.ManifestElement;
15 import org.osgi.framework.Constants;
16
17 /**
18  * A prerequisite entry declared by a plug-in. The declaration causes
19  * classes defined by the prerequisite plug-in to be visible
20  * to the plug-in that declared the dependency.
21  * <p>
22  * This interface is not intended to be implemented by developers.
23  * </p>
24  *
25  * @see IPluginDescriptor#getPluginPrerequisites()
26  * @deprecated
27  * In Eclipse 3.0 the plug-in prerequisite representation was changed. Clients of
28  * <code>IPluginPrerequisite</code> are directed to the headers associated with the relevant bundle.
29  * In particular, the <code>Require-Bundle</code> header contains all available information
30  * about the prerequisites of a plug-in. Having retrieved the header, the {@link ManifestElement}
31  * helper class can be used to parse the value and discover the individual
32  * prerequisite plug-ins. The various header attributes are defined in {@link Constants}.
33  * <p>For example,
34  * <pre> String header = bundle.getHeaders().get(Constants.REQUIRE_BUNDLE);
35  * ManifestElement[] elements = ManifestElement.parseHeader(
36  * Constants.REQUIRE_BUNDLE, header);
37  * if (elements == null)
38  * return;
39  * elements[0].getValue(); // the prerequisite plug-in id
40  * elements[0].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); // the prerequisite plug-in version
41  * ...
42  * </pre>
43  * </p><p>
44  * See {@link IPluginDescriptor} for information on the relationship between plug-in
45  * descriptors and bundles.
46  * </p><p>
47  * This interface must only be used by plug-ins
48  * which explicitly require the org.eclipse.core.runtime.compatibility plug-in.
49  * </p>
50  */

51 public interface IPluginPrerequisite {
52     /**
53      * Returns the actual version identifier that is used
54      * at runtime to resolve this prerequisite dependency,
55      * or null, if the dependency is not resolved.
56      *
57      * @return the plug-in version identifier, or null
58      * @deprecated Callers of this method should interrogate the current {@link State}
59      * of the platform. For example,
60      * <pre>
61      * State state = Platform.getPlatformAdmin().getState();
62      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
63      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
64      * BundleDescription prereq = spec.getSupplier();
65      * </pre>
66      */

67     public PluginVersionIdentifier getResolvedVersionIdentifier();
68
69     /**
70      * Returns the plug-in identifier of the prerequisite plug-in.
71      *
72      * @return the plug-in identifier
73      * @deprecated Given a manifest element equivalent of a plug-in
74      * prerequisite (see the class comment), this method is replaced by:
75      * <pre>
76      * element.getValue();
77      * </pre>
78      */

79     public String JavaDoc getUniqueIdentifier();
80
81     /**
82      * Returns the version identifier of the prerequisite plug-in,
83      * or <code>null</code> if none.
84      *
85      * @return the plug-in version identifier, or <code>null</code> if
86      * none was specified
87      * @deprecated Callers of this method should interrogate the current {@link State}
88      * of the platform. For example,
89      * <pre>
90      * State state = Platform.getPlatformAdmin().getState();
91      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
92      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
93      * Version reqMinVersion = spec.getVersionRange().getMinimum();
94      * </pre>
95      */

96     public PluginVersionIdentifier getVersionIdentifier();
97
98     /**
99      * Indicates whether this prerequisite plug-in is further exposed to any
100      * plug-ins that declare a dependency on this plug-in. This allows
101      * for chaining of dependencies. For example, if plug-in A depends
102      * on plug-in B which depends on plug-in C, the classes from C
103      * are typically visible to B, but not to A. A can get around this
104      * if either B explicitly exports its dependency on C, or
105      * A explicitly declares C as a prerequisite in addition to B.
106      *
107      * @return <code>true</code> if this prerequisite plug-in is exposed,
108      * <code>false</code> otherwise
109      * @deprecated Given a manifest element equivalent of a plug-in
110      * prerequisite (see the class comment), this method is replaced by:
111      * <pre>
112      * element.getAttribute(Constants.REPROVIDE_ATTRIBUTE);
113      * </pre>
114      */

115     public boolean isExported();
116
117     /**
118      * Indicates that this plug-in prerequisite can be resolved
119      * against a configured plug-in with an identifier that is
120      * greater than or equal to it.
121      *
122      * @return <code>true</code> if greater or equal match is allowed,
123      * <code>false</code> otherwise.
124      * @since 2.0
125      * @deprecated Callers of this method should interrogate the current {@link State}
126      * of the platform. For example,
127      * <pre>
128      * State state = Platform.getPlatformAdmin().getState();
129      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
130      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
131      * VersionRange versionRange = spec.getVersionRange();
132      * if (versionRange == null || versionRange.getMinimum() == null)
133      * return false;
134      * Version minimum = versionRange.getMinimum();
135      * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
136      * if (maximum.equals(Version.maxVersion))
137      * return true;
138      * return false;
139      * </pre>
140      */

141     public boolean isMatchedAsGreaterOrEqual();
142
143     /**
144      * Indicates that this plug-in prerequisite can be resolved
145      * against a configured plug-in with a compatible identifier.
146      *
147      * @return <code>true</code> if compatible match is allowed,
148      * <code>false</code> if exact match is required.
149      * @deprecated Callers of this method should interrogate the current {@link State}
150      * of the platform. For example,
151      * <pre>
152      * State state = Platform.getPlatformAdmin().getState();
153      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
154      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
155      * VersionRange versionRange = spec.getVersionRange();
156      * if (versionRange == null || versionRange.getMinimum() == null)
157      * return false;
158      * Version minimum = versionRange.getMinimum();
159      * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
160      * if (!minimum.isInclusive() || maximum.isInclusive())
161      * return false;
162      * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
163      * return true;
164      * return false;
165      * </pre>
166      */

167     public boolean isMatchedAsCompatible();
168
169     /**
170      * Indicates that this plug-in prerequisite can only be resolved
171      * against a configured plug-in with an equivalent plug-in
172      * identifier.
173      *
174      * @return <code>true</code> if only equivalent identifier match
175      * satisfies this dependency, <code>false</code> otherwise.
176      * @since 2.0
177      * @deprecated Callers of this method should interrogate the current {@link State}
178      * of the platform. For example,
179      * <pre>
180      * State state = Platform.getPlatformAdmin().getState();
181      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
182      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
183      * VersionRange versionRange = spec.getVersionRange();
184      * if (versionRange == null || versionRange.getMinimum() == null)
185      * return false;
186      * Version minimum = versionRange.getMinimum();
187      * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
188      * if (!minimum.isInclusive() || maximum.isInclusive())
189      * return false;
190      * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
191      * return false;
192      * else if (minimum.getMajorComponent() != maximum.getMajorComponent())
193      * return false;
194      * else if (minimum.getMinorComponent() == maximum.getMinorComponent() - 1)
195      * return true;
196      * return false;
197      * </pre>
198      */

199     public boolean isMatchedAsEquivalent();
200
201     /**
202      * Indicates that this plug-in prerequisite can only be resolved
203      * against a configured plug-in with a plug-in identifier that
204      * is perfectly equal.
205      *
206      * @return <code>true</code> if only perfectly equal
207      * identifier match satisfies this dependency,
208      * <code>false</code> otherwise.
209      * @since 2.0
210      * @deprecated Callers of this method should interrogate the current {@link State}
211      * of the platform. For example,
212      * <pre>
213      * State state = Platform.getPlatformAdmin().getState();
214      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
215      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
216      * VersionRange versionRange = spec.getVersionRange();
217      * if (versionRange == null || versionRange.getMinimum() == null)
218      * return false;
219      * Version minimum = versionRange.getMinimum();
220      * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
221      * if (minimum.equals(maximum))
222      * return true;
223      * return false;
224      * </pre>
225      */

226     public boolean isMatchedAsPerfect();
227
228     /**
229      * Indicates that this plug-in prerequisite can only be resolved
230      * against a configured plug-in with exactly the same plug-in
231      * identifier.
232      *
233      * @return <code>true</code> if only exact identifier match
234      * satisfies this dependency, <code>false</code> if compatible
235      * plug-in will satisfy this dependency.
236      * @deprecated Callers of this method should interrogate the current {@link State}
237      * of the platform. For example,
238      * <pre>
239      * State state = Platform.getPlatformAdmin().getState();
240      * BundleDescription bundle = state.getBundle("my plug-in id", my plug-in version);
241      * BundleSpecification spec = bundle.getRequiredBundle("required plug-in id");
242      * VersionRange versionRange = spec.getVersionRange();
243      * if (versionRange == null || versionRange.getMinimum() == null)
244      * return false;
245      * Version minimum = versionRange.getMinimum();
246      * Version maximum = versionRange.getMaximum() == null ? Version.maxVersion : versionRange.getMaximum();
247      * if (!minimum.isInclusive() || maximum.isInclusive())
248      * return false;
249      * else if (minimum.getMajorComponent() == maximum.getMajorComponent() - 1)
250      * return false;
251      * else if (minimum.getMajorComponent() != maximum.getMajorComponent())
252      * return false;
253      * else if (minimum.getMinorComponent() == maximum.getMinorComponent() - 1)
254      * return true;
255      * return false;
256      * </pre>
257      */

258     public boolean isMatchedAsExact();
259
260     /**
261      * Indicates whether this plug-in prerequisite is optional. If a required (i.e., non-optional)
262      * prerequisite is missing, this plugin is disabled.
263      *
264      * @return <code>true</code> if this prerequisite is optional, <code>false</code> otherwise
265      * @deprecated Given a manifest element equivalent of a plug-in
266      * prerequisite (see the class comment), this method is replaced by:
267      * <pre>
268      * "true".equals(element.getAttribute(Constants.OPTIONAL_ATTRIBUTE);
269      * </pre>
270      */

271     public boolean isOptional();
272 }
273
Popular Tags