diff options
author | Thomas Watson | 2012-02-22 17:30:26 +0000 |
---|---|---|
committer | Thomas Watson | 2012-02-22 19:40:25 +0000 |
commit | 61b4c49d88895f2c7cc9760a8d74816f7206f7f4 (patch) | |
tree | adc3e9fe674a5438ed8de06a408957ded63cc0a9 /bundles/org.eclipse.osgi/osgi/src/org/osgi/framework | |
parent | 86ebd7592f8ec2cd63934c99f50e15dace1f90c6 (diff) | |
download | rt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.tar.gz rt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.tar.xz rt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.zip |
Bug 371997 - org.eclipse.osgi needs to be updated with the newv20120222-1940
org.osgi.framework.namespace package
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi/src/org/osgi/framework')
24 files changed, 998 insertions, 1119 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java index 96cd89a60..bc8954d89 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1078,7 +1078,7 @@ public interface Bundle extends Comparable<Bundle> { * This method is intended to be used to obtain configuration, setup, * localization and other information from this bundle. This method takes * into account that the "contents" of this bundle can be extended - * with fragments. This "bundle space" is not a name space with + * with fragments. This "bundle space" is not a namespace with * unique members; the same entry name can be present multiple times. This * method therefore returns an enumeration of URL objects. These URLs can * come from different JARs but have the same path name. This method can diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java index bab1ac06b..f65f518fc 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -133,7 +133,7 @@ public final class CapabilityPermission extends BasicPermission { * <li>location - The location of the bundle providing the capability.</li> * <li>id - The bundle ID of the bundle providing the capability.</li> * <li>name - The symbolic name of the bundle providing the capability.</li> - * <li>capability.namespace - The name space of the required capability.</li> + * <li>capability.namespace - The namespace of the required capability.</li> * </ul> * Since the above attribute names may conflict with attribute names of a * capability, you can prefix an attribute name with '@' in the filter @@ -146,9 +146,9 @@ public final class CapabilityPermission extends BasicPermission { * {@code require} permission allows the owner of this permission to require * a capability matching the attributes. The {@code provide} permission * allows the bundle to provide a capability in the specified capability - * name space. + * namespace. * - * @param name The capability name space or a filter over the attributes. + * @param name The capability namespace or a filter over the attributes. * @param actions {@code require},{@code provide} (canonical order) * @throws IllegalArgumentException If the specified name is a filter * expression and either the specified action is not {@code require} @@ -170,7 +170,7 @@ public final class CapabilityPermission extends BasicPermission { * constructor cannot be added to a {@code CapabilityPermission} permission * collection. * - * @param namespace The requested capability name space. + * @param namespace The requested capability namespace. * @param attributes The requested capability attributes. * @param providingBundle The bundle providing the requested capability. * @param actions The action {@code require}. diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java index 9a86f456a..817a7c125 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.osgi.framework; +import org.osgi.framework.hooks.bundle.CollisionHook; import org.osgi.framework.launch.Framework; /** @@ -1163,8 +1164,9 @@ public interface Constants { /** * Framework launching property specifying the trust repositories used by * the framework. The value is a {@code java.io.File.pathSeparator} - * separated list of valid file paths to files that contain key stores of - * type {@code JKS}. The framework will use the key stores as trust + * separated list of valid file paths to files that contain key stores. Key + * stores of type {@code JKS} must be supported and other key store types + * may be supported. The framework will use the key stores as trust * repositories to authenticate certificates of trusted signers. The key * stores are only used as read-only trust repositories to access public * keys. No passwords are required to access the key stores' public keys. @@ -1290,7 +1292,7 @@ public interface Constants { * persists across multiple Framework invocations. * * <p> - * By convention, every bundle has its own unique name space, starting with + * By convention, every bundle has its own unique namespace, starting with * the bundle's identifier (see {@link Bundle#getBundleId()}) and followed * by a dot (.). A bundle may use this as the prefix of the persistent * identifiers for the services it registers. @@ -1660,12 +1662,11 @@ public interface Constants { * {@link #BUNDLE_VERSION version} may be installed. * * <p> - * Default value is {@link #FRAMEWORK_BSNVERSION_SINGLE single} in this - * release of the specification. This default may change to - * {@link #FRAMEWORK_BSNVERSION_MULTIPLE multiple} in a future specification - * release. Therefore, code must not assume the default behavior is - * {@code single} and should interrogate the value of this property to - * determine the behavior. + * Default value is {@link #FRAMEWORK_BSNVERSION_MANAGED managed} in this + * release of the specification. This default may change in a future + * specification release. Therefore, code must not assume the default + * behavior is {@code managed} and should interrogate the value of this + * property to determine the behavior. * * <p> * The value of this property may be retrieved by calling the @@ -1673,6 +1674,7 @@ public interface Constants { * * @see #FRAMEWORK_BSNVERSION_MULTIPLE * @see #FRAMEWORK_BSNVERSION_SINGLE + * @see #FRAMEWORK_BSNVERSION_MANAGED * @since 1.6 */ String FRAMEWORK_BSNVERSION = "org.osgi.framework.bsnversion"; @@ -1694,6 +1696,22 @@ public interface Constants { * * @since 1.6 * @see #FRAMEWORK_BSNVERSION + * @see BundleException#DUPLICATE_BUNDLE_ERROR */ String FRAMEWORK_BSNVERSION_SINGLE = "single"; + + /** + * Specifies the framework must consult the {@link CollisionHook bundle + * collision hook} services to determine if it will be an error to install a + * bundle or update a bundle to have the same symbolic name and version as + * another installed bundle. If no bundle collision hook services are + * registered, then it will be an error to install a bundle or update a + * bundle to have the same symbolic name and version as another installed + * bundle. + * + * @since 1.7 + * @see #FRAMEWORK_BSNVERSION + * @see BundleException#DUPLICATE_BUNDLE_ERROR + */ + String FRAMEWORK_BSNVERSION_MANAGED = "managed"; } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java index f7358d518..9f4ee5c02 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,18 @@ import java.util.Collection; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; /** * OSGi Framework Bundle Collision Hook Service. * * <p> - * Bundles registering this service will be called during framework bundle - * install and update operations to determine if an install or update operation - * will result in a bundle symbolic name and version collision. + * If the framework was launched with the {@link Constants#FRAMEWORK_BSNVERSION + * org.osgi.framework.bsnversion} framework launching property set to + * {@link Constants#FRAMEWORK_BSNVERSION_MANAGED managed}, then bundles + * registering this service will be called during framework bundle install and + * update operations to determine if an install or update operation will result + * in a bundle symbolic name and version collision. * * @ThreadSafe * @version $Id$ diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java index 8ba035202..3db4f8cf3 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,8 @@ package org.osgi.framework.hooks.resolver; import java.util.Collection; import org.osgi.framework.Bundle; -import org.osgi.framework.resource.ResourceConstants; +import org.osgi.framework.namespace.BundleNamespace; +import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.framework.wiring.BundleCapability; import org.osgi.framework.wiring.BundleRequirement; import org.osgi.framework.wiring.BundleRevision; @@ -60,52 +61,51 @@ import org.osgi.framework.wiring.FrameworkWiring; * * <li>Determine the collection of unresolved bundle revisions that may be * considered for resolution during the current resolution process and place - * each of the bundle revisions in a shrinkable collection {@code Resolvable}. For each - * resolver hook call the {@link #filterResolvable(Collection)} method with the - * shrinkable collection {@code Resolvable}.</li> - * <li>The shrinkable collection {@code Resolvable} now contains all the unresolved - * bundle revisions that may end up as resolved at the end of the current - * resolve process. Any other bundle revisions that got removed from the - * shrinkable collection {@code Resolvable} must not end up as resolved at the end of the - * current resolve process.</li> + * each of the bundle revisions in a shrinkable collection {@code Resolvable}. + * For each resolver hook call the {@link #filterResolvable(Collection)} method + * with the shrinkable collection {@code Resolvable}.</li> + * <li>The shrinkable collection {@code Resolvable} now contains all the + * unresolved bundle revisions that may end up as resolved at the end of the + * current resolve process. Any other bundle revisions that got removed from the + * shrinkable collection {@code Resolvable} must not end up as resolved at the + * end of the current resolve process.</li> * <li>For each bundle revision {@code B} left in the shrinkable collection - * {@code Resolvable} and any bundle revision {@code B} which is currently resolved - * that represents a singleton bundle do the following: + * {@code Resolvable} and any bundle revision {@code B} which is currently + * resolved that represents a singleton bundle do the following: * <p/> - * Determine the collection of available capabilities that have a name space of - * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity}, are singletons, - * and have the same symbolic name as the singleton bundle revision {@code B} - * and place each of the matching capabilities into a shrinkable collection - * {@code Collisions}. + * Determine the collection of available capabilities that have a namespace of + * {@link IdentityNamespace osgi.identity}, are singletons, and have the same + * symbolic name as the singleton bundle revision {@code B} and place each of + * the matching capabilities into a shrinkable collection {@code Collisions}. * <p/> - * Remove the {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} - * capability provided by bundle revision {@code B} from shrinkable collection - * {@code Collisions}. A singleton bundle cannot collide with itself. + * Remove the {@link IdentityNamespace osgi.identity} capability provided by + * bundle revision {@code B} from shrinkable collection {@code Collisions}. A + * singleton bundle cannot collide with itself. * <p/> * For each resolver hook call the * {@link #filterSingletonCollisions(BundleCapability, Collection)} with the - * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} capability - * provided by bundle revision {@code B} and the shrinkable collection {@code Collisions} + * {@link IdentityNamespace osgi.identity} capability provided by bundle + * revision {@code B} and the shrinkable collection {@code Collisions} * <p/> * The shrinkable collection {@code Collisions} now contains all singleton - * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} capabilities that - * can influence the ability of bundle revision {@code B} to resolve. + * {@link IdentityNamespace osgi.identity} capabilities that can influence the + * ability of bundle revision {@code B} to resolve. * <p/> - * If the bundle revision {@code B} is already resolved then any resolvable - * bundle revision contained in the collection {@code Collisions} is not - * allowed to resolve. - * </li> + * If the bundle revision {@code B} is already resolved then any resolvable + * bundle revision contained in the collection {@code Collisions} is not allowed + * to resolve.</li> * <li>During a resolve process a framework is free to attempt to resolve any or - * all bundles contained in shrinkable collection {@code Resolvable}. For each bundle - * revision {@code B} left in the shrinkable collection {@code Resolvable} which the - * framework attempts to resolve the following steps must be followed: + * all bundles contained in shrinkable collection {@code Resolvable}. For each + * bundle revision {@code B} left in the shrinkable collection + * {@code Resolvable} which the framework attempts to resolve the following + * steps must be followed: * <p/> * For each requirement {@code R} specified by bundle revision {@code B} * determine the collection of capabilities that satisfy (or match) the * requirement and place each matching capability into a shrinkable collection - * {@code Candidates}. A capability is considered to match a particular requirement if - * its attributes satisfy a specified requirement and the requirer bundle has - * permission to access the capability. + * {@code Candidates}. A capability is considered to match a particular + * requirement if its attributes satisfy a specified requirement and the + * requirer bundle has permission to access the capability. * * <p/> * For each resolver hook call the @@ -113,10 +113,10 @@ import org.osgi.framework.wiring.FrameworkWiring; * {@code R} and the shrinkable collection {@code Candidates}. * * <p/> - * The shrinkable collection {@code Candidates} now contains all the capabilities that - * may be used to satisfy the requirement {@code R}. Any other capabilities that - * got removed from the shrinkable collection {@code Candidates} must not be used to - * satisfy requirement {@code R}.</li> + * The shrinkable collection {@code Candidates} now contains all the + * capabilities that may be used to satisfy the requirement {@code R}. Any other + * capabilities that got removed from the shrinkable collection + * {@code Candidates} must not be used to satisfy requirement {@code R}.</li> * <li>For each resolver hook call the {@link #end()} method to inform the hooks * about a resolve process ending.</li> * </ol> @@ -156,20 +156,18 @@ public interface ResolverHook { * represents a singleton capability and the specified collection represent * a collection of singleton capabilities which are considered collision * candidates. The singleton capability and the collection of collision - * candidates must all use the same name space. + * candidates must all use the same namespace. * <p> - * Currently only capabilities with the name space of - * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} and - * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} can be - * singletons. The collision candidates will all have the same name space, - * be singletons, and have the same symbolic name as the specified - * singleton capability. + * Currently only capabilities with the namespace of {@link BundleNamespace + * osgi.wiring.bundle} and {@link IdentityNamespace osgi.identity} can be + * singletons. The collision candidates will all have the same namespace, be + * singletons, and have the same symbolic name as the specified singleton + * capability. * <p> - * In the future, capabilities in other name spaces may support the - * singleton concept. Hook implementations should be prepared to receive - * calls to this method for capabilities in name spaces other than - * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} or - * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity}. + * In the future, capabilities in other namespaces may support the singleton + * concept. Hook implementations should be prepared to receive calls to this + * method for capabilities in namespaces other than {@link BundleNamespace + * osgi.wiring.bundle} or {@link IdentityNamespace osgi.identity}. * <p> * This method can filter the list of collision candidates by removing * potential collisions. Removing a collision candidate will allow the @@ -182,18 +180,20 @@ public interface ResolverHook { void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates); /** - * Filter matches hook method. This method is called during the resolve process for the - * specified requirement. The collection of candidates match the specified requirement. - * This method can filter the collection of matching candidates by removing candidates from - * the collection. Removing a candidate will prevent the resolve process from choosing the - * removed candidate to satisfy the requirement. + * Filter matches hook method. This method is called during the resolve + * process for the specified requirement. The collection of candidates match + * the specified requirement. This method can filter the collection of + * matching candidates by removing candidates from the collection. Removing + * a candidate will prevent the resolve process from choosing the removed + * candidate to satisfy the requirement. * <p> - * All of the candidates will have the same name space and will - * match the specified requirement. + * All of the candidates will have the same namespace and will match the + * specified requirement. * <p> - * If the Java Runtime Environment supports permissions then the collection of - * candidates will only contain candidates for which the requirer has permission to - * access. + * If the Java Runtime Environment supports permissions then the collection + * of candidates will only contain candidates for which the requirer has + * permission to access. + * * @param requirement the requirement to filter candidates for * @param candidates a collection of candidates that match the requirement */ diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java new file mode 100644 index 000000000..383e84df9 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Wiring Capability and Requirement Namespaces base class. + * + * <p> + * This class is the common class shared by all OSGi defined wiring namespaces. + * It defines the names for the common attributes and directives for the OSGi + * specified wiring namespaces. + * + * <p> + * The values associated with these keys are of type {@code String}, unless + * otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public abstract class AbstractWiringNamespace extends Namespace { + + /** + * The capability directive used to specify the comma separated list of + * mandatory attributes which must be specified in the + * {@link Namespace#REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in + * order for the capability to match the requirement. + */ + public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory"; + + /** + * The capability attribute contains the {@code Version} of the resource + * providing the capability if one is specified or {@code 0.0.0} if not + * specified. The value of this attribute must be of type {@code Version}. + */ + public static final String CAPABILITY_BUNDLE_VERSION_ATTRIBUTE = "bundle-version"; + + AbstractWiringNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java new file mode 100644 index 000000000..79a5a14a9 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Bundle Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * <p> + * For compatibility with previous versions of the specification all directives + * specified on the {@code Bundle-SymbolicName} header are available to this + * namespace. The directives {@link #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + * fragment-attachment} and {@link #REQUIREMENT_EXTENSION_DIRECTIVE extension} + * should be looked up using the {@link HostNamespace#HOST_NAMESPACE host} + * namespace. The directive {@link #CAPABILITY_SINGLETON_DIRECTIVE singleton} + * should be looked up using the {@link IdentityNamespace#IDENTITY_NAMESPACE + * identity} namespace. Also, the {@link Namespace#CAPABILITY_USES_DIRECTIVE uses} + * directive has no meaning to this namespace. + * <p> + * A non-fragment resource with the {@link IdentityNamespace#TYPE_BUNDLE + * osgi.bundle} type {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE + * identity} provides exactly one<sup>†</sup> bundle capability (that is, + * the bundle can be required by another bundle). A fragment resource with the + * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type + * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare + * a bundle capability. A resource requires zero or more bundle requirements + * (that is, required bundles). + * <p> + * † A resource with no symbolic name must not provide a bundle + * capability. + * + * @Immutable + * @version $Id$ + */ +public final class BundleNamespace extends AbstractWiringNamespace { + + /** + * Namespace name for bundle capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the symbolic name of the + * bundle. + */ + public static final String BUNDLE_NAMESPACE = "osgi.wiring.bundle"; + + /** + * The capability directive identifying if the resource is a singleton. A + * {@code String} value of "true" indicates the resource is a + * singleton; any other value or <code>null</code> indicates the resource is + * not a singleton. + */ + public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton"; + + /** + * The capability directive identifying if and when a fragment may attach to + * a host bundle. The default value is {@link #FRAGMENT_ATTACHMENT_ALWAYS + * always}. + * + * @see #FRAGMENT_ATTACHMENT_ALWAYS + * @see #FRAGMENT_ATTACHMENT_RESOLVETIME + * @see #FRAGMENT_ATTACHMENT_NEVER + */ + public static final String CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment"; + + /** + * The directive value indicating that fragments are allowed to attach to + * the host bundle at any time (while the host is resolved or during the + * process of resolving the host bundle). + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_ALWAYS = "always"; + + /** + * The directive value indicating that fragments are allowed to attach to + * the host bundle only during the process of resolving the host bundle. + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_RESOLVETIME = "resolve-time"; + + /** + * The directive value indicating that no fragments are allowed to attach to + * the host bundle at any time. + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_NEVER = "never"; + + /** + * The requirement directive used to specify the type of the extension + * fragment. + * + * @see #EXTENSION_FRAMEWORK + * @see #EXTENSION_BOOTCLASSPATH + */ + public final static String REQUIREMENT_EXTENSION_DIRECTIVE = "extension"; + + /** + * The directive value indicating that the extension fragment is to be + * loaded by the framework's class loader. + * + * + * @see #REQUIREMENT_EXTENSION_DIRECTIVE + */ + public final static String EXTENSION_FRAMEWORK = "framework"; + + /** + * The directive value indicating that the extension fragment is to be + * loaded by the boot class loader. + * + * @see #REQUIREMENT_EXTENSION_DIRECTIVE + */ + public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath"; + + /** + * The requirement directive used to specify the visibility type for a + * requirement. The default value is {@link #VISIBILITY_PRIVATE private}. + * + * @see #VISIBILITY_PRIVATE private + * @see #VISIBILITY_REEXPORT reexport + */ + public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility"; + + /** + * The directive value identifying a private + * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private + * visibility type indicates that any {@link PackageNamespace packages} that + * are exported by the required bundle are not made visible on the export + * signature of the requiring bundle. . + * + * @see #REQUIREMENT_VISIBILITY_DIRECTIVE + */ + public final static String VISIBILITY_PRIVATE = "private"; + + /** + * The directive value identifying a reexport + * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport + * visibility type indicates any {@link PackageNamespace packages} that are + * exported by the required bundle are re-exported by the requiring bundle. + * + * @see #REQUIREMENT_VISIBILITY_DIRECTIVE + */ + public final static String VISIBILITY_REEXPORT = "reexport"; + + private BundleNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java new file mode 100644 index 000000000..485f581dc --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Contract Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public final class ContractNamespace extends Namespace { + + /** + * Namespace name for contract capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the name of the contract. + */ + public static final String CONTRACT_NAMESPACE = "osgi.contract"; + + /** + * The capability attribute contains the {@code Version} of the + * specification of the contract. The value of this attribute must be of + * type {@code Version}. + */ + public final static String CAPABILITY_VERSION_ATTRIBUTE = "version"; + + private ContractNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java new file mode 100644 index 000000000..e1c30aac8 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Execution Environment Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public final class ExecutionEnvironmentNamespace extends Namespace { + + /** + * Namespace name for execution environment capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the name of the execution + * environment. + */ + public static final String EXECUTION_ENVIRONMENT_NAMESPACE = "osgi.ee"; + + /** + * The capability attribute contains the versions of the execution + * environment. The value of this attribute must be of type + * {@code List<Version>}. + */ + public final static String CAPABILITY_VERSION_ATTRIBUTE = "version"; + + private ExecutionEnvironmentNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java new file mode 100644 index 000000000..2434f81e9 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Extender Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public final class ExtenderNamespace extends Namespace { + + /** + * Namespace name for extender capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the name of the extender. + */ + public static final String EXTENDER_NAMESPACE = "osgi.extender"; + + /** + * The capability attribute contains the {@code Version} of the + * specification of the extender. The value of this attribute must be of + * type {@code Version}. + */ + public final static String CAPABILITY_VERSION_ATTRIBUTE = "version"; + + private ExtenderNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java new file mode 100644 index 000000000..d9482705d --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Host Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * <p> + * For compatibility with previous versions of the specification all directives + * specified on the {@code Bundle-SymbolicName} header are available to this + * namespace. The directive {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} + * should be looked up using the {@link BundleNamespace#BUNDLE_NAMESPACE bundle} + * namespace. The directive {@link #CAPABILITY_SINGLETON_DIRECTIVE singleton} + * should be looked up using the {@link IdentityNamespace#IDENTITY_NAMESPACE + * identity} namespace. Also, the {@link Namespace#CAPABILITY_USES_DIRECTIVE uses} + * directive has no meaning to this namespace. + * <p> + * A non-fragment resource with the with the + * {@link IdentityNamespace#TYPE_BUNDLE osgi.bundle} type + * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} provides zero or + * one<sup>†</sup> host capabilities. A fragment resource with the + * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type + * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare + * a host capability and must declare exactly one host requirement. + * <p> + * † A resource with no bundle symbolic name must not provide a host + * capability. + * + * @Immutable + * @version $Id$ + */ +public final class HostNamespace extends AbstractWiringNamespace { + + /** + * Namespace name for host capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the symbolic name of the + * host. + * + */ + public static final String HOST_NAMESPACE = "osgi.wiring.host"; + + /** + * The capability directive identifying if the resource is a singleton. A + * {@code String} value of "true" indicates the resource is a + * singleton; any other value or <code>null</code> indicates the resource is + * not a singleton. + */ + public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton"; + + /** + * The capability directive identifying if and when a fragment may attach to + * a host bundle. The default value is {@link #FRAGMENT_ATTACHMENT_ALWAYS + * always}. + * + * @see #FRAGMENT_ATTACHMENT_ALWAYS + * @see #FRAGMENT_ATTACHMENT_RESOLVETIME + * @see #FRAGMENT_ATTACHMENT_NEVER + */ + public static final String CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment"; + + /** + * The directive value indicating that fragments are allowed to attach to + * the host bundle at any time (while the host is resolved or during the + * process of resolving the host bundle). + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_ALWAYS = "always"; + + /** + * The directive value indicating that fragments are allowed to attach to + * the host bundle only during the process of resolving the host bundle. + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_RESOLVETIME = "resolve-time"; + + /** + * The directive value indicating that no fragments are allowed to attach to + * the host bundle at any time. + * + * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE + */ + public static final String FRAGMENT_ATTACHMENT_NEVER = "never"; + + /** + * The requirement directive used to specify the type of the extension + * fragment. + * + * @see #EXTENSION_FRAMEWORK + * @see #EXTENSION_BOOTCLASSPATH + */ + public final static String REQUIREMENT_EXTENSION_DIRECTIVE = "extension"; + + /** + * The directive value indicating that the extension fragment is to be + * loaded by the framework's class loader. + * + * + * @see #REQUIREMENT_EXTENSION_DIRECTIVE + */ + public final static String EXTENSION_FRAMEWORK = "framework"; + + /** + * The directive value indicating that the extension fragment is to be + * loaded by the boot class loader. + * + * @see #REQUIREMENT_EXTENSION_DIRECTIVE + */ + public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath"; + + /** + * The requirement directive used to specify the visibility type for a + * requirement. The default value is {@link #VISIBILITY_PRIVATE private}. + * + * @see #VISIBILITY_PRIVATE private + * @see #VISIBILITY_REEXPORT reexport + */ + public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility"; + + /** + * The directive value identifying a private + * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private + * visibility type indicates that any {@link PackageNamespace packages} that + * are exported by the required bundle are not made visible on the export + * signature of the requiring bundle. . + * + * @see #REQUIREMENT_VISIBILITY_DIRECTIVE + */ + public final static String VISIBILITY_PRIVATE = "private"; + + /** + * The directive value identifying a reexport + * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport + * visibility type indicates any {@link PackageNamespace packages} that are + * exported by the required bundle are re-exported by the requiring bundle. + * + * @see #REQUIREMENT_VISIBILITY_DIRECTIVE + */ + public final static String VISIBILITY_REEXPORT = "reexport"; + + private HostNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java new file mode 100644 index 000000000..d033e96e5 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.resource.Namespace; + +/** + * Identity Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * <p> + * Each resource provides exactly one<sup>†</sup> identity capability that + * can be used to identify the resource. + * + * <p> + * The bundle wiring for the bundle revision provides exactly + * one<sup>†</sup> identity capability. + * + * <p> + * † A resource with no symbolic name must not provide an identity + * capability. + * + * @Immutable + * @version $Id$ + */ +public final class IdentityNamespace extends Namespace { + + /** + * Namespace name for identity capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the symbolic name of the + * resource. + */ + public static final String IDENTITY_NAMESPACE = "osgi.identity"; + + /** + * The capability directive identifying if the resource is a singleton. A + * {@code String} value of "true" indicates the resource is a + * singleton; any other value or <code>null</code> indicates the resource is + * not a singleton. + */ + public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton"; + + /** + * The capability attribute identifying the {@code Version} of the resource + * if one is specified or {@code 0.0.0} if not specified. The value of this + * attribute must be of type {@code Version}. + */ + public static final String CAPABILITY_VERSION_ATTRIBUTE = "version"; + + /** + * The capability attribute identifying the resource type. If the resource + * has no type then the value {@link #TYPE_UNKNOWN unknown} must be used for + * the attribute. + * + * @see #TYPE_BUNDLE + * @see #TYPE_FRAGMENT + * @see #TYPE_UNKNOWN + */ + public static final String CAPABILITY_TYPE_ATTRIBUTE = "type"; + + /** + * The attribute value identifying the resource + * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi bundle. + * + * @see #CAPABILITY_TYPE_ATTRIBUTE + */ + public static final String TYPE_BUNDLE = "osgi.bundle"; + + /** + * The attribute value identifying the resource + * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi fragment. + * + * @see #CAPABILITY_TYPE_ATTRIBUTE + */ + public static final String TYPE_FRAGMENT = "osgi.fragment"; + + /** + * The attribute value identifying the resource + * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as unknown. + * + * @see #CAPABILITY_TYPE_ATTRIBUTE + */ + public static final String TYPE_UNKNOWN = "unknown"; + + private IdentityNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java new file mode 100644 index 000000000..df5c7f2f6 --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +/** + * Package Capability and Requirement Namespace. + * + * <p> + * A resource provides zero or more package capabilities (this is, exported + * packages) and requires zero or more package requirements (that is, imported + * packages). + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public final class PackageNamespace extends AbstractWiringNamespace { + + /** + * Namespace name for package capabilities and requirements. + * + * <p> + * Also, the capability attribute used to specify the name of the package. + */ + public static final String PACKAGE_NAMESPACE = "osgi.wiring.package"; + + /** + * The capability directive used to specify the comma separated list of + * classes which must be allowed to be exported. + */ + public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include"; + + /** + * The capability directive used to specify the comma separated list of + * classes which must not be allowed to be exported. + */ + public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude"; + + /** + * The capability attribute contains the {@code Version} of the package if + * one is specified or {@code 0.0.0} if not specified. The value of this + * attribute must be of type {@code Version}. + */ + public final static String CAPABILITY_VERSION_ATTRIBUTE = "version"; + + /** + * The capability attribute contains the symbolic name of the resource + * providing the package. + */ + public final static String CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE = "bundle-symbolic-name"; + + private PackageNamespace() { + // empty + } +} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java deleted file mode 100644 index 1fb855c7c..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -import java.util.Map; - -/** - * A capability that has been declared from a {@link Resource}. - * - * <p> - * Instances of this type must be <i>effectively immutable</i>. That is, for a - * given instance of this interface, the methods defined by this interface must - * always return the same result. - * - * @ThreadSafe - * @version $Id$ - */ -public interface Capability { - - /** - * Returns the name space of this capability. - * - * @return The name space of this capability. - */ - String getNamespace(); - - /** - * Returns the directives of this capability. - * - * <p> - * Only the following list of directives have specified semantics: - * <ul> - * <li> {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective} - * <li> {@link ResourceConstants#CAPABILITY_USES_DIRECTIVE uses} - * <li> {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory} - - * only recognized for the {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE - * osgi.wiring.bundle} and - * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package} - * name spaces. - * <li> {@link ResourceConstants#CAPABILITY_EXCLUDE_DIRECTIVE exclude} - only - * recognized for the {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE - * osgi.wiring.package} name space. - * <li> {@link ResourceConstants#CAPABILITY_INCLUDE_DIRECTIVE include} - only - * recognized for the {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE - * osgi.wiring.package} name space. - * </ul> - * All other directives have no specified semantics and are considered extra - * user defined information. The OSGi Alliance reserves the right to extend - * the set of directives which have specified semantics. - * - * @return An unmodifiable map of directive names to directive values for - * this capability, or an empty map if this capability has no - * directives. - */ - Map<String, String> getDirectives(); - - /** - * Returns the attributes of this capability. - * - * @return An unmodifiable map of attribute names to attribute values for - * this capability, or an empty map if this capability has no - * attributes. - */ - Map<String, Object> getAttributes(); - - /** - * Returns the resource declaring this capability. - * - * @return The resource declaring this capability. - */ - Resource getResource(); - - /** - * Compares this {@code Capability} to another {@code Capability}. - * - * <p> - * This {@code Capability} is equal to another {@code Capability} if they - * have the same name space, directives and attributes and are declared by - * the same resource. - * - * @param obj The object to compare against this {@code Capability}. - * @return {@code true} if this {@code Capability} is equal to the other - * object; {@code false} otherwise. - */ - boolean equals(Object obj); - - /** - * Returns the hashCode of this {@code Capability}. - * - * @return The hashCode of this {@code Capability}. - */ - int hashCode(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java deleted file mode 100644 index 0f28402db..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -import java.util.Map; - -/** - * A requirement that has been declared from a {@link Resource} . - * - * <p> - * Instances of this type must be <i>effectively immutable</i>. That is, for a - * given instance of this interface, the methods defined by this interface must - * always return the same result. - * - * @ThreadSafe - * @version $Id$ - */ -public interface Requirement { - /** - * Returns the name space of this requirement. - * - * @return The name space of this requirement. - */ - String getNamespace(); - - /** - * Returns the directives of this requirement. - * - * <p> - * Only the following list of directives have specified semantics: - * <ul> - * <li> {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective} - * <li> {@link ResourceConstants#REQUIREMENT_FILTER_DIRECTIVE filter} - * <li> {@link ResourceConstants#REQUIREMENT_CARDINALITY_DIRECTIVE - * cardinality} - * <li> {@link ResourceConstants#REQUIREMENT_RESOLUTION_DIRECTIVE resolution} - * <li> {@link ResourceConstants#REQUIREMENT_VISIBILITY_DIRECTIVE visibility} - * - only recognized for the - * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} name - * space. - * </ul> - * All other directives have no specified semantics and are considered extra - * user defined information. The OSGi Alliance reserves the right to extend - * the set of directives which have specified semantics. - * - * @return An unmodifiable map of directive names to directive values for - * this requirement, or an empty map if this requirement has no - * directives. - */ - Map<String, String> getDirectives(); - - /** - * Returns the attributes of this requirement. - * - * <p> - * Requirement attributes have no specified semantics and are considered - * extra user defined information. - * - * @return An unmodifiable map of attribute names to attribute values for - * this requirement, or an empty map if this requirement has no - * attributes. - */ - Map<String, Object> getAttributes(); - - /** - * Returns the resource declaring this requirement. - * - * @return The resource declaring this requirement. - */ - Resource getResource(); - - /** - * Compares this {@code Requirement} to another {@code Requirement}. - * - * <p> - * This {@code Requirement} is equal to another {@code Requirement} if they - * have the same name space, directives and attributes and are declared by - * the same resource. - * - * @param obj The object to compare against this {@code Requirement}. - * @return {@code true} if this {@code Requirement} is equal to the other - * object; {@code false} otherwise. - */ - boolean equals(Object obj); - - /** - * Returns the hashCode of this {@code Requirement}. - * - * @return The hashCode of this {@code Requirement}. - */ - int hashCode(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java deleted file mode 100644 index 4b73a753d..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -import java.util.List; - - -/** - * A resource is the representation of a uniquely identified and typed data. - * - * A resources can be wired together via capabilities and requirements. - * - * <p> - * Instances of this type must be <i>effectively immutable</i>. That is, for a - * given instance of this interface, the methods defined by this interface must - * always return the same result. - * - * @ThreadSafe - * @version $Id$ - */ -public interface Resource { - /** - * Returns the capabilities declared by this resource. - * - * @param namespace The name space of the declared capabilities to return or - * {@code null} to return the declared capabilities from all name - * spaces. - * @return An unmodifiable list containing the declared {@link Capability}s - * from the specified name space. The returned list will be empty if - * this resource declares no capabilities in the specified name - * space. - */ - List<Capability> getCapabilities(String namespace); - - /** - * Returns the requirements declared by this bundle resource. - * - * @param namespace The name space of the declared requirements to return or - * {@code null} to return the declared requirements from all name - * spaces. - * @return An unmodifiable list containing the declared {@link Requirement} - * s from the specified name space. The returned list will be empty - * if this resource declares no requirements in the specified name - * space. - */ - List<Requirement> getRequirements(String namespace); - - /** - * Compares this {@code Resource} to another {@code Resource}. - * - * <p> - * This {@code Resource} is equal to another {@code Resource} if they have - * they both have the same content and come from the same location. Location - * may be defined as the bundle location if the resource is an installed - * bundle or the repository location if the resource is in a repository. - * - * @param obj The object to compare against this {@code Resource}. - * @return {@code true} if this {@code Resource} is equal to the other - * object; {@code false} otherwise. - */ - boolean equals(Object obj); - - /** - * Returns the hashCode of this {@code Resource}. - * - * @return The hashCode of this {@code Resource}. - */ - int hashCode(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java deleted file mode 100644 index ab8d42db8..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -import org.osgi.framework.Constants; -import org.osgi.framework.Version; -import org.osgi.framework.wiring.BundleRevision; -import org.osgi.framework.wiring.BundleWiring; - -/** - * Defines standard names for the attributes, directives and name spaces for - * resources, capabilities and requirements. - * - * <p> - * The values associated with these keys are of type {@code String}, unless - * otherwise indicated. - * - * @Immutable - * @version $Id$ - */ -public final class ResourceConstants { - - private ResourceConstants() { - // keep others from creating objects of this type. - } - - /** - * Name space for the identity capability. Each {@link Resource resource} - * provides exactly one<sup>†</sup> identity capability that can be - * used to identify the resource. - * - * For identity capability attributes the following applies: - * <ul> - * <li>The - * <q>osgi.identity</q> attribute contains the symbolic name of the - * resource. - * <li>The {@link #IDENTITY_VERSION_ATTRIBUTE version} attribute contains - * the {@link Version} of the resource. - * <li>The {@link #IDENTITY_TYPE_ATTRIBUTE type} attribute contains the - * resource type. - * </ul> - * <p> - * A resource with a symbolic name - * {@link Resource#getCapabilities(String) provides} exactly one - * <sup>†</sup> identity - * {@link Resource#getCapabilities(String) capability}. - * <p> - * For a {@link BundleRevision revision} with a symbolic name the - * {@link BundleWiring wiring} for the revision - * {@link BundleWiring#getCapabilities(String) provides} exactly - * one<sup>†</sup> identity capability. - * <p> - * † A resource with no symbolic name must not provide an identity - * capability. - */ - public static final String IDENTITY_NAMESPACE = "osgi.identity"; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the - * {@link Version version} of the resource. This attribute must be set to a value of - * type {@link Version}. If the resource has no version then the value - * {@link Version#emptyVersion 0.0.0} must be used for the attribute. - */ - public static final String IDENTITY_VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the - * resource type. This attribute must be set to a value of type {@link String}. - * if the resource has no type then the value - * {@link ResourceConstants#IDENTITY_TYPE_UNKNOWN unknown} must be used for the - * attribute. - */ - public static final String IDENTITY_TYPE_ATTRIBUTE = "type"; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} - * attribute value identifying the resource type as an OSGi bundle. - */ - public static final String IDENTITY_TYPE_BUNDLE = "osgi.bundle"; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} - * attribute value identifying the resource type as an OSGi fragment. - */ - public static final String IDENTITY_TYPE_FRAGMENT = "osgi.fragment"; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} - * attribute value identifying the resource type as unknown. - */ - public static final String IDENTITY_TYPE_UNKNOWN = "unknown"; - - /** - * An {@link #IDENTITY_NAMESPACE identity} capability {@link Requirement#getDirectives() directive} - * identifying if the resource is a singleton. A {@link String} value of "true" indicates - * the resource is a singleton; any other value or <code>null</code> indicates the resource is not a - * singleton. - */ - public static final String IDENTITY_SINGLETON_DIRECTIVE = Constants.SINGLETON_DIRECTIVE; - - /** - * Name space for package capabilities and requirements. - * - * For capability attributes the following applies: - * <ul> - * <li>The - * <q>osgi.wiring.package</q> attribute contains the name of the package. - * <li>The {@link Constants#VERSION_ATTRIBUTE version} attribute contains - * the the {@link Version} of the package if one is specified or - * {@link Version#emptyVersion} if not specified. - * <li>The {@link Constants#BUNDLE_SYMBOLICNAME_ATTRIBUTE - * bundle-symbolic-name} attribute contains the symbolic name of the - * resource providing the package if one is specified. - * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} - * attribute contains the {@link Version} of resource providing the package - * if one is specified or {@link Version#emptyVersion} if not specified. - * <li>All other attributes are of type {@link String} and are used as - * arbitrary matching attributes for the capability. - * </ul> - * <p> - * A resource provides zero or more package - * {@link Resource#getCapabilities(String) capabilities} (this is, exported - * packages) and requires zero or more package - * {@link Resource#getRequirements(String) requirements} (that is, imported - * packages). - */ - public static final String WIRING_PACKAGE_NAMESPACE = "osgi.wiring.package"; - - /** - * Name space for bundle capabilities and requirements. - * - * For capability attributes the following applies: - * <ul> - * <li>The - * <q>osgi.wiring.bundle</q> attribute contains the symbolic name of the - * bundle. - * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} - * attribute contains the {@link Version} of the bundle if one is specified - * or {@link Version#emptyVersion} if not specified. - * <li>All other attributes are of type {@link String} and are used as - * arbitrary matching attributes for the capability. - * </ul> - * <p> - * A non-fragment resource with the {@link #IDENTITY_TYPE_BUNDLE - * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides - * exactly one <sup>†</sup> bundle - * {@link Resource#getCapabilities(String) capability} (that is, the bundle - * can be required by another bundle). A fragment resource with the - * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type - * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare - * a bundle capability. A resource requires zero or more bundle - * {@link Resource#getRequirements(String) requirements} (that is, required - * bundles). - * <p> - * † A resource with no symbolic name must not provide a bundle - * capability. - */ - public static final String WIRING_BUNDLE_NAMESPACE = "osgi.wiring.bundle"; - - /** - * Name space for host capabilities and requirements. - * - * For capability attributes the following applies: - * <ul> - * <li>The - * <q>osgi.wiring.host</q> attribute contains the symbolic name of the - * bundle. - * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} - * attribute contains the {@link Version} of the bundle if one is specified - * or {@link Version#emptyVersion} if not specified. - * <li>All other attributes are of type {@link String} and are used as - * arbitrary matching attributes for the capability. - * </ul> - * <p> - * <p> - * A non-fragment resource with the with the {@link #IDENTITY_TYPE_BUNDLE - * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides - * zero or one <sup>†</sup> host - * {@link Resource#getCapabilities(String) capabilities}. - * A fragment resource with the - * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type - * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare - * a host capability and must - * {@link Resource#getRequirements(String) declare} exactly one host - * requirement. - * <p> - * † A resource with no bundle symbolic name must not provide a host - * capability. - */ - public static final String WIRING_HOST_NAMESPACE = "osgi.wiring.host"; - - /** - * A requirement {@link Requirement#getDirectives() directive} used to - * specify a capability filter. This filter is used to match against a - * capability's {@link Capability#getAttributes() attributes}. - */ - public final static String REQUIREMENT_FILTER_DIRECTIVE = Constants.FILTER_DIRECTIVE; - - /** - * A requirement {@link Requirement#getDirectives() directive} used to - * specify the resolution type for a requirement. The default value is - * {@link #REQUIREMENT_RESOLUTION_MANDATORY mandatory}. - * - * @see #REQUIREMENT_RESOLUTION_MANDATORY mandatory - * @see #REQUIREMENT_RESOLUTION_OPTIONAL optional - */ - public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE; - /** - * A directive value identifying a mandatory - * {@link Resource#getRequirements(String) requirement} resolution type. A - * mandatory resolution type indicates that the requirement must be resolved - * when the {@link Resource resource} is resolved. If such requirement - * cannot be resolved, the resource fails to resolve. - * - * @see #REQUIREMENT_RESOLUTION_DIRECTIVE - */ - public final static String REQUIREMENT_RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY; - - /** - * A directive value identifying an optional - * {@link Resource#getRequirements(String) requirement} resolution type. An - * optional resolution type indicates that the requirement is optional and - * the {@link Resource resource} may be resolved without requirement being - * resolved. - * - * @see #REQUIREMENT_RESOLUTION_DIRECTIVE - */ - public final static String REQUIREMENT_RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL; - - /** - * A requirement {@link Requirement#getDirectives() directive} used to - * specify the effective time for the requirement. The default value is - * {@link #EFFECTIVE_RESOLVE resolve}. - * - * @see #EFFECTIVE_RESOLVE resolve - * @see #EFFECTIVE_ACTIVE active - */ - public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; - - /** - * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE - * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that - * is effective at resolve time. Capabilities and requirements with an - * effective time of resolve are the only capabilities which are processed - * while resolving a resource. - * - * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE - * @see #CAPABILITY_EFFECTIVE_DIRECTIVE - */ - public final static String EFFECTIVE_RESOLVE = Constants.EFFECTIVE_RESOLVE; - - /** - * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE - * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that - * is effective at active time. Capabilities and requirements with an - * effective time of active are ignored while resolving a resource. - * - * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE - * @see #CAPABILITY_EFFECTIVE_DIRECTIVE - */ - public final static String EFFECTIVE_ACTIVE = Constants.EFFECTIVE_ACTIVE; - - /** - * A requirement {@link Requirement#getDirectives() directive} used to - * specify the visibility type for a requirement. The default value is - * {@link #REQUIREMENT_VISIBILITY_PRIVATE private}. This directive must only - * be used for requirements with the require - * {@link #WIRING_BUNDLE_NAMESPACE bundle} name space. - * - * @see #REQUIREMENT_VISIBILITY_PRIVATE private - * @see #REQUIREMENT_VISIBILITY_REEXPORT reexport - */ - public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = Constants.VISIBILITY_DIRECTIVE; - - /** - * A directive value identifying a private - * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private - * visibility type indicates that any {@link #WIRING_PACKAGE_NAMESPACE - * packages} that are exported by the required - * {@link #WIRING_BUNDLE_NAMESPACE bundle} are not made visible on the - * export signature of the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle} - * . - * - * @see #REQUIREMENT_VISIBILITY_DIRECTIVE - */ - public final static String REQUIREMENT_VISIBILITY_PRIVATE = Constants.VISIBILITY_PRIVATE; - - /** - * A directive value identifying a reexport - * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport - * visibility type indicates any {@link #WIRING_PACKAGE_NAMESPACE packages} - * that are exported by the required {@link #WIRING_BUNDLE_NAMESPACE bundle} - * are re-exported by the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}. - */ - public final static String REQUIREMENT_VISIBILITY_REEXPORT = Constants.VISIBILITY_REEXPORT; - - /** - * A requirement {@link Requirement#getDirectives() directive} used to - * specify the cardinality for a requirement. The default value is - * {@link #REQUIREMENT_CARDINALITY_SINGULAR singular}. - * - * @see #REQUIREMENT_CARDINALITY_MULTIPLE multiple - * @see #REQUIREMENT_CARDINALITY_SINGULAR singular - */ - public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality"; - - /** - * A directive value identifying a multiple - * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. - */ - public final static String REQUIREMENT_CARDINALITY_MULTIPLE = "multiple"; - - /** - * A directive value identifying a singular - * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. - */ - public final static String REQUIREMENT_CARDINALITY_SINGULAR = "singular"; - - - /** - * A capability {@link Capability#getDirectives() directive} used to specify - * the comma separated list of {@link #WIRING_PACKAGE_NAMESPACE package} - * names a capability uses. - */ - public final static String CAPABILITY_USES_DIRECTIVE = Constants.USES_DIRECTIVE; - - /** - * A capability {@link Capability#getDirectives() directive} used to specify - * the effective time for the capability. The default value is - * {@link #EFFECTIVE_RESOLVE resolve}. - * - * @see #EFFECTIVE_RESOLVE resolve - * @see #EFFECTIVE_ACTIVE active - */ - public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; - - /** - * A capability {@link Capability#getDirectives() directive} used to specify - * the comma separated list of mandatory attributes which must be specified - * in the {@link #REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in - * order for the capability to match the requirement. This directive must - * only be used for capabilities with the {@link #WIRING_PACKAGE_NAMESPACE - * package}, {@link #WIRING_BUNDLE_NAMESPACE bundle}, or - * {@link #WIRING_HOST_NAMESPACE host} name space. - */ - public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory"; - - /** - * A capability {@link Capability#getDirectives() directive} used to specify - * the comma separated list of classes which must be allowed to be exported. - * This directive must only be used for capabilities with the - * {@link #WIRING_PACKAGE_NAMESPACE package} name space. - */ - public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include"; - - /** - * A capability {@link Capability#getDirectives() directive} used to specify - * the comma separated list of classes which must not be allowed to be - * exported. This directive must only be used for capabilities with the - * {@link #WIRING_PACKAGE_NAMESPACE package} name space. - */ - public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude"; -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java deleted file mode 100644 index 7cab76f1c..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -/** - * A wire connecting a {@link Capability} to a {@link Requirement}. - * - * <p> - * Instances of this type must be <i>effectively immutable</i>. That is, for a - * given instance of this interface, the methods defined by this interface must - * always return the same result. - * - * @ThreadSafe - * @version $Id$ - */ -public interface Wire { - /** - * Returns the {@link Capability} for this wire. - * - * @return The {@link Capability} for this wire. - */ - Capability getCapability(); - - /** - * Returns the {@link Requirement} for this wire. - * - * @return The {@link Requirement} for this wire. - */ - Requirement getRequirement(); - - /** - * Returns the resource providing the {@link #getCapability() capability}. - * <p> - * The returned resource may differ from the resource referenced by the - * {@link #getCapability() capability}. - * - * @return The resource providing the capability. - */ - Resource getProvider(); - - /** - * Returns the resource who {@link #getRequirement() requires} the - * {@link #getCapability() capability}. - * <p> - * The returned resource may differ from the resource referenced by the - * {@link #getRequirement() requirement}. - * - * @return The resource who requires the capability. - */ - Resource getRequirer(); - - /** - * Compares this {@code Wire} to another {@code Wire}. - * - * <p> - * This {@code Wire} is equal to another {@code Wire} if they have the same - * capability, requirement, provider and requirer. - * - * @param obj The object to compare against this {@code Wire}. - * @return {@code true} if this {@code Wire} is equal to the other object; - * {@code false} otherwise. - */ - boolean equals(Object obj); - - /** - * Returns the hashCode of this {@code Wire}. - * - * @return The hashCode of this {@code Wire}. - */ - int hashCode(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java deleted file mode 100644 index ac9bdc86f..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.framework.resource; - -import java.util.List; - -/** - * A wiring for a resource. A wiring is associated with a resource and - * represents the dependencies with other wirings. - * - * <p> - * Instances of this type must be <i>effectively immutable</i>. That is, for a - * given instance of this interface, the methods defined by this interface must - * always return the same result. - * - * @ThreadSafe - * @version $Id$ - */ -public interface Wiring { - /** - * Returns the capabilities provided by this wiring. - * - * <p> - * Only capabilities considered by the resolver are returned. For example, - * capabilities with - * {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective} - * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE - * resolve} are not returned. - * - * <p> - * A capability may not be required by any wiring and thus there may be no - * {@link #getProvidedResourceWires(String) wires} for the capability. - * - * <p> - * A wiring for a non-fragment resource provides a subset of the declared - * capabilities from the resource and all attached fragment - * resources<sup>†</sup>. Not all declared capabilities may be - * provided since some may be discarded. For example, if a package is - * declared to be both exported and imported, only one is selected and the - * other is discarded. - * <p> - * A wiring for a fragment resource with a symbolic name must provide - * exactly one {@link ResourceConstants#IDENTITY_NAMESPACE identity} - * capability. - * <p> - * † The {@link ResourceConstants#IDENTITY_NAMESPACE identity} - * capability provided by attached fragment resource must not be included in - * the capabilities of the host wiring. - * - * @param namespace The name space of the capabilities to return or - * {@code null} to return the capabilities from all name spaces. - * @return A list containing a snapshot of the {@link Capability}s, or an - * empty list if this wiring provides no capabilities in the - * specified name space. For a given name space, the list contains - * the wires in the order the capabilities were specified in the - * manifests of the {@link #getResource() resource} and the attached - * fragment resources<sup>†</sup> of this wiring. There is no - * ordering defined between capabilities in different name spaces. - */ - List<Capability> getResourceCapabilities(String namespace); - - /** - * Returns the requirements of this wiring. - * - * <p> - * Only requirements considered by the resolver are returned. For example, - * requirements with - * {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective} - * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE - * resolve} are not returned. - * - * <p> - * A wiring for a non-fragment resource has a subset of the declared - * requirements from the resource and all attached fragment resources. Not - * all declared requirements may be present since some may be discarded. For - * example, if a package is declared to be optionally imported and is not - * actually imported, the requirement must be discarded. - * - * @param namespace The name space of the requirements to return or - * {@code null} to return the requirements from all name spaces. - * @return A list containing a snapshot of the {@link Requirement}s, or an - * empty list if this wiring uses no requirements in the specified - * name space. For a given name space, the list contains the wires - * in the order the requirements were specified in the manifests of - * the {@link #getResource() resource} and the attached fragment - * resources of this wiring. There is no ordering defined between - * requirements in different name spaces. - */ - List<Requirement> getResourceRequirements(String namespace); - - /** - * Returns the {@link Wire}s to the provided {@link Capability capabilities} - * of this wiring. - * - * @param namespace The name space of the capabilities for which to return - * wires or {@code null} to return the wires for the capabilities in - * all name spaces. - * @return A list containing a snapshot of the {@link Wire}s for the - * {@link Capability capabilities} of this wiring, or an empty list - * if this wiring has no capabilities in the specified name space. - * For a given name space, the list contains the wires in the order - * the capabilities were specified in the manifests of the - * {@link #getResource() resource} and the attached fragment - * resources of this wiring. There is no ordering defined between - * capabilities in different name spaces. - */ - List<Wire> getProvidedResourceWires(String namespace); - - /** - * Returns the {@link Wire}s to the {@link Requirement requirements} in use - * by this wiring. - * - * @param namespace The name space of the requirements for which to return - * wires or {@code null} to return the wires for the requirements in - * all name spaces. - * @return A list containing a snapshot of the {@link Wire}s for the - * {@link Requirement requirements} of this wiring, or an empty list - * if this wiring has no requirements in the specified name space. - * For a given name space, the list contains the wires in the order - * the requirements were specified in the manifests of the - * {@link #getResource() resource} and the attached fragment - * resources of this wiring. There is no ordering defined between - * requirements in different name spaces. - */ - List<Wire> getRequiredResourceWires(String namespace); - - /** - * Returns the resource associated with this wiring. - * - * @return The resource associated with this wiring. - */ - Resource getResource(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java index 8b31e9d8c..6ef74f1b5 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java @@ -18,7 +18,8 @@ package org.osgi.framework.wiring; import java.util.Map; -import org.osgi.framework.resource.Capability; +import org.osgi.framework.namespace.AbstractWiringNamespace; +import org.osgi.resource.Capability; /** * A capability that has been declared from a {@link BundleRevision bundle @@ -44,6 +45,11 @@ public interface BundleCapability extends Capability { /** * {@inheritDoc} + * + * <p> + * All capability directives not specified by the + * {@link AbstractWiringNamespace wiring namespaces} have no specified + * semantics and are considered extra user defined information. */ Map<String, String> getDirectives(); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java index bb292dc1b..bc4807252 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java @@ -18,7 +18,8 @@ package org.osgi.framework.wiring; import java.util.Map; -import org.osgi.framework.resource.Requirement; +import org.osgi.framework.namespace.AbstractWiringNamespace; +import org.osgi.resource.Requirement; /** * A requirement that has been declared from a {@link BundleRevision bundle @@ -38,10 +39,10 @@ public interface BundleRequirement extends Requirement { /** * Returns whether the specified capability matches this requirement. - * + * * @param capability The capability to match to this requirement. * @return {@code true} if the specified capability has the same - * {@link #getNamespace() name space} as this requirement and the + * {@link #getNamespace() namespace} as this requirement and the * filter for this requirement matches the * {@link BundleCapability#getAttributes() attributes of the * specified capability}; {@code false} otherwise. @@ -55,6 +56,11 @@ public interface BundleRequirement extends Requirement { /** * {@inheritDoc} + * + * <p> + * All requirement directives not specified by the + * {@link AbstractWiringNamespace wiring namespaces} have no specified + * semantics and are considered extra user defined information. */ Map<String, String> getDirectives(); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java index a9dd63b0e..edc3350c0 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,17 +22,19 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleReference; import org.osgi.framework.Constants; import org.osgi.framework.Version; -import org.osgi.framework.resource.Capability; -import org.osgi.framework.resource.Requirement; -import org.osgi.framework.resource.Resource; -import org.osgi.framework.resource.ResourceConstants; +import org.osgi.framework.namespace.BundleNamespace; +import org.osgi.framework.namespace.HostNamespace; +import org.osgi.framework.namespace.PackageNamespace; +import org.osgi.resource.Capability; +import org.osgi.resource.Requirement; +import org.osgi.resource.Resource; /** * Bundle Revision. When a bundle is installed and each time a bundle is * updated, a new bundle revision of the bundle is created. Since a bundle * update can change the entries in a bundle, different bundle wirings for the * same bundle can be associated with different bundle revisions. - * + * * <p> * For a bundle that has not been uninstalled, the most recent bundle revision * is defined to be the current bundle revision. A bundle in the UNINSTALLED @@ -40,15 +42,15 @@ import org.osgi.framework.resource.ResourceConstants; * bundle can be obtained by calling {@link Bundle#adapt(Class) bundle.adapt} * (BundleRevision.class). Since a bundle in the UNINSTALLED state does not have * a current revision, adapting such a bundle returns {@code null}. - * + * * <p> - * The framework defines name spaces for {@link #PACKAGE_NAMESPACE package}, - * {@link #BUNDLE_NAMESPACE bundle} and {@link #HOST_NAMESPACE host} - * capabilities and requirements. These name spaces are defined only to express - * wiring information by the framework. They must not be used in + * The framework defines namespaces for {@link PackageNamespace package}, + * {@link BundleNamespace bundle} and {@link HostNamespace host} capabilities + * and requirements. These namespaces are defined only to express wiring + * information by the framework. They must not be used in * {@link Constants#PROVIDE_CAPABILITY Provide-Capability} and * {@link Constants#REQUIRE_CAPABILITY Require-Capability} manifest headers. - * + * * @ThreadSafe * @noimplement * @version $Id$ @@ -74,14 +76,14 @@ public interface BundleRevision extends BundleReference, Resource { /** * Returns the capabilities declared by this bundle revision. - * - * @param namespace The name space of the declared capabilities to return or - * {@code null} to return the declared capabilities from all name - * spaces. + * + * @param namespace The namespace of the declared capabilities to return or + * {@code null} to return the declared capabilities from all + * namespaces. * @return An unmodifiable list containing the declared - * {@link BundleCapability}s from the specified name space. The + * {@link BundleCapability}s from the specified namespace. The * returned list will be empty if this bundle revision declares no - * capabilities in the specified name space. The list contains the + * capabilities in the specified namespace. The list contains the * declared capabilities in the order they are specified in the * manifest. */ @@ -89,29 +91,29 @@ public interface BundleRevision extends BundleReference, Resource { /** * Returns the requirements declared by this bundle revision. - * - * @param namespace The name space of the declared requirements to return or - * {@code null} to return the declared requirements from all name - * spaces. + * + * @param namespace The namespace of the declared requirements to return or + * {@code null} to return the declared requirements from all + * namespaces. * @return An unmodifiable list containing the declared - * {@link BundleRequirement}s from the specified name space. The + * {@link BundleRequirement}s from the specified namespace. The * returned list will be empty if this bundle revision declares no - * requirements in the specified name space. The list contains the + * requirements in the specified namespace. The list contains the * declared requirements in the order they are specified in the * manifest. */ List<BundleRequirement> getDeclaredRequirements(String namespace); /** - * Name space for package capabilities and requirements. - * + * Namespace for package capabilities and requirements. + * * <p> * The name of the package is stored in the capability attribute of the same - * name as this name space (osgi.wiring.package). The other - * directives and attributes of the package, from the - * {@link Constants#EXPORT_PACKAGE Export-Package} manifest header, can be - * found in the cabability's {@link BundleCapability#getDirectives() - * directives} and {@link BundleCapability#getAttributes() attributes}. The + * name as this namespace (osgi.wiring.package). The other directives and + * attributes of the package, from the {@link Constants#EXPORT_PACKAGE + * Export-Package} manifest header, can be found in the cabability's + * {@link BundleCapability#getDirectives() directives} and + * {@link BundleCapability#getAttributes() attributes}. The * {@link Constants#VERSION_ATTRIBUTE version} capability attribute must * contain the {@link Version} of the package if one is specified or * {@link Version#emptyVersion} if not specified. The @@ -122,14 +124,14 @@ public interface BundleRevision extends BundleReference, Resource { * bundle-version} capability attribute must contain the * {@link BundleRevision#getVersion() version} of the provider if one is * specified or {@link Version#emptyVersion} if not specified. - * + * * <p> * The package capabilities provided by the system bundle, that is the * bundle with id zero, must include the package specified by the * {@link Constants#FRAMEWORK_SYSTEMPACKAGES} and * {@link Constants#FRAMEWORK_SYSTEMPACKAGES_EXTRA} framework properties as * well as any other package exported by the framework implementation. - * + * * <p> * A bundle revision {@link BundleRevision#getDeclaredCapabilities(String) * declares} zero or more package capabilities (this is, exported packages) @@ -142,16 +144,18 @@ public interface BundleRevision extends BundleReference, Resource { * resolved package requirements (that is, imported packages). The number of * package wires required by a bundle wiring may change as the bundle wiring * may dynamically import additional packages. + * + * @see PackageNamespace */ - String PACKAGE_NAMESPACE = ResourceConstants.WIRING_PACKAGE_NAMESPACE; + String PACKAGE_NAMESPACE = PackageNamespace.PACKAGE_NAMESPACE; /** - * Name space for bundle capabilities and requirements. - * + * Namespace for bundle capabilities and requirements. + * * <p> * The bundle symbolic name of the bundle is stored in the capability - * attribute of the same name as this name space (osgi.wiring.bundle). - * The other directives and attributes of the bundle, from the + * attribute of the same name as this namespace (osgi.wiring.bundle). The + * other directives and attributes of the bundle, from the * {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest * header, can be found in the cabability's * {@link BundleCapability#getDirectives() directives} and @@ -160,14 +164,14 @@ public interface BundleRevision extends BundleReference, Resource { * attribute must contain the {@link Version} of the bundle from the * {@link Constants#BUNDLE_VERSION Bundle-Version} manifest header if one is * specified or {@link Version#emptyVersion} if not specified. - * + * * <p> * A non-fragment revision * {@link BundleRevision#getDeclaredCapabilities(String) declares} exactly * one<sup>†</sup> bundle capability (that is, the bundle can be * required by another bundle). A fragment revision must not declare a * bundle capability. - * + * * <p> * A bundle wiring for a non-fragment revision * {@link BundleWiring#getCapabilities(String) provides} exactly @@ -175,21 +179,23 @@ public interface BundleRevision extends BundleReference, Resource { * required by another bundle) and * {@link BundleWiring#getRequiredWires(String) requires} zero or more * bundle capabilities (that is, requires other bundles). - * + * * <p> * † A bundle with no bundle symbolic name (that is, a bundle with * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} * {@literal <} 2) must not provide a bundle capability. + * + * @see BundleNamespace */ - String BUNDLE_NAMESPACE = ResourceConstants.WIRING_BUNDLE_NAMESPACE; + String BUNDLE_NAMESPACE = BundleNamespace.BUNDLE_NAMESPACE; /** - * Name space for host capabilities and requirements. - * + * Namespace for host capabilities and requirements. + * * <p> * The bundle symbolic name of the bundle is stored in the capability - * attribute of the same name as this name space (osgi.wiring.host). - * The other directives and attributes of the bundle, from the + * attribute of the same name as this namespace (osgi.wiring.host). The + * other directives and attributes of the bundle, from the * {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest * header, can be found in the cabability's * {@link BundleCapability#getDirectives() directives} and @@ -198,7 +204,7 @@ public interface BundleRevision extends BundleReference, Resource { * attribute must contain the {@link Version} of the bundle from the * {@link Constants#BUNDLE_VERSION Bundle-Version} manifest header if one is * specified or {@link Version#emptyVersion} if not specified. - * + * * <p> * A non-fragment revision * {@link BundleRevision#getDeclaredCapabilities(String) declares} zero or @@ -207,7 +213,7 @@ public interface BundleRevision extends BundleReference, Resource { * attached}. A fragment revision must * {@link BundleRevision#getDeclaredRequirements(String) declare} exactly * one host requirement. - * + * * <p> * A bundle wiring for a non-fragment revision * {@link BundleWiring#getCapabilities(String) provides} zero or @@ -216,13 +222,15 @@ public interface BundleRevision extends BundleReference, Resource { * attached}. A bundle wiring for a fragment revision * {@link BundleWiring#getRequiredWires(String) requires} a host capability * for each host to which it is attached. - * + * * <p> * † A bundle with no bundle symbolic name (that is, a bundle with * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} * {@literal <} 2) must not provide a host capability. + * + * @see HostNamespace */ - String HOST_NAMESPACE = ResourceConstants.WIRING_HOST_NAMESPACE; + String HOST_NAMESPACE = HostNamespace.HOST_NAMESPACE; /** * Returns the special types of this bundle revision. The bundle revision diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java index 0d5aec119..f1e239aaa 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java @@ -16,7 +16,7 @@ package org.osgi.framework.wiring; -import org.osgi.framework.resource.Wire; +import org.osgi.resource.Wire; /** diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java index 1479627fa..aaaaf6dbe 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,17 +22,19 @@ import java.util.List; import org.osgi.framework.Bundle; import org.osgi.framework.BundleReference; -import org.osgi.framework.resource.Capability; -import org.osgi.framework.resource.Requirement; -import org.osgi.framework.resource.ResourceConstants; -import org.osgi.framework.resource.Wire; -import org.osgi.framework.resource.Wiring; +import org.osgi.framework.namespace.IdentityNamespace; +import org.osgi.framework.namespace.PackageNamespace; +import org.osgi.resource.Capability; +import org.osgi.resource.Namespace; +import org.osgi.resource.Requirement; +import org.osgi.resource.Wire; +import org.osgi.resource.Wiring; /** * A wiring for a bundle. Each time a bundle is resolved, a new bundle wiring * for the bundle is created. A bundle wiring is associated with a bundle * revision and represents the dependencies with other bundle wirings. - * + * * <p> * The bundle wiring for a bundle is the {@link #isCurrent() current} bundle * wiring if it is the most recent bundle wiring for the current bundle @@ -43,13 +45,13 @@ import org.osgi.framework.resource.Wiring; * loader. All bundles with non-current, in use bundle wirings are considered * removal pending. Once a bundle wiring is no longer in use, it is considered * stale and is discarded by the framework. - * + * * <p> * The current bundle wiring for a bundle can be obtained by calling * {@link Bundle#adapt(Class) bundle.adapt}(BundleWiring.class). A bundle in the * INSTALLED or UNINSTALLED state does not have a current wiring, adapting such * a bundle returns {@code null}. - * + * * @ThreadSafe * @noimplement * @version $Id$ @@ -61,7 +63,7 @@ public interface BundleWiring extends BundleReference, Wiring { * most recent bundle wiring for the current bundle revision. All bundles * with non-current, in use bundle wirings are considered * {@link FrameworkWiring#getRemovalPendingBundles() removal pending}. - * + * * @return {@code true} if this bundle wiring is the current bundle wiring; * {@code false} otherwise. */ @@ -72,7 +74,7 @@ public interface BundleWiring extends BundleReference, Wiring { * in use if it is the {@link #isCurrent() current} wiring or if some other * in use bundle wiring is dependent upon it. Once a bundle wiring is no * longer in use, it is considered stale and is discarded by the framework. - * + * * @return {@code true} if this bundle wiring is in use; {@code false} * otherwise. */ @@ -80,18 +82,17 @@ public interface BundleWiring extends BundleReference, Wiring { /** * Returns the capabilities provided by this bundle wiring. - * + * * <p> * Only capabilities considered by the resolver are returned. For example, - * capabilities with - * {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective} - * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE + * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE + * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE * resolve} are not returned. - * + * * <p> * A capability may not be required by any bundle wiring and thus there may * be no {@link #getProvidedWires(String) wires} for the capability. - * + * * <p> * A bundle wiring for a non-fragment revision provides a subset of the * declared capabilities from the bundle revision and all attached fragment @@ -101,100 +102,98 @@ public interface BundleWiring extends BundleReference, Wiring { * other is discarded. * <p> * A bundle wiring for a fragment revision with a symbolic name must provide - * exactly one {@link ResourceConstants#IDENTITY_NAMESPACE identity} - * capability. + * exactly one {@link IdentityNamespace identity} capability. * <p> - * † The {@link ResourceConstants#IDENTITY_NAMESPACE identity} - * capability provided by attached fragment revisions must not be included - * in the capabilities of the host bundle wiring. - * - * @param namespace The name space of the capabilities to return or - * {@code null} to return the capabilities from all name spaces. + * † The {@link IdentityNamespace identity} capability provided by + * attached fragment revisions must not be included in the capabilities of + * the host bundle wiring. + * + * @param namespace The namespace of the capabilities to return or + * {@code null} to return the capabilities from all namespaces. * @return A list containing a snapshot of the {@link BundleCapability}s, or * an empty list if this bundle wiring provides no capabilities in - * the specified name space. If this bundle wiring is not + * the specified namespace. If this bundle wiring is not * {@link #isInUse() in use}, {@code null} will be returned. For a - * given name space, the list contains the wires in the order the + * given namespace, the list contains the wires in the order the * capabilities were specified in the manifests of the * {@link #getRevision() bundle revision} and the attached * fragments<sup>†</sup> of this bundle wiring. There is no - * ordering defined between capabilities in different name spaces. + * ordering defined between capabilities in different namespaces. */ List<BundleCapability> getCapabilities(String namespace); /** * Returns the requirements of this bundle wiring. - * + * * <p> * Only requirements considered by the resolver are returned. For example, - * requirements with - * {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective} - * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE + * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE + * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE * resolve} are not returned. - * + * * <p> * A bundle wiring for a non-fragment revision has a subset of the declared * requirements from the bundle revision and all attached fragment * revisions. Not all declared requirements may be present since some may be * discarded. For example, if a package is declared to be optionally * imported and is not actually imported, the requirement must be discarded. - * - * @param namespace The name space of the requirements to return or - * {@code null} to return the requirements from all name spaces. + * + * @param namespace The namespace of the requirements to return or + * {@code null} to return the requirements from all namespaces. * @return A list containing a snapshot of the {@link BundleRequirement}s, * or an empty list if this bundle wiring uses no requirements in - * the specified name space. If this bundle wiring is not + * the specified namespace. If this bundle wiring is not * {@link #isInUse() in use}, {@code null} will be returned. For a - * given name space, the list contains the wires in the order the + * given namespace, the list contains the wires in the order the * requirements were specified in the manifests of the * {@link #getRevision() bundle revision} and the attached fragments * of this bundle wiring. There is no ordering defined between - * requirements in different name spaces. + * requirements in different namespaces. */ List<BundleRequirement> getRequirements(String namespace); /** * Returns the {@link BundleWire}s to the provided {@link BundleCapability * capabilities} of this bundle wiring. - * - * @param namespace The name space of the capabilities for which to return + * + * @param namespace The namespace of the capabilities for which to return * wires or {@code null} to return the wires for the capabilities in - * all name spaces. + * all namespaces. * @return A list containing a snapshot of the {@link BundleWire}s for the * {@link BundleCapability capabilities} of this bundle wiring, or * an empty list if this bundle wiring has no capabilities in the - * specified name space. If this bundle wiring is not + * specified namespace. If this bundle wiring is not * {@link #isInUse() in use}, {@code null} will be returned. For a - * given name space, the list contains the wires in the order the + * given namespace, the list contains the wires in the order the * capabilities were specified in the manifests of the * {@link #getRevision() bundle revision} and the attached fragments * of this bundle wiring. There is no ordering defined between - * capabilities in different name spaces. + * capabilities in different namespaces. */ List<BundleWire> getProvidedWires(String namespace); /** * Returns the {@link BundleWire}s to the {@link BundleRequirement * requirements} in use by this bundle wiring. - * + * * <p> * This method may return different results if this bundle wiring adds wires * to more requirements. For example, dynamically importing a package will * establish a new wire to the dynamically imported package. - * - * @param namespace The name space of the requirements for which to return + * + * @param namespace The namespace of the requirements for which to return * wires or {@code null} to return the wires for the requirements in - * all name spaces. + * all namespaces. * @return A list containing a snapshot of the {@link BundleWire}s for the * {@link BundleRequirement requirements} of this bundle wiring, or * an empty list if this bundle wiring has no requirements in the - * specified name space. If this bundle wiring is not + * specified namespace. If this bundle wiring is not * {@link #isInUse() in use}, {@code null} will be returned. For a - * given name space, the list contains the wires in the order the + * given namespace, the list contains the wires in the order the * requirements were specified in the manifests of the * {@link #getRevision() bundle revision} and the attached fragments * of this bundle wiring. There is no ordering defined between - * requirements in different name spaces. + * requirements in different namespaces. */ List<BundleWire> getRequiredWires(String namespace); @@ -202,13 +201,13 @@ public interface BundleWiring extends BundleReference, Wiring { * Returns the bundle revision for the bundle in this bundle wiring. Since a * bundle update can change the entries in a bundle, different bundle * wirings for the same bundle can have different bundle revisions. - * + * * <p> * The bundle object {@link BundleReference#getBundle() referenced} by the * returned {@code BundleRevision} may return different information than the * returned {@code BundleRevision} since the returned {@code BundleRevision} * may refer to an older revision of the bundle. - * + * * @return The bundle revision for this bundle wiring. * @see BundleRevision#getWiring() */ @@ -218,7 +217,7 @@ public interface BundleWiring extends BundleReference, Wiring { * Returns the class loader for this bundle wiring. Since a bundle refresh * creates a new bundle wiring for a bundle, different bundle wirings for * the same bundle will have different class loaders. - * + * * @return The class loader for this bundle wiring. If this bundle wiring is * not {@link #isInUse() in use} or this bundle wiring is for a * fragment revision, {@code null} will be returned. @@ -234,24 +233,24 @@ public interface BundleWiring extends BundleReference, Wiring { * loader is not used to search for entries. Only the contents of this * bundle wiring's bundle revision and its attached fragment revisions are * searched for the specified entries. - * + * * <p> * This method takes into account that the "contents" of this * bundle wiring can have attached fragments. This "bundle space" - * is not a name space with unique members; the same entry name can be + * is not a namespace with unique members; the same entry name can be * present multiple times. This method therefore returns a list of URL * objects. These URLs can come from different JARs but have the same path * name. This method can either return only entries in the specified path or * recurse into subdirectories returning entries in the directory tree * beginning at the specified path. - * + * * <p> * URLs for directory entries must have their path end with "/". * <p> * Note: Jar and zip files are not required to include directory entries. * URLs to directory entries will not be returned if the bundle contents do * not contain directory entries. - * + * * @param path The path name in which to look. The path is always relative * to the root of this bundle wiring and may begin with * "/". A path value of "/" indicates the root of @@ -283,14 +282,14 @@ public interface BundleWiring extends BundleReference, Wiring { /** * The find entries operation must recurse into subdirectories. - * + * * <p> * This bit may be set when calling * {@link #findEntries(String, String, int)} to specify the result must * include the matching entries from the specified path and its * subdirectories. If this bit is not set, then the result must only include * matching entries from the specified path. - * + * * @see #findEntries(String, String, int) */ int FINDENTRIES_RECURSE = 0x00000001; @@ -299,7 +298,7 @@ public interface BundleWiring extends BundleReference, Wiring { * Returns the names of resources visible to this bundle wiring's * {@link #getClassLoader() class loader}. The returned names can be used to * access the resources via this bundle wiring's class loader. - * + * * <ul> * <li>Only the resource names for resources in bundle wirings will be * returned. The names of resources visible to a bundle wiring's parent @@ -308,7 +307,7 @@ public interface BundleWiring extends BundleReference, Wiring { * <li>Only established wires will be examined for resources. This method * must not cause new wires for dynamic imports to be established. * </ul> - * + * * @param path The path name in which to look. The path is always relative * to the root of this bundle wiring's class loader and may begin * with "/". A path value of "/" indicates the @@ -338,14 +337,14 @@ public interface BundleWiring extends BundleReference, Wiring { /** * The list resource names operation must recurse into subdirectories. - * + * * <p> * This bit may be set when calling * {@link #listResources(String, String, int)} to specify the result must * include the names of matching resources from the specified path and its * subdirectories. If this bit is not set, then the result must only include * names of matching resources from the specified path. - * + * * @see #listResources(String, String, int) */ int LISTRESOURCES_RECURSE = 0x00000001; @@ -355,9 +354,9 @@ public interface BundleWiring extends BundleReference, Wiring { * matching resources contained in this bundle wiring's * {@link #getRevision() bundle revision} and its attached fragment * revisions. The result must not include resource names for resources in - * {@link BundleRevision#PACKAGE_NAMESPACE package} names which are + * {@link PackageNamespace package} names which are * {@link #getRequiredWires(String) imported} by this wiring. - * + * * <p> * This bit may be set when calling * {@link #listResources(String, String, int)} to specify the result must @@ -367,57 +366,57 @@ public interface BundleWiring extends BundleReference, Wiring { * reachable from this bundle wiring's class loader which may include the * names of matching resources contained in imported packages and required * bundles. - * + * * @see #listResources(String, String, int) */ int LISTRESOURCES_LOCAL = 0x00000002; /** * {@inheritDoc} - * + * * <p> * This method returns the same value as {@link #getCapabilities(String)}. - * + * * @since 1.1 */ List<Capability> getResourceCapabilities(String namespace); /** * {@inheritDoc} - * + * * <p> * This method returns the same value as {@link #getRequirements(String)}. - * + * * @since 1.1 */ List<Requirement> getResourceRequirements(String namespace); /** * {@inheritDoc} - * + * * <p> * This method returns the same value as {@link #getProvidedWires(String)}. - * + * * @since 1.1 */ List<Wire> getProvidedResourceWires(String namespace); /** * {@inheritDoc} - * + * * <p> * This method returns the same value as {@link #getRequiredWires(String)}. - * + * * @since 1.1 */ List<Wire> getRequiredResourceWires(String namespace); /** * {@inheritDoc} - * + * * <p> * This method returns the same value as {@link #getRevision()}. - * + * * @since 1.1 */ BundleRevision getResource(); |