You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2014/07/30 09:22:35 UTC
svn commit: r1614569 [3/5] - in /felix/trunk/framework: ./
src/main/appended-resources/META-INF/
src/main/java/org/apache/felix/framework/ src/main/java/org/osgi/dto/
src/main/java/org/osgi/framework/ src/main/java/org/osgi/framework/dto/
src/main/java...
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceObjects.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceObjects.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceObjects.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2013). 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.
@@ -42,8 +42,8 @@ import java.util.Set;
* A bundle's authority to register or get a service.
* <ul>
* <li>The {@code register} action allows a bundle to register a service on the
- * specified names.
- * <li>The {@code get} action allows a bundle to detect a service and get it.
+ * specified names.</li>
+ * <li>The {@code get} action allows a bundle to detect a service and get it.</li>
* </ul>
* Permission to get a service is required in order to detect events regarding
* the service. Untrusted bundles should not be able to detect the presence of
@@ -51,7 +51,7 @@ import java.util.Set;
* to get the specific service.
*
* @ThreadSafe
- * @version $Id: 96438ad164d7f0f4273787226298bf8208cf0034 $
+ * @author $Id: ff7fc46dd623c0a09b49965048dd6faa2b111b39 $
*/
public final class ServicePermission extends BasicPermission {
@@ -207,7 +207,7 @@ public final class ServicePermission ext
if (reference == null) {
throw new IllegalArgumentException("reference must not be null");
}
- StringBuffer sb = new StringBuffer("(service.id=");
+ StringBuffer sb = new StringBuffer("(" + Constants.SERVICE_ID + "=");
sb.append(reference.getProperty(Constants.SERVICE_ID));
sb.append(")");
return sb.toString();
@@ -364,6 +364,7 @@ public final class ServicePermission ext
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof ServicePermission)) {
return false;
@@ -438,6 +439,7 @@ public final class ServicePermission ext
*
* @return The canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -469,6 +471,7 @@ public final class ServicePermission ext
* @return A new {@code PermissionCollection} object suitable for storing
* {@code ServicePermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new ServicePermissionCollection();
}
@@ -484,6 +487,7 @@ public final class ServicePermission ext
* class name and actions as this {@code ServicePermission} object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -503,6 +507,7 @@ public final class ServicePermission ext
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -538,9 +543,8 @@ public final class ServicePermission ext
}
/**
- * Called by {@code <@link ServicePermission#implies(Permission)>}. This
- * method is only called on a requested permission which cannot have a
- * filter set.
+ * Called by {@link ServicePermission#implies(Permission)}. This method is
+ * only called on a requested permission which cannot have a filter set.
*
* @return a map of properties for this permission.
*/
@@ -557,8 +561,8 @@ public final class ServicePermission ext
final Map<String, Object> props = new HashMap<String, Object>(4);
final Bundle bundle = service.getBundle();
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
props.put("id", new Long(bundle.getBundleId()));
props.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
@@ -587,6 +591,7 @@ public final class ServicePermission ext
entries = null;
}
+ @Override
public Object get(Object k) {
if (!(k instanceof String)) {
return null;
@@ -639,14 +644,17 @@ public final class ServicePermission ext
throw new UnsupportedOperationException();
}
+ @Override
public String toString() {
return k + "=" + v;
}
+ @Override
public int hashCode() {
return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
}
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -717,6 +725,7 @@ final class ServicePermissionCollection
* @throws SecurityException If this {@code ServicePermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof ServicePermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -771,6 +780,7 @@ final class ServicePermissionCollection
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(final Permission permission) {
if (!(permission instanceof ServicePermission)) {
return false;
@@ -877,6 +887,7 @@ final class ServicePermissionCollection
*
* @return Enumeration of all the ServicePermission objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
Map<String, ServicePermission> pc = filterPermissions;
@@ -901,9 +912,11 @@ final class ServicePermissionCollection
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields.get("permissions", null);
permissions = new HashMap<String, ServicePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
+ @SuppressWarnings("unchecked")
HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2013). 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,6 +17,7 @@
package org.osgi.framework;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
/**
* A reference to a service.
@@ -46,11 +47,11 @@ import java.util.Dictionary;
* @see BundleContext#getServiceReferences(Class, String)
* @see BundleContext#getServiceReferences(String, String)
* @see BundleContext#getService(ServiceReference)
+ * @see BundleContext#getServiceObjects(ServiceReference)
* @ThreadSafe
- * @noimplement
- * @version $Id: 75352193f9f11a2c19692890153c6ff91611023b $
+ * @author $Id: a56f8df70e8c74a76a1ef02b714b4612bc064ecc $
*/
-
+@ProviderType
public interface ServiceReference<S> extends Comparable<Object> {
/**
* Returns the property value to which the specified property key is mapped
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2014). 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,6 +17,7 @@
package org.osgi.framework;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
/**
* A registered service.
@@ -33,10 +34,9 @@ import java.util.Dictionary;
* @param <S> Type of Service.
* @see BundleContext#registerService(String[],Object,Dictionary)
* @ThreadSafe
- * @noimplement
- * @version $Id: a84248da0db0538708d2394a9478153e06b8afb9 $
+ * @author $Id: 0bc5bfa68ae7cb4a409c066585d3ab4077d80eeb $
*/
-
+@ProviderType
public interface ServiceRegistration<S> {
/**
* Returns a {@code ServiceReference} object for a service being registered.
@@ -53,15 +53,16 @@ public interface ServiceRegistration<S>
* Updates the properties associated with a service.
*
* <p>
- * The {@link Constants#OBJECTCLASS} and {@link Constants#SERVICE_ID} keys
+ * The {@link Constants#OBJECTCLASS}, {@link Constants#SERVICE_BUNDLEID},
+ * {@link Constants#SERVICE_ID} and {@link Constants#SERVICE_SCOPE} keys
* cannot be modified by this method. These values are set by the Framework
* when the service is registered in the OSGi environment.
*
* <p>
* The following steps are required to modify service properties:
* <ol>
- * <li>The service's properties are replaced with the provided properties.
- * <li>A service event of type {@link ServiceEvent#MODIFIED} is fired.
+ * <li>The service's properties are replaced with the provided properties.</li>
+ * <li>A service event of type {@link ServiceEvent#MODIFIED} is fired.</li>
* </ol>
*
* @param properties The properties for this service. See {@link Constants}
@@ -86,18 +87,21 @@ public interface ServiceRegistration<S>
* The following steps are required to unregister a service:
* <ol>
* <li>The service is removed from the Framework service registry so that it
- * can no longer be obtained.
+ * can no longer be obtained.</li>
* <li>A service event of type {@link ServiceEvent#UNREGISTERING} is fired
* so that bundles using this service can release their use of the service.
* Once delivery of the service event is complete, the
* {@code ServiceReference} objects for the service may no longer be used to
- * get a service object for the service.
+ * get a service object for the service.</li>
* <li>For each bundle whose use count for this service is greater than
- * zero: <br>
- * The bundle's use count for this service is set to zero. <br>
- * If the service was registered with a {@link ServiceFactory} object, the
- * {@code ServiceFactory.ungetService} method is called to release the
- * service object for the bundle.
+ * zero:
+ * <ul>
+ * <li>The bundle's use count for this service is set to zero.</li>
+ * <li>If the service was registered with a {@link ServiceFactory} object,
+ * the {@code ServiceFactory.ungetService} method is called to release the
+ * service object for the bundle.</li>
+ * </ul>
+ * </li>
* </ol>
*
* @throws IllegalStateException If this {@code ServiceRegistration} object
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2013). 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.
@@ -26,7 +26,7 @@ import java.util.Map;
* during filter expression evaluation in the permission implies method.
*
* @Immutable
- * @version $Id: 94eea19050b84907f1257d7a12ebf8ab404f4473 $
+ * @author $Id: 53dec4a366c1c419baeb1e3b7d6b2b3bf172ad93 $
*/
final class SignerProperty {
private final Bundle bundle;
@@ -64,6 +64,7 @@ final class SignerProperty {
* @param o SignerProperty to compare against.
* @return true if the DN name chain matches the pattern.
*/
+ @Override
public boolean equals(Object o) {
if (!(o instanceof SignerProperty))
return false;
@@ -91,6 +92,7 @@ final class SignerProperty {
* Since the equals method does not obey the general equals contract, this
* method cannot generate hash codes which obey the equals contract.
*/
+ @Override
public int hashCode() {
return 31;
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A synchronous {@code BundleEvent} listener. {@code SynchronousBundleListener}
* is a listener interface that may be implemented by a bundle developer. When a
@@ -57,9 +59,9 @@ package org.osgi.framework;
* @since 1.1
* @see BundleEvent
* @ThreadSafe
- * @version $Id: 74246f4ceeba7f9a5ee198048522f93d4691c51a $
+ * @author $Id: 6b50c6c9d8b8b091928495eb036552773284b13a $
*/
-
+@ConsumerType
public interface SynchronousBundleListener extends BundleListener {
// This is a marker interface
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.hooks.service.ListenerHook;
/**
@@ -65,9 +66,9 @@ import org.osgi.framework.hooks.service.
* @see ServicePermission
* @ThreadSafe
* @since 1.7
- * @version $Id: 543a345802f8dc7a49d29e8fb7aee7004ee2b329 $
+ * @author $Id: c68fe7ab0c3461256613d22dd666f17f87597dfe $
*/
-
+@ConsumerType
public interface UnfilteredServiceListener extends ServiceListener {
// This is a marker interface
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/Version.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/Version.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/Version.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2014). 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.
@@ -37,7 +37,7 @@ import java.util.StringTokenizer;
*
* @since 1.3
* @Immutable
- * @version $Id: a0b5a865f7fbf2b3dcb77a13b2e99da0b64702bb $
+ * @author $Id: c24d4d37a0657ac69de29085d2d290cbb0031c4a $
*/
public class Version implements Comparable<Version> {
@@ -210,13 +210,13 @@ public class Version implements Comparab
* Parses a version identifier from the specified string.
*
* <p>
- * See {@code Version(String)} for the format of the version string.
+ * See {@link #Version(String)} for the format of the version string.
*
* @param version String representation of the version identifier. Leading
* and trailing whitespace will be ignored.
* @return A {@code Version} object representing the version identifier. If
* {@code version} is {@code null} or the empty string then
- * {@code emptyVersion} will be returned.
+ * {@link #emptyVersion} will be returned.
* @throws IllegalArgumentException If {@code version} is improperly
* formatted.
*/
@@ -225,6 +225,30 @@ public class Version implements Comparab
return emptyVersion;
}
+ return valueOf(version);
+ }
+
+ /**
+ * Returns a {@code Version} object holding the version identifier in the
+ * specified {@code String}.
+ *
+ * <p>
+ * See {@link #Version(String)} for the format of the version string.
+ *
+ * <p>
+ * This method performs a similar function as {@link #parseVersion(String)}
+ * but has the static factory {@code valueOf(String)} method signature.
+ *
+ * @param version String representation of the version identifier. Leading
+ * and trailing whitespace will be ignored. Must not be {@code null}.
+ * @return A {@code Version} object representing the version identifier. If
+ * {@code version} is the empty string then {@link #emptyVersion}
+ * will be returned.
+ * @throws IllegalArgumentException If {@code version} is improperly
+ * formatted.
+ * @since 1.8
+ */
+ public static Version valueOf(String version) {
version = version.trim();
if (version.length() == 0) {
return emptyVersion;
@@ -279,6 +303,7 @@ public class Version implements Comparab
*
* @return The string representation of this version identifier.
*/
+ @Override
public String toString() {
return toString0();
}
@@ -289,8 +314,9 @@ public class Version implements Comparab
* @return The string representation of this version identifier.
*/
String toString0() {
- if (versionString != null) {
- return versionString;
+ String s = versionString;
+ if (s != null) {
+ return s;
}
int q = qualifier.length();
StringBuffer result = new StringBuffer(20 + q);
@@ -311,11 +337,13 @@ public class Version implements Comparab
*
* @return An integer which is a hash code value for this object.
*/
+ @Override
public int hashCode() {
- if (hash != 0) {
- return hash;
+ int h = hash;
+ if (h != 0) {
+ return h;
}
- int h = 31 * 17;
+ h = 31 * 17;
h = 31 * h + major;
h = 31 * h + minor;
h = 31 * h + micro;
@@ -335,6 +363,7 @@ public class Version implements Comparab
* @return {@code true} if {@code object} is a {@code Version} and is equal
* to this object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object object) {
if (object == this) { // quicktest
return true;
Modified: 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=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). 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.
@@ -32,7 +32,7 @@ import java.util.StringTokenizer;
*
* @since 1.7
* @Immutable
- * @version $Id: d0c21e6a5015a7fa0b33179a29122ea7d137145a $
+ * @author $Id: 1f5fa660a1a42e83371fe0d2c61ae79ce1cb1710 $
*/
public class VersionRange {
@@ -123,7 +123,7 @@ public class VersionRange {
*
* @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.
+ * range string is ignored. Must not be {@code null}.
* @throws IllegalArgumentException If {@code range} is improperly
* formatted.
*/
@@ -191,7 +191,7 @@ public class VersionRange {
*/
private static Version parseVersion(String version, String range) {
try {
- return Version.parseVersion(version);
+ return Version.valueOf(version);
} catch (IllegalArgumentException e) {
IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
iae.initCause(e);
@@ -377,9 +377,11 @@ public class VersionRange {
*
* @return The string representation of this version range.
*/
+ @Override
public String toString() {
- if (versionRangeString != null) {
- return versionRangeString;
+ String s = versionRangeString;
+ if (s != null) {
+ return s;
}
String leftVersion = left.toString();
if (right == null) {
@@ -402,14 +404,16 @@ public class VersionRange {
*
* @return An integer which is a hash code value for this object.
*/
+ @Override
public int hashCode() {
- if (hash != 0) {
- return hash;
+ int h = hash;
+ if (h != 0) {
+ return h;
}
if (empty) {
return hash = 31;
}
- int h = 31 + (leftClosed ? 7 : 5);
+ h = 31 + (leftClosed ? 7 : 5);
h = 31 * h + left.hashCode();
if (right != null) {
h = 31 * h + right.hashCode();
@@ -430,6 +434,7 @@ public class VersionRange {
* @return {@code true} if {@code object} is a {@code VersionRange} and is
* equal to this object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object object) {
if (object == this) { // quicktest
return true;
@@ -471,9 +476,16 @@ public class VersionRange {
}
StringBuffer result = new StringBuffer(128);
- if (right != null) {
+ final boolean needPresence = !leftClosed && ((right == null) || !rightClosed);
+ final boolean multipleTerms = needPresence || (right != null);
+ if (multipleTerms) {
result.append("(&");
}
+ if (needPresence) {
+ result.append('(');
+ result.append(attributeName);
+ result.append("=*)");
+ }
if (leftClosed) {
result.append('(');
result.append(attributeName);
@@ -501,9 +513,31 @@ public class VersionRange {
result.append(right.toString0());
result.append("))");
}
+ }
+ if (multipleTerms) {
result.append(')');
}
return result.toString();
}
+
+ /**
+ * Returns a {@code VersionRange} object holding the version range in the
+ * specified {@code String}.
+ *
+ * <p>
+ * See {@link #VersionRange(String)} for the format of the version range
+ * string.
+ *
+ * @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. Must not be {@code null}.
+ * @return A {@code VersionRange} object representing the version range.
+ * @throws IllegalArgumentException If {@code range} is improperly
+ * formatted.
+ * @since 1.8
+ */
+ public static VersionRange valueOf(String range) {
+ return new VersionRange(range);
+ }
}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.Bundle;
+
+/**
+ * Data Transfer Object for a Bundle.
+ *
+ * <p>
+ * A Bundle can be adapted to provide a {@code BundleDTO} for the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleDTO extends DTO {
+ /**
+ * The bundle's unique identifier.
+ *
+ * @see Bundle#getBundleId()
+ */
+ public long id;
+
+ /**
+ * The time when the bundle was last modified.
+ *
+ * @see Bundle#getLastModified()
+ */
+ public long lastModified;
+
+ /**
+ * The bundle's state.
+ *
+ * @see Bundle#getState()
+ */
+ public int state;
+
+ /**
+ * The bundle's symbolic name.
+ *
+ * @see Bundle#getSymbolicName()
+ */
+ public String symbolicName;
+
+ /**
+ * The bundle's version.
+ *
+ * @see Bundle#getVersion()
+ */
+ public String version;
+}
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.dto;
+
+import java.util.List;
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Data Transfer Object for a Framework.
+ *
+ * <p>
+ * The System Bundle can be adapted to provide a {@code FrameworkDTO} for the
+ * framework of the system bundle. A {@code FrameworkDTO} obtained from a
+ * framework will contain only the launch properties of the framework. These
+ * properties will not include the System properties.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class FrameworkDTO extends DTO {
+ /**
+ * The bundles that are installed in the framework.
+ *
+ * @see BundleContext#getBundles()
+ */
+ public List<BundleDTO> bundles;
+
+ /**
+ * The launch properties of the framework.
+ *
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ *
+ * @see BundleContext#getProperty(String)
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The services that are registered in the framework.
+ *
+ * @see BundleContext#getServiceReferences(String, String)
+ */
+ public List<ServiceReferenceDTO> services;
+}
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Data Transfer Object for a ServiceReference.
+ *
+ * <p>
+ * {@code ServiceReferenceDTO}s for all registered services can be obtained from
+ * a {@link FrameworkDTO}. An installed Bundle can be adapted to provide a
+ * {@code ServiceReferenceDTO[]} of the services registered by the Bundle. A
+ * {@code ServiceReferenceDTO} obtained from a framework must convert service
+ * property values which are not valid value types for DTOs to type
+ * {@code String} using {@code String.valueOf(Object)}.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class ServiceReferenceDTO extends DTO {
+ /**
+ * The id of the service.
+ *
+ * @see Constants#SERVICE_ID
+ */
+ public long id;
+
+ /**
+ * The id of the bundle that registered the service.
+ *
+ * @see ServiceReference#getBundle()
+ */
+ public long bundle;
+
+ /**
+ * The properties for the service.
+ *
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ *
+ * @see ServiceReference#getProperty(String)
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The ids of the bundles that are using the service.
+ *
+ * @see ServiceReference#getUsingBundles()
+ */
+ public long[] usingBundles;
+}
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
+ */
+
+/**
+ * OSGi Data Transfer Object Framework Package Version 1.8.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.dto; version="[1.8,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.dto; version="[1.8,1.9)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.8")
+package org.osgi.framework.dto;
+
+import org.osgi.annotation.versioning.Version;
+
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/dto/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/dto/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/dto/packageinfo?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/dto/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/dto/packageinfo Wed Jul 30 07:22:32 2014
@@ -0,0 +1 @@
+version 1.8
Modified: 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=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -33,8 +34,9 @@ import org.osgi.framework.Constants;
* in a bundle symbolic name and version collision.
*
* @ThreadSafe
- * @version $Id: a1a25ee0432f210a56e911246f477f19edc28bc1 $
+ * @author $Id: b05e0c3819aff6df35c2ec034242596d04f53408 $
*/
+@ConsumerType
public interface CollisionHook {
/**
@@ -54,17 +56,17 @@ public interface CollisionHook {
* 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
+ * <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
+ * installed.</li>
+ * <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.
+ * being updated to.</li>
* </ul>
* This method can filter the collection of collision candidates by removing
* potential collisions. For the specified operation to succeed, the
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
@@ -28,8 +29,9 @@ import org.osgi.framework.BundleEvent;
* (install, start, stop, update, and uninstall bundle) operations.
*
* @ThreadSafe
- * @version $Id: e1471b36491a02bd8598a30d05c889ee58edc760 $
+ * @author $Id: 0b986db904e41d5a5bfb5d28fc849ee967decf0d $
*/
+@ConsumerType
public interface EventHook {
/**
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -29,8 +30,9 @@ import org.osgi.framework.BundleExceptio
* (get bundles) operations.
*
* @ThreadSafe
- * @version $Id: ae6bf5fc5cf999ac39dfc195c99ef7e223e3b847 $
+ * @author $Id: 1029e10212f150304095fc99433197083cc00e9e $
*/
+@ConsumerType
public interface FindHook {
/**
* Find hook method. This method is called for the following:
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
+ */
+
+/**
+ * Framework Bundle Hooks Package Version 1.1.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.hooks.bundle; version="[1.1,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.1")
+package org.osgi.framework.hooks.bundle;
+
+import org.osgi.annotation.versioning.Version;
+
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo Wed Jul 30 07:22:32 2014
@@ -0,0 +1 @@
+version 1.1
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.Bundle;
import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -71,51 +72,47 @@ import org.osgi.framework.wiring.Framewo
* <li>For each bundle revision {@code B} left in the shrinkable collection
* {@code Resolvable} and any bundle revision {@code B} which is currently
* resolved that represents a singleton bundle do the following:
- * <p/>
- * Determine the collection of available capabilities that have a namespace of
- * {@link IdentityNamespace osgi.identity}, are singletons, and have the same
+ * <ul>
+ * <li>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
+ * the matching capabilities into a shrinkable collection {@code Collisions}.</li>
+ * <li>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
+ * singleton bundle cannot collide with itself.</li>
+ * <li>For each resolver hook call the
* {@link #filterSingletonCollisions(BundleCapability, Collection)} with the
* {@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
+ * revision {@code B} and the shrinkable collection {@code Collisions}</li>
+ * <li>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
+ * ability of bundle revision {@code B} to resolve.</li>
+ * <li>If the bundle revision {@code B} is already resolved then any resolvable
* bundle revision contained in the collection {@code Collisions} is not allowed
* to resolve.</li>
+ * </ul>
+ * </li>
* <li>During a resolve process a framework is free to attempt to resolve any or
* all bundles contained in shrinkable collection {@code Resolvable}. For each
* bundle revision {@code B} left in the shrinkable collection
* {@code Resolvable} which the framework attempts to resolve the following
* steps must be followed:
- * <p/>
- * For each requirement {@code R} specified by bundle revision {@code B}
+ * <ul>
+ * <li>For each requirement {@code R} specified by bundle revision {@code B}
* determine the collection of capabilities that satisfy (or match) the
* requirement and place each matching capability into a shrinkable collection
* {@code Candidates}. A capability is considered to match a particular
* requirement if its attributes satisfy a specified requirement and the
- * requirer bundle has permission to access the capability.
- *
- * <p/>
- * For each resolver hook call the
+ * requirer bundle has permission to access the capability.</li>
+ * <li>For each resolver hook call the
* {@link #filterMatches(BundleRequirement, Collection)} with the requirement
- * {@code R} and the shrinkable collection {@code Candidates}.
- *
- * <p/>
- * The shrinkable collection {@code Candidates} now contains all the
+ * {@code R} and the shrinkable collection {@code Candidates}.</li>
+ * <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>
+ * </ul>
+ * </li>
* <li>For each resolver hook call the {@link #end()} method to inform the hooks
* about a resolve process ending.</li>
* </ol>
@@ -134,8 +131,9 @@ import org.osgi.framework.wiring.Framewo
*
* @see ResolverHookFactory
* @NotThreadSafe
- * @version $Id: 9d3ef6240aead0952b5a47b793780c1c0589089a $
+ * @author $Id: 7b2a0a5dbec7b0e999112ae324d050fcf190fa5d $
*/
+@ConsumerType
public interface ResolverHook {
/**
* Filter resolvable candidates hook method. This method may be called
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.FrameworkWiring;
@@ -31,8 +32,9 @@ import org.osgi.framework.wiring.Framewo
*
* @ThreadSafe
* @see ResolverHook
- * @version $Id: e0a2f3ad081c31bbb682fa366c15a3080bf6da2b $
+ * @author $Id: d073890a9814291f258c9326f720323d7f4d7d90 $
*/
+@ConsumerType
public interface ResolverHookFactory {
/**
* This method is called by the framework each time a resolve process begins
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
+ */
+
+/**
+ * Framework Resolver Hooks Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.hooks.resolver; version="[1.0,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.framework.hooks.resolver;
+
+import org.osgi.annotation.versioning.Version;
+
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo Wed Jul 30 07:22:32 2014
@@ -0,0 +1 @@
+version 1.0
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
@@ -29,9 +30,9 @@ import org.osgi.framework.ServiceEvent;
*
* @ThreadSafe
* @deprecated As of 1.1. Replaced by {@link EventListenerHook}.
- * @version $Id: 84757a5f719db4d7671e81a76af2b320404ae0f5 $
+ * @author $Id: b8c500c6f09cc25e3a6294489b7e6a1d458d5e6f $
*/
-
+@ConsumerType
public interface EventHook {
/**
* Event hook method. This method is called prior to service event delivery
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,6 +18,7 @@ package org.osgi.framework.hooks.service
import java.util.Collection;
import java.util.Map;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
@@ -31,9 +32,9 @@ import org.osgi.framework.hooks.service.
*
* @ThreadSafe
* @since 1.1
- * @version $Id: b0b99b29206f272ad479fa08ffcd5ef5fda909b8 $
+ * @author $Id: 2b80241ca24005be3a9a3550138e1ba9a3a9ad6e $
*/
-
+@ConsumerType
public interface EventListenerHook {
/**
* Event listener hook method. This method is called prior to service event
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2013). 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,6 +17,7 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -28,9 +29,9 @@ import org.osgi.framework.ServiceReferen
* (get service references) operations.
*
* @ThreadSafe
- * @version $Id: 45612d6a10a25ca0b40ba695eb8dba21c2c78c24 $
+ * @author $Id: 4325a49f8c29ac9e7f32e8450db26148bbda5642 $
*/
-
+@ConsumerType
public interface FindHook {
/**
* Find hook method. This method is called during the service find operation
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2013). 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,6 +17,8 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.BundleContext;
/**
@@ -27,9 +29,9 @@ import org.osgi.framework.BundleContext;
* addition and removal.
*
* @ThreadSafe
- * @version $Id: 94029e2b70119793b3e7d77d6e1d5052d9ee1723 $
+ * @author $Id: 34bd086f723505e6ec22dadd9f0e47e92f80352b $
*/
-
+@ConsumerType
public interface ListenerHook {
/**
* Added listeners hook method. This method is called to provide the hook
@@ -66,8 +68,8 @@ public interface ListenerHook {
* which added the Service Listener and the filter with which it was added.
*
* @ThreadSafe
- * @noimplement
*/
+ @ProviderType
public interface ListenerInfo {
/**
* Return the context of the bundle which added the listener.
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
+ */
+
+/**
+ * Framework Service Hooks Package Version 1.1.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.hooks.service; version="[1.1,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.1")
+package org.osgi.framework.hooks.service;
+
+import org.osgi.annotation.versioning.Version;
+
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo Wed Jul 30 07:22:32 2014
@@ -0,0 +1 @@
+version 1.1
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -23,7 +23,7 @@ package org.osgi.framework.hooks.weaving
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: eb38b85f6ed66ec445fb2f0ee7143df021327a9a $
+ * @author $Id: 7575fc1b015fea7c77397391df6c8d2085513e76 $
*/
public class WeavingException extends RuntimeException {
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java?rev=1614569&r1=1614568&r2=1614569&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
package org.osgi.framework.hooks.weaving;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* OSGi Framework Weaving Hook Service.
*
@@ -34,9 +36,9 @@ package org.osgi.framework.hooks.weaving
* bytes as modified by previously called weaving hooks.
*
* @ThreadSafe
- * @version $Id: d1985029024baba2db1c56aab1e06ee953fd6365 $
+ * @author $Id: 8d99df5b0f3e7ffa9573695923afe86de9835fde $
*/
-
+@ConsumerType
public interface WeavingHook {
/**
* Weaving hook method.
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,6 +18,7 @@ package org.osgi.framework.hooks.weaving
import java.security.ProtectionDomain;
import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.wiring.BundleWiring;
/**
@@ -29,25 +30,92 @@ import org.osgi.framework.wiring.BundleW
* should be added to the bundle as dynamic imports.
*
* <p>
- * After weaving is {@link #isWeavingComplete() complete}, this object becomes
- * effectively immutable.
+ * Upon entering one of the terminal states, this object becomes effectively
+ * immutable.
*
* @NotThreadSafe
- * @noimplement
- * @version $Id: 549caef41027c8f0d0fdb4deae756eae6b69d1ee $
+ * @author $Id: b86db7713c738ae7147fe86f754302e2e324676b $
*/
+@ProviderType
public interface WovenClass {
+ /**
+ * The woven class is being transformed.
+ *
+ * <p>
+ * The woven class is in this state while {@link WeavingHook weaving hooks}
+ * are being called. The woven class is mutable so the {@link #getBytes()
+ * class bytes} may be {@link #setBytes(byte[]) modified} and
+ * {@link #getDynamicImports() dynamic imports} may be added. If a weaving
+ * hook throws an exception the state transitions to
+ * {@link #TRANSFORMING_FAILED}. Otherwise, after the last weaving hook has
+ * been successfully called, the state transitions to {@link #TRANSFORMED}.
+ *
+ * @since 1.1
+ */
+ int TRANSFORMING = 0x00000001;
+
+ /**
+ * The woven class has been transformed.
+ *
+ * <p>
+ * The woven class is in this state after {@link WeavingHook weaving hooks}
+ * have been called and before the class is defined. The woven class cannot
+ * be further transformed. The woven class is in this state while defining
+ * the class. If a failure occurs while defining the class, the state
+ * transitions to {@link #DEFINE_FAILED}. Otherwise, after the class has
+ * been defined, the state transitions to {@link #DEFINED}.
+ *
+ * @since 1.1
+ */
+ int TRANSFORMED = 0x00000002;
+
+ /**
+ * The woven class has been defined.
+ * <p>
+ * The woven class is in this state after the class is defined. The woven
+ * class cannot be further transformed. This is a terminal state. Upon
+ * entering this state, this object is effectively immutable, the
+ * {@link #getBundleWiring() bundle wiring} has been updated with the
+ * {@link #getDynamicImports() dynamic import requirements} and the class
+ * has been {@link #getDefinedClass() defined}.
+ *
+ * @since 1.1
+ */
+ int DEFINED = 0x00000004;
+
+ /**
+ * The woven class failed to transform.
+ * <p>
+ * The woven class is in this state if a {@link WeavingHook weaving hook}
+ * threw an exception. The woven class cannot be further transformed or
+ * defined. This is a terminal state. Upon entering this state, this object
+ * is effectively immutable.
+ *
+ * @since 1.1
+ */
+ int TRANSFORMING_FAILED = 0x00000008;
+
+ /**
+ * The woven class failed to define.
+ * <p>
+ * The woven class is in this state when a failure occurs while defining the
+ * class. The woven class cannot be further transformed or defined. This is
+ * a terminal state. Upon entering this state, this object is effectively
+ * immutable.
+ *
+ * @since 1.1
+ */
+ int DEFINE_FAILED = 0x00000010;
/**
* Returns the class file bytes to be used to define the
* {@link WovenClass#getClassName() named} class.
*
* <p>
- * While weaving is not {@link #isWeavingComplete() complete}, this method
- * returns a reference to the class files byte array contained in this
- * object. After weaving is {@link #isWeavingComplete() complete}, this
- * object becomes effectively immutable and a copy of the class file byte
- * array is returned.
+ * While in the {@link #TRANSFORMING} state, this method returns a reference
+ * to the class files byte array contained in this object. After leaving the
+ * {@link #TRANSFORMING} state, this woven class can no longer be
+ * transformed and a copy of the class file byte array is returned.
*
* @return The bytes to be used to define the
* {@link WovenClass#getClassName() named} class.
@@ -64,10 +132,10 @@ public interface WovenClass {
* weave} method by the framework.
*
* <p>
- * While weaving is not {@link #isWeavingComplete() complete}, this method
- * replaces the reference to the array contained in this object with the
- * specified array. After weaving is {@link #isWeavingComplete() complete},
- * this object becomes effectively immutable and this method will throw an
+ * While in the {@link #TRANSFORMING} state, this method replaces the
+ * reference to the array contained in this object with the specified array.
+ * After leaving the {@link #TRANSFORMING} state, this woven class can no
+ * longer be transformed and this method will throw an
* {@link IllegalStateException}.
*
* @param newBytes The new classfile that will be used to define the
@@ -75,8 +143,9 @@ public interface WovenClass {
* is retained by this object and the caller must not modify the
* specified array.
* @throws NullPointerException If newBytes is {@code null}.
- * @throws IllegalStateException If weaving is {@link #isWeavingComplete()
- * complete}.
+ * @throws IllegalStateException If state is {@link #TRANSFORMED},
+ * {@link #DEFINED}, {@link #TRANSFORMING_FAILED} or
+ * {@link #DEFINE_FAILED}.
* @throws SecurityException If the caller does not have
* {@code AdminPermission[bundle,WEAVE]} and the Java runtime
* environment supports permissions.
@@ -92,12 +161,14 @@ public interface WovenClass {
* weave} method by the framework.
*
* <p>
- * After weaving is {@link #isWeavingComplete() complete}, this object
- * becomes effectively immutable and the returned list will be unmodifiable.
+ * After leaving the {@link #TRANSFORMING} state, this woven class can no
+ * longer be transformed and the returned list will be unmodifiable.
*
* <p>
- * If the Java runtime environment supports permissions, the caller must
- * have {@code AdminPermission[bundle,WEAVE]} to modify the returned list.
+ * If the Java runtime environment supports permissions, any modification to
+ * the returned list requires {@code AdminPermission[bundle,WEAVE]}.
+ * Additionally, any add or set modification requires
+ * {@code PackagePermission[package,IMPORT]}.
*
* @return A list containing zero or more dynamic import package
* descriptions to add to the bundle wiring for this woven class.
@@ -109,13 +180,11 @@ public interface WovenClass {
/**
* Returns whether weaving is complete in this woven class. Weaving is
- * complete after the last {@link WeavingHook weaving hook} is called and
- * the class is defined.
- *
- * <p>
- * After weaving is complete, this object becomes effectively immutable.
+ * complete after the class is defined.
*
- * @return {@code true} weaving is complete, {@code false} otherwise.
+ * @return {@code true} if {@link #getState() state} is {@link #DEFINED},
+ * {@link #TRANSFORMING_FAILED} or {@link #DEFINE_FAILED};
+ * {@code false} otherwise.
*/
public boolean isWeavingComplete();
@@ -154,4 +223,16 @@ public interface WovenClass {
* @return The bundle wiring whose class loader will define the woven class.
*/
public BundleWiring getBundleWiring();
+
+ /**
+ * Returns the current state of this woven class.
+ * <p>
+ * A woven class can be in only one state at any time.
+ *
+ * @return Either {@link #TRANSFORMING}, {@link #TRANSFORMED},
+ * {@link #DEFINED}, {@link #TRANSFORMING_FAILED} or
+ * {@link #DEFINE_FAILED}.
+ * @since 1.1
+ */
+ public int getState();
}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.weaving;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Woven Class Listener Service.
+ *
+ * <p>
+ * Bundles registering this service will receive notifications whenever a
+ * {@link WovenClass woven class} completes a {@link WovenClass#getState()
+ * state} transition. Woven Class Listeners are not able to modify the woven
+ * class in contrast with {@link WeavingHook weaving hooks}.
+ *
+ * <p>
+ * Receiving a woven class in the {@link WovenClass#TRANSFORMED TRANSFORMED}
+ * state allows listeners to observe the modified {@link WovenClass#getBytes()
+ * byte codes} before the class has been {@link WovenClass#DEFINED DEFINED} as
+ * well as the additional {@link WovenClass#getDynamicImports() dynamic imports}
+ * before the {@link WovenClass#getBundleWiring() bundle wiring} has been
+ * updated.
+ *
+ * <p>
+ * Woven class listeners are synchronously {@link #modified(WovenClass) called}
+ * when a woven class completes a state transition. The woven class processing
+ * will not proceed until all woven class listeners are done.
+ *
+ * <p>
+ * If the Java runtime environment supports permissions, the caller must have
+ * {@code ServicePermission[WovenClassListener,REGISTER]} in order to register a
+ * listener.
+ *
+ * @ThreadSafe
+ * @since 1.1
+ * @author $Id$
+ */
+@ConsumerType
+public interface WovenClassListener {
+ /**
+ * Receives notification that a {@link WovenClass woven class} has completed
+ * a state transition.
+ *
+ * <p>
+ * The listener will be notified when a woven class has entered the
+ * {@link WovenClass#TRANSFORMED TRANSFORMED}, {@link WovenClass#DEFINED
+ * DEFINED}, {@link WovenClass#TRANSFORMING_FAILED TRANSFORMING_FAILED} and
+ * {@link WovenClass#DEFINE_FAILED DEFINE_FAILED} states.
+ *
+ * <p>
+ * If this method throws any exception, the Framework must log the exception
+ * but otherwise ignore it.
+ *
+ * @param wovenClass The woven class that completed a state transition.
+ */
+ public void modified(WovenClass wovenClass);
+}
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java Wed Jul 30 07:22:32 2014
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
+ */
+
+/**
+ * Framework Weaving Hooks Package Version 1.1.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest.
+ * </p>
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * </p>
+ * <p>
+ * {@code Import-Package: org.osgi.framework.hooks.weaving; version="[1.1,2.0)"}
+ * </p>
+ * @author $Id$
+ */
+
+@Version("1.1")
+package org.osgi.framework.hooks.weaving;
+
+import org.osgi.annotation.versioning.Version;
+
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo?rev=1614569&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo Wed Jul 30 07:22:32 2014
@@ -0,0 +1 @@
+version 1.1
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2014). 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,10 +19,12 @@ package org.osgi.framework.launch;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
/**
* A Framework instance. A Framework is also known as a System Bundle.
@@ -33,12 +35,29 @@ import org.osgi.framework.FrameworkEvent
* instance.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: e76240d5de584d1666880d9bc358571a76cbd8fb $
+ * @author $Id: 25b603f31ba381c47a8db8a9f2e006e13588877a $
*/
+@ProviderType
public interface Framework extends Bundle {
/**
+ * Initialize this Framework.
+ * <p>
+ * This method performs the same function as calling
+ * {@link #init(FrameworkListener...)} with no framework listeners.
+ *
+ * @throws BundleException If this Framework could not be initialized.
+ * @throws SecurityException If the Java Runtime Environment supports
+ * permissions and the caller does not have the appropriate
+ * {@code AdminPermission[this,EXECUTE]} or if there is a security
+ * manager already installed and the
+ * {@link Constants#FRAMEWORK_SECURITY} configuration property is
+ * set.
+ * @see #init(FrameworkListener...)
+ */
+ void init() throws BundleException;
+
+ /**
* Initialize this Framework. After calling this method, this Framework
* must:
* <ul>
@@ -53,6 +72,8 @@ public interface Framework extends Bundl
* {@code ConditionalPermissionAdmin}.</li>
* <li>Be {@link #adapt(Class) adaptable} to the OSGi defined types to which
* a system bundle can be adapted.</li>
+ * <li>Have called the {@code start} method of the extension bundle
+ * activator for all resolved extension bundles.</li>
* </ul>
*
* <p>
@@ -63,6 +84,17 @@ public interface Framework extends Bundl
* This method does nothing if called when this Framework is in the
* {@link #STARTING}, {@link #ACTIVE} or {@link #STOPPING} states.
*
+ * <p>
+ * All framework events fired by this method method are also delivered to
+ * the specified FrameworkListeners in the order they are specified before
+ * returning from this method. After returning from this method the
+ * specified listeners are no longer notified of framework events.
+ *
+ * @param listeners Zero or more listeners to be notified when framework
+ * events occur while initializing the framework. The specified
+ * listeners do not need to be otherwise registered with the
+ * framework. If a specified listener is registered with the
+ * framework, it will be notified twice for each framework event.
* @throws BundleException If this Framework could not be initialized.
* @throws SecurityException If the Java Runtime Environment supports
* permissions and the caller does not have the appropriate
@@ -70,9 +102,9 @@ public interface Framework extends Bundl
* manager already installed and the
* {@link Constants#FRAMEWORK_SECURITY} configuration property is
* set.
- *
+ * @since 1.2
*/
- void init() throws BundleException;
+ void init(FrameworkListener... listeners) throws BundleException;
/**
* Wait until this Framework has completely stopped. The {@code stop} and
@@ -328,6 +360,20 @@ public interface Framework extends Bundl
URL getEntry(String path);
/**
+ * Returns the time when the set of bundles in this framework was last
+ * modified. The set of bundles is considered to be modified when a bundle
+ * is installed, updated or uninstalled.
+ *
+ * <p>
+ * The time value is the number of milliseconds since January 1, 1970,
+ * 00:00:00 UTC.
+ *
+ * @return The time when the set of bundles in this framework was last
+ * modified.
+ */
+ long getLastModified();
+
+ /**
* Returns {@code null} as a framework implementation does not have a proper
* bundle from which to return entries.
*
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=1614569&r1=1614568&r2=1614569&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 Wed Jul 30 07:22:32 2014
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2013). 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,6 +17,7 @@
package org.osgi.framework.launch;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
/**
@@ -44,9 +45,9 @@ import org.osgi.framework.Bundle;
* the resource.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 1684e14aa98a1f6e1ff3e0f3afa2c55982210f72 $
+ * @author $Id: c1647bcb8416b6dfa9e37c6cc146bb54c7173526 $
*/
+@ProviderType
public interface FrameworkFactory {
/**