You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2012/05/11 22:19:07 UTC
svn commit: r1337360 [6/7] - in /felix/trunk/framework: ./
src/main/java/org/apache/felix/framework/
src/main/java/org/apache/felix/framework/resolver/
src/main/java/org/apache/felix/framework/wiring/
src/main/java/org/osgi/framework/ src/main/java/org...
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java Fri May 11 20:19:02 2012
@@ -0,0 +1,174 @@
+/*
+ * 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>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Bundle-SymbolicName} header are visible in the capability and all
+ * directives specified on the {@code Fragment-Host} header are visible in the
+ * requirement.
+ *
+ * <ul>
+ * <li>The {@link Namespace#CAPABILITY_USES_DIRECTIVE uses} directive must be
+ * ignored. A {@code uses} directive specified on the
+ * {@code Bundle-SymbolicName} header must be ignored. A {@code uses} directive
+ * must not be present in the capability.</li>
+ * <li>The {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE directives} must be ignored.
+ * This namespace is only effective at {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} time. An {@code effective} directive specified on the
+ * {@code Bundle-SymbolicName} or {@code Fragment-Host} headers must be ignored.
+ * An {@code effective} directive must not be present in a capability or
+ * requirement.</li>
+ * <li>The {@link Namespace#REQUIREMENT_CARDINALITY_DIRECTIVE cardinality}
+ * directive has limited applicability to this namespace. A {@code cardinality}
+ * directive specified on the {@code Fragment-Host} header must be ignored. All
+ * requirements must have the {@code cardinality} directive set to
+ * {@link Namespace#CARDINALITY_MULTIPLE multiple}.</li>
+ * </ul>
+ *
+ * <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: aa3cc744c7b9c21d908260f456567ab8a6de1430 $
+ */
+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 "{@code true}" indicates the resource
+ * is a singleton; any other value or {@code null} indicates the resource is
+ * not a singleton.
+ *
+ * <p>
+ * This directive should be examined using the {@link IdentityNamespace
+ * identity} namespace.
+ *
+ * @see IdentityNamespace#CAPABILITY_SINGLETON_DIRECTIVE
+ */
+ 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.
+ *
+ * <p>
+ * This directive should be examined using the {@link BundleNamespace
+ * bundle} namespace.
+ *
+ * @see BundleNamespace#REQUIREMENT_VISIBILITY_DIRECTIVE
+ */
+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
+
+ private HostNamespace() {
+ // empty
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java Fri May 11 20:19:02 2012
@@ -0,0 +1,162 @@
+/*
+ * 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: e34dcaba1f828326a0db13b3d811b2d170ff97a5 $
+ */
+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} 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";
+
+ /**
+ * The capability attribute that contains a human readable copyright notice
+ * for the resource. See the {@code Bundle-Copyright} manifest header.
+ */
+ public static final String CAPABILITY_COPYRIGHT_ATTRIBUTE = "copyright";
+
+ /**
+ * The capability attribute that contains a human readable description for
+ * the resource. See the {@code Bundle-Description} manifest header.
+ */
+ public static final String CAPABILITY_DESCRIPTION_ATTRIBUTE = "description";
+
+ /**
+ * The capability attribute that contains the URL to documentation for the
+ * resource. See the {@code Bundle-DocURL} manifest header.
+ */
+ public static final String CAPABILITY_DOCUMENTATION_ATTRIBUTE = "documentation";
+
+ /**
+ * The capability attribute that contains the URL to the license for the
+ * resource. See the {@code name} portion of the {@code Bundle-License}
+ * manifest header.
+ */
+ public static final String CAPABILITY_LICENSE_ATTRIBUTE = "license";
+
+ /**
+ * The requirement directive that classifies the relationship with another
+ * resource.
+ *
+ * @see #CLASSIFIER_SOURCES
+ * @see #CLASSIFIER_JAVADOC
+ */
+ public static final String REQUIREMENT_CLASSIFIER_DIRECTIVE = "classifier";
+
+ /**
+ * The attribute value identifying the resource
+ * {@link #REQUIREMENT_CLASSIFIER_DIRECTIVE classifier} as an archive
+ * containing the source code in the same directory layout as the resource.
+ *
+ * @see #REQUIREMENT_CLASSIFIER_DIRECTIVE
+ */
+
+ public static final String CLASSIFIER_SOURCES = "sources";
+ /**
+ * The attribute value identifying the resource
+ * {@link #REQUIREMENT_CLASSIFIER_DIRECTIVE classifier} as an archive
+ * containing the javadoc in the same directory layout as the resource.
+ *
+ * @see #REQUIREMENT_CLASSIFIER_DIRECTIVE
+ */
+ public static final String CLASSIFIER_JAVADOC = "javadoc";
+
+ private IdentityNamespace() {
+ // empty
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java Fri May 11 20:19:02 2012
@@ -0,0 +1,112 @@
+/*
+ * 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;
+
+/**
+ * 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.
+ *
+ * <p>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Export-Package} header are visible in the capability and all
+ * directives specified on the {@code Import-Package} and
+ * {@code DynamicImport-Package} headers are visible in the requirement.
+ *
+ * <ul>
+ * <li>The {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE directives} must be ignored.
+ * This namespace is only effective at {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} time. An {@code effective} directive specified on the
+ * {@code Export-Package}, {@code Import-Package} or
+ * {@code DynamicImport-Package} headers must be ignored. An {@code effective}
+ * directive must not be present in a capability or requirement.</li>
+ * <li>The {@link Namespace#REQUIREMENT_CARDINALITY_DIRECTIVE cardinality}
+ * directive has limited applicability to this namespace. A {@code cardinality}
+ * directive specified on the {@code Import-Package} or
+ * {@code DynamicImport-Package} headers must be ignored. Only requirements with
+ * {@link Namespace#REQUIREMENT_RESOLUTION_DIRECTIVE resolution} set to
+ * {@link #RESOLUTION_DYNAMIC dynamic} and the package name contains a wildcard
+ * must have the {@code cardinality} directive set to
+ * {@link Namespace#CARDINALITY_MULTIPLE multiple}. Otherwise, a
+ * {@code cardinality} directive must not be present in a requirement.</li>
+ * </ul>
+ *
+ * @Immutable
+ * @version $Id: 5adc45bd1ae26120cbff3562c7c8cefc01e38bd3 $
+ */
+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";
+
+ /**
+ * The directive value identifying a dynamic requirement resolution type. A
+ * dynamic resolution type indicates that the requirement is resolved
+ * dynamically at runtime (such as a dynamically imported package) and the
+ * resource will be resolved without the requirement being resolved.
+ *
+ * @see Namespace#REQUIREMENT_RESOLUTION_DIRECTIVE
+ */
+ public final static String RESOLUTION_DYNAMIC = "dynamic";
+
+ private PackageNamespace() {
+ // empty
+ }
+}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -33,7 +33,7 @@ import org.osgi.framework.FrameworkListe
*
* @ThreadSafe
* @noimplement
- * @version $Id: 2bca22671674ba50b8c6801d5d1df8e291fe2a9d $
+ * @version $Id: 12c6f60842df994c7de2cc3cfd02f791b95fc35b $
*/
public interface FrameworkStartLevel extends BundleReference {
/**
@@ -126,7 +126,7 @@ public interface FrameworkStartLevel ext
* is first installed.
*
* @return The initial start level value for Bundles.
- * @see #setInitialBundleStartLevel
+ * @see #setInitialBundleStartLevel(int)
*/
int getInitialBundleStartLevel();
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -17,6 +17,8 @@
package org.osgi.framework.wiring;
import java.util.Map;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Capability;
/**
* A capability that has been declared from a {@link BundleRevision bundle
@@ -24,19 +26,32 @@ import java.util.Map;
*
* @ThreadSafe
* @noimplement
- * @version $Id: 0fde13c3228af1aa97872b37ccf0aa6e23123b11 $
+ * @version $Id: 39086f7e6086c2b3d83fbcb976a011cf69483ad8 $
*/
-public interface BundleCapability {
+public interface BundleCapability extends Capability {
+
/**
- * Returns the name space of this capability.
+ * Returns the bundle revision declaring this capability.
*
- * @return The name space of this capability.
+ * @return The bundle revision declaring this capability.
+ */
+ BundleRevision getRevision();
+
+ /**
+ * Returns the namespace of this capability.
+ *
+ * @return The namespace of this capability.
*/
String getNamespace();
/**
* Returns the directives of this capability.
*
+ * <p>
+ * All capability directives not specified by the
+ * {@link AbstractWiringNamespace wiring namespaces} have no specified
+ * semantics and are considered extra user defined information.
+ *
* @return An unmodifiable map of directive names to directive values for
* this capability, or an empty map if this capability has no
* directives.
@@ -53,9 +68,13 @@ public interface BundleCapability {
Map<String, Object> getAttributes();
/**
- * Returns the bundle revision declaring this capability.
+ * Returns the resource declaring this capability.
*
- * @return The bundle revision declaring this capability.
+ * <p>
+ * This method returns the same value as {@link #getRevision()}.
+ *
+ * @return The resource declaring this capability.
+ * @since 1.1
*/
- BundleRevision getRevision();
+ BundleRevision getResource();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -17,6 +17,8 @@
package org.osgi.framework.wiring;
import java.util.Map;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Requirement;
/**
* A requirement that has been declared from a {@link BundleRevision bundle
@@ -24,19 +26,43 @@ import java.util.Map;
*
* @ThreadSafe
* @noimplement
- * @version $Id: 659132c1fac7526240df377ead0e1bc8d4af2e77 $
+ * @version $Id: 212ffb64f724d982db86ff7e49ed64ea530e670a $
*/
-public interface BundleRequirement {
+public interface BundleRequirement extends Requirement {
+ /**
+ * Returns the bundle revision declaring this requirement.
+ *
+ * @return The bundle revision declaring this requirement.
+ */
+ BundleRevision getRevision();
+
/**
- * Returns the name space of this requirement.
+ * Returns whether the specified capability matches this requirement.
*
- * @return The name space of this requirement.
+ * @param capability The capability to match to this requirement.
+ * @return {@code true} if the specified capability has the same
+ * {@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.
+ */
+ boolean matches(BundleCapability capability);
+
+ /**
+ * Returns the namespace of this requirement.
+ *
+ * @return The namespace of this requirement.
*/
String getNamespace();
/**
* Returns the directives of this requirement.
*
+ * <p>
+ * All requirement directives not specified by the
+ * {@link AbstractWiringNamespace wiring namespaces} have no specified
+ * semantics and are considered extra user defined information.
+ *
* @return An unmodifiable map of directive names to directive values for
* this requirement, or an empty map if this requirement has no
* directives.
@@ -46,6 +72,10 @@ public interface BundleRequirement {
/**
* 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.
@@ -53,21 +83,14 @@ public interface BundleRequirement {
Map<String, Object> getAttributes();
/**
- * Returns the bundle revision declaring this requirement.
+ * Returns the resource declaring this requirement.
*
- * @return The bundle revision declaring this requirement.
- */
- BundleRevision getRevision();
-
- /**
- * Returns whether the specified capability matches this requirement.
+ * <p>
+ * This method returns the same value as {@link #getRevision()}.
*
- * @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
- * filter for this requirement matches the
- * {@link BundleCapability#getAttributes() attributes of the
- * specified capability}; {@code false} otherwise.
+ * @return The resource declaring this requirement. This can be {@code null}
+ * if this requirement is synthesized.
+ * @since 1.1
*/
- boolean matches(BundleCapability capability);
+ BundleRevision getResource();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -17,11 +17,16 @@
package org.osgi.framework.wiring;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
+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
@@ -38,18 +43,18 @@ import org.osgi.framework.Version;
* 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: 139b3046ebd46c48b03dda8d36f2f9d79e2e616d $
+ * @version $Id: e68e01a670f0ae9d6eb736414f875c8b216ed1bc $
*/
-public interface BundleRevision extends BundleReference {
+public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the symbolic name for this bundle revision.
*
@@ -71,41 +76,43 @@ public interface BundleRevision extends
/**
* 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.
- * @return A list containing a snapshot of the declared
- * {@link BundleCapability}s, or an empty list if this bundle
- * revision declares no capabilities in the specified name space.
- * The list contains the declared capabilities in the order they are
- * specified in the manifest.
+ * @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 namespace. The
+ * returned list will be empty if this bundle revision declares no
+ * capabilities in the specified namespace. The list contains the
+ * declared capabilities in the order they are specified in the
+ * manifest.
*/
List<BundleCapability> getDeclaredCapabilities(String namespace);
/**
* 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.
- * @return A list containing a snapshot of the declared
- * {@link BundleRequirement}s, or an empty list if this bundle
- * revision declares no requirements in the specified name space.
- * The list contains the declared requirements in the order they are
- * specified in the manifest.
+ * @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 namespace. The
+ * returned list will be empty if this bundle revision declares no
+ * 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
@@ -136,16 +143,18 @@ public interface BundleRevision extends
* 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 = "osgi.wiring.package";
+ 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
@@ -174,16 +183,18 @@ public interface BundleRevision extends
* † 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 = "osgi.wiring.bundle";
+ 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
@@ -215,8 +226,10 @@ public interface BundleRevision extends
* † 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 = "osgi.wiring.host";
+ String HOST_NAMESPACE = HostNamespace.HOST_NAMESPACE;
/**
* Returns the special types of this bundle revision. The bundle revision
@@ -252,4 +265,40 @@ public interface BundleRevision extends
* @see BundleWiring#getRevision()
*/
BundleWiring getWiring();
+
+ /**
+ * Returns the capabilities declared by this resource.
+ *
+ * <p>
+ * This method returns the same value as
+ * {@link #getDeclaredCapabilities(String)}.
+ *
+ * @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 Capability}s
+ * from the specified namespace. The returned list will be empty if
+ * this resource declares no capabilities in the specified
+ * namespace.
+ * @since 1.1
+ */
+ List<Capability> getCapabilities(String namespace);
+
+ /**
+ * Returns the requirements declared by this bundle resource.
+ *
+ * <p>
+ * This method returns the same value as
+ * {@link #getDeclaredRequirements(String)}.
+ *
+ * @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 Requirement}
+ * s from the specified namespace. The returned list will be empty
+ * if this resource declares no requirements in the specified
+ * namespace.
+ * @since 1.1
+ */
+ List<Requirement> getRequirements(String namespace);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java Fri May 11 20:19:02 2012
@@ -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.
@@ -17,7 +17,6 @@
package org.osgi.framework.wiring;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
@@ -38,7 +37,7 @@ import org.osgi.framework.BundleReferenc
*
* @ThreadSafe
* @noimplement
- * @version $Id: 1d95ad10f0f08b100f8ee2485bdd34120032c7af $
+ * @version $Id: 8423242078417873faf0f8979e153e3c1f3a0e4b $
*/
public interface BundleRevisions extends BundleReference {
/**
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -16,14 +16,16 @@
package org.osgi.framework.wiring;
+import org.osgi.resource.Wire;
+
/**
* A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
*
* @ThreadSafe
* @noimplement
- * @version $Id: 4f936a84065762ec3267a44f86ae01b0150e44ce $
+ * @version $Id: 02e7cd6ec0fa9fdb73f782a6890984d5d4e7ca21 $
*/
-public interface BundleWire {
+public interface BundleWire extends Wire {
/**
* Returns the {@link BundleCapability} for this wire.
*
@@ -44,7 +46,7 @@ public interface BundleWire {
*
* <p>
* The bundle revision referenced by the returned bundle wiring may differ
- * from the bundle revision reference by the {@link #getCapability()
+ * from the bundle revision referenced by the {@link #getCapability()
* capability}.
*
* @return The bundle wiring providing the capability. If the bundle wiring
@@ -60,7 +62,7 @@ public interface BundleWire {
*
* <p>
* The bundle revision referenced by the returned bundle wiring may differ
- * from the bundle revision reference by the {@link #getRequirement()
+ * from the bundle revision referenced by the {@link #getRequirement()
* requirement}.
*
* @return The bundle wiring whose requirement is wired to the capability.
@@ -69,4 +71,38 @@ public interface BundleWire {
* returned.
*/
BundleWiring getRequirerWiring();
+
+ /**
+ * Returns the resource providing the {@link #getCapability() capability}.
+ *
+ * <p>
+ * The returned resource may differ from the resource referenced by the
+ * {@link #getCapability() capability}.
+ *
+ * <p>
+ * This method returns the same value as {@link #getProviderWiring()}.
+ * {@link BundleWiring#getRevision() getRevision()}.
+ *
+ * @return The resource providing the capability.
+ * @since 1.1
+ */
+ BundleRevision 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}.
+ *
+ * <p>
+ * This method returns the same value as {@link #getRequirerWiring()}.
+ * {@link BundleWiring#getRevision() getRevision()}.
+ *
+ * @return The resource who requires the capability.
+ * @since 1.1
+ */
+ BundleRevision getRequirer();
+
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -19,9 +19,15 @@ package org.osgi.framework.wiring;
import java.net.URL;
import java.util.Collection;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
+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
@@ -47,9 +53,9 @@ import org.osgi.framework.BundleReferenc
*
* @ThreadSafe
* @noimplement
- * @version $Id: 58b8ec3bb9649387d4ccba1070f034f217d06ea2 $
+ * @version $Id: a3b3fd7ad7d289a5bfc6e4e02c875bc42a34df89 $
*/
-public interface BundleWiring extends BundleReference {
+public interface BundleWiring extends BundleReference, Wiring {
/**
* Returns {@code true} if this bundle wiring is the current bundle wiring.
* The bundle wiring for a bundle is the current bundle wiring if it is the
@@ -77,27 +83,41 @@ public interface BundleWiring extends Bu
* Returns the capabilities provided by this bundle wiring.
*
* <p>
+ * Only capabilities considered by the resolver are returned. For example,
+ * 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
- * revisions. Not all declared capabilities may be provided since some may
- * be discarded. For example, if a package is declared to be exported and
- * import, only one is selected and the other is discarded.
+ * revisions<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 bundle wiring for a fragment revision with a symbolic name must provide
+ * exactly one {@link IdentityNamespace identity} capability.
+ * <p>
+ * † 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 name space of the capabilities to return or
- * {@code null} to return the capabilities from all name spaces.
+ * @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
- * of this bundle wiring. There is no ordering defined between
- * capabilities in different name spaces.
+ * {@link #getRevision() bundle revision} and the attached
+ * fragments<sup>†</sup> of this bundle wiring. There is no
+ * ordering defined between capabilities in different namespaces.
*/
List<BundleCapability> getCapabilities(String namespace);
@@ -105,23 +125,29 @@ public interface BundleWiring extends Bu
* Returns the requirements of this bundle wiring.
*
* <p>
+ * Only requirements considered by the resolver are returned. For example,
+ * 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);
@@ -129,19 +155,19 @@ public interface BundleWiring extends Bu
* 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);
@@ -154,19 +180,19 @@ public interface BundleWiring extends Bu
* 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);
@@ -210,7 +236,7 @@ public interface BundleWiring extends Bu
* <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
@@ -218,6 +244,8 @@ public interface BundleWiring extends Bu
* 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.
@@ -303,8 +331,7 @@ public interface BundleWiring extends Bu
* must contain no duplicate resource names. If this bundle wiring
* is not {@link #isInUse() in use}, {@code null} must be returned.
*/
- Collection<String> listResources(String path, String filePattern,
- int options);
+ Collection<String> listResources(String path, String filePattern, int options);
/**
* The list resource names operation must recurse into subdirectories.
@@ -325,7 +352,7 @@ public interface BundleWiring extends Bu
* 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>
@@ -341,4 +368,135 @@ public interface BundleWiring extends Bu
* @see #listResources(String, String, int)
*/
int LISTRESOURCES_LOCAL = 0x00000002;
+
+ /**
+ * Returns the capabilities provided by this wiring.
+ *
+ * <p>
+ * Only capabilities considered by the resolver are returned. For example,
+ * 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 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 {@code osgi.identity} capability.
+ * <p>
+ * † The {@code osgi.identity} capability provided by attached
+ * fragment resource must not be included in the capabilities of the host
+ * wiring.
+ *
+ * <p>
+ * This method returns the same value as {@link #getCapabilities(String)}.
+ *
+ * @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 Capability}s, or an
+ * empty list if this wiring provides no capabilities in the
+ * specified namespace. For a given namespace, 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 namespaces.
+ * @since 1.1
+ */
+ 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 Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#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.
+ *
+ * <p>
+ * This method returns the same value as {@link #getRequirements(String)}.
+ *
+ * @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 Requirement}s, or an
+ * empty list if this wiring uses no requirements in the specified
+ * namespace. For a given namespace, 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 namespaces.
+ * @since 1.1
+ */
+ List<Requirement> getResourceRequirements(String namespace);
+
+ /**
+ * Returns the {@link Wire}s to the provided {@link Capability capabilities}
+ * of this wiring.
+ *
+ * <p>
+ * This method returns the same value as {@link #getProvidedWires(String)}.
+ *
+ * @param namespace The namespace of the capabilities for which to return
+ * wires or {@code null} to return the wires for the capabilities in
+ * all namespaces.
+ * @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 namespace.
+ * For a given namespace, 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 namespaces.
+ * @since 1.1
+ */
+ List<Wire> getProvidedResourceWires(String namespace);
+
+ /**
+ * Returns the {@link Wire}s to the {@link Requirement requirements} in use
+ * by this wiring.
+ *
+ * <p>
+ * This method returns the same value as {@link #getRequiredWires(String)}.
+ *
+ * @param namespace The namespace of the requirements for which to return
+ * wires or {@code null} to return the wires for the requirements in
+ * all namespaces.
+ * @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 namespace.
+ * For a given namespace, 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 namespaces.
+ * @since 1.1
+ */
+ List<Wire> getRequiredResourceWires(String namespace);
+
+ /**
+ * Returns the resource associated with this wiring.
+ *
+ * <p>
+ * This method returns the same value as {@link #getRevision()}.
+ *
+ * @return The resource associated with this wiring.
+ * @since 1.1
+ */
+ BundleRevision getResource();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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.
@@ -17,7 +17,6 @@
package org.osgi.framework.wiring;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.FrameworkListener;
@@ -34,7 +33,7 @@ import org.osgi.framework.FrameworkListe
*
* @ThreadSafe
* @noimplement
- * @version $Id: f9f3f89b5b8d369453d645a52a482a385a2bd520 $
+ * @version $Id: bff4cdf85c632e2946e18c1640a86e80c069dd37 $
*/
public interface FrameworkWiring extends BundleReference {
/**
@@ -110,8 +109,7 @@ public interface FrameworkWiring extends
* {@code AdminPermission[System Bundle,RESOLVE]} and the Java
* runtime environment supports permissions.
*/
- void refreshBundles(Collection<Bundle> bundles,
- FrameworkListener... listeners);
+ void refreshBundles(Collection<Bundle> bundles, FrameworkListener... listeners);
/**
* Resolves the specified bundles. The Framework must attempt to resolve the
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Capability.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Capability.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Capability.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Capability.java Fri May 11 20:19:02 2012
@@ -0,0 +1,86 @@
+/*
+ * 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.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: 5f40514f7bf45f6dce59651e8812b0922580e77e $
+ */
+public interface Capability {
+
+ /**
+ * Returns the namespace of this capability.
+ *
+ * @return The namespace of this capability.
+ */
+ String getNamespace();
+
+ /**
+ * Returns the directives of this capability.
+ *
+ * @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 namespace, 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();
+}
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Namespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Namespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Namespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Namespace.java Fri May 11 20:19:02 2012
@@ -0,0 +1,154 @@
+/*
+ * 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.resource;
+
+/**
+ * Capability and Requirement Namespaces base class.
+ *
+ * <p>
+ * This class is the common class shared by all OSGi defined namespaces. It
+ * defines the names for the common attributes and directives for the OSGi
+ * specified namespaces.
+ *
+ * <p>
+ * The OSGi Alliance reserves the right to extend the set of directives and
+ * attributes which have specified semantics for all of the specified
+ * namespaces.
+ *
+ * <p>
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id: 43c9ff5cea19546d71c4703db71a2b5070a3f2fa $
+ */
+public abstract class Namespace {
+
+ /**
+ * The capability directive used to specify the comma separated list of
+ * package names used by a capability.
+ */
+ public final static String CAPABILITY_USES_DIRECTIVE = "uses";
+
+ /**
+ * The capability 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 = "effective";
+
+ /**
+ * The requirement directive used to specify a capability filter. This
+ * filter is used to match against a capability's attributes.
+ */
+ public final static String REQUIREMENT_FILTER_DIRECTIVE = "filter";
+
+ /**
+ * The requirement directive used to specify the resolution type for a
+ * requirement. The default value is {@link #RESOLUTION_MANDATORY mandatory}
+ * .
+ *
+ * @see #RESOLUTION_MANDATORY mandatory
+ * @see #RESOLUTION_OPTIONAL optional
+ */
+ public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = "resolution";
+
+ /**
+ * The directive value identifying a mandatory requirement resolution type.
+ * A mandatory resolution type indicates that the requirement must be
+ * resolved when the resource is resolved. If such a requirement cannot be
+ * resolved, the resource fails to resolve.
+ *
+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+ */
+ public final static String RESOLUTION_MANDATORY = "mandatory";
+
+ /**
+ * The directive value identifying an optional requirement resolution type.
+ * An optional resolution type indicates that the requirement is optional
+ * and the resource may be resolved without the requirement being resolved.
+ *
+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+ */
+ public final static String RESOLUTION_OPTIONAL = "optional";
+
+ /**
+ * The requirement 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 = "effective";
+
+ /**
+ * The 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 = "resolve";
+
+ /**
+ * The 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 = "active";
+
+ /**
+ * The requirement directive used to specify the cardinality for a
+ * requirement. The default value is {@link #CARDINALITY_SINGLE single}.
+ *
+ * @see #CARDINALITY_MULTIPLE multiple
+ * @see #CARDINALITY_SINGLE single
+ */
+ public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality";
+
+ /**
+ * The directive value identifying a multiple
+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
+ *
+ * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+ */
+ public final static String CARDINALITY_MULTIPLE = "multiple";
+
+ /**
+ * The directive value identifying a
+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type of single.
+ *
+ * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+ */
+ public final static String CARDINALITY_SINGLE = "single";
+
+ /**
+ * Protected constructor for Namespace sub-types.
+ */
+ protected Namespace() {
+ // empty
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Requirement.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Requirement.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Requirement.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Requirement.java Fri May 11 20:19:02 2012
@@ -0,0 +1,90 @@
+/*
+ * 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.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: 212b26179910f98fd2c59c3e1e7dd0d086f42b5d $
+ */
+public interface Requirement {
+ /**
+ * Returns the namespace of this requirement.
+ *
+ * @return The namespace of this requirement.
+ */
+ String getNamespace();
+
+ /**
+ * Returns the directives of this requirement.
+ *
+ * @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. This can be {@code null}
+ * if this requirement is synthesized.
+ */
+ 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 namespace, 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();
+}
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Resource.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Resource.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Resource.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Resource.java Fri May 11 20:19:02 2012
@@ -0,0 +1,82 @@
+/*
+ * 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.resource;
+
+import java.util.List;
+
+/**
+ * A resource is the representation of a uniquely identified and typed data. A
+ * resource declares requirements that need to be satisfied by capabilities
+ * before it can provide its capabilities.
+ *
+ * <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: 40958d5777ee269d27d58e9f646a4c91bcc6daa4 $
+ */
+public interface Resource {
+ /**
+ * Returns the capabilities declared by this resource.
+ *
+ * @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 Capability}s
+ * from the specified namespace. The returned list will be empty if
+ * this resource declares no capabilities in the specified
+ * namespace.
+ */
+ List<Capability> getCapabilities(String namespace);
+
+ /**
+ * Returns the requirements declared by this bundle resource.
+ *
+ * @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 Requirement}
+ * s from the specified namespace. The returned list will be empty
+ * if this resource declares no requirements in the specified
+ * namespace.
+ */
+ List<Requirement> getRequirements(String namespace);
+
+ /**
+ * Compares this {@code Resource} to another {@code Resource}.
+ *
+ * <p>
+ * This {@code Resource} is equal to another {@code Resource} if 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();
+}
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Wire.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Wire.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Wire.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Wire.java Fri May 11 20:19:02 2012
@@ -0,0 +1,87 @@
+/*
+ * 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.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: d7ca9a5d3e8dd2277f8243a750e40fbcf79185bd $
+ */
+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();
+}
Added: felix/trunk/framework/src/main/java/org/osgi/resource/Wiring.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/resource/Wiring.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/resource/Wiring.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/resource/Wiring.java Fri May 11 20:19:02 2012
@@ -0,0 +1,144 @@
+/*
+ * 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.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: b65dec3887cfa1d5731e860db558a01503c0f47d $
+ */
+public interface Wiring {
+ /**
+ * Returns the capabilities provided by this wiring.
+ *
+ * <p>
+ * Only capabilities considered by the resolver are returned. For example,
+ * 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 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 {@code osgi.identity} capability.
+ * <p>
+ * † The {@code osgi.identity} capability provided by attached
+ * fragment resource must not be included in the capabilities of the host
+ * 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 Capability}s, or an
+ * empty list if this wiring provides no capabilities in the
+ * specified namespace. For a given namespace, 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 namespaces.
+ */
+ 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 Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#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 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 Requirement}s, or an
+ * empty list if this wiring uses no requirements in the specified
+ * namespace. For a given namespace, 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 namespaces.
+ */
+ List<Requirement> getResourceRequirements(String namespace);
+
+ /**
+ * Returns the {@link Wire}s to the provided {@link Capability capabilities}
+ * of this wiring.
+ *
+ * @param namespace The namespace of the capabilities for which to return
+ * wires or {@code null} to return the wires for the capabilities in
+ * all namespaces.
+ * @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 namespace.
+ * For a given namespace, 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 namespaces.
+ */
+ List<Wire> getProvidedResourceWires(String namespace);
+
+ /**
+ * Returns the {@link Wire}s to the {@link Requirement requirements} in use
+ * by this wiring.
+ *
+ * @param namespace The namespace of the requirements for which to return
+ * wires or {@code null} to return the wires for the requirements in
+ * all namespaces.
+ * @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 namespace.
+ * For a given namespace, 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 namespaces.
+ */
+ List<Wire> getRequiredResourceWires(String namespace);
+
+ /**
+ * Returns the resource associated with this wiring.
+ *
+ * @return The resource associated with this wiring.
+ */
+ Resource getResource();
+}
Modified: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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.
@@ -45,7 +45,7 @@ import org.osgi.framework.Version;
* @noimplement
* @deprecated The PackageAdmin service has been replaced by the
* <code>org.osgi.framework.wiring</code> package.
- * @version $Id: c56b99465e3f62a9808297a47de8cb7edb802119 $
+ * @version $Id: 22ce5e8e388107b04edba3aea2f3036b8026798d $
*/
public interface ExportedPackage {
/**
@@ -83,9 +83,9 @@ public interface ExportedPackage {
/**
* Returns the version of this exported package.
*
- * @return The version of this exported package, or {@code null} if
- * no version information is available.
- * @deprecated As of 1.2, replaced by {@link #getVersion}.
+ * @return The version of this exported package, or {@code null} if no
+ * version information is available.
+ * @deprecated As of 1.2, replaced by {@link #getVersion()}.
*/
public String getSpecificationVersion();