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 [5/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/VersionRange.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java Fri May 11 20:19:02 2012
@@ -0,0 +1,509 @@
+/*
+ * 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;
+
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+
+/**
+ * Version range. A version range is an interval describing a set of
+ * {@link Version versions}.
+ *
+ * <p>
+ * A range has a left (lower) endpoint and a right (upper) endpoint. Each
+ * endpoint can be open (excluded from the set) or closed (included in the set).
+ *
+ * <p>
+ * {@code VersionRange} objects are immutable.
+ *
+ * @since 1.7
+ * @Immutable
+ * @version $Id: d0c21e6a5015a7fa0b33179a29122ea7d137145a $
+ */
+
+public class VersionRange {
+ /**
+ * The left endpoint is open and is excluded from the range.
+ * <p>
+ * The value of {@code LEFT_OPEN} is {@code '('}.
+ */
+ public static final char LEFT_OPEN = '(';
+ /**
+ * The left endpoint is closed and is included in the range.
+ * <p>
+ * The value of {@code LEFT_CLOSED} is {@code '['}.
+ */
+ public static final char LEFT_CLOSED = '[';
+ /**
+ * The right endpoint is open and is excluded from the range.
+ * <p>
+ * The value of {@code RIGHT_OPEN} is {@code ')'}.
+ */
+ public static final char RIGHT_OPEN = ')';
+ /**
+ * The right endpoint is closed and is included in the range.
+ * <p>
+ * The value of {@code RIGHT_CLOSED} is {@code ']'}.
+ */
+ public static final char RIGHT_CLOSED = ']';
+
+ private final boolean leftClosed;
+ private final Version left;
+ private final Version right;
+ private final boolean rightClosed;
+ private final boolean empty;
+
+ private transient String versionRangeString /* default to null */;
+ private transient int hash /* default to 0 */;
+
+ private static final String LEFT_OPEN_DELIMITER = "(";
+ private static final String LEFT_CLOSED_DELIMITER = "[";
+ private static final String LEFT_DELIMITERS = LEFT_CLOSED_DELIMITER + LEFT_OPEN_DELIMITER;
+ private static final String RIGHT_OPEN_DELIMITER = ")";
+ private static final String RIGHT_CLOSED_DELIMITER = "]";
+ private static final String RIGHT_DELIMITERS = RIGHT_OPEN_DELIMITER + RIGHT_CLOSED_DELIMITER;
+ private static final String ENDPOINT_DELIMITER = ",";
+
+ /**
+ * Creates a version range from the specified versions.
+ *
+ * @param leftType Must be either {@link #LEFT_CLOSED} or {@link #LEFT_OPEN}
+ * .
+ * @param leftEndpoint Left endpoint of range. Must not be {@code null}.
+ * @param rightEndpoint Right endpoint of range. May be {@code null} to
+ * indicate the right endpoint is <i>Infinity</i>.
+ * @param rightType Must be either {@link #RIGHT_CLOSED} or
+ * {@link #RIGHT_OPEN}.
+ * @throws IllegalArgumentException If the arguments are invalid.
+ */
+ public VersionRange(char leftType, Version leftEndpoint, Version rightEndpoint, char rightType) {
+ if ((leftType != LEFT_CLOSED) && (leftType != LEFT_OPEN)) {
+ throw new IllegalArgumentException("invalid leftType \"" + leftType + "\"");
+ }
+ if ((rightType != RIGHT_OPEN) && (rightType != RIGHT_CLOSED)) {
+ throw new IllegalArgumentException("invalid rightType \"" + rightType + "\"");
+ }
+ if (leftEndpoint == null) {
+ throw new IllegalArgumentException("null leftEndpoint argument");
+ }
+ leftClosed = leftType == LEFT_CLOSED;
+ rightClosed = rightType == RIGHT_CLOSED;
+ left = leftEndpoint;
+ right = rightEndpoint;
+ empty = isEmpty0();
+ }
+
+ /**
+ * Creates a version range from the specified string.
+ *
+ * <p>
+ * Version range string grammar:
+ *
+ * <pre>
+ * range ::= interval | atleast
+ * interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' )
+ * left ::= version
+ * right ::= version
+ * atleast ::= version
+ * </pre>
+ *
+ * @param range String representation of the version range. The versions in
+ * the range must contain no whitespace. Other whitespace in the
+ * range string is ignored.
+ * @throws IllegalArgumentException If {@code range} is improperly
+ * formatted.
+ */
+ public VersionRange(String range) {
+ boolean closedLeft;
+ boolean closedRight;
+ Version endpointLeft;
+ Version endpointRight;
+
+ try {
+ StringTokenizer st = new StringTokenizer(range, LEFT_DELIMITERS, true);
+ String token = st.nextToken().trim(); // whitespace or left delim
+ if (token.length() == 0) { // leading whitespace
+ token = st.nextToken(); // left delim
+ }
+ closedLeft = LEFT_CLOSED_DELIMITER.equals(token);
+ if (!closedLeft && !LEFT_OPEN_DELIMITER.equals(token)) {
+ // first token is not a delimiter, so it must be "atleast"
+ if (st.hasMoreTokens()) { // there must be no more tokens
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+ }
+ leftClosed = true;
+ rightClosed = false;
+ left = parseVersion(token, range);
+ right = null;
+ empty = false;
+ return;
+ }
+ String version = st.nextToken(ENDPOINT_DELIMITER);
+ endpointLeft = parseVersion(version, range);
+ token = st.nextToken(); // consume comma
+ version = st.nextToken(RIGHT_DELIMITERS);
+ token = st.nextToken(); // right delim
+ closedRight = RIGHT_CLOSED_DELIMITER.equals(token);
+ if (!closedRight && !RIGHT_OPEN_DELIMITER.equals(token)) {
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+ }
+ endpointRight = parseVersion(version, range);
+
+ if (st.hasMoreTokens()) { // any more tokens have to be whitespace
+ token = st.nextToken("").trim();
+ if (token.length() != 0) { // trailing whitespace
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+ }
+ }
+ } catch (NoSuchElementException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+ iae.initCause(e);
+ throw iae;
+ }
+
+ leftClosed = closedLeft;
+ rightClosed = closedRight;
+ left = endpointLeft;
+ right = endpointRight;
+ empty = isEmpty0();
+ }
+
+ /**
+ * Parse version component into a Version.
+ *
+ * @param version version component string
+ * @param range Complete range string for exception message, if any
+ * @return Version
+ */
+ private static Version parseVersion(String version, String range) {
+ try {
+ return Version.parseVersion(version);
+ } catch (IllegalArgumentException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
+ iae.initCause(e);
+ throw iae;
+ }
+ }
+
+ /**
+ * Returns the left endpoint of this version range.
+ *
+ * @return The left endpoint.
+ */
+ public Version getLeft() {
+ return left;
+ }
+
+ /**
+ * Returns the right endpoint of this version range.
+ *
+ * @return The right endpoint. May be {@code null} which indicates the right
+ * endpoint is <i>Infinity</i>.
+ */
+ public Version getRight() {
+ return right;
+ }
+
+ /**
+ * Returns the type of the left endpoint of this version range.
+ *
+ * @return {@link #LEFT_CLOSED} if the left endpoint is closed or
+ * {@link #LEFT_OPEN} if the left endpoint is open.
+ */
+ public char getLeftType() {
+ return leftClosed ? LEFT_CLOSED : LEFT_OPEN;
+ }
+
+ /**
+ * Returns the type of the right endpoint of this version range.
+ *
+ * @return {@link #RIGHT_CLOSED} if the right endpoint is closed or
+ * {@link #RIGHT_OPEN} if the right endpoint is open.
+ */
+ public char getRightType() {
+ return rightClosed ? RIGHT_CLOSED : RIGHT_OPEN;
+ }
+
+ /**
+ * Returns whether this version range includes the specified version.
+ *
+ * @param version The version to test for inclusion in this version range.
+ * @return {@code true} if the specified version is included in this version
+ * range; {@code false} otherwise.
+ */
+ public boolean includes(Version version) {
+ if (empty) {
+ return false;
+ }
+ if (left.compareTo(version) >= (leftClosed ? 1 : 0)) {
+ return false;
+ }
+ if (right == null) {
+ return true;
+ }
+ return right.compareTo(version) >= (rightClosed ? 0 : 1);
+ }
+
+ /**
+ * Returns the intersection of this version range with the specified version
+ * ranges.
+ *
+ * @param ranges The version ranges to intersect with this version range.
+ * @return A version range representing the intersection of this version
+ * range and the specified version ranges. If no version ranges are
+ * specified, then this version range is returned.
+ */
+ public VersionRange intersection(VersionRange... ranges) {
+ if ((ranges == null) || (ranges.length == 0)) {
+ return this;
+ }
+ // prime with data from this version range
+ boolean closedLeft = leftClosed;
+ boolean closedRight = rightClosed;
+ Version endpointLeft = left;
+ Version endpointRight = right;
+
+ for (VersionRange range : ranges) {
+ int comparison = endpointLeft.compareTo(range.left);
+ if (comparison == 0) {
+ closedLeft = closedLeft && range.leftClosed;
+ } else {
+ if (comparison < 0) { // move endpointLeft to the right
+ endpointLeft = range.left;
+ closedLeft = range.leftClosed;
+ }
+ }
+ if (range.right != null) {
+ if (endpointRight == null) {
+ endpointRight = range.right;
+ closedRight = range.rightClosed;
+ } else {
+ comparison = endpointRight.compareTo(range.right);
+ if (comparison == 0) {
+ closedRight = closedRight && range.rightClosed;
+ } else {
+ if (comparison > 0) { // move endpointRight to the left
+ endpointRight = range.right;
+ closedRight = range.rightClosed;
+ }
+ }
+ }
+ }
+ }
+
+ return new VersionRange(closedLeft ? LEFT_CLOSED : LEFT_OPEN, endpointLeft, endpointRight, closedRight ? RIGHT_CLOSED : RIGHT_OPEN);
+ }
+
+ /**
+ * Returns whether this version range is empty. A version range is empty if
+ * the set of versions defined by the interval is empty.
+ *
+ * @return {@code true} if this version range is empty; {@code false}
+ * otherwise.
+ */
+ public boolean isEmpty() {
+ return empty;
+ }
+
+ /**
+ * Internal isEmpty behavior.
+ *
+ * @return {@code true} if this version range is empty; {@code false}
+ * otherwise.
+ */
+ private boolean isEmpty0() {
+ if (right == null) { // infinity
+ return false;
+ }
+ int comparison = left.compareTo(right);
+ if (comparison == 0) { // endpoints equal
+ return !leftClosed || !rightClosed;
+ }
+ return comparison > 0; // true if left > right
+ }
+
+ /**
+ * Returns whether this version range contains only a single version.
+ *
+ * @return {@code true} if this version range contains only a single
+ * version; {@code false} otherwise.
+ */
+ public boolean isExact() {
+ if (empty || (right == null)) {
+ return false;
+ }
+ if (leftClosed) {
+ if (rightClosed) {
+ // [l,r]: exact if l == r
+ return left.equals(right);
+ } else {
+ // [l,r): exact if l++ >= r
+ Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
+ return adjacent1.compareTo(right) >= 0;
+ }
+ } else {
+ if (rightClosed) {
+ // (l,r] is equivalent to [l++,r]: exact if l++ == r
+ Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
+ return adjacent1.equals(right);
+ } else {
+ // (l,r) is equivalent to [l++,r): exact if (l++)++ >=r
+ Version adjacent2 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "--");
+ return adjacent2.compareTo(right) >= 0;
+ }
+ }
+ }
+
+ /**
+ * Returns the string representation of this version range.
+ *
+ * <p>
+ * The format of the version range string will be a version string if the
+ * right end point is <i>Infinity</i> ({@code null}) or an interval string.
+ *
+ * @return The string representation of this version range.
+ */
+ public String toString() {
+ if (versionRangeString != null) {
+ return versionRangeString;
+ }
+ String leftVersion = left.toString();
+ if (right == null) {
+ StringBuffer result = new StringBuffer(leftVersion.length() + 1);
+ result.append(left.toString0());
+ return versionRangeString = result.toString();
+ }
+ String rightVerion = right.toString();
+ StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5);
+ result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN);
+ result.append(left.toString0());
+ result.append(ENDPOINT_DELIMITER);
+ result.append(right.toString0());
+ result.append(rightClosed ? RIGHT_CLOSED : RIGHT_OPEN);
+ return versionRangeString = result.toString();
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ *
+ * @return An integer which is a hash code value for this object.
+ */
+ public int hashCode() {
+ if (hash != 0) {
+ return hash;
+ }
+ if (empty) {
+ return hash = 31;
+ }
+ int h = 31 + (leftClosed ? 7 : 5);
+ h = 31 * h + left.hashCode();
+ if (right != null) {
+ h = 31 * h + right.hashCode();
+ h = 31 * h + (rightClosed ? 7 : 5);
+ }
+ return hash = h;
+ }
+
+ /**
+ * Compares this {@code VersionRange} object to another object.
+ *
+ * <p>
+ * A version range is considered to be <b>equal to </b> another version
+ * range if both the endpoints and their types are equal or if both version
+ * ranges are {@link #isEmpty() empty}.
+ *
+ * @param object The {@code VersionRange} object to be compared.
+ * @return {@code true} if {@code object} is a {@code VersionRange} and is
+ * equal to this object; {@code false} otherwise.
+ */
+ public boolean equals(Object object) {
+ if (object == this) { // quicktest
+ return true;
+ }
+ if (!(object instanceof VersionRange)) {
+ return false;
+ }
+ VersionRange other = (VersionRange) object;
+ if (empty && other.empty) {
+ return true;
+ }
+ if (right == null) {
+ return (leftClosed == other.leftClosed) && (other.right == null) && left.equals(other.left);
+ }
+ return (leftClosed == other.leftClosed) && (rightClosed == other.rightClosed) && left.equals(other.left) && right.equals(other.right);
+ }
+
+ /**
+ * Returns the filter string for this version range using the specified
+ * attribute name.
+ *
+ * @param attributeName The attribute name to use in the returned filter
+ * string.
+ * @return A filter string for this version range using the specified
+ * attribute name.
+ * @throws IllegalArgumentException If the specified attribute name is not a
+ * valid attribute name.
+ *
+ * @see "Core Specification, Filters, for a description of the filter string syntax."
+ */
+ public String toFilterString(String attributeName) {
+ if (attributeName.length() == 0) {
+ throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
+ }
+ for (char ch : attributeName.toCharArray()) {
+ if ((ch == '=') || (ch == '>') || (ch == '<') || (ch == '~') || (ch == '(') || (ch == ')')) {
+ throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
+ }
+ }
+
+ StringBuffer result = new StringBuffer(128);
+ if (right != null) {
+ result.append("(&");
+ }
+ if (leftClosed) {
+ result.append('(');
+ result.append(attributeName);
+ result.append(">=");
+ result.append(left.toString0());
+ result.append(')');
+ } else {
+ result.append("(!(");
+ result.append(attributeName);
+ result.append("<=");
+ result.append(left.toString0());
+ result.append("))");
+ }
+ if (right != null) {
+ if (rightClosed) {
+ result.append('(');
+ result.append(attributeName);
+ result.append("<=");
+ result.append(right.toString0());
+ result.append(')');
+ } else {
+ result.append("(!(");
+ result.append(attributeName);
+ result.append(">=");
+ result.append(right.toString0());
+ result.append("))");
+ }
+ result.append(')');
+ }
+
+ return result.toString();
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java Fri May 11 20:19:02 2012
@@ -0,0 +1,85 @@
+/*
+ * 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.hooks.bundle;
+
+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>
+ * 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 all registered
+ * collision hook services 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: a1a25ee0432f210a56e911246f477f19edc28bc1 $
+ */
+public interface CollisionHook {
+
+ /**
+ * Specifies a bundle install operation is being performed.
+ */
+ int INSTALLING = 1;
+
+ /**
+ * Specifies a bundle update operation is being performed.
+ */
+ int UPDATING = 2;
+
+ /**
+ * Filter bundle collisions hook method. This method is called during the
+ * install or update operation. The operation type will be
+ * {@link #INSTALLING installing} or {@link #UPDATING updating}. Depending
+ * on the operation type the target bundle and the collision candidate
+ * collection are the following:
+ * <ul>
+ * <li> {@link #INSTALLING installing} - The target is the bundle associated
+ * with the {@link BundleContext} used to call one of the
+ * {@link BundleContext#installBundle(String) install} methods. The
+ * collision candidate collection contains the existing bundles installed
+ * which have the same symbolic name and version as the bundle being
+ * installed.
+ * <li> {@link #UPDATING updating} - The target is the bundle used to call
+ * one of the {@link Bundle#update() update} methods. The collision
+ * candidate collection contains the existing bundles installed which have
+ * the same symbolic name and version as the content the target bundle is
+ * being updated to.
+ * </ul>
+ * This method can filter the collection of collision candidates by removing
+ * potential collisions. For the specified operation to succeed, the
+ * collection of collision candidates must be empty after all registered
+ * collision hook services have been called.
+ *
+ * @param operationType The operation type. Must be the value of
+ * {@link #INSTALLING installing} or {@link #UPDATING updating}.
+ * @param target The target bundle used to determine what collision
+ * candidates to filter.
+ * @param collisionCandidates The collection of collision candidates. The
+ * collection supports all the optional {@code Collection} operations
+ * except {@code add} and {@code addAll}. Attempting to add to the
+ * collection will result in an {@code UnsupportedOperationException}
+ * . The collection is not synchronized.
+ */
+ void filterCollisions(int operationType, Bundle target, Collection<Bundle> collisionCandidates);
+}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). 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.
@@ -17,11 +17,10 @@
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
-/**
+/**
* OSGi Framework Bundle Event Hook Service.
*
* <p>
@@ -29,21 +28,23 @@ import org.osgi.framework.BundleEvent;
* (install, start, stop, update, and uninstall bundle) operations.
*
* @ThreadSafe
- * @version $Id: 18ea1ec1f14f47410a43e99be4da3b2583149722 $
+ * @version $Id: e1471b36491a02bd8598a30d05c889ee58edc760 $
*/
public interface EventHook {
/**
- * Bundle event hook method. This method is called prior to bundle event
- * delivery when a bundle is installed, resolved, started, stopped, unresolved, or
- * uninstalled. This method can filter the bundles which receive the event.
+ * Bundle event hook method. This method is called prior to bundle event
+ * delivery when a bundle is installed, resolved, started, stopped,
+ * unresolved, or uninstalled. This method can filter the bundles which
+ * receive the event.
* <p>
- * This method must be called by the framework one and only one time for each bundle
- * event generated, this included bundle events which are generated when there are no
- * bundle listeners registered. This method must be called on the same thread that is
- * performing the action which generated the specified event. The specified
- * collection includes bundle contexts with synchronous and asynchronous bundle
- * listeners registered with them.
+ * This method must be called by the framework one and only one time for
+ * each bundle event generated, this included bundle events which are
+ * generated when there are no bundle listeners registered. This method must
+ * be called on the same thread that is performing the action which
+ * generated the specified event. The specified collection includes bundle
+ * contexts with synchronous and asynchronous bundle listeners registered
+ * with them.
*
* @param event The bundle event to be delivered
* @param contexts A collection of Bundle Contexts for bundles which have
@@ -52,9 +53,9 @@ public interface EventHook {
* collection to prevent the event from being delivered to the
* associated bundles. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void event(BundleEvent event, Collection<BundleContext> contexts);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.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.
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -29,7 +29,7 @@ import org.osgi.framework.BundleExceptio
* (get bundles) operations.
*
* @ThreadSafe
- * @version $Id: 4492a677df650072fe6acaea9ea35571f31eb5a9 $
+ * @version $Id: ae6bf5fc5cf999ac39dfc195c99ef7e223e3b847 $
*/
public interface FindHook {
/**
@@ -48,19 +48,16 @@ public interface FindHook {
* {@link BundleException#REJECTED_BY_HOOK} exception.</li>
* </ul>
*
- * @param context
- * The bundle context of the bundle performing the find
- * operation.
- * @param bundles
- * A collection of Bundles to be returned as a result of the find
- * operation. The implementation of this method may remove
- * bundles from the collection to prevent the bundles from being
- * returned to the bundle performing the find operation. The
- * collection supports all the optional {@code Collection}
- * operations except {@code add} and {@code addAll}. Attempting
- * to add to the collection will result in an
- * {@code UnsupportedOperationException}. The collection is not
- * synchronized.
+ * @param context The bundle context of the bundle performing the find
+ * operation.
+ * @param bundles A collection of Bundles to be returned as a result of the
+ * find operation. The implementation of this method may remove
+ * bundles from the collection to prevent the bundles from being
+ * returned to the bundle performing the find operation. The
+ * collection supports all the optional {@code Collection} operations
+ * except {@code add} and {@code addAll}. Attempting to add to the
+ * collection will result in an {@code UnsupportedOperationException}
+ * . The collection is not synchronized.
*/
void find(BundleContext context, Collection<Bundle> bundles);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java Fri May 11 20:19:02 2012
@@ -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.
@@ -17,8 +17,9 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
+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;
@@ -51,62 +52,70 @@ import org.osgi.framework.wiring.Framewo
* must be thrown to the caller of the API which triggered the resolve process.
* In cases where the the caller is not available a framework event of type
* error should be fired.</li>
+ *
* <li>For each registered hook factory call the
* {@link ResolverHookFactory#begin(Collection)} method to inform the hooks
* about a resolve process beginning and to obtain a Resolver Hook instance that
* will be used for the duration of the resolve process.</li>
+ *
* <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 R}. For each
- * resolver hook call the {@link #filterResolvable(Collection)} method with the
- * shrinkable collection {@code R}.</li>
- * <li>The shrinkable collection {@code R} 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 R} 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 R} that represents a singleton bundle do the following:<br/>
- * Determine the collection of available capabilities that have a name space of
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}, 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 S}.
- *
- * Remove the {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}
- * capability provided by bundle revision {@code B} from shrinkable collection
- * {@code S}. A singleton bundle cannot collide with itself.
- *
+ * {@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 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 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 BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} capability
- * provided by bundle revision {@code B} and the shrinkable collection {@code S}
- *
- * The shrinkable collection {@code S} now contains all singleton
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} capabilities that
- * can influence the ability of bundle revision {@code B} to resolve.</li>
+ * {@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 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>
* <li>During a resolve process a framework is free to attempt to resolve any or
- * all bundles contained in shrinkable collection {@code R}. For each bundle
- * revision {@code B} left in the shrinkable collection {@code R} 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 T} specified by bundle revision {@code B}
+ * 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 C}. 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
* {@link #filterMatches(BundleRequirement, Collection)} with the requirement
- * {@code T} and the shrinkable collection {@code C}.
+ * {@code R} and the shrinkable collection {@code Candidates}.
*
* <p/>
- * The shrinkable collection {@code C} now contains all the capabilities that
- * may be used to satisfy the requirement {@code T}. Any other capabilities that
- * got removed from the shrinkable collection {@code C} must not be used to
- * satisfy requirement {@code T}.</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>
@@ -125,18 +134,18 @@ import org.osgi.framework.wiring.Framewo
*
* @see ResolverHookFactory
* @NotThreadSafe
- * @version $Id: ea23400257d780706250f8825ec886aaebb0e5d8 $
+ * @version $Id: 9d3ef6240aead0952b5a47b793780c1c0589089a $
*/
public interface ResolverHook {
/**
- * Filter resolvable candidates hook method. This method may be called
- * multiple times during a single resolve process.
- * This method can filter the collection of candidates by removing
- * potential candidates. Removing a candidate will prevent the candidate
- * from resolving during the current resolve process.
+ * Filter resolvable candidates hook method. This method may be called
+ * multiple times during a single resolve process. This method can filter
+ * the collection of candidates by removing potential candidates. Removing a
+ * candidate will prevent the candidate from resolving during the current
+ * resolve process.
*
- * @param candidates the collection of resolvable candidates available during
- * a resolve process.
+ * @param candidates the collection of resolvable candidates available
+ * during a resolve process.
*/
void filterResolvable(Collection<BundleRevision> candidates);
@@ -146,19 +155,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} can be
- * singletons. In that case all the collision candidates have the name space
- * of {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}, are
+ * 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}.
+ * 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
@@ -171,28 +179,29 @@ 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
*/
void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates);
/**
- * This method is called once at the end of the resolve process.
- * After the end method is called the resolve process has ended.
- * The framework must not hold onto this resolver hook instance
- * after end has been called.
+ * This method is called once at the end of the resolve process. After the
+ * end method is called the resolve process has ended. The framework must
+ * not hold onto this resolver hook instance after end has been called.
*/
void end();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.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,78 +17,88 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.FrameworkWiring;
-/**
+/**
* OSGi Framework Resolver Hook Factory Service.
*
* <p>
- * Bundles registering this service will be called by the framework during
- * a bundle resolver process to obtain a {@link ResolverHook resolver hook}
+ * Bundles registering this service will be called by the framework during a
+ * bundle resolver process to obtain a {@link ResolverHook resolver hook}
* instance which will be used for the duration of a resolve process.
*
* @ThreadSafe
* @see ResolverHook
- * @version $Id: 4023566367435f07c047a7ba571f3bedc53aa37a $
+ * @version $Id: e0a2f3ad081c31bbb682fa366c15a3080bf6da2b $
*/
public interface ResolverHookFactory {
/**
* This method is called by the framework each time a resolve process begins
- * to obtain a {@link ResolverHook resolver hook} instance. This resolver hook
- * instance will be used for the duration of the resolve process. At the end of
- * the resolve process the method {@link ResolverHook#end()} must be called by
- * the framework and the framework must not hold any references of the resolver
- * hook instance.
+ * to obtain a {@link ResolverHook resolver hook} instance. This resolver
+ * hook instance will be used for the duration of the resolve process. At
+ * the end of the resolve process the method {@link ResolverHook#end()} must
+ * be called by the framework and the framework must not hold any references
+ * of the resolver hook instance.
* <p>
- * The triggers represent the collection of bundles which triggered
- * the resolve process. This collection may be empty if the triggers
- * cannot be determined by the framework. In most cases the triggers
- * can easily be determined. Calling certain methods on
- * {@link Bundle bundle} when a bundle is in the {@link Bundle#INSTALLED INSTALLED}
- * state will cause the framework to begin a resolve process in order to resolve the
- * bundle. The following methods will start a resolve process in this case:
+ * The triggers represent the collection of bundles which triggered the
+ * resolve process. This collection may be empty if the triggers cannot be
+ * determined by the framework. In most cases the triggers can easily be
+ * determined. Calling certain methods on {@link Bundle bundle} when a
+ * bundle is in the {@link Bundle#INSTALLED INSTALLED} state will cause the
+ * framework to begin a resolve process in order to resolve the bundle. The
+ * following methods will start a resolve process in this case:
* <ul>
- * <li>{@link Bundle#start() start}</li>
- * <li>{@link Bundle#loadClass(String) loadClass}</li>
- * <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
- * <li>{@link Bundle#getResource(String) getResource}</li>
- * <li>{@link Bundle#getResources(String) getResources}</li>
- * </ul>
+ * <li>{@link Bundle#start() start}</li>
+ * <li>{@link Bundle#loadClass(String) loadClass}</li>
+ * <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
+ * <li>{@link Bundle#getResource(String) getResource}</li>
+ * <li>{@link Bundle#getResources(String) getResources}</li>
+ * </ul>
* In such cases the collection will contain the single bundle which the
- * framework is trying to resolve. Other cases will cause multiple bundles to be
- * included in the trigger bundles collection. When {@link FrameworkWiring#resolveBundles(Collection)
- * resolveBundles} is called the collection of triggers must include all the current bundle
- * revisions for bundles passed to resolveBundles which are in the {@link Bundle#INSTALLED INSTALLED}
- * state.
+ * framework is trying to resolve. Other cases will cause multiple bundles
+ * to be included in the trigger bundles collection. When
+ * {@link FrameworkWiring#resolveBundles(Collection) resolveBundles} is
+ * called the collection of triggers must include all the current bundle
+ * revisions for bundles passed to resolveBundles which are in the
+ * {@link Bundle#INSTALLED INSTALLED} state.
* <p>
- * When {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
- * is called the collection of triggers is determined with the following steps:
+ * When
+ * {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
+ * is called the collection of triggers is determined with the following
+ * steps:
* <ul>
- * <li>If the collection of bundles passed is null then {@link FrameworkWiring#getRemovalPendingBundles()}
- * is called to get the initial collection of bundles.</li>
- * <li>The equivalent of calling {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
- * the initial collection of bundles to get the dependency closure collection of the bundles being refreshed.</li>
- * <li>Remove any non-active bundles from the dependency closure collection.</li>
- * <li>For each bundle remaining in the dependency closure collection get the current bundle revision
- * and add it to the collection of triggers.</li>
+ * <li>If the collection of bundles passed is null then
+ * {@link FrameworkWiring#getRemovalPendingBundles()} is called to get the
+ * initial collection of bundles.</li>
+ * <li>The equivalent of calling
+ * {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
+ * the initial collection of bundles to get the dependency closure
+ * collection of the bundles being refreshed.</li>
+ * <li>Remove any non-active bundles from the dependency closure collection.
+ * </li>
+ * <li>For each bundle remaining in the dependency closure collection get
+ * the current bundle revision and add it to the collection of triggers.</li>
* </ul>
* <p>
- * As described above, a resolve process is typically initiated as a result of calling API that causes the
- * framework to attempt to resolve one or more bundles.
- * The framework is free to start a resolve process at any time for reasons other than calls to framework API.
- * For example, a resolve process may be used by the framework for diagnostic purposes and result in no
- * bundles actually becoming resolved at the end of the process.
- * Resolver hook implementations must be prepared for resolve processes that are initiated for other reasons
- * besides calls to framework API.
- * @param triggers an unmodifiable collection of bundles which triggered the resolve process.
- * This collection may be empty if the collection of trigger bundles cannot be
- * determined.
- * @return a resolver hook instance to be used for the duration of the resolve process.
- * A {@code null} value may be returned which indicates this resolver hook factory abstains from
- * the resolve process.
+ * As described above, a resolve process is typically initiated as a result
+ * of calling API that causes the framework to attempt to resolve one or
+ * more bundles. The framework is free to start a resolve process at any
+ * time for reasons other than calls to framework API. For example, a
+ * resolve process may be used by the framework for diagnostic purposes and
+ * result in no bundles actually becoming resolved at the end of the
+ * process. Resolver hook implementations must be prepared for resolve
+ * processes that are initiated for other reasons besides calls to framework
+ * API.
+ *
+ * @param triggers an unmodifiable collection of bundles which triggered the
+ * resolve process. This collection may be empty if the collection of
+ * trigger bundles cannot be determined.
+ * @return a resolver hook instance to be used for the duration of the
+ * resolve process. A {@code null} value may be returned which
+ * indicates this resolver hook factory abstains from the resolve
+ * process.
*/
ResolverHook begin(Collection<BundleRevision> triggers);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 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.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
@@ -30,7 +29,7 @@ import org.osgi.framework.ServiceEvent;
*
* @ThreadSafe
* @deprecated As of 1.1. Replaced by {@link EventListenerHook}.
- * @version $Id: 8fb8cfa2c8847f99fd84711e12f02a57bf06932e $
+ * @version $Id: 84757a5f719db4d7671e81a76af2b320404ae0f5 $
*/
public interface EventHook {
@@ -46,9 +45,9 @@ public interface EventHook {
* collection to prevent the event from being delivered to the
* associated bundles. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void event(ServiceEvent event, Collection<BundleContext> contexts);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). 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.
@@ -18,7 +18,6 @@ package org.osgi.framework.hooks.service
import java.util.Collection;
import java.util.Map;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
@@ -32,7 +31,7 @@ import org.osgi.framework.hooks.service.
*
* @ThreadSafe
* @since 1.1
- * @version $Id: 61c6aa7e7d4c85b3e5a6a3a340155bcda0074505 $
+ * @version $Id: b0b99b29206f272ad479fa08ffcd5ef5fda909b8 $
*/
public interface EventListenerHook {
@@ -56,6 +55,5 @@ public interface EventListenerHook {
* collection will result in an {@code UnsupportedOperationException}
* . The map and the collections are not synchronized.
*/
- void event(ServiceEvent event,
- Map<BundleContext, Collection<ListenerInfo>> listeners);
+ void event(ServiceEvent event, Map<BundleContext, Collection<ListenerInfo>> listeners);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 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.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -29,7 +28,7 @@ import org.osgi.framework.ServiceReferen
* (get service references) operations.
*
* @ThreadSafe
- * @version $Id: 4a939200fa6634a563379b057e11bd1b5d174b9d $
+ * @version $Id: 45612d6a10a25ca0b40ba695eb8dba21c2c78c24 $
*/
public interface FindHook {
@@ -40,12 +39,12 @@ public interface FindHook {
*
* @param context The bundle context of the bundle performing the find
* operation.
- * @param name The class name of the services to find or {@code null}
- * to find all services.
- * @param filter The filter criteria of the services to find or
- * {@code null} for no filter criteria.
- * @param allServices {@code true} if the find operation is the result
- * of a call to
+ * @param name The class name of the services to find or {@code null} to
+ * find all services.
+ * @param filter The filter criteria of the services to find or {@code null}
+ * for no filter criteria.
+ * @param allServices {@code true} if the find operation is the result of a
+ * call to
* {@link BundleContext#getAllServiceReferences(String, String)}
* @param references A collection of Service References to be returned as a
* result of the find operation. The implementation of this method
@@ -53,10 +52,9 @@ public interface FindHook {
* references from being returned to the bundle performing the find
* operation. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
- void find(BundleContext context, String name, String filter,
- boolean allServices, Collection<ServiceReference< ? >> references);
+ void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 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.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
/**
@@ -28,7 +27,7 @@ import org.osgi.framework.BundleContext;
* addition and removal.
*
* @ThreadSafe
- * @version $Id: c1687e95e568589cf3e6d927b7d372c9f88c5d16 $
+ * @version $Id: 94029e2b70119793b3e7d77d6e1d5052d9ee1723 $
*/
public interface ListenerHook {
@@ -43,8 +42,8 @@ public interface ListenerHook {
* @param listeners A collection of {@link ListenerInfo}s for newly added
* service listeners which are now listening to service events.
* Attempting to add to or remove from the collection will result in
- * an {@code UnsupportedOperationException}. The collection is
- * not synchronized.
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void added(Collection<ListenerInfo> listeners);
@@ -57,8 +56,8 @@ public interface ListenerHook {
* @param listeners A collection of {@link ListenerInfo}s for newly removed
* service listeners which are no longer listening to service events.
* Attempting to add to or remove from the collection will result in
- * an {@code UnsupportedOperationException}. The collection is
- * not synchronized.
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void removed(Collection<ListenerInfo> listeners);
@@ -81,17 +80,15 @@ public interface ListenerHook {
* Return the filter string with which the listener was added.
*
* @return The filter string with which the listener was added. This may
- * be {@code null} if the listener was added without a
- * filter.
+ * be {@code null} if the listener was added without a filter.
*/
String getFilter();
/**
* Return the state of the listener for this addition and removal life
- * cycle. Initially this method will return {@code false}
- * indicating the listener has been added but has not been removed.
- * After the listener has been removed, this method must always return
- * {@code true}.
+ * cycle. Initially this method will return {@code false} indicating the
+ * listener has been added but has not been removed. After the listener
+ * has been removed, this method must always return {@code true}.
*
* <p>
* There is an extremely rare case in which removed notification to
@@ -109,19 +106,16 @@ public interface ListenerHook {
boolean isRemoved();
/**
- * Compares this {@code ListenerInfo} to another
- * {@code ListenerInfo}. Two {@code ListenerInfo}s are equals
- * if they refer to the same listener for a given addition and removal
- * life cycle. If the same listener is added again, it must have a
- * different {@code ListenerInfo} which is not equal to this
- * {@code ListenerInfo}.
- *
- * @param obj The object to compare against this
- * {@code ListenerInfo}.
- * @return {@code true} if the other object is a
- * {@code ListenerInfo} object and both objects refer to
- * the same listener for a given addition and removal life
- * cycle.
+ * Compares this {@code ListenerInfo} to another {@code ListenerInfo}.
+ * Two {@code ListenerInfo}s are equals if they refer to the same
+ * listener for a given addition and removal life cycle. If the same
+ * listener is added again, it must have a different
+ * {@code ListenerInfo} which is not equal to this {@code ListenerInfo}.
+ *
+ * @param obj The object to compare against this {@code ListenerInfo}.
+ * @return {@code true} if the other object is a {@code ListenerInfo}
+ * object and both objects refer to the same listener for a
+ * given addition and removal life cycle.
*/
boolean equals(Object obj);
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java Fri May 11 20:19:02 2012
@@ -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.
@@ -18,7 +18,6 @@ package org.osgi.framework.hooks.weaving
import java.security.ProtectionDomain;
import java.util.List;
-
import org.osgi.framework.wiring.BundleWiring;
/**
@@ -35,7 +34,7 @@ import org.osgi.framework.wiring.BundleW
*
* @NotThreadSafe
* @noimplement
- * @version $Id: c689a4c27dc39af1bf5f51338f1a8eaca1dddc1a $
+ * @version $Id: 549caef41027c8f0d0fdb4deae756eae6b69d1ee $
*/
public interface WovenClass {
@@ -138,15 +137,16 @@ public interface WovenClass {
public ProtectionDomain getProtectionDomain();
/**
- * Returns the class associated with this woven class. When loading a class
- * for the first time this method will return {@code null} until weaving is
- * {@link #isWeavingComplete() complete}. Once weaving is complete, this
- * method will return the class object.
+ * Returns the class defined by this woven class. During weaving, this
+ * method will return {@code null}. Once weaving is
+ * {@link #isWeavingComplete() complete}, this method will return the class
+ * object if this woven class was used to define the class.
*
* @return The class associated with this woven class, or {@code null} if
- * weaving is not complete or the class definition failed.
+ * weaving is not complete, the class definition failed or this
+ * woven class was not used to define the class.
*/
- public Class< ? > getDefinedClass();
+ public Class<?> getDefinedClass();
/**
* Returns the bundle wiring whose class loader will define the woven class.
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 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,6 @@ package org.osgi.framework.launch;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -35,7 +34,7 @@ import org.osgi.framework.FrameworkEvent
*
* @ThreadSafe
* @noimplement
- * @version $Id: 2be857d06f3605a04f701b59f11e127c0f8940dc $
+ * @version $Id: e76240d5de584d1666880d9bc358571a76cbd8fb $
*/
public interface Framework extends Bundle {
@@ -76,13 +75,12 @@ public interface Framework extends Bundl
void init() throws BundleException;
/**
- * Wait until this Framework has completely stopped. The {@code stop}
- * and {@code update} methods on a Framework performs an asynchronous
- * stop of the Framework. This method can be used to wait until the
- * asynchronous stop of this Framework has completed. This method will only
- * wait if called when this Framework is in the {@link #STARTING},
- * {@link #ACTIVE}, or {@link #STOPPING} states. Otherwise it will return
- * immediately.
+ * Wait until this Framework has completely stopped. The {@code stop} and
+ * {@code update} methods on a Framework performs an asynchronous stop of
+ * the Framework. This method can be used to wait until the asynchronous
+ * stop of this Framework has completed. This method will only wait if
+ * called when this Framework is in the {@link #STARTING}, {@link #ACTIVE},
+ * or {@link #STOPPING} states. Otherwise it will return immediately.
* <p>
* A Framework Event is returned to indicate why this Framework has stopped.
*
@@ -90,8 +88,8 @@ public interface Framework extends Bundl
* Framework has completely stopped. A value of zero will wait
* indefinitely.
* @return A Framework Event indicating the reason this method returned. The
- * following {@code FrameworkEvent} types may be returned by
- * this method.
+ * following {@code FrameworkEvent} types may be returned by this
+ * method.
* <ul>
* <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
* been stopped. </li>
@@ -230,8 +228,8 @@ public interface Framework extends Bundl
*
* @throws BundleException This Framework cannot be uninstalled.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void uninstall() throws BundleException;
@@ -251,8 +249,8 @@ public interface Framework extends Bundl
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void update() throws BundleException;
@@ -268,8 +266,8 @@ public interface Framework extends Bundl
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void update(InputStream in) throws BundleException;
@@ -284,8 +282,8 @@ public interface Framework extends Bundl
/**
* Returns the Framework location identifier. This Framework is assigned the
- * unique location "{@code System Bundle}" since this
- * Framework is also a System Bundle.
+ * unique location "{@code System Bundle}" since this Framework is
+ * also a System Bundle.
*
* @return The string "{@code System Bundle}".
* @throws SecurityException If the caller does not have the appropriate
@@ -299,8 +297,8 @@ public interface Framework extends Bundl
/**
* Returns the symbolic name of this Framework. The symbolic name is unique
* for the implementation of the framework. However, the symbolic name
- * "{@code system.bundle}" must be recognized as an alias to
- * the implementation-defined symbolic name since this Framework is also a
+ * "{@code system.bundle}" must be recognized as an alias to the
+ * implementation-defined symbolic name since this Framework is also a
* System Bundle.
*
* @return The symbolic name of this Framework.
@@ -310,22 +308,22 @@ public interface Framework extends Bundl
String getSymbolicName();
/**
- * Returns {@code null} as a framework implementation does not have a
- * proper bundle from which to return entry paths.
+ * Returns {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entry paths.
*
* @param path Ignored.
- * @return {@code null} as a framework implementation does not have a
- * proper bundle from which to return entry paths.
+ * @return {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entry paths.
*/
Enumeration<String> getEntryPaths(String path);
/**
- * Returns {@code null} as a framework implementation does not have a
- * proper bundle from which to return an entry.
+ * Returns {@code null} as a framework implementation does not have a proper
+ * bundle from which to return an entry.
*
* @param path Ignored.
- * @return {@code null} as a framework implementation does not have a
- * proper bundle from which to return an entry.
+ * @return {@code null} as a framework implementation does not have a proper
+ * bundle from which to return an entry.
*/
URL getEntry(String path);
@@ -339,8 +337,7 @@ public interface Framework extends Bundl
* @return {@code null} as a framework implementation does not have a proper
* bundle from which to return entries.
*/
- Enumeration<URL> findEntries(String path, String filePattern,
- boolean recurse);
+ Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
/**
* Adapt this Framework to the specified type.
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 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.launch;
import java.util.Map;
-
import org.osgi.framework.Bundle;
/**
@@ -33,20 +32,20 @@ import org.osgi.framework.Bundle;
* This UTF-8 encoded resource must contain the name of the framework
* implementation's FrameworkFactory implementation class. Space and tab
* characters, including blank lines, in the resource must be ignored. The
- * number sign ('#' \u0023) and all characters following it on each line are
- * a comment and must be ignored.
+ * number sign ({@code '#'} \u0023) and all characters following it on each
+ * line are a comment and must be ignored.
*
* <p>
* Launchers can find the name of the FrameworkFactory implementation class in
* the resource and then load and construct a FrameworkFactory object for the
* framework implementation. The FrameworkFactory implementation class must have
* a public, no-argument constructor. Java™ SE 6 introduced the
- * {@code ServiceLoader} class which can create a FrameworkFactory instance
- * from the resource.
+ * {@code ServiceLoader} class which can create a FrameworkFactory instance from
+ * the resource.
*
* @ThreadSafe
* @noimplement
- * @version $Id: c370e19dba77231f0dbf1601218ad97b20391ea0 $
+ * @version $Id: 1684e14aa98a1f6e1ff3e0f3afa2c55982210f72 $
*/
public interface FrameworkFactory {
@@ -59,15 +58,15 @@ public interface FrameworkFactory {
* use some reasonable default configuration appropriate for the
* current VM. For example, the system packages for the current
* execution environment should be properly exported. The specified
- * configuration argument may be {@code null}. The created
- * framework instance must copy any information needed from the
- * specified configuration argument since the configuration argument
- * can be changed after the framework instance has been created.
+ * configuration argument may be {@code null}. The created framework
+ * instance must copy any information needed from the specified
+ * configuration argument since the configuration argument can be
+ * changed after the framework instance has been created.
* @return A new, configured {@link Framework} instance. The framework
* instance must be in the {@link Bundle#INSTALLED} state.
* @throws SecurityException If the caller does not have
- * {@code AllPermission}, and the Java Runtime Environment
- * supports permissions.
+ * {@code AllPermission}, and the Java Runtime Environment supports
+ * permissions.
*/
Framework newFramework(Map<String, String> configuration);
}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java Fri May 11 20:19:02 2012
@@ -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: 383e84df9190757ce6bb6fb722e80a3b7d6b68da $
+ */
+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
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java Fri May 11 20:19:02 2012
@@ -0,0 +1,153 @@
+/*
+ * 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>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Bundle-SymbolicName} header are visible in the capability and all
+ * directives specified on the {@code Require-Bundle} 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 Require-Bundle} 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 must be ignored. A {@code cardinality} directive specified on the
+ * {@code Require-Bundle} header must be ignored. A {@code cardinality}
+ * directive must not be present in a requirement.</li>
+ * </ul>
+ *
+ * <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: 339f1204725aa9d9c2463b1224b2e38e505024e9 $
+ */
+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 "{@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.
+ *
+ * <p>
+ * This directive should be examined using the {@link HostNamespace host}
+ * namespace.
+ *
+ * @see HostNamespace#CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment";
+
+ /**
+ * The requirement directive used to specify the type of the extension
+ * fragment.
+ *
+ * <p>
+ * This directive should be examined using the {@link HostNamespace host}
+ * namespace.
+ *
+ * @see HostNamespace#REQUIREMENT_EXTENSION_DIRECTIVE
+ */
+ public final static String REQUIREMENT_EXTENSION_DIRECTIVE = "extension";
+
+ /**
+ * 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
+ }
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java?rev=1337360&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java Fri May 11 20:19:02 2012
@@ -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: e1c30aac8efacc1b21ab20ffebcc1af30a1054a8 $
+ */
+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
+ }
+}