FELIX-4590 : [Core R6] Update to R6 API
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1614569 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
index bbdd980..2dc5214 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
@@ -34,7 +34,9 @@
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceObjects;
import org.osgi.framework.ServicePermission;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -513,4 +515,19 @@
throw new IllegalStateException("Invalid BundleContext.");
}
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleContext#registerService(java.lang.Class, org.osgi.framework.ServiceFactory, java.util.Dictionary)
+ */
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz,
+ ServiceFactory<S> factory, Dictionary<String, ?> properties) {
+ throw new UnsupportedOperationException(); // TODO
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleContext#getServiceObjects(org.osgi.framework.ServiceReference)
+ */
+ public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
+ throw new UnsupportedOperationException(); // TODO
+ }
}
\ No newline at end of file
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index b6af4b6..4ca089e 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -18,10 +18,37 @@
*/
package org.apache.felix.framework;
-import java.io.*;
-import java.net.*;
-import java.security.*;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLStreamHandler;
+import java.security.AccessControlException;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.WeakHashMap;
import org.apache.felix.framework.BundleWiringImpl.BundleClassLoader;
import org.apache.felix.framework.ServiceRegistry.ServiceRegistryCallbacks;
@@ -478,6 +505,7 @@
// This overrides the default behavior of BundleImpl.getFramework()
// to return "this", since the system bundle is the framework.
+ @Override
Felix getFramework()
{
return this;
@@ -505,41 +533,49 @@
return super.adapt(type);
}
+ @Override
public long getBundleId()
{
return 0;
}
+ @Override
public long getLastModified()
{
return 0;
}
+ @Override
void setLastModified(long l)
{
// Ignore.
}
+ @Override
String _getLocation()
{
return Constants.SYSTEM_BUNDLE_LOCATION;
}
+ @Override
public int getPersistentState()
{
return Bundle.ACTIVE;
}
+ @Override
public void setPersistentStateInactive()
{
// Ignore.
}
+ @Override
public void setPersistentStateActive()
{
// Ignore.
}
+ @Override
public void setPersistentStateUninstalled()
{
// Ignore.
@@ -551,6 +587,7 @@
* @param defaultLevel This parameter is ignored by the system bundle.
* @return Always returns zero.
**/
+ @Override
int getStartLevel(int defaultLevel)
{
return 0;
@@ -564,11 +601,13 @@
* @throws IllegalArgumentException Always throws exception since system
* bundle's start level cannot be changed.
**/
+ @Override
void setStartLevel(int level)
{
throw new IllegalArgumentException("Cannot set the system bundle's start level.");
}
+ @Override
public boolean hasPermission(Object obj)
{
return true;
@@ -821,7 +860,7 @@
{
if (bundle != this)
{
- setBundleProtectionDomain((BundleImpl) bundle, (BundleRevisionImpl) ((BundleImpl) bundle).adapt(BundleRevisionImpl.class));
+ setBundleProtectionDomain((BundleImpl) bundle, ((BundleImpl) bundle).adapt(BundleRevisionImpl.class));
}
}
catch (Exception ex)
@@ -887,6 +926,7 @@
*
* @throws org.osgi.framework.BundleException if any error occurs.
**/
+ @Override
public void start() throws BundleException
{
int startLevel = FelixConstants.FRAMEWORK_DEFAULT_STARTLEVEL;
@@ -936,6 +976,7 @@
fireFrameworkEvent(FrameworkEvent.STARTED, this, null);
}
+ @Override
public void start(int options) throws BundleException
{
start();
@@ -945,6 +986,7 @@
* This method asynchronously shuts down the framework, it must be called at the
* end of a session in order to shutdown all active bundles.
**/
+ @Override
public void stop() throws BundleException
{
Object sm = System.getSecurityManager();
@@ -978,6 +1020,7 @@
}
}
+ @Override
public void stop(int options) throws BundleException
{
stop();
@@ -1022,16 +1065,19 @@
return event;
}
+ @Override
public void uninstall() throws BundleException
{
throw new BundleException("Cannot uninstall the system bundle.");
}
+ @Override
public void update() throws BundleException
{
update(null);
}
+ @Override
public void update(InputStream is) throws BundleException
{
Object sm = System.getSecurityManager();
@@ -1114,6 +1160,7 @@
}).start();
}
+ @Override
public String toString()
{
return getSymbolicName() + " [" + getBundleId() +"]";
@@ -3196,7 +3243,7 @@
}
}
}
- return (Bundle[]) bundles.toArray(new Bundle[bundles.size()]);
+ return bundles.toArray(new Bundle[bundles.size()]);
}
/**
@@ -3208,7 +3255,7 @@
Bundle[] getBundles()
{
Collection<Bundle> bundles = m_installedBundles[IDENTIFIER_MAP_IDX].values();
- return (Bundle[]) bundles.toArray(new Bundle[bundles.size()]);
+ return bundles.toArray(new Bundle[bundles.size()]);
}
void addBundleListener(BundleImpl bundle, BundleListener l)
@@ -3573,7 +3620,7 @@
{
try
{
- return (S) m_registry.getService(bundle, ref);
+ return m_registry.getService(bundle, ref);
}
catch (ServiceException ex)
{
@@ -4385,7 +4432,7 @@
// Remove dependencies.
m_dependencies.removeDependencies(bundle);
// Reset the bundle object.
- ((BundleImpl) bundle).refresh();
+ bundle.refresh();
// Fire UNRESOLVED event if necessary
// and notify state change..
if (fire)
@@ -5249,4 +5296,12 @@
{
return m_urlHandlersActivator.getContentHandlerService(mimeType);
}
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.launch.Framework#init(org.osgi.framework.FrameworkListener[])
+ */
+ public void init(FrameworkListener... listeners) throws BundleException {
+ this.init(); // TODO
+ }
+
}
diff --git a/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
index 8ad803c..ba51e43 100644
--- a/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
@@ -21,11 +21,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.FrameworkWiring;
+import org.osgi.resource.Requirement;
import org.osgi.service.packageadmin.PackageAdmin;
class FrameworkWiringImpl implements FrameworkWiring, Runnable
@@ -185,4 +189,11 @@
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.wiring.FrameworkWiring#findProviders(org.osgi.resource.Requirement)
+ */
+ public Collection<BundleCapability> findProviders(Requirement requirement) {
+ throw new UnsupportedOperationException(); // TODO
+ }
}
\ No newline at end of file
diff --git a/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java b/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
index ce35e18..7dd92e5 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
@@ -21,14 +21,25 @@
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.felix.framework.util.MapToDictionary;
import org.apache.felix.framework.util.StringMap;
import org.apache.felix.framework.util.Util;
import org.apache.felix.framework.wiring.BundleCapabilityImpl;
-import org.osgi.framework.*;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceException;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
@@ -307,6 +318,7 @@
// Add the framework assigned properties.
props.put(Constants.OBJECTCLASS, m_classes);
props.put(Constants.SERVICE_ID, m_serviceId);
+ props.put("service.bundleid", m_bundle.getBundleId()); // TODO use constants once available
// Update the service property map.
m_propMap = props;
@@ -470,6 +482,7 @@
return ServiceRegistrationImpl.this.getUsingBundles();
}
+ @Override
public String toString()
{
String[] ocs = (String[]) getProperty("objectClass");
diff --git a/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java b/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
index 2f44e5a..e563935 100644
--- a/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
@@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
+
import org.apache.felix.framework.util.ImmutableList;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
import org.osgi.framework.AdminPermission;
@@ -373,4 +374,12 @@
}
return bytes;
}
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.hooks.weaving.WovenClass#getState()
+ */
+ public int getState() {
+ throw new UnsupportedOperationException(); // TODO
+ }
+
}
\ No newline at end of file
diff --git a/framework/src/main/java/org/osgi/dto/DTO.java b/framework/src/main/java/org/osgi/dto/DTO.java
new file mode 100644
index 0000000..adaf574
--- /dev/null
+++ b/framework/src/main/java/org/osgi/dto/DTO.java
@@ -0,0 +1,273 @@
+/*
+ * 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.dto;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Super type for Data Transfer Objects.
+ *
+ * <p>
+ * A Data Transfer Object (DTO) is easily serializable having only public fields
+ * of primitive types and their wrapper classes, Strings, and DTOs. List, Set,
+ * Map and array aggregates may also be used. The aggregates must only hold
+ * objects of the listed types or aggregates.
+ *
+ * <p>
+ * The object graph from a Data Transfer Object must be a tree to simplify
+ * serialization and deserialization.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public abstract class DTO {
+
+ /**
+ * Return a string representation of this DTO suitable for use when
+ * debugging.
+ *
+ * <p>
+ * The format of the string representation is not specified and subject to
+ * change.
+ *
+ * @return A string representation of this DTO suitable for use when
+ * debugging.
+ */
+ @Override
+ public String toString() {
+ return appendValue(new StringBuilder(), new IdentityHashMap<Object, String>(), "#", this).toString();
+ }
+
+ /**
+ * Append the specified DTO's string representation to the specified
+ * StringBuilder.
+ *
+ * @param result StringBuilder to which the string representation is
+ * appended.
+ * @param objectRefs References to "seen" objects.
+ * @param refpath The reference path of the specified DTO.
+ * @param dto The DTO whose string representation is to be appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendDTO(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final DTO dto) {
+ result.append("{");
+ String delim = "";
+ for (Field field : dto.getClass().getFields()) {
+ if (Modifier.isStatic(field.getModifiers())) {
+ continue;
+ }
+ result.append(delim);
+ final String name = field.getName();
+ appendString(result, name);
+ result.append(":");
+ Object value = null;
+ try {
+ value = field.get(dto);
+ } catch (IllegalAccessException e) {
+ // use null value;
+ }
+ appendValue(result, objectRefs, refpath + "/" + name, value);
+ delim = ", ";
+ }
+ result.append("}");
+ return result;
+ }
+
+ /**
+ * Append the specified value's string representation to the specified
+ * StringBuilder.
+ *
+ * <p>
+ * This method handles cycles in the object graph, using path-based
+ * references, even though the specification requires the object graph from
+ * a DTO to be a tree.
+ *
+ * @param result StringBuilder to which the string representation is
+ * appended.
+ * @param objectRefs References to "seen" objects.
+ * @param refpath The reference path of the specified value.
+ * @param value The object whose string representation is to be appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendValue(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Object value) {
+ if (value == null) {
+ return result.append("null");
+ }
+ // Simple Java types
+ if (value instanceof String || value instanceof Character) {
+ return appendString(result, compress(value.toString()));
+ }
+ if (value instanceof Number || value instanceof Boolean) {
+ return result.append(value.toString());
+ }
+
+ // Complex types
+ final String path = objectRefs.get(value);
+ if (path != null) {
+ result.append("{\"$ref\":");
+ appendString(result, path);
+ result.append("}");
+ return result;
+ }
+ objectRefs.put(value, refpath);
+
+ if (value instanceof DTO) {
+ return appendDTO(result, objectRefs, refpath, (DTO) value);
+ }
+ if (value instanceof Map) {
+ return appendMap(result, objectRefs, refpath, (Map<?, ?>) value);
+ }
+ if (value instanceof List || value instanceof Set) {
+ return appendIterable(result, objectRefs, refpath, (Iterable<?>) value);
+ }
+ if (value.getClass().isArray()) {
+ return appendArray(result, objectRefs, refpath, value);
+ }
+ return appendString(result, compress(value.toString()));
+ }
+
+ /**
+ * Append the specified array's string representation to the specified
+ * StringBuilder.
+ *
+ * @param result StringBuilder to which the string representation is
+ * appended.
+ * @param objectRefs References to "seen" objects.
+ * @param refpath The reference path of the specified array.
+ * @param array The array whose string representation is to be appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendArray(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Object array) {
+ result.append("[");
+ final int length = Array.getLength(array);
+ for (int i = 0; i < length; i++) {
+ if (i > 0) {
+ result.append(",");
+ }
+ appendValue(result, objectRefs, refpath + "/" + i, Array.get(array, i));
+ }
+ result.append("]");
+ return result;
+ }
+
+ /**
+ * Append the specified iterable's string representation to the specified
+ * StringBuilder.
+ *
+ * @param result StringBuilder to which the string representation is
+ * appended.
+ * @param objectRefs References to "seen" objects.
+ * @param refpath The reference path of the specified list.
+ * @param iterable The iterable whose string representation is to be
+ * appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendIterable(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Iterable<?> iterable) {
+ result.append("[");
+ int i = 0;
+ for (Object item : iterable) {
+ if (i > 0) {
+ result.append(",");
+ }
+ appendValue(result, objectRefs, refpath + "/" + i, item);
+ i++;
+ }
+ result.append("]");
+ return result;
+ }
+
+ /**
+ * Append the specified map's string representation to the specified
+ * StringBuilder.
+ *
+ * @param result StringBuilder to which the string representation is
+ * appended.
+ * @param objectRefs References to "seen" objects.
+ * @param refpath The reference path of the specified map.
+ * @param map The map whose string representation is to be appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendMap(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Map<?, ?> map) {
+ result.append("{");
+ String delim = "";
+ for (Map.Entry<?, ?> entry : map.entrySet()) {
+ result.append(delim);
+ final String name = String.valueOf(entry.getKey());
+ appendString(result, name);
+ result.append(":");
+ final Object value = entry.getValue();
+ appendValue(result, objectRefs, refpath + "/" + name, value);
+ delim = ", ";
+ }
+ result.append("}");
+ return result;
+ }
+
+ /**
+ * Append the specified string to the specified StringBuilder.
+ *
+ * @param result StringBuilder to which the string is appended.
+ * @param string The string to be appended.
+ * @return The specified StringBuilder.
+ */
+ private static StringBuilder appendString(final StringBuilder result, final CharSequence string) {
+ result.append("\"");
+ int i = result.length();
+ result.append(string);
+ while (i < result.length()) { // escape if necessary
+ char c = result.charAt(i);
+ if ((c == '"') || (c == '\\')) {
+ result.insert(i, '\\');
+ i = i + 2;
+ continue;
+ }
+ if (c < 0x20) {
+ result.insert(i + 1, Integer.toHexString(c | 0x10000));
+ result.replace(i, i + 2, "\\u");
+ i = i + 6;
+ continue;
+ }
+ i++;
+ }
+ result.append("\"");
+ return result;
+ }
+
+ /**
+ * Compress, in length, the specified string.
+ *
+ * @param in The string to potentially compress.
+ * @return The string compressed, if necessary.
+ */
+ private static CharSequence compress(final CharSequence in) {
+ final int length = in.length();
+ if (length <= 21) {
+ return in;
+ }
+ StringBuilder result = new StringBuilder(21);
+ result.append(in, 0, 9);
+ result.append("...");
+ result.append(in, length - 9, length);
+ return result;
+ }
+}
diff --git a/framework/src/main/java/org/osgi/dto/package-info.java b/framework/src/main/java/org/osgi/dto/package-info.java
new file mode 100644
index 0000000..1209bb5
--- /dev/null
+++ b/framework/src/main/java/org/osgi/dto/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 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.
+ */
+
+/**
+ * OSGi Data Transfer Object 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. 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.dto; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.dto; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.dto;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/dto/packageinfo b/framework/src/main/java/org/osgi/dto/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/dto/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/framework/AdaptPermission.java b/framework/src/main/java/org/osgi/framework/AdaptPermission.java
index fbe70c1..918e469 100644
--- a/framework/src/main/java/org/osgi/framework/AdaptPermission.java
+++ b/framework/src/main/java/org/osgi/framework/AdaptPermission.java
@@ -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.
@@ -41,7 +41,7 @@
* {@code AdaptPermission} has one action: {@code adapt}.
*
* @ThreadSafe
- * @version $Id: 3bc095bd294db2d8ea25971a3d71991de1495b1a $
+ * @author $Id: 9f0866e633ce08566547b4955a2ece54c46944e0 $
*/
public final class AdaptPermission extends BasicPermission {
@@ -286,6 +286,7 @@
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof AdaptPermission)) {
return false;
@@ -339,6 +340,7 @@
* @return Canonical string representation of the {@code AdaptPermission}
* actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -353,6 +355,7 @@
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new AdaptPermissionCollection();
}
@@ -369,6 +372,7 @@
* the same name and actions as this {@code AdaptPermission} object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -388,6 +392,7 @@
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -424,9 +429,8 @@
}
/**
- * Called by {@code <@link AdaptPermission#implies(Permission)>}. This
- * method is only called on a requested permission which cannot have a
- * filter set.
+ * Called by {@link AdaptPermission#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.
*/
@@ -438,8 +442,8 @@
final Map<String, Object> map = new HashMap<String, Object>(5);
map.put("adaptClass", getName());
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
map.put("id", new Long(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
@@ -502,6 +506,7 @@
* @throws SecurityException If this {@code AdaptPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof AdaptPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -547,6 +552,7 @@
* @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 AdaptPermission)) {
return false;
@@ -590,6 +596,7 @@
*
* @return Enumeration of all {@code AdaptPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -607,7 +614,9 @@
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- permissions = (HashMap<String, AdaptPermission>) gfields.get("permissions", null);
+ @SuppressWarnings("unchecked")
+ HashMap<String, AdaptPermission> p = (HashMap<String, AdaptPermission>) gfields.get("permissions", null);
+ permissions = p;
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/framework/src/main/java/org/osgi/framework/AdminPermission.java b/framework/src/main/java/org/osgi/framework/AdminPermission.java
index 324360c..26e9093 100644
--- a/framework/src/main/java/org/osgi/framework/AdminPermission.java
+++ b/framework/src/main/java/org/osgi/framework/AdminPermission.java
@@ -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.
@@ -52,8 +52,10 @@
* lifecycle BundleContext.installBundle
* Bundle.update
* Bundle.uninstall
- * listener BundleContext.addBundleListener for SynchronousBundleListener
- * BundleContext.removeBundleListener for SynchronousBundleListener
+ * listener BundleContext.addBundleListener for
+ * SynchronousBundleListener
+ * BundleContext.removeBundleListener for
+ * SynchronousBundleListener
* metadata Bundle.getHeaders
* Bundle.getLocation
* resolve FrameworkWiring.refreshBundles
@@ -67,7 +69,8 @@
* startlevel FrameworkStartLevel.setStartLevel
* FrameworkStartLevel.setInitialBundleStartLevel
* context Bundle.getBundleContext
- * weave WovenClass.setBytes
+ * weave WovenClass.getBytes
+ * WovenClass.setBytes
* WovenClass.getDynamicImports for modification
* </pre>
*
@@ -89,7 +92,7 @@
* Filter attribute names are processed in a case sensitive manner.
*
* @ThreadSafe
- * @version $Id: cd883e81fde210ce8f0cabaebea377378d672818 $
+ * @author $Id: 2a803b07dcdc9af47ca0cb208d96fcd9c0bcfb0c $
*/
public final class AdminPermission extends BasicPermission {
@@ -236,8 +239,9 @@
* Examples:
*
* <pre>
- * (signer=\*,o=ACME,c=US)
- * (&(signer=\*,o=ACME,c=US)(name=com.acme.*)(location=http://www.acme.com/bundles/*))
+ * (signer=\*,o=ACME,c=US)
+ * (&(signer=\*,o=ACME,c=US)(name=com.acme.*)
+ * (location=http://www.acme.com/bundles/*))
* (id>=1)
* </pre>
*
@@ -593,6 +597,7 @@
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof AdminPermission)) {
return false;
@@ -663,6 +668,7 @@
* @return Canonical string representation of the {@code AdminPermission}
* actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -740,6 +746,7 @@
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new AdminPermissionCollection();
}
@@ -751,6 +758,7 @@
* @return {@code true} if {@code obj} is equivalent to this
* {@code AdminPermission}; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -770,6 +778,7 @@
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -833,8 +842,8 @@
recurse.set(bundle);
try {
final Map<String, Object> map = new HashMap<String, Object>(4);
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
map.put("id", new Long(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
@@ -893,6 +902,7 @@
* @throws SecurityException If this {@code AdminPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(Permission permission) {
if (!(permission instanceof AdminPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -936,6 +946,7 @@
* {@code AdminPermission} in this collection, {@code false}
* otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (!(permission instanceof AdminPermission)) {
return false;
@@ -979,6 +990,7 @@
*
* @return Enumeration of all {@code AdminPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -997,6 +1009,7 @@
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields.get("permissions", null);
permissions = new HashMap<String, AdminPermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
diff --git a/framework/src/main/java/org/osgi/framework/AllServiceListener.java b/framework/src/main/java/org/osgi/framework/AllServiceListener.java
index 71e27cd..4db7ba3 100644
--- a/framework/src/main/java/org/osgi/framework/AllServiceListener.java
+++ b/framework/src/main/java/org/osgi/framework/AllServiceListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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 {@code ServiceEvent} listener that does not filter based upon package
* wiring. {@code AllServiceListener} is a listener interface that may be
@@ -52,9 +54,9 @@
* @see ServicePermission
* @ThreadSafe
* @since 1.3
- * @version $Id: 7a0c82db414be7064a06e1868eb41a8c8f8d9d6c $
+ * @author $Id: fc2039183bb7c2117c182949118bb4cdd3b2e6c2 $
*/
-
+@ConsumerType
public interface AllServiceListener extends ServiceListener {
// This is a marker interface
}
diff --git a/framework/src/main/java/org/osgi/framework/Bundle.java b/framework/src/main/java/org/osgi/framework/Bundle.java
index d814e9a..b9334ae 100644
--- a/framework/src/main/java/org/osgi/framework/Bundle.java
+++ b/framework/src/main/java/org/osgi/framework/Bundle.java
@@ -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.
@@ -25,6 +25,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.wiring.FrameworkWiring;
/**
@@ -44,12 +45,12 @@
* <p>
* A bundle can be in one of six states:
* <ul>
- * <li>{@link #UNINSTALLED}
- * <li>{@link #INSTALLED}
- * <li>{@link #RESOLVED}
- * <li>{@link #STARTING}
- * <li>{@link #STOPPING}
- * <li>{@link #ACTIVE}
+ * <li>{@link #UNINSTALLED}</li>
+ * <li>{@link #INSTALLED}</li>
+ * <li>{@link #RESOLVED}</li>
+ * <li>{@link #STARTING}</li>
+ * <li>{@link #STOPPING}</li>
+ * <li>{@link #ACTIVE}</li>
* </ul>
* <p>
* Values assigned to these states have no specified ordering; they represent
@@ -74,9 +75,9 @@
* bundle id} and is greater if it has a higher bundle id.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 8a58ab72af389b1999b88348e4944203b7096510 $
+ * @author $Id: 81a8f18b2fcc7810817cd19f6d5e0709db1c1d12 $
*/
+@ProviderType
public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is uninstalled and may not be used.
@@ -114,14 +115,14 @@
* include:
* <ul>
* <li>The bundle's class path from its {@link Constants#BUNDLE_CLASSPATH}
- * Manifest header.
+ * Manifest header.</li>
* <li>The bundle's package dependencies from its
* {@link Constants#EXPORT_PACKAGE} and {@link Constants#IMPORT_PACKAGE}
- * Manifest headers.
+ * Manifest headers.</li>
* <li>The bundle's required bundle dependencies from its
- * {@link Constants#REQUIRE_BUNDLE} Manifest header.
+ * {@link Constants#REQUIRE_BUNDLE} Manifest header.</li>
* <li>A fragment bundle's host dependency from its
- * {@link Constants#FRAGMENT_HOST} Manifest header.
+ * {@link Constants#FRAGMENT_HOST} Manifest header.</li>
* </ul>
* <p>
* Note that the bundle is not active yet. A bundle must be put in the
@@ -262,12 +263,11 @@
* <ul>
* <li>If the {@link #START_TRANSIENT} option is set, then a
* {@code BundleException} is thrown indicating this bundle cannot be
- * started due to the Framework's current start level.
- *
+ * started due to the Framework's current start level.</li>
* <li>Otherwise, the Framework must set this bundle's persistent autostart
* setting to <em>Started with declared activation</em> if the
* {@link #START_ACTIVATION_POLICY} option is set or
- * <em>Started with eager activation</em> if not set.
+ * <em>Started with eager activation</em> if not set.</li>
* </ul>
* <p>
* When the Framework's current start level becomes equal to or more than
@@ -279,82 +279,71 @@
* then this method must wait for activation or deactivation to complete
* before continuing. If this does not occur in a reasonable time, a
* {@code BundleException} is thrown to indicate this bundle was unable to
- * be started.
- *
- * <li>If this bundle's state is {@code ACTIVE} then this method returns
- * immediately.
- *
+ * be started.</li>
* <li>If the {@link #START_TRANSIENT} option is not set then set this
* bundle's autostart setting to <em>Started with declared activation</em>
* if the {@link #START_ACTIVATION_POLICY} option is set or
* <em>Started with eager activation</em> if not set. When the Framework is
* restarted and this bundle's autostart setting is not <em>Stopped</em>,
- * this bundle must be automatically started.
- *
+ * this bundle must be automatically started.</li>
+ * <li>If this bundle's state is {@code ACTIVE} then this method returns
+ * immediately.</li>
* <li>If this bundle's state is not {@code RESOLVED}, an attempt is made to
* resolve this bundle. If the Framework cannot resolve this bundle, a
- * {@code BundleException} is thrown.
- *
+ * {@code BundleException} is thrown.</li>
* <li>If the {@link #START_ACTIVATION_POLICY} option is set and this
* bundle's declared activation policy is {@link Constants#ACTIVATION_LAZY
* lazy} then:
* <ul>
* <li>If this bundle's state is {@code STARTING} then this method returns
- * immediately.
- * <li>This bundle's state is set to {@code STARTING}.
- * <li>A bundle event of type {@link BundleEvent#LAZY_ACTIVATION} is fired.
+ * immediately.</li>
+ * <li>This bundle's state is set to {@code STARTING}.</li>
+ * <li>A bundle event of type {@link BundleEvent#LAZY_ACTIVATION} is fired.</li>
* <li>This method returns immediately and the remaining steps will be
- * followed when this bundle's activation is later triggered.
+ * followed when this bundle's activation is later triggered.</li>
* </ul>
- * <i></i>
- * <li>This bundle's state is set to {@code STARTING}.
- *
- * <li>A bundle event of type {@link BundleEvent#STARTING} is fired.
- *
+ * </li>
+ * <li>This bundle's state is set to {@code STARTING}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STARTING} is fired.</li>
* <li>The {@link BundleActivator#start(BundleContext)} method of this
* bundle's {@code BundleActivator}, if one is specified, is called. If the
* {@code BundleActivator} is invalid or throws an exception then:
* <ul>
- * <li>This bundle's state is set to {@code STOPPING}.
- * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
- * <li>Any services registered by this bundle must be unregistered.
- * <li>Any services used by this bundle must be released.
- * <li>Any listeners registered by this bundle must be removed.
- * <li>This bundle's state is set to {@code RESOLVED}.
- * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.
- * <li>A {@code BundleException} is then thrown.
+ * <li>This bundle's state is set to {@code STOPPING}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.</li>
+ * <li>Any services registered by this bundle must be unregistered.</li>
+ * <li>Any services used by this bundle must be released.</li>
+ * <li>Any listeners registered by this bundle must be removed.</li>
+ * <li>This bundle's state is set to {@code RESOLVED}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.</li>
+ * <li>A {@code BundleException} is then thrown.</li>
* </ul>
- * <i></i>
- * <li>If this bundle's state is {@code UNINSTALLED}, because this bundle
- * was uninstalled while the {@code BundleActivator.start} method was
- * running, a {@code BundleException} is thrown.
- *
- * <li>This bundle's state is set to {@code ACTIVE}.
- *
- * <li>A bundle event of type {@link BundleEvent#STARTED} is fired.
+ * </li>
+ * <li>This bundle's state is set to {@code ACTIVE}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STARTED} is fired.</li>
* </ol>
*
* <b>Preconditions </b>
* <ul>
* <li>{@code getState()} in { {@code INSTALLED}, {@code RESOLVED}
* } or { {@code INSTALLED}, {@code RESOLVED},
- * {@code STARTING} } if this bundle has a lazy activation policy.
+ * {@code STARTING} } if this bundle has a lazy activation policy.</li>
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>Bundle autostart setting is modified unless the
- * {@link #START_TRANSIENT} option was set.
+ * {@link #START_TRANSIENT} option was set.</li>
* <li>{@code getState()} in { {@code ACTIVE} } unless the
- * lazy activation policy was used.
+ * lazy activation policy was used.</li>
* <li>{@code BundleActivator.start()} has been called and did not throw an
- * exception unless the lazy activation policy was used.
+ * exception unless the lazy activation policy was used.</li>
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
* <li>Depending on when the exception occurred, bundle autostart setting is
- * modified unless the {@link #START_TRANSIENT} option was set.
+ * modified unless the {@link #START_TRANSIENT} option was set.</li>
* <li>{@code getState()} not in { {@code STARTING}, {@code ACTIVE}
- * }.
+ * }.</li>
* </ul>
*
* @param options The options for starting this bundle. See
@@ -404,62 +393,53 @@
* The following steps are required to stop a bundle:
* <ol>
* <li>If this bundle's state is {@code UNINSTALLED} then an
- * {@code IllegalStateException} is thrown.
- *
+ * {@code IllegalStateException} is thrown.</li>
* <li>If this bundle is in the process of being activated or deactivated
* then this method must wait for activation or deactivation to complete
* before continuing. If this does not occur in a reasonable time, a
* {@code BundleException} is thrown to indicate this bundle was unable to
- * be stopped.
+ * be stopped.</li>
* <li>If the {@link #STOP_TRANSIENT} option is not set then then set this
* bundle's persistent autostart setting to to <em>Stopped</em>. When the
* Framework is restarted and this bundle's autostart setting is
- * <em>Stopped</em>, this bundle must not be automatically started.
- *
+ * <em>Stopped</em>, this bundle must not be automatically started.</li>
* <li>If this bundle's state is not {@code STARTING} or {@code ACTIVE} then
- * this method returns immediately.
- *
- * <li>This bundle's state is set to {@code STOPPING}.
- *
- * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
- *
+ * this method returns immediately.</li>
+ * <li>This bundle's state is set to {@code STOPPING}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.</li>
* <li>If this bundle's state was {@code ACTIVE} prior to setting the state
* to {@code STOPPING}, the {@link BundleActivator#stop(BundleContext)}
* method of this bundle's {@code BundleActivator}, if one is specified, is
* called. If that method throws an exception, this method must continue to
* stop this bundle and a {@code BundleException} must be thrown after
- * completion of the remaining steps.
- *
- * <li>Any services registered by this bundle must be unregistered.
- * <li>Any services used by this bundle must be released.
- * <li>Any listeners registered by this bundle must be removed.
- *
+ * completion of the remaining steps.</li>
+ * <li>Any services registered by this bundle must be unregistered.</li>
+ * <li>Any services used by this bundle must be released.</li>
+ * <li>Any listeners registered by this bundle must be removed.</li>
* <li>If this bundle's state is {@code UNINSTALLED}, because this bundle
* was uninstalled while the {@code BundleActivator.stop} method was
- * running, a {@code BundleException} must be thrown.
- *
- * <li>This bundle's state is set to {@code RESOLVED}.
- *
- * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.
+ * running, a {@code BundleException} must be thrown.</li>
+ * <li>This bundle's state is set to {@code RESOLVED}.</li>
+ * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.</li>
* </ol>
*
* <b>Preconditions </b>
* <ul>
- * <li>{@code getState()} in { {@code ACTIVE} }.
+ * <li>{@code getState()} in { {@code ACTIVE} }.</li>
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>Bundle autostart setting is modified unless the
- * {@link #STOP_TRANSIENT} option was set.
+ * {@link #STOP_TRANSIENT} option was set.</li>
* <li>{@code getState()} not in { {@code ACTIVE}, {@code STOPPING}
- * }.
+ * }.</li>
* <li>{@code BundleActivator.stop} has been called and did not throw an
- * exception.
+ * exception.</li>
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
* <li>Bundle autostart setting is modified unless the
- * {@link #STOP_TRANSIENT} option was set.
+ * {@link #STOP_TRANSIENT} option was set.</li>
* </ul>
*
* @param options The options for stopping this bundle. See
@@ -520,45 +500,40 @@
* The following steps are required to update a bundle:
* <ol>
* <li>If this bundle's state is {@code UNINSTALLED} then an
- * {@code IllegalStateException} is thrown.
- *
+ * {@code IllegalStateException} is thrown.</li>
* <li>If this bundle's state is {@code ACTIVE}, {@code STARTING} or
* {@code STOPPING}, this bundle is stopped as described in the
* {@code Bundle.stop} method. If {@code Bundle.stop} throws an exception,
- * the exception is rethrown terminating the update.
- *
+ * the exception is rethrown terminating the update.</li>
* <li>The updated version of this bundle is read from the input stream and
* installed. If the Framework is unable to install the updated version of
* this bundle, the original version of this bundle must be restored and a
* {@code BundleException} must be thrown after completion of the remaining
- * steps.
- *
- * <li>This bundle's state is set to {@code INSTALLED}.
- *
+ * steps.</li>
+ * <li>This bundle's state is set to {@code INSTALLED}.</li>
* <li>If the updated version of this bundle was successfully installed, a
- * bundle event of type {@link BundleEvent#UPDATED} is fired.
- *
+ * bundle event of type {@link BundleEvent#UPDATED} is fired.</li>
* <li>If this bundle's state was originally {@code ACTIVE}, the updated
* bundle is started as described in the {@code Bundle.start} method. If
* {@code Bundle.start} throws an exception, a Framework event of type
- * {@link FrameworkEvent#ERROR} is fired containing the exception.
+ * {@link FrameworkEvent#ERROR} is fired containing the exception.</li>
* </ol>
*
* <b>Preconditions </b>
* <ul>
- * <li>{@code getState()} not in { {@code UNINSTALLED} }.
+ * <li>{@code getState()} not in { {@code UNINSTALLED} }.</li>
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>{@code getState()} in { {@code INSTALLED}, {@code RESOLVED},
- * {@code ACTIVE} }.
- * <li>This bundle has been updated.
+ * {@code ACTIVE} }.</li>
+ * <li>This bundle has been updated.</li>
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
* <li>{@code getState()} in { {@code INSTALLED}, {@code RESOLVED},
- * {@code ACTIVE} }.
- * <li>Original bundle is still used; no update occurred.
+ * {@code ACTIVE} }.</li>
+ * <li>Original bundle is still used; no update occurred.</li>
* </ul>
*
* @param input The {@code InputStream} from which to read the new bundle or
@@ -633,35 +608,31 @@
* The following steps are required to uninstall a bundle:
* <ol>
* <li>If this bundle's state is {@code UNINSTALLED} then an
- * {@code IllegalStateException} is thrown.
- *
+ * {@code IllegalStateException} is thrown.</li>
* <li>If this bundle's state is {@code ACTIVE}, {@code STARTING} or
* {@code STOPPING}, this bundle is stopped as described in the
* {@code Bundle.stop} method. If {@code Bundle.stop} throws an exception, a
* Framework event of type {@link FrameworkEvent#ERROR} is fired containing
- * the exception.
- *
- * <li>This bundle's state is set to {@code UNINSTALLED}.
- *
- * <li>A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.
- *
+ * the exception.</li>
+ * <li>This bundle's state is set to {@code UNINSTALLED}.</li>
+ * <li>A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.</li>
* <li>This bundle and any persistent storage area provided for this bundle
- * by the Framework are removed.
+ * by the Framework are removed.</li>
* </ol>
*
* <b>Preconditions </b>
* <ul>
- * <li>{@code getState()} not in { {@code UNINSTALLED} }.
+ * <li>{@code getState()} not in { {@code UNINSTALLED} }.</li>
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li>{@code getState()} in { {@code UNINSTALLED} }.
- * <li>This bundle has been uninstalled.
+ * <li>{@code getState()} in { {@code UNINSTALLED} }.</li>
+ * <li>This bundle has been uninstalled.</li>
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li>{@code getState()} not in { {@code UNINSTALLED} }.
- * <li>This Bundle has not been uninstalled.
+ * <li>{@code getState()} not in { {@code UNINSTALLED} }.</li>
+ * <li>This Bundle has not been uninstalled.</li>
* </ul>
*
* @throws BundleException If the uninstall failed. This can occur if
@@ -727,12 +698,12 @@
* <p>
* A bundle's unique identifier has the following attributes:
* <ul>
- * <li>Is unique and persistent.
- * <li>Is a {@code long}.
+ * <li>Is unique and persistent.</li>
+ * <li>Is a {@code long}.</li>
* <li>Its value is not reused for another bundle, even after a bundle is
- * uninstalled.
- * <li>Does not change while a bundle remains installed.
- * <li>Does not change when a bundle is updated.
+ * uninstalled.</li>
+ * <li>Does not change while a bundle remains installed.</li>
+ * <li>Does not change when a bundle is updated.</li>
* </ul>
*
* <p>
@@ -789,8 +760,8 @@
/**
* Returns this bundle's {@code ServiceReference} list for all services it
* is using or returns {@code null} if this bundle is not using any
- * services. A bundle is considered to be using a service if its use count
- * for that service is greater than zero.
+ * services. A bundle is considered to be using a service if it has any
+ * unreleased service objects.
*
* <p>
* If the Java Runtime Environment supports permissions, a
diff --git a/framework/src/main/java/org/osgi/framework/BundleActivator.java b/framework/src/main/java/org/osgi/framework/BundleActivator.java
index acdb825..ab80909 100644
--- a/framework/src/main/java/org/osgi/framework/BundleActivator.java
+++ b/framework/src/main/java/org/osgi/framework/BundleActivator.java
@@ -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.
@@ -16,6 +16,8 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Customizes the starting and stopping of a bundle.
* <p>
@@ -34,19 +36,19 @@
* {@code BundleActivator}. The form of the Manifest header is:
*
* <p>
- * {@code Bundle-Activator: <i>class-name</i>}
+ * {@code Bundle-Activator:} <i>class-name</i>
*
* <p>
- * where {@code <i>class-name</i>} is a fully qualified Java classname.
+ * where <i>class-name</i> is a fully qualified Java classname.
* <p>
* The specified {@code BundleActivator} class must have a public constructor
* that takes no parameters so that a {@code BundleActivator} object can be
* created by {@code Class.newInstance()}.
*
* @NotThreadSafe
- * @version $Id: f5b2debe0064ab60669102d0a087feaeab13dc0e $
+ * @author $Id: a9d91a8ae13157f49a6a55b0c7f25b63b6bd00bd $
*/
-
+@ConsumerType
public interface BundleActivator {
/**
* Called when this bundle is started so the Framework can perform the
diff --git a/framework/src/main/java/org/osgi/framework/BundleContext.java b/framework/src/main/java/org/osgi/framework/BundleContext.java
index 71c3b92..600f548 100644
--- a/framework/src/main/java/org/osgi/framework/BundleContext.java
+++ b/framework/src/main/java/org/osgi/framework/BundleContext.java
@@ -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.
@@ -20,6 +20,7 @@
import java.io.InputStream;
import java.util.Collection;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
/**
* A bundle's execution context within the Framework. The context is used to
@@ -29,15 +30,15 @@
* <p>
* {@code BundleContext} methods allow a bundle to:
* <ul>
- * <li>Subscribe to events published by the Framework.
- * <li>Register service objects with the Framework service registry.
- * <li>Retrieve {@code ServiceReferences} from the Framework service registry.
- * <li>Get and release service objects for a referenced service.
- * <li>Install new bundles in the Framework.
- * <li>Get the list of bundles installed in the Framework.
- * <li>Get the {@link Bundle} object for a bundle.
+ * <li>Subscribe to events published by the Framework.</li>
+ * <li>Register service objects with the Framework service registry.</li>
+ * <li>Retrieve {@code ServiceReferences} from the Framework service registry.</li>
+ * <li>Get and release service objects for a referenced service.</li>
+ * <li>Install new bundles in the Framework.</li>
+ * <li>Get the list of bundles installed in the Framework.</li>
+ * <li>Get the {@link Bundle} object for a bundle.</li>
* <li>Create {@code File} objects for files in a persistent storage area
- * provided for the bundle by the Framework.
+ * provided for the bundle by the Framework.</li>
* </ul>
*
* <p>
@@ -57,8 +58,17 @@
* <p>
* The {@code BundleContext} object is only valid during the execution of its
* context bundle; that is, during the period from when the context bundle is in
- * the {@code STARTING}, {@code STOPPING}, and {@code ACTIVE} bundle states. If
- * the {@code BundleContext} object is used subsequently, an
+ * the {@code STARTING}, {@code STOPPING}, and {@code ACTIVE} bundle states.
+ * However, the {@code BundleContext} object becomes invalid after
+ * {@link BundleActivator#stop(BundleContext)} returns (if the bundle has a
+ * Bundle Activator). The {@code BundleContext} object becomes invalid before
+ * disposing of any remaining registered services and releasing any remaining
+ * services in use. Since those activities can result in other bundles being
+ * called (for example, {@link ServiceListener}s for
+ * {@link ServiceEvent#UNREGISTERING} events and {@link ServiceFactory}s for
+ * unget operations), those other bundles can observe the stopping bundle in the
+ * {@code STOPPING} state but with an invalid {@code BundleContext} object. If
+ * the {@code BundleContext} object is used after it has become invalid, an
* {@code IllegalStateException} must be thrown. The {@code BundleContext}
* object must never be reused after its context bundle is stopped.
*
@@ -75,10 +85,9 @@
* Environment supports permissions.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 4f166fd274f3965e48a7dbc239213d00e062b6d0 $
+ * @author $Id: fbf0b18296a0b85d628ee8c47d0f0f213a914e48 $
*/
-
+@ProviderType
public interface BundleContext extends BundleReference {
/**
@@ -127,29 +136,24 @@
* The following steps are required to install a bundle:
* <ol>
* <li>If a bundle containing the same location identifier is already
- * installed, the {@code Bundle} object for that bundle is returned.
- *
+ * installed, the {@code Bundle} object for that bundle is returned.</li>
* <li>The bundle's content is read from the input stream. If this fails, a
- * {@link BundleException} is thrown.
- *
+ * {@link BundleException} is thrown.</li>
* <li>The bundle's associated resources are allocated. The associated
* resources minimally consist of a unique identifier and a persistent
* storage area if the platform has file system support. If this step fails,
- * a {@code BundleException} is thrown.
- *
- * <li>The bundle's state is set to {@code INSTALLED}.
- *
- * <li>A bundle event of type {@link BundleEvent#INSTALLED} is fired.
- *
+ * a {@code BundleException} is thrown.</li>
+ * <li>The bundle's state is set to {@code INSTALLED}.</li>
+ * <li>A bundle event of type {@link BundleEvent#INSTALLED} is fired.</li>
* <li>The {@code Bundle} object for the newly or previously installed
- * bundle is returned.
+ * bundle is returned.</li>
* </ol>
*
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>{@code getState()} in { {@code INSTALLED}, {@code RESOLVED}
- * }.
- * <li>Bundle has a unique ID.
+ * }.</li>
+ * <li>Bundle has a unique ID.</li>
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
@@ -386,29 +390,36 @@
* <p>
* The following steps are required to register a service:
* <ol>
- * <li>If {@code service} is not a {@code ServiceFactory}, an
+ * <li>If {@code service} does not implement {@code ServiceFactory}, an
* {@code IllegalArgumentException} is thrown if {@code service} is not an
- * {@code instanceof} all the specified class names.
+ * {@code instanceof} all the specified class names.</li>
* <li>The Framework adds the following service properties to the service
* properties from the specified {@code Dictionary} (which may be
- * {@code null}): <br/>
- * A property named {@link Constants#SERVICE_ID} identifying the
- * registration number of the service <br/>
- * A property named {@link Constants#OBJECTCLASS} containing all the
- * specified classes. <br/>
+ * {@code null}):
+ * <ul>
+ * <li>A property named {@link Constants#SERVICE_ID} identifying the
+ * registration number of the service</li>
+ * <li>A property named {@link Constants#OBJECTCLASS} containing all the
+ * specified classes.</li>
+ * <li>A property named {@link Constants#SERVICE_SCOPE} identifying the
+ * scope of the service.</li>
+ * <li>A property named {@link Constants#SERVICE_BUNDLEID} identifying the
+ * the context bundle.</li>
+ * </ul>
* Properties with these names in the specified {@code Dictionary} will be
- * ignored.
+ * ignored.</li>
* <li>The service is added to the Framework service registry and may now be
- * used by other bundles.
- * <li>A service event of type {@link ServiceEvent#REGISTERED} is fired.
+ * used by other bundles.</li>
+ * <li>A service event of type {@link ServiceEvent#REGISTERED} is fired.</li>
* <li>A {@code ServiceRegistration} object for this registration is
- * returned.
+ * returned.</li>
* </ol>
*
* @param clazzes The class names under which the service can be located.
* The class names in this array will be stored in the service's
* properties under the key {@link Constants#OBJECTCLASS}.
- * @param service The service object or a {@code ServiceFactory} object.
+ * @param service The service object or an object implementing
+ * {@code ServiceFactory}.
* @param properties The properties for this service. The keys in the
* properties object must all be {@code String} objects. See
* {@link Constants} for a list of standard service property keys.
@@ -422,10 +433,10 @@
* unregister the service.
* @throws IllegalArgumentException If one of the following is true:
* <ul>
- * <li>{@code service} is {@code null}. <li>{@code service} is not a
- * {@code ServiceFactory} object and is not an instance of all the
- * named classes in {@code clazzes}. <li> {@code properties}
- * contains case variants of the same key name.
+ * <li>{@code service} is {@code null}.</li><li>{@code service} does
+ * not implement {@code ServiceFactory} and is not an instance of
+ * all the specified classes.</li><li> {@code properties} contains
+ * case variants of the same key name.</li>
* </ul>
* @throws SecurityException If the caller does not have the
* {@code ServicePermission} to register the service for all the
@@ -433,6 +444,7 @@
* permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see ServiceRegistration
+ * @see PrototypeServiceFactory
* @see ServiceFactory
*/
ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties);
@@ -450,7 +462,8 @@
* than just a single string.
*
* @param clazz The class name under which the service can be located.
- * @param service The service object or a {@code ServiceFactory} object.
+ * @param service The service object or an object implementing
+ * {@code ServiceFactory}.
* @param properties The properties for this service.
* @return A {@code ServiceRegistration} object for use by the bundle
* registering the service to update the service's properties or to
@@ -471,7 +484,8 @@
*
* @param <S> Type of Service.
* @param clazz The class under whose name the service can be located.
- * @param service The service object or a {@code ServiceFactory} object.
+ * @param service The service object or an object implementing
+ * {@code ServiceFactory}.
* @param properties The properties for this service.
* @return A {@code ServiceRegistration} object for use by the bundle
* registering the service to update the service's properties or to
@@ -483,6 +497,29 @@
<S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties);
/**
+ * Registers the specified service factory object with the specified
+ * properties under the name of the specified class with the Framework.
+ *
+ * <p>
+ * This method is otherwise identical to
+ * {@link #registerService(Class, Object, Dictionary)} and is provided to
+ * return a type safe {@code ServiceRegistration} when registering a
+ * {@link ServiceFactory}.
+ *
+ * @param <S> Type of Service.
+ * @param clazz The class under whose name the service can be located.
+ * @param factory The {@code ServiceFactory} object.
+ * @param properties The properties for this service.
+ * @return A {@code ServiceRegistration} object for use by the bundle
+ * registering the service to update the service's properties or to
+ * unregister the service.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @see #registerService(Class, Object, Dictionary)
+ * @since 1.8
+ */
+ <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties);
+
+ /**
* Returns an array of {@code ServiceReference} objects. The returned array
* of {@code ServiceReference} objects contains services that were
* registered under the specified class, match the specified filter
@@ -513,16 +550,16 @@
* service must have been registered with the specified class name. The
* complete list of class names with which a service was registered is
* available from the service's {@link Constants#OBJECTCLASS objectClass}
- * property.
+ * property.</li>
* <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
+ * expression must match the service.</li>
* <li>If the Java Runtime Environment supports permissions, the caller must
* have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
+ * one of the class names under which the service was registered.</li>
* <li>For each class name with which the service was registered, calling
* {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
* bundle and the class name on the service's {@code ServiceReference}
- * object must return {@code true}
+ * object must return {@code true}</li>
* </ul>
*
* @param clazz The class name with which the service was registered or
@@ -565,12 +602,12 @@
* service must have been registered with the specified class name. The
* complete list of class names with which a service was registered is
* available from the service's {@link Constants#OBJECTCLASS objectClass}
- * property.
+ * property.</li>
* <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
+ * expression must match the service.</li>
* <li>If the Java Runtime Environment supports permissions, the caller must
* have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
+ * one of the class names under which the service was registered.</li>
* </ul>
*
* @param clazz The class name with which the service was registered or
@@ -606,7 +643,7 @@
* highest ranking (as specified in its {@link Constants#SERVICE_RANKING}
* property) is returned.
* <p>
- * If there is a tie in ranking, the service with the lowest service ID (as
+ * If there is a tie in ranking, the service with the lowest service id (as
* specified in its {@link Constants#SERVICE_ID} property); that is, the
* service that was registered first is returned.
*
@@ -636,7 +673,7 @@
* If multiple such services exist, the service with the highest ranking (as
* specified in its {@link Constants#SERVICE_RANKING} property) is returned.
* <p>
- * If there is a tie in ranking, the service with the lowest service ID (as
+ * If there is a tie in ranking, the service with the lowest service id (as
* specified in its {@link Constants#SERVICE_ID} property); that is, the
* service that was registered first is returned.
*
@@ -681,16 +718,16 @@
* <li>The service must have been registered with the name of the specified
* class. The complete list of class names with which a service was
* registered is available from the service's {@link Constants#OBJECTCLASS
- * objectClass} property.
+ * objectClass} property.</li>
* <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
+ * expression must match the service.</li>
* <li>If the Java Runtime Environment supports permissions, the caller must
* have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
+ * one of the class names under which the service was registered.</li>
* <li>For each class name with which the service was registered, calling
* {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
* bundle and the class name on the service's {@code ServiceReference}
- * object must return {@code true}
+ * object must return {@code true}</li>
* </ul>
*
* @param <S> Type of Service
@@ -707,45 +744,47 @@
<S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) throws InvalidSyntaxException;
/**
- * Returns the service object referenced by the specified
+ * Returns the service object for the service referenced by the specified
* {@code ServiceReference} object.
+ *
* <p>
- * A bundle's use of a service is tracked by the bundle's use count of that
- * service. Each time a service's service object is returned by
- * {@link #getService(ServiceReference)} the context bundle's use count for
- * that service is incremented by one. Each time the service is released by
- * {@link #ungetService(ServiceReference)} the context bundle's use count
- * for that service is decremented by one.
+ * A bundle's use of a service object obtained from this method is tracked
+ * by the bundle's use count of that service. Each time the service object
+ * is returned by {@link #getService(ServiceReference)} the context bundle's
+ * use count for the service is incremented by one. Each time the service
+ * object is released by {@link #ungetService(ServiceReference)} the context
+ * bundle's use count for the service is decremented by one.
+ *
* <p>
- * When a bundle's use count for a service drops to zero, the bundle should
- * no longer use that service.
+ * When a bundle's use count for the service drops to zero, the bundle
+ * should no longer use the service object.
*
* <p>
* This method will always return {@code null} when the service associated
- * with this {@code reference} has been unregistered.
+ * with the specified {@code reference} has been unregistered.
*
* <p>
* The following steps are required to get the service object:
* <ol>
- * <li>If the service has been unregistered, {@code null} is returned.
+ * <li>If the service has been unregistered, {@code null} is returned.</li>
* <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with an object implementing the
- * {@code ServiceFactory} interface, the
+ * and the service has {@link Constants#SCOPE_BUNDLE bundle} or
+ * {@link Constants#SCOPE_PROTOTYPE prototype} scope, the
* {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
- * called to create a service object for the context bundle. If the service
- * object returned by the {@code ServiceFactory} object is {@code null}, not
- * an {@code instanceof} all the classes named when the service was
- * registered or the {@code ServiceFactory} object throws an exception or
- * will be recursively called for the context bundle, {@code null} is
- * returned and a Framework event of type {@link FrameworkEvent#ERROR}
- * containing a {@link ServiceException} describing the error is fired. <br>
- * This service object is cached by the Framework. While the context
- * bundle's use count for the service is greater than zero, subsequent calls
- * to get the services's service object for the context bundle will return
- * the cached service object.
- * <li>The context bundle's use count for this service is incremented by
- * one.
- * <li>The service object for the service is returned.
+ * called to supply the service object for the context bundle. If the
+ * service object returned by the {@code ServiceFactory} object is
+ * {@code null}, not an {@code instanceof} all the classes named when the
+ * service was registered or the {@code ServiceFactory} object throws an
+ * exception or will be recursively called for the context bundle,
+ * {@code null} is returned and a Framework event of type
+ * {@link FrameworkEvent#ERROR} containing a {@link ServiceException}
+ * describing the error is fired. The supplied service object is cached by
+ * the Framework. While the context bundle's use count for the service is
+ * greater than zero, subsequent calls to get the service object for the
+ * context bundle will return the cached service object.</li>
+ * <li>The context bundle's use count for the service is incremented by one.
+ * </li>
+ * <li>The service object for the service is returned.</li>
* </ol>
*
* @param <S> Type of Service.
@@ -770,28 +809,28 @@
<S> S getService(ServiceReference<S> reference);
/**
- * Releases the service object referenced by the specified
+ * Releases the service object for the service referenced by the specified
* {@code ServiceReference} object. If the context bundle's use count for
* the service is zero, this method returns {@code false}. Otherwise, the
* context bundle's use count for the service is decremented by one.
*
* <p>
- * The service's service object should no longer be used and all references
- * to it should be destroyed when a bundle's use count for the service drops
- * to zero.
+ * The service object must no longer be used and all references to it should
+ * be destroyed when a bundle's use count for the service drops to zero.
*
* <p>
- * The following steps are required to unget the service object:
+ * The following steps are required to release the service object:
* <ol>
* <li>If the context bundle's use count for the service is zero or the
- * service has been unregistered, {@code false} is returned.
- * <li>The context bundle's use count for this service is decremented by
- * one.
- * <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with a {@code ServiceFactory} object, the
+ * service has been unregistered, {@code false} is returned.</li>
+ * <li>The context bundle's use count for the service is decremented by one.
+ * </li>
+ * <li>If the context bundle's use count for the service is now zero and the
+ * service has {@link Constants#SCOPE_BUNDLE bundle} or
+ * {@link Constants#SCOPE_PROTOTYPE prototype} scope, the
* {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
- * method is called to release the service object for the context bundle.
- * <li>{@code true} is returned.
+ * method is called to release the service object for the context bundle.</li>
+ * <li>{@code true} is returned.</li>
* </ol>
*
* @param reference A reference to the service to be released.
@@ -808,6 +847,47 @@
boolean ungetService(ServiceReference<?> reference);
/**
+ * Returns the {@link ServiceObjects} object for the service referenced by
+ * the specified {@code ServiceReference} object.
+ *
+ * <p>
+ * The {@link ServiceObjects} object can be used to obtain multiple service
+ * objects for services with {@link Constants#SCOPE_PROTOTYPE prototype}
+ * scope.
+ *
+ * <p>
+ * For services with {@link Constants#SCOPE_SINGLETON singleton} or
+ * {@link Constants#SCOPE_BUNDLE bundle} scope, the
+ * {@link ServiceObjects#getService()} method behaves the same as the
+ * {@link #getService(ServiceReference)} method and the
+ * {@link ServiceObjects#ungetService(Object)} method behaves the same as
+ * the {@link #ungetService(ServiceReference)} method. That is, only one,
+ * use-counted service object is available from the {@link ServiceObjects}
+ * object.
+ *
+ * <p>
+ * This method will always return {@code null} when the service associated
+ * with the specified {@code reference} has been unregistered.
+ *
+ * @param <S> Type of Service.
+ * @param reference A reference to the service.
+ * @return A {@link ServiceObjects} object for the service associated with
+ * the specified {@code reference} or {@code null} if the service is
+ * not registered.
+ * @throws SecurityException If the caller does not have the
+ * {@code ServicePermission} to get the service using at least one
+ * of the named classes the service was registered under and the
+ * Java Runtime Environment supports permissions.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @throws IllegalArgumentException If the specified
+ * {@code ServiceReference} was not created by the same framework
+ * instance as this {@code BundleContext}.
+ * @see PrototypeServiceFactory
+ * @since 1.8
+ */
+ <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference);
+
+ /**
* Creates a {@code File} object for a file in the persistent storage area
* provided for the bundle by the Framework. This method will return
* {@code null} if the platform does not have file system support.
diff --git a/framework/src/main/java/org/osgi/framework/BundleEvent.java b/framework/src/main/java/org/osgi/framework/BundleEvent.java
index 04a34a3..5bc8614 100644
--- a/framework/src/main/java/org/osgi/framework/BundleEvent.java
+++ b/framework/src/main/java/org/osgi/framework/BundleEvent.java
@@ -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.
@@ -32,7 +32,7 @@
* @Immutable
* @see BundleListener
* @see SynchronousBundleListener
- * @version $Id: 9e2102212eb526b5f11fdde4b0fc5c171a0b39c8 $
+ * @author $Id: cd49848213816c4f76541b70be12ac3af7900972 $
*/
public class BundleEvent extends EventObject {
@@ -201,16 +201,16 @@
/**
* Returns the type of lifecyle event. The type values are:
* <ul>
- * <li>{@link #INSTALLED}
- * <li>{@link #RESOLVED}
- * <li>{@link #LAZY_ACTIVATION}
- * <li>{@link #STARTING}
- * <li>{@link #STARTED}
- * <li>{@link #STOPPING}
- * <li>{@link #STOPPED}
- * <li>{@link #UPDATED}
- * <li>{@link #UNRESOLVED}
- * <li>{@link #UNINSTALLED}
+ * <li>{@link #INSTALLED}</li>
+ * <li>{@link #RESOLVED}</li>
+ * <li>{@link #LAZY_ACTIVATION}</li>
+ * <li>{@link #STARTING}</li>
+ * <li>{@link #STARTED}</li>
+ * <li>{@link #STOPPING}</li>
+ * <li>{@link #STOPPED}</li>
+ * <li>{@link #UPDATED}</li>
+ * <li>{@link #UNRESOLVED}</li>
+ * <li>{@link #UNINSTALLED}</li>
* </ul>
*
* @return The type of lifecycle event.
diff --git a/framework/src/main/java/org/osgi/framework/BundleException.java b/framework/src/main/java/org/osgi/framework/BundleException.java
index c47eb77..dfed442 100644
--- a/framework/src/main/java/org/osgi/framework/BundleException.java
+++ b/framework/src/main/java/org/osgi/framework/BundleException.java
@@ -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.
@@ -32,7 +32,7 @@
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: 0c97ed2696b4576d61440020922b1a97545beb1e $
+ * @author $Id: a0d23c4cb73b0d6386bcd6b9eebed29fdd9a4deb $
*/
public class BundleException extends Exception {
@@ -203,6 +203,7 @@
* @return The cause of this exception or {@code null} if no cause was set.
* @since 1.3
*/
+ @Override
public Throwable getCause() {
return super.getCause();
}
@@ -218,6 +219,7 @@
* been set.
* @since 1.3
*/
+ @Override
public Throwable initCause(Throwable cause) {
return super.initCause(cause);
}
diff --git a/framework/src/main/java/org/osgi/framework/BundleListener.java b/framework/src/main/java/org/osgi/framework/BundleListener.java
index 8d86d30..c177187 100644
--- a/framework/src/main/java/org/osgi/framework/BundleListener.java
+++ b/framework/src/main/java/org/osgi/framework/BundleListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). 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.EventListener;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A {@code BundleEvent} listener. {@code BundleListener} is a listener
@@ -34,9 +35,9 @@
*
* @see BundleEvent
* @NotThreadSafe
- * @version $Id: d48b4a8a59c839466a3d749dde23980d236f58c6 $
+ * @author $Id: 2c27d37a3a77e1c80f9b022f8dc2f614dff5f5ef $
*/
-
+@ConsumerType
public interface BundleListener extends EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
diff --git a/framework/src/main/java/org/osgi/framework/BundlePermission.java b/framework/src/main/java/org/osgi/framework/BundlePermission.java
index f9e64ae..08c28cd 100644
--- a/framework/src/main/java/org/osgi/framework/BundlePermission.java
+++ b/framework/src/main/java/org/osgi/framework/BundlePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -58,7 +58,7 @@
*
* @since 1.3
* @ThreadSafe
- * @version $Id: ccba905e3373800dfdb080118e97145abf778da2 $
+ * @author $Id: 5d3a115a2622919f564e2a2f46d70090ad9859cb $
*/
public final class BundlePermission extends BasicPermission {
@@ -287,6 +287,7 @@
* @return {@code true} if the specified {@code BundlePermission} action is
* implied by this object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof BundlePermission)) {
return false;
@@ -309,6 +310,7 @@
* @return Canonical string representation of the {@code BundlePermission
* } actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -351,6 +353,7 @@
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new BundlePermissionCollection();
}
@@ -368,6 +371,7 @@
* has the same bundle symbolic name and actions as this
* {@code BundlePermission} object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -387,6 +391,7 @@
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -461,6 +466,7 @@
* @throws SecurityException If this {@code BundlePermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof BundlePermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -500,6 +506,7 @@
* @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 BundlePermission)) {
return false;
@@ -559,6 +566,7 @@
*
* @return Enumeration of all {@code BundlePermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -577,6 +585,7 @@
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields.get("permissions", null);
permissions = new HashMap<String, BundlePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
diff --git a/framework/src/main/java/org/osgi/framework/BundleReference.java b/framework/src/main/java/org/osgi/framework/BundleReference.java
index 97340f7..8cd2df5 100644
--- a/framework/src/main/java/org/osgi/framework/BundleReference.java
+++ b/framework/src/main/java/org/osgi/framework/BundleReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2010). 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.
@@ -16,14 +16,16 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* A reference to a Bundle.
*
* @since 1.5
* @ThreadSafe
- * @noimplement
- * @version $Id: e61bd3e020264b04022a430fe09a85ee3aabf1a3 $
+ * @author $Id: ad4e0b99177540205a1a8f37f9075989434cc59f $
*/
+@ProviderType
public interface BundleReference {
/**
* Returns the {@code Bundle} object associated with this
diff --git a/framework/src/main/java/org/osgi/framework/CapabilityPermission.java b/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
index c27e1ac..56b1eb5 100644
--- a/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
+++ b/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
@@ -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.
@@ -41,13 +41,13 @@
* A bundle's authority to provide or require a capability.
* <ul>
* <li>The {@code provide} action allows a bundle to provide a capability
- * matching the specified filter.
+ * matching the specified filter.</li>
* <li>The {@code require} action allows a bundle to require a capability
- * matching the specified filter.
+ * matching the specified filter.</li>
* </ul>
*
* @ThreadSafe
- * @version $Id: b17bcaec959f67c3eae4c4c80c39a0a8716b22dc $
+ * @author $Id: 1d8e892cf46d7410cd3fdff1f5ca2fb010a33ae6 $
* @since 1.6
*/
@@ -334,6 +334,7 @@
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof CapabilityPermission)) {
return false;
@@ -382,6 +383,7 @@
*
* @return The canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -413,6 +415,7 @@
* @return A new {@code PermissionCollection} object suitable for storing
* {@code CapabilityPermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new CapabilityPermissionCollection();
}
@@ -428,6 +431,7 @@
* name and actions as this {@code CapabilityPermission} object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -448,6 +452,7 @@
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -486,9 +491,8 @@
}
/**
- * Called by {@code <@link CapabilityPermission#implies(Permission)>}. This
- * method is only called on a requested permission which cannot have a
- * filter set.
+ * Called by {@link CapabilityPermission#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.
*/
@@ -502,8 +506,8 @@
if (bundle == null) {
return properties = props;
}
- 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();
@@ -531,6 +535,7 @@
entries = null;
}
+ @Override
public Object get(Object k) {
if (!(k instanceof String)) {
return null;
@@ -609,6 +614,7 @@
* @throws SecurityException If this {@code CapabilityPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof CapabilityPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -663,6 +669,7 @@
* @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 CapabilityPermission)) {
return false;
@@ -743,6 +750,7 @@
*
* @return Enumeration of all the CapabilityPermission objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
Map<String, CapabilityPermission> pc = filterPermissions;
@@ -766,9 +774,11 @@
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
HashMap<String, CapabilityPermission> p = (HashMap<String, CapabilityPermission>) gfields.get("permissions", null);
permissions = p;
all_allowed = gfields.get("all_allowed", false);
+ @SuppressWarnings("unchecked")
HashMap<String, CapabilityPermission> fp = (HashMap<String, CapabilityPermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
diff --git a/framework/src/main/java/org/osgi/framework/Configurable.java b/framework/src/main/java/org/osgi/framework/Configurable.java
index 5fa08c4..62abd45 100644
--- a/framework/src/main/java/org/osgi/framework/Configurable.java
+++ b/framework/src/main/java/org/osgi/framework/Configurable.java
@@ -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.
@@ -26,7 +26,7 @@
* {@code instanceof Configurable}.
*
* @deprecated As of 1.2. Please use Configuration Admin service.
- * @version $Id: 1018601ae90d2d16ec34136db4b04dca3ccf8e65 $
+ * @author $Id: dce95833dd076e870099385a306989959a84aafd $
*/
public interface Configurable {
/**
diff --git a/framework/src/main/java/org/osgi/framework/Constants.java b/framework/src/main/java/org/osgi/framework/Constants.java
index 10618a1..2815b24 100644
--- a/framework/src/main/java/org/osgi/framework/Constants.java
+++ b/framework/src/main/java/org/osgi/framework/Constants.java
@@ -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.
@@ -16,6 +16,7 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.hooks.bundle.CollisionHook;
import org.osgi.framework.launch.Framework;
@@ -28,10 +29,9 @@
* otherwise indicated.
*
* @since 1.1
- * @noimplement
- * @version $Id: 6d07a4c3e29a5cd93b3daf0f9fcdab5472b357f6 $
+ * @author $Id: 6873c6f7d537ddbe39a6a2eba107ca3c2de49ce5 $
*/
-
+@ProviderType
public interface Constants {
/**
* Location identifier of the OSGi <i>system bundle </i>, which is defined
@@ -48,6 +48,14 @@
String SYSTEM_BUNDLE_SYMBOLICNAME = "system.bundle";
/**
+ * Identifier of the OSGi <i>system bundle </i>, which is defined to be
+ * {@code 0}.
+ *
+ * @since 1.8
+ */
+ long SYSTEM_BUNDLE_ID = 0L;
+
+ /**
* Manifest header identifying the bundle's category.
* <p>
* The header value may be retrieved from the {@code Dictionary} object
@@ -196,7 +204,7 @@
String BUNDLE_CONTACTADDRESS = "Bundle-ContactAddress";
/**
- * Manifest header attribute identifying the bundle's activator class.
+ * Manifest header identifying the bundle's activator class.
*
* <p>
* If present, this header specifies the name of the bundle resource class
@@ -211,6 +219,19 @@
String BUNDLE_ACTIVATOR = "Bundle-Activator";
/**
+ * Manifest header identifying the extension bundle's activator class.
+ *
+ * <p>
+ * If present, this header specifies the name of the extension bundle
+ * resource class that implements the {@code BundleActivator} interface and
+ * whose {@code start} and {@code stop} methods are called by the Framework
+ * when the Framework is initialized and shutdown, respectively.
+ *
+ * @since 1.8
+ */
+ String EXTENSION_BUNDLE_ACTIVATOR = "ExtensionBundle-Activator";
+
+ /**
* Manifest header identifying the location from which a new bundle version
* is obtained during a bundle update operation.
*
@@ -387,7 +408,8 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="resolve-time"
+ * Bundle-SymbolicName: com.acme.module.test;
+ * fragment-attachment:="resolve-time"
* </pre>
*
* @see #FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -543,7 +565,8 @@
* like:
*
* <pre>
- * Import-Package: org.osgi.framework; bundle-symbolic-name="com.acme.module.test"
+ * Import-Package: org.osgi.framework;
+ * bundle-symbolic-name="com.acme.module.test"
* </pre>
*
* @see #IMPORT_PACKAGE
@@ -786,6 +809,9 @@
* Fragment-Host: system.bundle; extension:="framework"
* </pre>
*
+ * <p>
+ * The default value is {@link #EXTENSION_FRAMEWORK framework}.
+ *
* @see #FRAGMENT_HOST
* @see #EXTENSION_FRAMEWORK
* @see #EXTENSION_BOOTCLASSPATH
@@ -1257,9 +1283,10 @@
*
* <p>
* The value of this property is assigned by the Framework when a service is
- * registered. The Framework assigns a unique value that is larger than all
- * previously assigned values since the Framework was started. These values
- * are NOT persistent across restarts of the Framework.
+ * registered. The Framework assigns a unique, non-negative value that is
+ * larger than all previously assigned values since the Framework was
+ * started. These values are NOT persistent across restarts of the
+ * Framework.
*/
String SERVICE_ID = "service.id";
@@ -1331,6 +1358,66 @@
String SERVICE_DESCRIPTION = "service.description";
/**
+ * Service property identifying the {@link Bundle#getBundleId() bundle id}
+ * of the {@link ServiceReference#getBundle() bundle registering the
+ * service}.
+ *
+ * <p>
+ * This property is set by the Framework when a service is registered. The
+ * value of this property must be of type {@code Long}.
+ *
+ * @since 1.8
+ */
+ String SERVICE_BUNDLEID = "service.bundleid";
+
+ /**
+ * Service property identifying a service's scope.
+ *
+ * <p>
+ * This property is set by the Framework when a service is registered. If
+ * the registered object implements {@link PrototypeServiceFactory}, then
+ * the value of this service property will be {@link #SCOPE_PROTOTYPE}.
+ * Otherwise, if the registered object implements {@link ServiceFactory},
+ * then the value of this service property will be {@link #SCOPE_BUNDLE}.
+ * Otherwise, the value of this service property will be
+ * {@link #SCOPE_SINGLETON}.
+ *
+ * @since 1.8
+ * @see #SCOPE_SINGLETON
+ * @see #SCOPE_BUNDLE
+ * @see #SCOPE_PROTOTYPE
+ */
+ String SERVICE_SCOPE = "service.scope";
+
+ /**
+ * Service scope is singleton. All bundles using the service receive the
+ * same service object.
+ *
+ * @since 1.8
+ * @see #SERVICE_SCOPE
+ */
+ String SCOPE_SINGLETON = "singleton";
+
+ /**
+ * Service scope is bundle. Each bundle using the service receives a
+ * customized service object.
+ *
+ * @since 1.8
+ * @see #SERVICE_SCOPE
+ */
+ String SCOPE_BUNDLE = "bundle";
+
+ /**
+ * Service scope is prototype. Each bundle using the service receives either
+ * a customized service object or can request multiple customized service
+ * objects via {@link ServiceObjects}.
+ *
+ * @since 1.8
+ * @see #SERVICE_SCOPE
+ */
+ String SCOPE_PROTOTYPE = "prototype";
+
+ /**
* Framework environment property identifying the Framework's universally
* unique identifier (UUID). A UUID represents a 128-bit value. A new UUID
* is generated by the {@link Framework#init()} method each time a framework
@@ -1700,4 +1787,26 @@
* @see BundleException#DUPLICATE_BUNDLE_ERROR
*/
String FRAMEWORK_BSNVERSION_MANAGED = "managed";
+
+ /**
+ * Manifest header identifying the bundle's icon URLs.
+ *
+ * <p>
+ * The header value may be retrieved from the {@code Dictionary} object
+ * returned by the {@code Bundle.getHeaders} method.
+ *
+ * @since 1.8
+ */
+ String BUNDLE_ICON = "Bundle-Icon";
+
+ /**
+ * Manifest header identifying the bundle's license information.
+ *
+ * <p>
+ * The header value may be retrieved from the {@code Dictionary} object
+ * returned by the {@code Bundle.getHeaders} method.
+ *
+ * @since 1.8
+ */
+ String BUNDLE_LICENSE = "Bundle-License";
}
diff --git a/framework/src/main/java/org/osgi/framework/Filter.java b/framework/src/main/java/org/osgi/framework/Filter.java
index 230a6e9..25a60b9 100644
--- a/framework/src/main/java/org/osgi/framework/Filter.java
+++ b/framework/src/main/java/org/osgi/framework/Filter.java
@@ -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.
@@ -18,6 +18,7 @@
import java.util.Dictionary;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
/**
* An <a href="http://www.ietf.org/rfc/rfc1960.txt">RFC 1960</a>-based Filter.
@@ -41,9 +42,9 @@
* @since 1.1
* @see "Core Specification, Filters, for a description of the filter string syntax."
* @ThreadSafe
- * @noimplement
- * @version $Id: 807a04ac07c3230b8f4d4e0f9588a35fbdc41e18 $
+ * @author $Id: 58cd4db16892b20e44be1288ccac929a5a26c53a $
*/
+@ProviderType
public interface Filter {
/**
* Filter using a service's properties.
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkEvent.java b/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
index 59fa92e..06a62f8 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -33,7 +33,7 @@
*
* @Immutable
* @see FrameworkListener
- * @version $Id: f679c7581879a2e6006ecdd317a5dd5f735764e3 $
+ * @author $Id: 7b74a68311acf2116ccf21e589ece0ce2cd383ba $
*/
public class FrameworkEvent extends EventObject {
@@ -223,16 +223,16 @@
* <p>
* The type values are:
* <ul>
- * <li>{@link #STARTED}
- * <li>{@link #ERROR}
- * <li>{@link #WARNING}
- * <li>{@link #INFO}
- * <li>{@link #PACKAGES_REFRESHED}
- * <li>{@link #STARTLEVEL_CHANGED}
- * <li>{@link #STOPPED}
- * <li>{@link #STOPPED_BOOTCLASSPATH_MODIFIED}
- * <li>{@link #STOPPED_UPDATE}
- * <li>{@link #WAIT_TIMEDOUT}
+ * <li>{@link #STARTED}</li>
+ * <li>{@link #ERROR}</li>
+ * <li>{@link #WARNING}</li>
+ * <li>{@link #INFO}</li>
+ * <li>{@link #PACKAGES_REFRESHED}</li>
+ * <li>{@link #STARTLEVEL_CHANGED}</li>
+ * <li>{@link #STOPPED}</li>
+ * <li>{@link #STOPPED_BOOTCLASSPATH_MODIFIED}</li>
+ * <li>{@link #STOPPED_UPDATE}</li>
+ * <li>{@link #WAIT_TIMEDOUT}</li>
* </ul>
*
* @return The type of state change.
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkListener.java b/framework/src/main/java/org/osgi/framework/FrameworkListener.java
index 7e1e813..1ed8faa 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkListener.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). 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.EventListener;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A {@code FrameworkEvent} listener. {@code FrameworkListener} is a listener
@@ -34,9 +35,9 @@
*
* @see FrameworkEvent
* @NotThreadSafe
- * @version $Id: ad7f563bd13b60e2b8a378f147057ca7f0accae2 $
+ * @author $Id: 97c76c64c6e6595ad445dcc2d8083d52540f73b8 $
*/
-
+@ConsumerType
public interface FrameworkListener extends EventListener {
/**
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkUtil.java b/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
index c26ba43..ab0af92 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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.
@@ -43,7 +43,7 @@
*
* @since 1.3
* @ThreadSafe
- * @version $Id: 1f46ea2bbbe2a1242fdaf0877709fb9c02eefae1 $
+ * @author $Id: e93d15cef98c0e7f425f3b076d317c46ebb9a52a $
*/
public class FrameworkUtil {
/**
@@ -539,6 +539,7 @@
*
* @return This {@code Filter}'s filter string.
*/
+ @Override
public String toString() {
String result = filterString;
if (result == null) {
@@ -661,6 +662,7 @@
* {@code this.toString().equals(obj.toString()}; {@code false}
* otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -682,6 +684,7 @@
*
* @return The hashCode of this {@code Filter}.
*/
+ @Override
public int hashCode() {
return this.toString().hashCode();
}
@@ -768,6 +771,7 @@
return compare_Boolean(operation, ((Boolean) value1).booleanValue(), value2);
}
if (value1 instanceof Comparable<?>) {
+ @SuppressWarnings("unchecked")
Comparable<Object> comparable = (Comparable<Object>) value1;
return compare_Comparable(operation, comparable, value2);
}
@@ -1615,6 +1619,7 @@
this.keys = keyList.toArray(new String[keyList.size()]);
}
+ @Override
public Object get(Object o) {
String k = (String) o;
for (String key : keys) {
@@ -1643,6 +1648,7 @@
this.reference = reference;
}
+ @Override
public Object get(Object key) {
if (reference == null) {
return null;
@@ -1655,14 +1661,14 @@
}
}
- static private final class SetAccessibleAction implements PrivilegedAction<Object> {
+ static private final class SetAccessibleAction implements PrivilegedAction<Void> {
private final AccessibleObject accessible;
SetAccessibleAction(AccessibleObject accessible) {
this.accessible = accessible;
}
- public Object run() {
+ public Void run() {
accessible.setAccessible(true);
return null;
}
@@ -1772,45 +1778,51 @@
* wildcard ("*"), or a List of Strings, each String representing a
* name/value pair in the RDN.
*
- * @param dnChain
+ * @param pattern
* @return a list of DNs.
* @throws IllegalArgumentException
*/
- private static List<Object> parseDNchainPattern(String dnChain) {
- if (dnChain == null) {
- throw new IllegalArgumentException("The DN chain must not be null.");
+ private static List<Object> parseDNchainPattern(String pattern) {
+ if (pattern == null) {
+ throw new IllegalArgumentException("The pattern must not be null.");
}
List<Object> parsed = new ArrayList<Object>();
- int startIndex = 0;
- startIndex = skipSpaces(dnChain, startIndex);
- while (startIndex < dnChain.length()) {
+ final int length = pattern.length();
+ char c = ';'; // start with semi-colon to detect empty pattern
+ for (int startIndex = skipSpaces(pattern, 0); startIndex < length;) {
+ int cursor = startIndex;
int endIndex = startIndex;
- boolean inQuote = false;
- out: while (endIndex < dnChain.length()) {
- char c = dnChain.charAt(endIndex);
+ out: for (boolean inQuote = false; cursor < length; cursor++) {
+ c = pattern.charAt(cursor);
switch (c) {
case '"' :
inQuote = !inQuote;
break;
case '\\' :
- endIndex++; // skip the escaped char
+ cursor++; // skip the escaped char
+ if (cursor == length) {
+ throw new IllegalArgumentException("unterminated escape");
+ }
break;
case ';' :
- if (!inQuote)
- break out;
+ if (!inQuote) {
+ break out; // end of pattern
+ }
+ break;
}
- endIndex++;
+ if (c != ' ') { // ignore trailing whitespace
+ endIndex = cursor + 1;
+ }
}
- if (endIndex > dnChain.length()) {
- throw new IllegalArgumentException("unterminated escape");
- }
- parsed.add(dnChain.substring(startIndex, endIndex));
- startIndex = endIndex + 1;
- startIndex = skipSpaces(dnChain, startIndex);
+ parsed.add(pattern.substring(startIndex, endIndex));
+ startIndex = skipSpaces(pattern, cursor + 1);
+ }
+ if (c == ';') { // last non-whitespace character was a semi-colon
+ throw new IllegalArgumentException("empty pattern");
}
- // Now we parse is a list of strings, lets make List of rdn out
- // of them
+ // Now we have parsed into a list of strings, lets make List of rdn
+ // out of them
for (int i = 0; i < parsed.size(); i++) {
String dn = (String) parsed.get(i);
if (dn.equals(STAR_WILDCARD) || dn.equals(MINUS_WILDCARD)) {
@@ -1818,11 +1830,12 @@
}
List<Object> rdns = new ArrayList<Object>();
if (dn.charAt(0) == '*') {
- if (dn.charAt(1) != ',') {
+ int index = skipSpaces(dn, 1);
+ if (dn.charAt(index) != ',') {
throw new IllegalArgumentException("invalid wildcard prefix");
}
rdns.add(STAR_WILDCARD);
- dn = new X500Principal(dn.substring(2)).getName(X500Principal.CANONICAL);
+ dn = new X500Principal(dn.substring(index + 1)).getName(X500Principal.CANONICAL);
} else {
dn = new X500Principal(dn).getName(X500Principal.CANONICAL);
}
@@ -1830,9 +1843,6 @@
parseDN(dn, rdns);
parsed.set(i, rdns);
}
- if (parsed.size() == 0) {
- throw new IllegalArgumentException("empty DN chain");
- }
return parsed;
}
@@ -2056,7 +2066,7 @@
* "cn=me,c=US;*;cn=you" will match
* "cn=me,c=US";cn=you" and "cn=me,c=US;cn=her;cn=you". The
* pattern "cn=me,c=US;-;cn=you" will match "cn=me,c=US";cn=you"
- * and "cn=me,c=US;cn=her;cn=him;cn=you".
+ * and "cn=me,c=US;cn=her;cn=him;cn=you".</li>
* <li>As a DN prefix. In this case, the DN must start with "*,".
* The wild card will match zero or more RDNs at the start of a
* DN. For example, "*,cn=me,c=US;cn=you" will match
diff --git a/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java b/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
index e2296c0..03f6f2b 100644
--- a/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
+++ b/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
@@ -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.
@@ -28,7 +28,7 @@
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: 8820ca2db85b557cef8da09ee861249dfb5ee914 $
+ * @author $Id: 59696296eff1574fa844e3a0a975ba6c83ec59af $
*/
public class InvalidSyntaxException extends Exception {
@@ -99,6 +99,7 @@
* @return The cause of this exception or {@code null} if no cause was set.
* @since 1.3
*/
+ @Override
public Throwable getCause() {
return super.getCause();
}
@@ -114,6 +115,7 @@
* been set.
* @since 1.3
*/
+ @Override
public Throwable initCause(Throwable cause) {
return super.initCause(cause);
}
diff --git a/framework/src/main/java/org/osgi/framework/PackagePermission.java b/framework/src/main/java/org/osgi/framework/PackagePermission.java
index 62d0d8d..940ee4f 100644
--- a/framework/src/main/java/org/osgi/framework/PackagePermission.java
+++ b/framework/src/main/java/org/osgi/framework/PackagePermission.java
@@ -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.
@@ -54,7 +54,7 @@
* deprecated, implies the {@code import} action.
*
* @ThreadSafe
- * @version $Id: e993fbc36b6bff84182a8594af5af3cad8c4e2a3 $
+ * @author $Id: c2d45ff158a6a19ff7bc155af3ac9941cb6a89d6 $
*/
public final class PackagePermission extends BasicPermission {
@@ -372,6 +372,7 @@
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof PackagePermission)) {
return false;
@@ -424,6 +425,7 @@
* @return Canonical string representation of the {@code PackagePermission}
* actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -453,6 +455,7 @@
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new PackagePermissionCollection();
}
@@ -470,6 +473,7 @@
* has the same package name and actions as this
* {@code PackagePermission} object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -489,6 +493,7 @@
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -525,9 +530,8 @@
}
/**
- * Called by {@code <@link PackagePermission#implies(Permission)>}. This
- * method is only called on a requested permission which cannot have a
- * filter set.
+ * Called by {@link PackagePermission#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.
*/
@@ -539,8 +543,8 @@
final Map<String, Object> map = new HashMap<String, Object>(5);
map.put("package.name", getName());
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
map.put("id", new Long(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
@@ -610,6 +614,7 @@
* @throws SecurityException If this {@code PackagePermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof PackagePermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -666,6 +671,7 @@
* @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 PackagePermission)) {
return false;
@@ -744,6 +750,7 @@
*
* @return Enumeration of all {@code PackagePermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
Map<String, PackagePermission> pc = filterPermissions;
@@ -768,9 +775,11 @@
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields.get("permissions", null);
permissions = new HashMap<String, PackagePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
+ @SuppressWarnings("unchecked")
HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
diff --git a/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java b/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java
new file mode 100644
index 0000000..12129fe
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java
@@ -0,0 +1,124 @@
+/*
+ * 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;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * A factory for {@link Constants#SCOPE_PROTOTYPE prototype scope} services. The
+ * factory can provide multiple, customized service objects in the OSGi
+ * environment.
+ *
+ * <p>
+ * When registering a service, a {@code PrototypeServiceFactory} object can be
+ * used instead of a service object, so that the bundle developer can create a
+ * customized service object for each caller that is using the service.
+ *
+ * <p>
+ * When a caller uses a {@link ServiceObjects} to
+ * {@link ServiceObjects#getService() request} a service object, the framework
+ * calls the {@link #getService(Bundle, ServiceRegistration) getService} method
+ * to return a service object customized for the requesting caller. The caller
+ * can {@link ServiceObjects#ungetService(Object) release} the returned service
+ * object and the framework will call the
+ * {@link #ungetService(Bundle, ServiceRegistration, Object) ungetService}
+ * method with the service object.
+ *
+ * <p>
+ * When a bundle uses the {@link BundleContext#getService(ServiceReference)}
+ * method to obtain a service object, the framework must act as if the service
+ * has {@link Constants#SCOPE_BUNDLE bundle scope}. That is, the framework will
+ * call the {@link #getService(Bundle, ServiceRegistration) getService} method
+ * to obtain a bundle-scoped service object which will be cached and have a use
+ * count. See {@link ServiceFactory}.
+ *
+ * <p>
+ * A bundle can use both {@link ServiceObjects} and
+ * {@link BundleContext#getService(ServiceReference)} to obtain a service object
+ * for a service. {@link ServiceObjects#getService()} will always return a
+ * service object provided by a call to
+ * {@link #getService(Bundle, ServiceRegistration)} and
+ * {@link BundleContext#getService(ServiceReference)} will always return the
+ * bundle-scoped service object.
+ *
+ * <p>
+ * {@code PrototypeServiceFactory} objects are only used by the Framework and
+ * are not made available to other bundles in the OSGi environment. The
+ * Framework may concurrently call a {@code PrototypeServiceFactory}.
+ *
+ * @param <S> Type of Service
+ * @see BundleContext#getServiceObjects(ServiceReference)
+ * @see ServiceObjects
+ * @ThreadSafe
+ * @since 1.8
+ * @author $Id$
+ */
+@ConsumerType
+public interface PrototypeServiceFactory<S> extends ServiceFactory<S> {
+ /**
+ * Returns a service object for a caller.
+ *
+ * <p>
+ * The Framework invokes this method for each caller requesting a service
+ * object using {@link ServiceObjects#getService()}. The factory can then
+ * return a customized service object for the caller.
+ *
+ * <p>
+ * The Framework must check that the returned service object is valid. If
+ * the returned service object is {@code null} or is not an
+ * {@code instanceof} all the classes named when the service was registered,
+ * a framework event of type {@link FrameworkEvent#ERROR} is fired
+ * containing a service exception of type
+ * {@link ServiceException#FACTORY_ERROR} and {@code null} is returned to
+ * the caller. If this method throws an exception, a framework event of type
+ * {@link FrameworkEvent#ERROR} is fired containing a service exception of
+ * type {@link ServiceException#FACTORY_EXCEPTION} with the thrown exception
+ * as the cause and {@code null} is returned to the caller.
+ *
+ * @param bundle The bundle requesting the service.
+ * @param registration The {@code ServiceRegistration} object for the
+ * requested service.
+ * @return A service object that <strong>must</strong> be an instance of all
+ * the classes named when the service was registered.
+ * @see ServiceObjects#getService()
+ */
+ public S getService(Bundle bundle, ServiceRegistration<S> registration);
+
+ /**
+ * Releases a service object customized for a caller.
+ *
+ * <p>
+ * The Framework invokes this method when a service has been released by a
+ * bundle such as by calling {@link ServiceObjects#ungetService(Object)}.
+ * The service object may then be destroyed.
+ *
+ * <p>
+ * If this method throws an exception, a framework event of type
+ * {@link FrameworkEvent#ERROR} is fired containing a service exception of
+ * type {@link ServiceException#FACTORY_EXCEPTION} with the thrown exception
+ * as the cause.
+ *
+ * @param bundle The bundle releasing the service.
+ * @param registration The {@code ServiceRegistration} object for the
+ * service being released.
+ * @param service The service object returned by a previous call to the
+ * {@link #getService(Bundle, ServiceRegistration) getService}
+ * method.
+ * @see ServiceObjects#ungetService(Object)
+ */
+ public void ungetService(Bundle bundle, ServiceRegistration<S> registration, S service);
+}
diff --git a/framework/src/main/java/org/osgi/framework/ServiceEvent.java b/framework/src/main/java/org/osgi/framework/ServiceEvent.java
index 2a59fe8..06eae88 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceEvent.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceEvent.java
@@ -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.
@@ -32,7 +32,7 @@
* @Immutable
* @see ServiceListener
* @see AllServiceListener
- * @version $Id: 49e34e0ad5564d6f4ca0ab0053b272c22b9fb917 $
+ * @author $Id: b27a941cb68e6416825b1b717090a2eb098733f3 $
*/
public class ServiceEvent extends EventObject {
diff --git a/framework/src/main/java/org/osgi/framework/ServiceException.java b/framework/src/main/java/org/osgi/framework/ServiceException.java
index de90784..e0a120c 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceException.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -30,7 +30,7 @@
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: 9f763412635f59585bb615cbc449fc7ab72b7103 $
+ * @author $Id: 32a515460813c702b127f65dda91cd23781b2a98 $
* @since 1.5
*/
@@ -74,6 +74,12 @@
* @since 1.6
*/
public static final int FACTORY_RECURSION = 6;
+ /**
+ * An asynchronous operation was unable to obtain the service.
+ *
+ * @since 1.8
+ */
+ public static final int ASYNC_ERROR = 7;
/**
* Creates a {@code ServiceException} with the specified message and
diff --git a/framework/src/main/java/org/osgi/framework/ServiceFactory.java b/framework/src/main/java/org/osgi/framework/ServiceFactory.java
index 4b52fee..1447958 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceFactory.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceFactory.java
@@ -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.
@@ -16,26 +16,34 @@
package org.osgi.framework;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
- * Allows services to provide customized service objects in the OSGi
+ * A factory for {@link Constants#SCOPE_BUNDLE bundle scope} services. The
+ * factory can provide service objects customized for each bundle in the OSGi
* environment.
*
* <p>
* When registering a service, a {@code ServiceFactory} object can be used
- * instead of a service object, so that the bundle developer can gain control of
- * the specific service object granted to a bundle that is using the service.
+ * instead of a service object, so that the bundle developer can create a
+ * customized service object for each bundle that is using the service.
*
* <p>
- * When this happens, the {@code BundleContext.getService(ServiceReference)}
- * method calls the {@code ServiceFactory.getService} method to create a service
- * object specifically for the requesting bundle. The service object returned by
- * the {@code ServiceFactory} is cached by the Framework until the bundle
- * releases its use of the service.
+ * When a bundle {@link BundleContext#getService(ServiceReference) requests} the
+ * service object, the framework calls the
+ * {@link #getService(Bundle, ServiceRegistration) getService} method to return
+ * a service object customized for the requesting bundle. The returned service
+ * object is cached by the Framework for subsequent calls to
+ * {@link BundleContext#getService(ServiceReference)} until the bundle releases
+ * its use of the service.
*
* <p>
- * When the bundle's use count for the service is decremented to zero (including
- * the bundle stopping or the service being unregistered), the
- * {@code ServiceFactory.ungetService} method is called.
+ * When the bundle's use count for the service is
+ * {@link BundleContext#ungetService(ServiceReference) decremented} to zero
+ * (including the bundle stopping or the service being unregistered), the
+ * framework will call the
+ * {@link #ungetService(Bundle, ServiceRegistration, Object) ungetService}
+ * method.
*
* <p>
* {@code ServiceFactory} objects are only used by the Framework and are not
@@ -45,18 +53,18 @@
* @param <S> Type of Service
* @see BundleContext#getService(ServiceReference)
* @ThreadSafe
- * @version $Id: 535776e702ec5ace54f577218ff8f7920741558b $
+ * @author $Id: f11fc6bee18315fb659c7987d1b66f1c9c95548a $
*/
-
+@ConsumerType
public interface ServiceFactory<S> {
/**
- * Creates a new service object.
+ * Returns a service object for a bundle.
*
* <p>
* The Framework invokes this method the first time the specified
* {@code bundle} requests a service object using the
- * {@code BundleContext.getService(ServiceReference)} method. The service
- * factory can then return a specific service object for each bundle.
+ * {@link BundleContext#getService(ServiceReference)} method. The factory
+ * can then return a customized service object for each bundle.
*
* <p>
* The Framework must check that the returned service object is valid. If
@@ -76,9 +84,10 @@
*
* <p>
* The Framework caches the valid service object and will return the same
- * service object on any future call to {@code BundleContext.getService} for
- * the specified bundle. This means the Framework must not allow this method
- * to be concurrently called for the specified bundle.
+ * service object on any future call to
+ * {@link BundleContext#getService(ServiceReference)} for the specified
+ * bundle. This means the Framework must not allow this method to be
+ * concurrently called for the specified bundle.
*
* @param bundle The bundle requesting the service.
* @param registration The {@code ServiceRegistration} object for the
@@ -90,7 +99,7 @@
public S getService(Bundle bundle, ServiceRegistration<S> registration);
/**
- * Releases a service object.
+ * Releases a service object customized for a bundle.
*
* <p>
* The Framework invokes this method when a service has been released by a
diff --git a/framework/src/main/java/org/osgi/framework/ServiceListener.java b/framework/src/main/java/org/osgi/framework/ServiceListener.java
index 839c1bc..f0d8ae2 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceListener.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceListener.java
@@ -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.EventListener;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A {@code ServiceEvent} listener. {@code ServiceListener} is a listener
@@ -49,9 +50,9 @@
* @see ServiceEvent
* @see ServicePermission
* @ThreadSafe
- * @version $Id: 601dfda6183ab7f18cd3916958a39734ea141c25 $
+ * @author $Id: 8468dbc769382269184c932d41e084cb2fa58eb9 $
*/
-
+@ConsumerType
public interface ServiceListener extends EventListener {
/**
* Receives notification that a service has had a lifecycle change.
diff --git a/framework/src/main/java/org/osgi/framework/ServiceObjects.java b/framework/src/main/java/org/osgi/framework/ServiceObjects.java
new file mode 100644
index 0000000..99314fe
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/ServiceObjects.java
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Allows multiple service objects for a service to be obtained.
+ *
+ * <p>
+ * For services with {@link Constants#SCOPE_PROTOTYPE prototype} scope, multiple
+ * service objects for the service can be obtained. For services with
+ * {@link Constants#SCOPE_SINGLETON singleton} or {@link Constants#SCOPE_BUNDLE
+ * bundle} scope, only one, use-counted service object is available to a
+ * requesting bundle.
+ *
+ * <p>
+ * Any unreleased service objects obtained from this {@code ServiceObjects}
+ * object are automatically released by the framework when the bundle associated
+ * with the BundleContext used to create this {@code ServiceObjects} object is
+ * stopped.
+ *
+ * @param <S> Type of Service
+ * @see BundleContext#getServiceObjects(ServiceReference)
+ * @see PrototypeServiceFactory
+ * @ThreadSafe
+ * @since 1.8
+ * @author $Id$
+ */
+@ProviderType
+public interface ServiceObjects<S> {
+ /**
+ * Returns a service object for the {@link #getServiceReference()
+ * associated} service.
+ *
+ * <p>
+ * This {@code ServiceObjects} object can be used to obtain multiple service
+ * objects for the associated service if the service has
+ * {@link Constants#SCOPE_PROTOTYPE prototype} scope.
+ *
+ * <p>
+ * If the associated service has {@link Constants#SCOPE_SINGLETON singleton}
+ * or {@link Constants#SCOPE_BUNDLE bundle} scope, this method behaves the
+ * same as calling the {@link BundleContext#getService(ServiceReference)}
+ * method for the associated service. That is, only one, use-counted service
+ * object is available from this {@link ServiceObjects} object.
+ *
+ * <p>
+ * This method will always return {@code null} when the associated service
+ * has been unregistered.
+ *
+ * <p>
+ * For a prototype scope service, the following steps are required to obtain
+ * a service object:
+ * <ol>
+ * <li>If the associated service has been unregistered, {@code null} is
+ * returned.</li>
+ * <li>The
+ * {@link PrototypeServiceFactory#getService(Bundle, ServiceRegistration)}
+ * method is called to supply a customized service object for the caller.</li>
+ * <li>If the service object returned by the {@code PrototypeServiceFactory}
+ * object is {@code null}, not an {@code instanceof} all the classes named
+ * when the service was registered or the {@code PrototypeServiceFactory}
+ * object throws an exception, {@code null} is returned and a Framework
+ * event of type {@link FrameworkEvent#ERROR} containing a
+ * {@link ServiceException} describing the error is fired.</li>
+ * <li>The customized service object is returned.</li>
+ * </ol>
+ *
+ * @return A service object for the associated service or {@code null} if
+ * the service is not registered, the customized service object
+ * returned by a {@code ServiceFactory} does not implement the
+ * classes under which it was registered or the
+ * {@code ServiceFactory} threw an exception.
+ * @throws IllegalStateException If the BundleContext used to create this
+ * {@code ServiceObjects} object is no longer valid.
+ * @see #ungetService(Object)
+ */
+ public S getService();
+
+ /**
+ * Releases a service object for the {@link #getServiceReference()
+ * associated} service.
+ *
+ * <p>
+ * This {@code ServiceObjects} object can be used to obtain multiple service
+ * objects for the associated service if the service has
+ * {@link Constants#SCOPE_PROTOTYPE prototype} scope. If the associated
+ * service has {@link Constants#SCOPE_SINGLETON singleton} or
+ * {@link Constants#SCOPE_BUNDLE bundle} scope, this method behaves the same
+ * as calling the {@link BundleContext#ungetService(ServiceReference)}
+ * method for the associated service. That is, only one, use-counted service
+ * object is available from this {@link ServiceObjects} object.
+ *
+ * <p>
+ * For a prototype scope service, the following steps are required to
+ * release a service object:
+ * <ol>
+ * <li>If the associated service has been unregistered, this method returns
+ * without doing anything.</li>
+ * <li>The
+ * {@link PrototypeServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
+ * method is called to release the specified service object.</li>
+ * </ol>
+ *
+ * <p>
+ * The specified service object must no longer be used and all references to
+ * it should be destroyed after calling this method.
+ *
+ * @param service A service object previously provided by this
+ * {@code ServiceObjects} object.
+ * @throws IllegalStateException If the BundleContext used to create this
+ * {@code ServiceObjects} object is no longer valid.
+ * @throws IllegalArgumentException If the specified service object was not
+ * provided by this {@code ServiceObjects} object.
+ * @see #getService()
+ */
+ public void ungetService(S service);
+
+ /**
+ * Returns the {@link ServiceReference} for the service associated with this
+ * {@code ServiceObjects} object.
+ *
+ * @return The {@link ServiceReference} for the service associated with this
+ * {@code ServiceObjects} object.
+ */
+ public ServiceReference<S> getServiceReference();
+}
diff --git a/framework/src/main/java/org/osgi/framework/ServicePermission.java b/framework/src/main/java/org/osgi/framework/ServicePermission.java
index 23ecfba..36e7558 100644
--- a/framework/src/main/java/org/osgi/framework/ServicePermission.java
+++ b/framework/src/main/java/org/osgi/framework/ServicePermission.java
@@ -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 @@
* 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 @@
* to get the specific service.
*
* @ThreadSafe
- * @version $Id: 96438ad164d7f0f4273787226298bf8208cf0034 $
+ * @author $Id: ff7fc46dd623c0a09b49965048dd6faa2b111b39 $
*/
public final class ServicePermission extends BasicPermission {
@@ -207,7 +207,7 @@
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 @@
* @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 @@
*
* @return The canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -469,6 +471,7 @@
* @return A new {@code PermissionCollection} object suitable for storing
* {@code ServicePermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new ServicePermissionCollection();
}
@@ -484,6 +487,7 @@
* 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 @@
*
* @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 @@
}
/**
- * 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 @@
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 @@
entries = null;
}
+ @Override
public Object get(Object k) {
if (!(k instanceof String)) {
return null;
@@ -639,14 +644,17 @@
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 @@
* @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 @@
* @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 @@
*
* @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 @@
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;
}
diff --git a/framework/src/main/java/org/osgi/framework/ServiceReference.java b/framework/src/main/java/org/osgi/framework/ServiceReference.java
index 7541517..193f749 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceReference.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceReference.java
@@ -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 @@
* @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
diff --git a/framework/src/main/java/org/osgi/framework/ServiceRegistration.java b/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
index 702e918..b50e6cb 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
@@ -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 @@
* @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 @@
* 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 @@
* 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
diff --git a/framework/src/main/java/org/osgi/framework/SignerProperty.java b/framework/src/main/java/org/osgi/framework/SignerProperty.java
index 9236dfa..0dbb6ca 100644
--- a/framework/src/main/java/org/osgi/framework/SignerProperty.java
+++ b/framework/src/main/java/org/osgi/framework/SignerProperty.java
@@ -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 @@
* 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 @@
* @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 @@
* 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;
}
diff --git a/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java b/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
index ee8474c..76ec1ba 100644
--- a/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
+++ b/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
@@ -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 @@
* @since 1.1
* @see BundleEvent
* @ThreadSafe
- * @version $Id: 74246f4ceeba7f9a5ee198048522f93d4691c51a $
+ * @author $Id: 6b50c6c9d8b8b091928495eb036552773284b13a $
*/
-
+@ConsumerType
public interface SynchronousBundleListener extends BundleListener {
// This is a marker interface
}
diff --git a/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java b/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
index d712fcf..27271ca 100644
--- a/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
+++ b/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
@@ -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 @@
* @see ServicePermission
* @ThreadSafe
* @since 1.7
- * @version $Id: 543a345802f8dc7a49d29e8fb7aee7004ee2b329 $
+ * @author $Id: c68fe7ab0c3461256613d22dd666f17f87597dfe $
*/
-
+@ConsumerType
public interface UnfilteredServiceListener extends ServiceListener {
// This is a marker interface
}
diff --git a/framework/src/main/java/org/osgi/framework/Version.java b/framework/src/main/java/org/osgi/framework/Version.java
index 02f6ddd..7ec6dc0 100644
--- a/framework/src/main/java/org/osgi/framework/Version.java
+++ b/framework/src/main/java/org/osgi/framework/Version.java
@@ -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 @@
*
* @since 1.3
* @Immutable
- * @version $Id: a0b5a865f7fbf2b3dcb77a13b2e99da0b64702bb $
+ * @author $Id: c24d4d37a0657ac69de29085d2d290cbb0031c4a $
*/
public class Version implements Comparable<Version> {
@@ -210,13 +210,13 @@
* 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 @@
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 @@
*
* @return The string representation of this version identifier.
*/
+ @Override
public String toString() {
return toString0();
}
@@ -289,8 +314,9 @@
* @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 @@
*
* @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 @@
* @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;
diff --git a/framework/src/main/java/org/osgi/framework/VersionRange.java b/framework/src/main/java/org/osgi/framework/VersionRange.java
index 0589a75..db4fc7b 100644
--- a/framework/src/main/java/org/osgi/framework/VersionRange.java
+++ b/framework/src/main/java/org/osgi/framework/VersionRange.java
@@ -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 @@
*
* @since 1.7
* @Immutable
- * @version $Id: d0c21e6a5015a7fa0b33179a29122ea7d137145a $
+ * @author $Id: 1f5fa660a1a42e83371fe0d2c61ae79ce1cb1710 $
*/
public class VersionRange {
@@ -123,7 +123,7 @@
*
* @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 @@
*/
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 @@
*
* @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 @@
*
* @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 @@
* @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 @@
}
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 @@
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);
+ }
}
diff --git a/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java b/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
new file mode 100644
index 0000000..aa30709
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/dto/BundleDTO.java
@@ -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;
+}
diff --git a/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java b/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
new file mode 100644
index 0000000..7c52572
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
@@ -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;
+}
diff --git a/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java b/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
new file mode 100644
index 0000000..2c70b84
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
@@ -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;
+}
diff --git a/framework/src/main/java/org/osgi/framework/dto/package-info.java b/framework/src/main/java/org/osgi/framework/dto/package-info.java
new file mode 100644
index 0000000..2acfb6f
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/dto/package-info.java
@@ -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;
+
diff --git a/framework/src/main/java/org/osgi/framework/dto/packageinfo b/framework/src/main/java/org/osgi/framework/dto/packageinfo
new file mode 100644
index 0000000..ed9885d
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/dto/packageinfo
@@ -0,0 +1 @@
+version 1.8
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
index 37446ff..cb3eb2d 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
@@ -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 @@
* in a bundle symbolic name and version collision.
*
* @ThreadSafe
- * @version $Id: a1a25ee0432f210a56e911246f477f19edc28bc1 $
+ * @author $Id: b05e0c3819aff6df35c2ec034242596d04f53408 $
*/
+@ConsumerType
public interface CollisionHook {
/**
@@ -54,17 +56,17 @@
* 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
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
index e66a20e..4bd7657 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
@@ -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 @@
* (install, start, stop, update, and uninstall bundle) operations.
*
* @ThreadSafe
- * @version $Id: e1471b36491a02bd8598a30d05c889ee58edc760 $
+ * @author $Id: 0b986db904e41d5a5bfb5d28fc849ee967decf0d $
*/
+@ConsumerType
public interface EventHook {
/**
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
index af556ea..9c8ab23 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
@@ -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 @@
* (get bundles) operations.
*
* @ThreadSafe
- * @version $Id: ae6bf5fc5cf999ac39dfc195c99ef7e223e3b847 $
+ * @author $Id: 1029e10212f150304095fc99433197083cc00e9e $
*/
+@ConsumerType
public interface FindHook {
/**
* Find hook method. This method is called for the following:
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
new file mode 100644
index 0000000..08c20ca
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/package-info.java
@@ -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;
+
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo b/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo
new file mode 100644
index 0000000..3987f9c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo
@@ -0,0 +1 @@
+version 1.1
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
index 51c46ec..f1d663f 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
@@ -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 @@
* <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 @@
*
* @see ResolverHookFactory
* @NotThreadSafe
- * @version $Id: 9d3ef6240aead0952b5a47b793780c1c0589089a $
+ * @author $Id: 7b2a0a5dbec7b0e999112ae324d050fcf190fa5d $
*/
+@ConsumerType
public interface ResolverHook {
/**
* Filter resolvable candidates hook method. This method may be called
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
index 91ce5f7..10f6e97 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
@@ -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 @@
*
* @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
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java b/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
new file mode 100644
index 0000000..de05003
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/package-info.java
@@ -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;
+
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo b/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
index 03a84d4..3603e77 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
@@ -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 @@
*
* @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
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
index 534efc5..3230742 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
@@ -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 @@
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 @@
*
* @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
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
index 4cd467c..745a6b4 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
@@ -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 @@
* (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
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
index ef933c3..2f4cab9 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
@@ -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 @@
* 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 @@
* 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.
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java b/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
new file mode 100644
index 0000000..74f0c41
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/package-info.java
@@ -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;
+
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo b/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo
new file mode 100644
index 0000000..3987f9c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo
@@ -0,0 +1 @@
+version 1.1
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java
index 8842797..254dd9b 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingException.java
@@ -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 @@
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: eb38b85f6ed66ec445fb2f0ee7143df021327a9a $
+ * @author $Id: 7575fc1b015fea7c77397391df6c8d2085513e76 $
*/
public class WeavingException extends RuntimeException {
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java
index be57658..760b00c 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java
@@ -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 @@
* bytes as modified by previously called weaving hooks.
*
* @ThreadSafe
- * @version $Id: d1985029024baba2db1c56aab1e06ee953fd6365 $
+ * @author $Id: 8d99df5b0f3e7ffa9573695923afe86de9835fde $
*/
-
+@ConsumerType
public interface WeavingHook {
/**
* Weaving hook method.
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
index 697a435..a7e131c 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
@@ -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 @@
import java.security.ProtectionDomain;
import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.wiring.BundleWiring;
/**
@@ -29,25 +30,92 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
/**
* 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.
+ * complete after the class is defined.
*
- * <p>
- * After weaving is complete, this object becomes effectively immutable.
- *
- * @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 @@
* @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();
}
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
new file mode 100644
index 0000000..4a7a699
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClassListener.java
@@ -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);
+}
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
new file mode 100644
index 0000000..5b48f04
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/package-info.java
@@ -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;
+
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo b/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo
new file mode 100644
index 0000000..3987f9c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo
@@ -0,0 +1 @@
+version 1.1
diff --git a/framework/src/main/java/org/osgi/framework/launch/Framework.java b/framework/src/main/java/org/osgi/framework/launch/Framework.java
index 54d599b..125e581 100644
--- a/framework/src/main/java/org/osgi/framework/launch/Framework.java
+++ b/framework/src/main/java/org/osgi/framework/launch/Framework.java
@@ -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 @@
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 @@
* 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 @@
* {@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 @@
* 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 @@
* 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 @@
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.
*
diff --git a/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java b/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
index bac0183..6d656d3 100644
--- a/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
+++ b/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
@@ -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 @@
* the resource.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 1684e14aa98a1f6e1ff3e0f3afa2c55982210f72 $
+ * @author $Id: c1647bcb8416b6dfa9e37c6cc146bb54c7173526 $
*/
+@ProviderType
public interface FrameworkFactory {
/**
diff --git a/framework/src/main/java/org/osgi/framework/launch/package-info.java b/framework/src/main/java/org/osgi/framework/launch/package-info.java
new file mode 100644
index 0000000..db5e926
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/launch/package-info.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 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.
+ */
+
+/**
+ * Framework Launch Package Version 1.2.
+ *
+ * <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.launch; version="[1.2,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.2")
+package org.osgi.framework.launch;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/launch/packageinfo b/framework/src/main/java/org/osgi/framework/launch/packageinfo
new file mode 100644
index 0000000..ef7df68
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/launch/packageinfo
@@ -0,0 +1 @@
+version 1.2
diff --git a/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
index 52563e2..c5186a1 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.namespace;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Namespace;
/**
@@ -31,8 +32,9 @@
* otherwise indicated.
*
* @Immutable
- * @version $Id: 383e84df9190757ce6bb6fb722e80a3b7d6b68da $
+ * @author $Id: 6bbd0ddefc452b0ace2f43ec3aa67a687adcf03c $
*/
+@ProviderType
public abstract class AbstractWiringNamespace extends Namespace {
/**
diff --git a/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
index 84b6700..59e36cb 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.
@@ -66,7 +66,7 @@
* capability.
*
* @Immutable
- * @version $Id: 339f1204725aa9d9c2463b1224b2e38e505024e9 $
+ * @author $Id: 2672d40cf3705b2cf21d01530e4bdfa2cdc61764 $
*/
public final class BundleNamespace extends AbstractWiringNamespace {
diff --git a/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
index 5328cae..a3f79a0 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.
@@ -29,7 +29,7 @@
* {@code String}, unless otherwise indicated.
*
* @Immutable
- * @version $Id: e1c30aac8efacc1b21ab20ffebcc1af30a1054a8 $
+ * @author $Id: 45a233050d35a5debc8a7d1be1f7e81178916984 $
*/
public final class ExecutionEnvironmentNamespace extends Namespace {
diff --git a/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
index 5964cf5..28f7c1d 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.
@@ -66,7 +66,7 @@
* capability.
*
* @Immutable
- * @version $Id: aa3cc744c7b9c21d908260f456567ab8a6de1430 $
+ * @author $Id: a7cbf04c393bfaaa7515804a8ab6b9ebfd72fbe5 $
*/
public final class HostNamespace extends AbstractWiringNamespace {
@@ -132,7 +132,7 @@
/**
* The requirement directive used to specify the type of the extension
- * fragment.
+ * fragment. The default value is {@link #EXTENSION_FRAMEWORK framework}.
*
* @see #EXTENSION_FRAMEWORK
* @see #EXTENSION_BOOTCLASSPATH
diff --git a/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
index c925e5a..cfbb843 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.
@@ -41,7 +41,7 @@
* capability.
*
* @Immutable
- * @version $Id: e34dcaba1f828326a0db13b3d811b2d170ff97a5 $
+ * @author $Id: 7bc7a11c45b30538ffbb7572c4539f6160557684 $
*/
public final class IdentityNamespace extends Namespace {
diff --git a/framework/src/main/java/org/osgi/framework/namespace/NativeNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/NativeNamespace.java
new file mode 100644
index 0000000..0e11cac
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/NativeNamespace.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 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.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.framework.Constants;
+import org.osgi.resource.Namespace;
+
+/**
+ * Native 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
+ * @author $Id$
+ */
+public final class NativeNamespace extends Namespace {
+
+ /**
+ * Namespace name for native capabilities and requirements.
+ */
+ public static final String NATIVE_NAMESPACE = "osgi.native";
+
+ /**
+ * The capability attribute contains alias values of the
+ * {@link Constants#FRAMEWORK_OS_NAME org.osgi.framework.os.name} launching
+ * property value according to the <a
+ * href="http://www.osgi.org/Specifications/Reference">OSGi Specification
+ * References</a>. The value of this attribute must be of type
+ * {@code List<String>}.
+ */
+ public final static String CAPABILITY_OSNAME_ATTRIBUTE = NATIVE_NAMESPACE + ".osname";
+
+ /**
+ * The capability attribute contains a {@code Version} parsed from the
+ * {@link Constants#FRAMEWORK_OS_VERSION org.osgi.framework.os.version}
+ * launching property value. The value of this attribute must be of type
+ * {@code Version}.
+ */
+ public final static String CAPABILITY_OSVERSION_ATTRIBUTE = NATIVE_NAMESPACE + ".osversion";
+
+ /**
+ * The capability attribute contains alias values of the
+ * {@link Constants#FRAMEWORK_PROCESSOR org.osgi.framework.processor}
+ * launching property value according to the <a
+ * href="http://www.osgi.org/Specifications/Reference">OSGi Specification
+ * References</a>. The value of this attribute must be of type
+ * {@code List<String>}.
+ */
+ public final static String CAPABILITY_PROCESSOR_ATTRIBUTE = NATIVE_NAMESPACE + ".processor";
+
+ /**
+ * The capability attribute contains the
+ * {@link Constants#FRAMEWORK_LANGUAGE org.osgi.framework.language}
+ * launching property value. The value of this attribute must be of type
+ * {@code String}.
+ */
+ public final static String CAPABILITY_LANGUAGE_ATTRIBUTE = NATIVE_NAMESPACE + ".language";
+
+ private NativeNamespace() {
+ // empty
+ }
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
index 2d1cbc3..9f7114c 100644
--- a/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
+++ b/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.
@@ -59,7 +59,7 @@
* </ul>
*
* @Immutable
- * @version $Id: 5adc45bd1ae26120cbff3562c7c8cefc01e38bd3 $
+ * @author $Id: 5f241fb0804d477ab8f2d33f247d45e62caf72df $
*/
public final class PackageNamespace extends AbstractWiringNamespace {
diff --git a/framework/src/main/java/org/osgi/framework/namespace/package-info.java b/framework/src/main/java/org/osgi/framework/namespace/package-info.java
new file mode 100644
index 0000000..e89f34a
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 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.
+ */
+
+/**
+ * Namespace Package Version 1.1.
+ *
+ * <p>
+ * Bundles should not need to import this package at runtime since all
+ * the types in this package just contain constants for capability and
+ * requirement namespaces specified by the OSGi Alliance.
+ *
+ * @author $Id$
+ */
+
+@Version("1.1")
+package org.osgi.framework.namespace;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/namespace/packageinfo b/framework/src/main/java/org/osgi/framework/namespace/packageinfo
new file mode 100644
index 0000000..3987f9c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/packageinfo
@@ -0,0 +1 @@
+version 1.1
diff --git a/framework/src/main/java/org/osgi/framework/package-info.java b/framework/src/main/java/org/osgi/framework/package-info.java
new file mode 100644
index 0000000..f7b9e43
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/package-info.java
@@ -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 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.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework; version="[1.8,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.8")
+package org.osgi.framework;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/packageinfo b/framework/src/main/java/org/osgi/framework/packageinfo
new file mode 100644
index 0000000..ed9885d
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/packageinfo
@@ -0,0 +1 @@
+version 1.8
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/BundleStartLevel.java b/framework/src/main/java/org/osgi/framework/startlevel/BundleStartLevel.java
index d22d3ef..44e3c45 100644
--- a/framework/src/main/java/org/osgi/framework/startlevel/BundleStartLevel.java
+++ b/framework/src/main/java/org/osgi/framework/startlevel/BundleStartLevel.java
@@ -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,7 @@
package org.osgi.framework.startlevel;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
@@ -29,9 +30,9 @@
* calling {@link BundleReference#getBundle()}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 9a000be191fe3cb4ae82535a30940db0340d5356 $
+ * @author $Id: 421ffd6e9c48cda1bcd28c62e9ace1c05852f112 $
*/
+@ProviderType
public interface BundleStartLevel extends BundleReference {
/**
* Return the assigned start level value for the bundle.
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java b/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
index 11a8049..632c94c 100644
--- a/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
+++ b/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.startlevel;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.FrameworkListener;
@@ -32,9 +33,9 @@
* obtained by calling {@link BundleReference#getBundle()}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 12c6f60842df994c7de2cc3cfd02f791b95fc35b $
+ * @author $Id: de8d10036e85359428ca3e14bbe9b2c6d448fb93 $
*/
+@ProviderType
public interface FrameworkStartLevel extends BundleReference {
/**
* Return the active start level value of the Framework.
@@ -69,13 +70,13 @@
* At each intermediate start level value on the way to and including the
* target start level, the Framework must:
* <ol>
- * <li>Change the active start level to the intermediate start level value.
+ * <li>Change the active start level to the intermediate start level value.</li>
* <li>Start bundles at the intermediate start level whose autostart setting
* indicate they must be started. They are started as described in the
* {@link Bundle#start(int)} method using the {@link Bundle#START_TRANSIENT}
* option. The {@link Bundle#START_ACTIVATION_POLICY} option must also be
* used if {@link BundleStartLevel#isActivationPolicyUsed()} returns
- * {@code true} for the bundle.
+ * {@code true} for the bundle.</li>
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
@@ -92,8 +93,8 @@
* <ol>
* <li>Stop bundles at the intermediate start level as described in the
* {@link Bundle#stop(int)} method using the {@link Bundle#STOP_TRANSIENT}
- * option.
- * <li>Change the active start level to the intermediate start level value.
+ * option.</li>
+ * <li>Change the active start level to the intermediate start level value.</li>
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/dto/BundleStartLevelDTO.java b/framework/src/main/java/org/osgi/framework/startlevel/dto/BundleStartLevelDTO.java
new file mode 100644
index 0000000..81430e2
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/dto/BundleStartLevelDTO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.startlevel.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.startlevel.BundleStartLevel;
+
+/**
+ * Data Transfer Object for a BundleStartLevel.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleStartLevelDTO}
+ * for the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleStartLevelDTO extends DTO {
+ /**
+ * The id of the bundle associated with this start level.
+ *
+ * @see BundleStartLevel#getBundle()
+ */
+ public long bundle;
+
+ /**
+ * The assigned start level value for the bundle.
+ *
+ * @see BundleStartLevel#getStartLevel()
+ */
+ public int startLevel;
+
+ /**
+ * The bundle's autostart setting indicates that the activation policy
+ * declared in the bundle manifest must be used.
+ *
+ * @see BundleStartLevel#isActivationPolicyUsed()
+ */
+ public boolean activationPolicyUsed;
+
+ /**
+ * The bundle's autostart setting indicates it must be started.
+ *
+ * @see BundleStartLevel#isPersistentlyStarted()
+ */
+ public boolean persistentlyStarted;
+}
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/dto/FrameworkStartLevelDTO.java b/framework/src/main/java/org/osgi/framework/startlevel/dto/FrameworkStartLevelDTO.java
new file mode 100644
index 0000000..2d1de40
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/dto/FrameworkStartLevelDTO.java
@@ -0,0 +1,47 @@
+/*
+ * 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.startlevel.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.startlevel.FrameworkStartLevel;
+
+/**
+ * Data Transfer Object for a FrameworkStartLevel.
+ *
+ * <p>
+ * The System Bundle can be adapted to provide a {@code FrameworkStartLevelDTO}
+ * for the framework of the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class FrameworkStartLevelDTO extends DTO {
+ /**
+ * The active start level value for the framework.
+ *
+ * @see FrameworkStartLevel#getStartLevel()
+ */
+ public int startLevel;
+
+ /**
+ * The initial start level value that is assigned to a bundle when it is
+ * first installed.
+ *
+ * @see FrameworkStartLevel#getInitialBundleStartLevel()
+ */
+ public int initialBundleStartLevel;
+}
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/dto/package-info.java b/framework/src/main/java/org/osgi/framework/startlevel/dto/package-info.java
new file mode 100644
index 0000000..62262c5
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/dto/package-info.java
@@ -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 Start Level 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. 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.startlevel.dto; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.startlevel.dto; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.framework.startlevel.dto;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/dto/packageinfo b/framework/src/main/java/org/osgi/framework/startlevel/dto/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/dto/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/package-info.java b/framework/src/main/java/org/osgi/framework/startlevel/package-info.java
new file mode 100644
index 0000000..27d775b
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/package-info.java
@@ -0,0 +1,83 @@
+/*
+ * 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 Start Level Package Version 1.0.
+ *
+ * <p>
+ * The Framework Start Level package allows management agents to manage a start
+ * level assigned to each bundle and the active start level of the Framework.
+ * This package is a replacement for the now deprecated
+ * {@code org.osgi.service.startlevel} package.
+ *
+ * <p>
+ * A start level is defined to be a state of execution in which the Framework
+ * exists. Start level values are defined as unsigned integers with 0 (zero)
+ * being the state where the Framework is not launched. Progressively higher
+ * integral values represent progressively higher start levels. For example, 2
+ * is a higher start level than 1.
+ *
+ * <p>
+ * {@code AdminPermission} is required to modify start level information.
+ *
+ * <p>
+ * Start Level support in the Framework includes the ability to modify the
+ * active start level of the Framework and to assign a specific start level to a
+ * bundle. The beginning start level of a Framework is specified via the
+ * {@link org.osgi.framework.Constants#FRAMEWORK_BEGINNING_STARTLEVEL} framework
+ * property when configuring a framework.
+ *
+ * <p>
+ * When the Framework is first started it must be at start level zero. In this
+ * state, no bundles are running. This is the initial state of the Framework
+ * before it is launched. When the Framework is launched, the Framework will
+ * enter start level one and all bundles which are assigned to start level one
+ * and whose autostart setting indicates the bundle should be started are
+ * started as described in the {@link org.osgi.framework.Bundle#start(int)}
+ * method. The Framework will continue to increase the start level, starting
+ * bundles at each start level, until the Framework has reached a beginning
+ * start level. At this point the Framework has completed starting bundles and
+ * will then fire a Framework event of type
+ * {@link org.osgi.framework.FrameworkEvent#STARTED} to announce it has
+ * completed its launch.
+ *
+ * <p>
+ * Within a start level, bundles may be started in an order defined by the
+ * Framework implementation. This may be something like ascending
+ * {@link org.osgi.framework.Bundle#getBundleId()} order or an order based upon
+ * dependencies between bundles. A similar but reversed order may be used when
+ * stopping bundles within a start level.
+ *
+ * <p>
+ * The Framework Start Level package can be used by management bundles to alter
+ * the active start level of the framework.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. For example:
+ *
+ * <pre>
+ * Import-Package: org.osgi.framework.startlevel; version="[1.0,2.0)"
+ * </pre>
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.framework.startlevel;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/packageinfo b/framework/src/main/java/org/osgi/framework/startlevel/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/startlevel/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java b/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
index 19d7a67..705ba74 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
@@ -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.wiring;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.namespace.AbstractWiringNamespace;
import org.osgi.resource.Capability;
@@ -25,9 +26,9 @@
* revision}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 39086f7e6086c2b3d83fbcb976a011cf69483ad8 $
+ * @author $Id: 834fb5779fb3c1b1b16ab25ffa4ab97a131b1262 $
*/
+@ProviderType
public interface BundleCapability extends Capability {
/**
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
index bb26c5d..42742dc 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
@@ -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.wiring;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.namespace.AbstractWiringNamespace;
import org.osgi.resource.Requirement;
@@ -25,9 +26,9 @@
* revision}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 212ffb64f724d982db86ff7e49ed64ea530e670a $
+ * @author $Id: ac0578af567754bcd12c63a350c06afdd1bfec05 $
*/
+@ProviderType
public interface BundleRequirement extends Requirement {
/**
* Returns the bundle revision declaring this requirement.
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
index 1ba9365..89d13b1 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
@@ -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.wiring;
import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Constants;
@@ -51,9 +52,9 @@
* {@link Constants#REQUIRE_CAPABILITY Require-Capability} manifest headers.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: e68e01a670f0ae9d6eb736414f875c8b216ed1bc $
+ * @author $Id: 1f318afdf8f5fe6097a841b49b67bf67d8c924f2 $
*/
+@ProviderType
public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the symbolic name for this bundle revision.
@@ -235,7 +236,7 @@
* Returns the special types of this bundle revision. The bundle revision
* type values are:
* <ul>
- * <li>{@link #TYPE_FRAGMENT}
+ * <li>{@link #TYPE_FRAGMENT}</li>
* </ul>
*
* A bundle revision may be more than one type at a time. A type code is
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
index f0d03ff..f9f7871 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
@@ -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.wiring;
import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
@@ -36,9 +37,9 @@
* {@link #getRevisions()} on the bundle.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 8423242078417873faf0f8979e153e3c1f3a0e4b $
+ * @author $Id: 83e7bf03af2150a54af13a319325856e532cefde $
*/
+@ProviderType
public interface BundleRevisions extends BundleReference {
/**
* Return the bundle revisions for the {@link BundleReference#getBundle()
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java b/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
index d14829a..ab2c658 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
@@ -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.
@@ -16,15 +16,16 @@
package org.osgi.framework.wiring;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Wire;
/**
* A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 02e7cd6ec0fa9fdb73f782a6890984d5d4e7ca21 $
+ * @author $Id: f51255c8510d4b513dc2bb70c2274d9c51e9b9e5 $
*/
+@ProviderType
public interface BundleWire extends Wire {
/**
* Returns the {@link BundleCapability} for this wire.
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java b/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
index b234c38..a11040c 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
@@ -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.
@@ -19,6 +19,7 @@
import java.net.URL;
import java.util.Collection;
import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -52,9 +53,9 @@
* a bundle returns {@code null}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: a3b3fd7ad7d289a5bfc6e4e02c875bc42a34df89 $
+ * @author $Id: 367499c4b37683c52e622f479242a9caf7e59b0f $
*/
+@ProviderType
public interface BundleWiring extends BundleReference, Wiring {
/**
* Returns {@code true} if this bundle wiring is the current bundle wiring.
@@ -113,8 +114,8 @@
* an empty list if this bundle wiring provides no capabilities in
* the specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given namespace, the list contains the wires in the order the
- * capabilities were specified in the manifests of the
+ * given namespace, the list contains the capabilities in the order
+ * the capabilities were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached
* fragments<sup>†</sup> of this bundle wiring. There is no
* ordering defined between capabilities in different namespaces.
@@ -143,8 +144,8 @@
* or an empty list if this bundle wiring uses no requirements in
* the specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given namespace, the list contains the wires in the order the
- * requirements were specified in the manifests of the
+ * given namespace, the list contains the requirements in the order
+ * the requirements were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached fragments
* of this bundle wiring. There is no ordering defined between
* requirements in different namespaces.
@@ -176,9 +177,10 @@
* requirements} in use by this bundle wiring.
*
* <p>
- * This method may return different results if this bundle wiring adds wires
- * to more requirements. For example, dynamically importing a package will
- * establish a new wire to the dynamically imported package.
+ * This method may return different results if this bundle wiring
+ * establishes additional wires to more requirements. For example,
+ * dynamically importing a package will establish a new wire to the
+ * dynamically imported package.
*
* @param namespace The namespace of the requirements for which to return
* wires or {@code null} to return the wires for the requirements in
@@ -191,8 +193,9 @@
* given namespace, the list contains the wires in the order the
* requirements were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached fragments
- * of this bundle wiring. There is no ordering defined between
- * requirements in different namespaces.
+ * of this bundle wiring followed by dynamically established wires,
+ * if any, in the order they were established. There is no ordering
+ * defined between requirements in different namespaces.
*/
List<BundleWire> getRequiredWires(String namespace);
@@ -302,9 +305,9 @@
* <li>Only the resource names for resources in bundle wirings will be
* returned. The names of resources visible to a bundle wiring's parent
* class loader, such as the bootstrap class loader, must not be included in
- * the result.
+ * the result.</li>
* <li>Only established wires will be examined for resources. This method
- * must not cause new wires for dynamic imports to be established.
+ * must not cause new wires for dynamic imports to be established.</li>
* </ul>
*
* @param path The path name in which to look. The path is always relative
@@ -405,7 +408,7 @@
* @return A list containing a snapshot of the {@link Capability}s, or an
* empty list if this wiring provides no capabilities in the
* specified namespace. For a given namespace, the list contains the
- * wires in the order the capabilities were specified in the
+ * capabilities in the order the capabilities were specified in the
* manifests of the {@link #getResource() resource} and the attached
* fragment resources<sup>†</sup> of this wiring. There is no
* ordering defined between capabilities in different namespaces.
@@ -436,11 +439,11 @@
* {@code null} to return the requirements from all namespaces.
* @return A list containing a snapshot of the {@link Requirement}s, or an
* empty list if this wiring uses no requirements in the specified
- * namespace. For a given namespace, the list contains the wires in
- * the order the requirements were specified in the manifests of the
- * {@link #getResource() resource} and the attached fragment
- * resources of this wiring. There is no ordering defined between
- * requirements in different namespaces.
+ * namespace. For a given namespace, the list contains the
+ * requirements in the order the requirements were specified in the
+ * manifests of the {@link #getResource() resource} and the attached
+ * fragment resources of this wiring. There is no ordering defined
+ * between requirements in different namespaces.
* @since 1.1
*/
List<Requirement> getResourceRequirements(String namespace);
diff --git a/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java b/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
index ce9952c..ee3c548 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2012). 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.
@@ -17,9 +17,11 @@
package org.osgi.framework.wiring;
import java.util.Collection;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.FrameworkListener;
+import org.osgi.resource.Requirement;
/**
* Query and modify wiring information for the framework. The framework wiring
@@ -32,9 +34,9 @@
* by calling {@link BundleReference#getBundle()}.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: bff4cdf85c632e2946e18c1640a86e80c069dd37 $
+ * @author $Id: 1ab9112badc94f802ccda966f7b73584f2a5c412 $
*/
+@ProviderType
public interface FrameworkWiring extends BundleReference {
/**
* Refreshes the specified bundles. This forces the update (replacement) or
@@ -53,27 +55,23 @@
* <li>Compute the {@link #getDependencyClosure(Collection) dependency
* closure} of the specified bundles. If no bundles are specified, compute
* the dependency closure of the {@link #getRemovalPendingBundles() removal
- * pending} bundles.
- *
+ * pending} bundles.</li>
* <li>Each bundle in the dependency closure that is in the {@code ACTIVE}
- * state will be stopped as described in the {@code Bundle.stop} method.
- *
+ * state will be stopped as described in the {@code Bundle.stop} method.</li>
* <li>Each bundle in the dependency closure that is in the {@code RESOLVED}
* state is unresolved and thus moved to the {@code INSTALLED} state. The
* effect of this step is that bundles in the dependency closure are no
- * longer {@code RESOLVED}.
- *
+ * longer {@code RESOLVED}.</li>
* <li>Each bundle in the dependency closure that is in the
* {@code UNINSTALLED} state is removed from the dependency closure and is
- * now completely removed from the Framework.
- *
+ * now completely removed from the Framework.</li>
* <li>Each bundle in the dependency closure that was in the {@code ACTIVE}
* state prior to Step 2 is started as described in the {@code Bundle.start}
* method, causing all bundles required for the restart to be resolved. It
* is possible that, as a result of the previous steps, packages that were
* previously exported no longer are. Therefore, some bundles may be
* unresolvable until bundles satisfying the dependencies have been
- * installed in the Framework.
+ * installed in the Framework.</li>
* </ol>
*
* <p>
@@ -171,4 +169,34 @@
* FrameworkWiring.
*/
Collection<Bundle> getDependencyClosure(Collection<Bundle> bundles);
+
+ /**
+ * Find bundle capabilities that match the given requirement.
+ *
+ * <p>
+ * The returned collection contains {@link BundleCapability} objects where
+ * the revision must be the {@link BundleCapability#getRevision() declaring
+ * revision} of the capability and the revision must either be the current
+ * bundle revision or an {@link BundleWiring#isInUse() in use} bundle
+ * revision.
+ *
+ * <p>
+ * Each returned capability must match the given requirement. This means
+ * that the filter in the requirement must match as well as any namespace
+ * specific directives. For example, the mandatory attributes for the
+ * osgi.wiring.package namespace.
+ *
+ * <p>
+ * The returned collection has not been filtered to remove capabilities that
+ * are non-effective, substituted or for which the providing bundle does not
+ * have permission to provide. No resolve hooks are called to filter
+ * matching capabilities.
+ *
+ * @param requirement The requirement to find matching bundle capabilities.
+ * Must not be {@code null}.
+ * @return A collection of {@link BundleCapability} objects that match the
+ * specified requirement.
+ * @since 1.2
+ */
+ Collection<BundleCapability> findProviders(Requirement requirement);
}
diff --git a/framework/src/main/java/org/osgi/framework/wiring/dto/BundleRevisionDTO.java b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleRevisionDTO.java
new file mode 100644
index 0000000..43d7416
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleRevisionDTO.java
@@ -0,0 +1,62 @@
+/*
+ * 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.wiring.dto;
+
+import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.dto.ResourceDTO;
+
+/**
+ * Data Transfer Object for a BundleRevision.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleRevisionDTO} for
+ * the current revision of the Bundle. {@code BundleRevisionDTO} objects for all
+ * in use revisions of the Bundle can be obtained by adapting the bundle to
+ * {@code BundleRevisionDTO[]}.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleRevisionDTO extends ResourceDTO {
+ /**
+ * The symbolic name of the bundle revision.
+ *
+ * @see BundleRevision#getSymbolicName()
+ */
+ public String symbolicName;
+
+ /**
+ * The type of the bundle revision.
+ *
+ * @see BundleRevision#getTypes()
+ */
+ public int type;
+
+ /**
+ * The version of the bundle revision.
+ *
+ * @see BundleRevision#getVersion()
+ */
+ public String version;
+
+ /**
+ * The id of the bundle associated with the bundle revision.
+ *
+ * @see BundleRevision#getBundle()
+ */
+ public long bundle;
+}
diff --git a/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWireDTO.java b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWireDTO.java
new file mode 100644
index 0000000..ef923b4
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWireDTO.java
@@ -0,0 +1,48 @@
+/*
+ * 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.wiring.dto;
+
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.resource.dto.WireDTO;
+import org.osgi.resource.dto.WiringDTO;
+
+/**
+ * Data Transfer Object for a BundleWire.
+ *
+ * <p>
+ * {@code BundleWireDTO}s are referenced {@link BundleWiringDTO.NodeDTO}s.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleWireDTO extends WireDTO {
+ /**
+ * The identifier of the provider wiring for the bundle wire.
+ *
+ * @see WiringDTO#id
+ * @see BundleWire#getProviderWiring()
+ */
+ public int providerWiring;
+
+ /**
+ * The identifier of the requiring wiring for the bundle wire.
+ *
+ * @see WiringDTO#id
+ * @see BundleWire#getRequirerWiring()
+ */
+ public int requirerWiring;
+}
diff --git a/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWiringDTO.java b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWiringDTO.java
new file mode 100644
index 0000000..e23e80f
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/dto/BundleWiringDTO.java
@@ -0,0 +1,97 @@
+/*
+ * 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.wiring.dto;
+
+import java.util.Set;
+import org.osgi.dto.DTO;
+import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.dto.WiringDTO;
+
+/**
+ * Data Transfer Object for a BundleWiring graph.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleWiringDTO} for
+ * the current wiring Bundle. {@code BundleWiringDTO} objects for all in use
+ * wirings of the Bundle can be obtained by adapting the bundle to
+ * {@code BundleWiringDTO[]}.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleWiringDTO extends DTO {
+ /**
+ * The id of the bundle associated with the bundle wiring graph.
+ *
+ * @see BundleWiring#getBundle()
+ */
+ public long bundle;
+
+ /**
+ * The identifier of the root wiring node of the bundle wiring graph.
+ *
+ * @see WiringDTO#id
+ */
+ public int root;
+
+ /**
+ * The set of wiring nodes referenced by the wiring graph.
+ *
+ * <p>
+ * All wiring nodes referenced by wiring node identifiers in the wiring
+ * graph are contained in this set.
+ */
+ public Set<NodeDTO> nodes;
+
+ /**
+ * The set of resources referenced by the wiring graph.
+ *
+ * <p>
+ * All resources referenced by resource identifiers in the wiring graph are
+ * contained in this set.
+ */
+ public Set<BundleRevisionDTO> resources;
+
+ /**
+ * Data Transfer Object for a BundleWiring node.
+ *
+ * <p>
+ * The {@link WiringDTO#providedWires providedWires} field must contain an
+ * array of {@link BundleWireDTO}s. The {@link WiringDTO#requiredWires
+ * requiredWires} field must contain an array of {@link BundleWireDTO}s.
+ *
+ * @NotThreadSafe
+ */
+ public static class NodeDTO extends WiringDTO {
+ /**
+ * The bundle wiring's in use setting indicates that the bundle wiring
+ * is in use.
+ *
+ * @see BundleWiring#isInUse()
+ */
+ public boolean inUse;
+
+ /**
+ * The current state of the bundle wiring. The bundle wiring's current
+ * setting indicates that the bundle wiring is the current bundle wiring
+ * for the bundle.
+ *
+ * @see BundleWiring#isCurrent()
+ */
+ public boolean current;
+ }
+}
diff --git a/framework/src/main/java/org/osgi/framework/wiring/dto/package-info.java b/framework/src/main/java/org/osgi/framework/wiring/dto/package-info.java
new file mode 100644
index 0000000..691bcdc
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/dto/package-info.java
@@ -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 Wiring Package Version 1.2.
+ *
+ * <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.wiring.dto; version="[1.2,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.wiring.dto; version="[1.2,1.3)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.2")
+package org.osgi.framework.wiring.dto;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/wiring/dto/packageinfo b/framework/src/main/java/org/osgi/framework/wiring/dto/packageinfo
new file mode 100644
index 0000000..ef7df68
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/dto/packageinfo
@@ -0,0 +1 @@
+version 1.2
diff --git a/framework/src/main/java/org/osgi/framework/wiring/package-info.java b/framework/src/main/java/org/osgi/framework/wiring/package-info.java
new file mode 100644
index 0000000..6fb7232
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * 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 Wiring Package Version 1.2.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. For example:
+ *
+ * <pre>
+ * Import-Package: org.osgi.framework.wiring; version="[1.2,2.0)"
+ * </pre>
+ *
+ * @author $Id$
+ */
+
+@Version("1.2")
+package org.osgi.framework.wiring;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/framework/wiring/packageinfo b/framework/src/main/java/org/osgi/framework/wiring/packageinfo
new file mode 100644
index 0000000..ef7df68
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/wiring/packageinfo
@@ -0,0 +1 @@
+version 1.2
diff --git a/framework/src/main/java/org/osgi/resource/Capability.java b/framework/src/main/java/org/osgi/resource/Capability.java
index bda0ce6..289c973 100644
--- a/framework/src/main/java/org/osgi/resource/Capability.java
+++ b/framework/src/main/java/org/osgi/resource/Capability.java
@@ -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.resource;
import java.util.Map;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A capability that has been declared from a {@link Resource}.
@@ -27,8 +28,9 @@
* always return the same result.
*
* @ThreadSafe
- * @version $Id: 5f40514f7bf45f6dce59651e8812b0922580e77e $
+ * @author $Id: e79d11402e14e170443c8a2a9da835391cd1ccc8 $
*/
+@ConsumerType
public interface Capability {
/**
diff --git a/framework/src/main/java/org/osgi/resource/Namespace.java b/framework/src/main/java/org/osgi/resource/Namespace.java
index abda616..a8223b1 100644
--- a/framework/src/main/java/org/osgi/resource/Namespace.java
+++ b/framework/src/main/java/org/osgi/resource/Namespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 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.resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Capability and Requirement Namespaces base class.
*
@@ -34,8 +36,9 @@
* otherwise indicated.
*
* @Immutable
- * @version $Id: 43c9ff5cea19546d71c4703db71a2b5070a3f2fa $
+ * @author $Id: 95a67250528646012b39e8e5a92775fbb635a8c0 $
*/
+@ConsumerType
public abstract class Namespace {
/**
diff --git a/framework/src/main/java/org/osgi/resource/Requirement.java b/framework/src/main/java/org/osgi/resource/Requirement.java
index cf931bf..4806faa 100644
--- a/framework/src/main/java/org/osgi/resource/Requirement.java
+++ b/framework/src/main/java/org/osgi/resource/Requirement.java
@@ -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.resource;
import java.util.Map;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A requirement that has been declared from a {@link Resource} .
@@ -27,8 +28,9 @@
* always return the same result.
*
* @ThreadSafe
- * @version $Id: 212b26179910f98fd2c59c3e1e7dd0d086f42b5d $
+ * @author $Id: 252221aeaaf9b189eef6e0c3798d0076a0032242 $
*/
+@ConsumerType
public interface Requirement {
/**
* Returns the namespace of this requirement.
diff --git a/framework/src/main/java/org/osgi/resource/Resource.java b/framework/src/main/java/org/osgi/resource/Resource.java
index 455d891..91edcdb 100644
--- a/framework/src/main/java/org/osgi/resource/Resource.java
+++ b/framework/src/main/java/org/osgi/resource/Resource.java
@@ -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.resource;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A resource is the representation of a uniquely identified and typed data. A
@@ -29,8 +30,9 @@
* always return the same result.
*
* @ThreadSafe
- * @version $Id: 40958d5777ee269d27d58e9f646a4c91bcc6daa4 $
+ * @author $Id: c7b6462fb53b38ac3071d7ba73af9dad2af6b9ce $
*/
+@ConsumerType
public interface Resource {
/**
* Returns the capabilities declared by this resource.
diff --git a/framework/src/main/java/org/osgi/resource/Wire.java b/framework/src/main/java/org/osgi/resource/Wire.java
index 18feab8..beba44e 100644
--- a/framework/src/main/java/org/osgi/resource/Wire.java
+++ b/framework/src/main/java/org/osgi/resource/Wire.java
@@ -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.
@@ -16,6 +16,8 @@
package org.osgi.resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A wire connecting a {@link Capability} to a {@link Requirement}.
*
@@ -25,8 +27,9 @@
* always return the same result.
*
* @ThreadSafe
- * @version $Id: d7ca9a5d3e8dd2277f8243a750e40fbcf79185bd $
+ * @author $Id: 6c248ea2b9b24f3610a14e5e8deec9cd0b7aa1c9 $
*/
+@ConsumerType
public interface Wire {
/**
* Returns the {@link Capability} for this wire.
diff --git a/framework/src/main/java/org/osgi/resource/Wiring.java b/framework/src/main/java/org/osgi/resource/Wiring.java
index 230fef0..56db2a3 100644
--- a/framework/src/main/java/org/osgi/resource/Wiring.java
+++ b/framework/src/main/java/org/osgi/resource/Wiring.java
@@ -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.resource;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A wiring for a resource. A wiring is associated with a resource and
@@ -28,8 +29,9 @@
* always return the same result.
*
* @ThreadSafe
- * @version $Id: b65dec3887cfa1d5731e860db558a01503c0f47d $
+ * @author $Id: 935272fa914a9cc0020549c43a3857acad2c45cc $
*/
+@ConsumerType
public interface Wiring {
/**
* Returns the capabilities provided by this wiring.
@@ -64,7 +66,7 @@
* @return A list containing a snapshot of the {@link Capability}s, or an
* empty list if this wiring provides no capabilities in the
* specified namespace. For a given namespace, the list contains the
- * wires in the order the capabilities were specified in the
+ * capabilities in the order the capabilities were specified in the
* manifests of the {@link #getResource() resource} and the attached
* fragment resources<sup>†</sup> of this wiring. There is no
* ordering defined between capabilities in different namespaces.
@@ -91,11 +93,11 @@
* {@code null} to return the requirements from all namespaces.
* @return A list containing a snapshot of the {@link Requirement}s, or an
* empty list if this wiring uses no requirements in the specified
- * namespace. For a given namespace, the list contains the wires in
- * the order the requirements were specified in the manifests of the
- * {@link #getResource() resource} and the attached fragment
- * resources of this wiring. There is no ordering defined between
- * requirements in different namespaces.
+ * namespace. For a given namespace, the list contains the
+ * requirements in the order the requirements were specified in the
+ * manifests of the {@link #getResource() resource} and the attached
+ * fragment resources of this wiring. There is no ordering defined
+ * between requirements in different namespaces.
*/
List<Requirement> getResourceRequirements(String namespace);
diff --git a/framework/src/main/java/org/osgi/resource/dto/CapabilityDTO.java b/framework/src/main/java/org/osgi/resource/dto/CapabilityDTO.java
new file mode 100644
index 0000000..1f7fad1
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/CapabilityDTO.java
@@ -0,0 +1,70 @@
+/*
+ * 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.resource.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.resource.Capability;
+
+/**
+ * Data Transfer Object for a Capability.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class CapabilityDTO extends DTO {
+ /**
+ * The unique identifier of the capability.
+ *
+ * <p>
+ * This identifier is transiently assigned and may vary across restarts.
+ */
+ public int id;
+
+ /**
+ * The namespace for the capability.
+ *
+ * @see Capability#getNamespace()
+ */
+ public String namespace;
+
+ /**
+ * The directives for the capability.
+ *
+ * @see Capability#getDirectives()
+ */
+ public Map<String, String> directives;
+
+ /**
+ * The attributes for the capability.
+ *
+ * <p>
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ *
+ * @see Capability#getAttributes()
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * The identifier of the resource declaring the capability.
+ *
+ * @see ResourceDTO#id
+ * @see Capability#getResource()
+ */
+ public int resource;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/CapabilityRefDTO.java b/framework/src/main/java/org/osgi/resource/dto/CapabilityRefDTO.java
new file mode 100644
index 0000000..81d5b85
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/CapabilityRefDTO.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) OSGi Alliance (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.resource.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a reference to a Capability.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class CapabilityRefDTO extends DTO {
+ /**
+ * The identifier of the capability in the resource.
+ *
+ * @see CapabilityDTO#id
+ */
+ public int capability;
+
+ /**
+ * The identifier of the resource declaring the capability.
+ *
+ * @see ResourceDTO#id
+ */
+ public int resource;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/RequirementDTO.java b/framework/src/main/java/org/osgi/resource/dto/RequirementDTO.java
new file mode 100644
index 0000000..dfa21db
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/RequirementDTO.java
@@ -0,0 +1,70 @@
+/*
+ * 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.resource.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.resource.Requirement;
+
+/**
+ * Data Transfer Object for a Requirement.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class RequirementDTO extends DTO {
+ /**
+ * The unique identifier of the requirement.
+ *
+ * <p>
+ * This identifier is transiently assigned and may vary across restarts.
+ */
+ public int id;
+
+ /**
+ * The namespace for the requirement.
+ *
+ * @see Requirement#getNamespace()
+ */
+ public String namespace;
+
+ /**
+ * The directives for the requirement.
+ *
+ * @see Requirement#getDirectives()
+ */
+ public Map<String, String> directives;
+
+ /**
+ * The attributes for the requirement.
+ *
+ * <p>
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ *
+ * @see Requirement#getAttributes()
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * The identifier of the resource declaring the requirement.
+ *
+ * @see ResourceDTO#id
+ * @see Requirement#getResource()
+ */
+ public int resource;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/RequirementRefDTO.java b/framework/src/main/java/org/osgi/resource/dto/RequirementRefDTO.java
new file mode 100644
index 0000000..8f913a7
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/RequirementRefDTO.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) OSGi Alliance (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.resource.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a reference to a Requirement.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class RequirementRefDTO extends DTO {
+ /**
+ * The identifier of the requirement in the resource.
+ *
+ * @see RequirementDTO#id
+ */
+ public int requirement;
+
+ /**
+ * The identifier of the resource declaring the requirement.
+ *
+ * @see ResourceDTO#id
+ */
+ public int resource;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/ResourceDTO.java b/framework/src/main/java/org/osgi/resource/dto/ResourceDTO.java
new file mode 100644
index 0000000..377b7af
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/ResourceDTO.java
@@ -0,0 +1,51 @@
+/*
+ * 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.resource.dto;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+import org.osgi.resource.Resource;
+
+/**
+ * Data Transfer Object for a Resource.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class ResourceDTO extends DTO {
+ /**
+ * The unique identifier of the resource.
+ *
+ * <p>
+ * This identifier is transiently assigned and may vary across restarts.
+ */
+ public int id;
+
+ /**
+ * The capabilities of the resource.
+ *
+ * @see Resource#getCapabilities(String)
+ */
+ public List<CapabilityDTO> capabilities;
+
+ /**
+ * The requirements of the resource.
+ *
+ * @see Resource#getRequirements(String)
+ */
+ public List<RequirementDTO> requirements;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/WireDTO.java b/framework/src/main/java/org/osgi/resource/dto/WireDTO.java
new file mode 100644
index 0000000..017ea7c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/WireDTO.java
@@ -0,0 +1,58 @@
+/*
+ * 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.resource.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.resource.Wire;
+
+/**
+ * Data Transfer Object for a Wire.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class WireDTO extends DTO {
+ /**
+ * Reference to the Capability for the wire.
+ *
+ * @see Wire#getCapability()
+ */
+ public CapabilityRefDTO capability;
+
+ /**
+ * Reference to the Requirement for the wire.
+ *
+ * @see Wire#getRequirement()
+ */
+ public RequirementRefDTO requirement;
+
+ /**
+ * The identifier of the provider resource for the wire.
+ *
+ * @see ResourceDTO#id
+ * @see Wire#getProvider()
+ */
+ public int provider;
+
+ /**
+ * The identifier of the requiring resource for the wire.
+ *
+ * @see ResourceDTO#id
+ * @see Wire#getRequirer()
+ */
+ public int requirer;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/WiringDTO.java b/framework/src/main/java/org/osgi/resource/dto/WiringDTO.java
new file mode 100644
index 0000000..8dc3844
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/WiringDTO.java
@@ -0,0 +1,73 @@
+/*
+ * 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.resource.dto;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+import org.osgi.resource.Wiring;
+
+/**
+ * Data Transfer Object for a Wiring node.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class WiringDTO extends DTO {
+ /**
+ * The unique identifier of the wiring node.
+ *
+ * <p>
+ * This identifier is transiently assigned and may vary across restarts.
+ */
+ public int id;
+
+ /**
+ * The references to the capabilities for the wiring node.
+ *
+ * @see Wiring#getResourceCapabilities(String)
+ */
+ public List<CapabilityRefDTO> capabilities;
+
+ /**
+ * The references to the requirements for the wiring node.
+ *
+ * @see Wiring#getResourceRequirements(String)
+ */
+ public List<RequirementRefDTO> requirements;
+
+ /**
+ * The provided wires for the wiring node.
+ *
+ * @see Wiring#getProvidedResourceWires(String)
+ */
+ public List<WireDTO> providedWires;
+
+ /**
+ * The required wires for the wiring node.
+ *
+ * @see Wiring#getRequiredResourceWires(String)
+ */
+ public List<WireDTO> requiredWires;
+
+ /**
+ * The identifier of the resource associated with the wiring node.
+ *
+ * @see ResourceDTO#id
+ * @see Wiring#getResource()
+ */
+ public int resource;
+}
diff --git a/framework/src/main/java/org/osgi/resource/dto/package-info.java b/framework/src/main/java/org/osgi/resource/dto/package-info.java
new file mode 100644
index 0000000..6e316cd
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/package-info.java
@@ -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 Resource 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. 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.resource.dto; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.resource.dto; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.resource.dto;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/resource/dto/packageinfo b/framework/src/main/java/org/osgi/resource/dto/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/dto/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/resource/package-info.java b/framework/src/main/java/org/osgi/resource/package-info.java
new file mode 100644
index 0000000..c537ca9
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ * 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.
+ */
+
+/**
+ * Resource 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. For example:
+ *
+ * <pre>
+ * Import-Package: org.osgi.resource; version="[1.0,2.0)"
+ * </pre>
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.resource;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/resource/packageinfo b/framework/src/main/java/org/osgi/resource/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java b/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
index 4dd3a3a..4b2001d 100644
--- a/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
+++ b/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
@@ -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.
@@ -45,7 +45,7 @@
* @noimplement
* @deprecated The PackageAdmin service has been replaced by the
* <code>org.osgi.framework.wiring</code> package.
- * @version $Id: 22ce5e8e388107b04edba3aea2f3036b8026798d $
+ * @author $Id: e04a2beb3de2afff4cb01747e589c04b5e0f0cc8 $
*/
public interface ExportedPackage {
/**
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java b/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
index 2c57890..03ca2e5 100644
--- a/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
+++ b/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2010). 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.
@@ -29,7 +29,7 @@
*
* @ThreadSafe
* @noimplement
- * @version $Id: a268c3bdc986080fa16bdb2f56ba1d3800d030dd $
+ * @author $Id: 4aad25d2f145d9a2d24825bc481dcc254b74ed51 $
* @deprecated This service has been replaced by the
* <code>org.osgi.framework.wiring</code> package.
* @see org.osgi.service.packageadmin.ExportedPackage
@@ -104,30 +104,28 @@
* graph any bundle that is wired to a package that is currently exported by
* a bundle in the graph. The graph is fully constructed when there is no
* bundle outside the graph that is wired to a bundle in the graph. The
- * graph may contain {@code UNINSTALLED} bundles that are currently
- * still exporting packages.
+ * graph may contain {@code UNINSTALLED} bundles that are currently still
+ * exporting packages.</li>
*
- * <li>Each bundle in the graph that is in the {@code ACTIVE} state
- * will be stopped as described in the {@code Bundle.stop} method.
+ * <li>Each bundle in the graph that is in the {@code ACTIVE} state will be
+ * stopped as described in the {@code Bundle.stop} method.</li>
*
- * <li>Each bundle in the graph that is in the {@code RESOLVED} state
- * is unresolved and thus moved to the {@code INSTALLED} state. The
- * effect of this step is that bundles in the graph are no longer
- * {@code RESOLVED}.
+ * <li>Each bundle in the graph that is in the {@code RESOLVED} state is
+ * unresolved and thus moved to the {@code INSTALLED} state. The effect of
+ * this step is that bundles in the graph are no longer {@code RESOLVED}.</li>
*
- * <li>Each bundle in the graph that is in the {@code UNINSTALLED}
- * state is removed from the graph and is now completely removed from the
- * Framework.
+ * <li>Each bundle in the graph that is in the {@code UNINSTALLED} state is
+ * removed from the graph and is now completely removed from the Framework.</li>
*
- * <li>Each bundle in the graph that was in the {@code ACTIVE} state
- * prior to Step 2 is started as described in the {@code Bundle.start}
- * method, causing all bundles required for the restart to be resolved. It
- * is possible that, as a result of the previous steps, packages that were
+ * <li>Each bundle in the graph that was in the {@code ACTIVE} state prior
+ * to Step 2 is started as described in the {@code Bundle.start} method,
+ * causing all bundles required for the restart to be resolved. It is
+ * possible that, as a result of the previous steps, packages that were
* previously exported no longer are. Therefore, some bundles may be
* unresolvable until another bundle offering a compatible package for
- * export has been installed in the Framework.
- * <li>A framework event of type
- * {@code FrameworkEvent.PACKAGES_REFRESHED} is fired.
+ * export has been installed in the Framework.</li>
+ * <li>A framework event of type {@code FrameworkEvent.PACKAGES_REFRESHED}
+ * is fired.</li>
* </ol>
*
* <p>
@@ -277,7 +275,7 @@
* Returns the special type of the specified bundle. The bundle type values
* are:
* <ul>
- * <li>{@link #BUNDLE_TYPE_FRAGMENT}
+ * <li>{@link #BUNDLE_TYPE_FRAGMENT}</li>
* </ul>
*
* A bundle may be more than one type at a time. A type code is used to
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java b/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
index 34c0b08..2434dce 100644
--- a/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
+++ b/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -46,7 +46,7 @@
* @noimplement
* @deprecated The PackageAdmin service has been replaced by the
* <code>org.osgi.framework.wiring</code> package.
- * @version $Id: 1606b0422cae6769b7eedc2d565df61841da1e22 $
+ * @author $Id: 08ab9c1a6f4a9af2060293d2c2972e4e07e2a238 $
*/
public interface RequiredBundle {
/**
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/package-info.java b/framework/src/main/java/org/osgi/service/packageadmin/package-info.java
new file mode 100644
index 0000000..c3483bd
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/packageadmin/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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 Admin Package Version 1.2.
+ *
+ * <p>
+ * <b>Deprecated.</b>
+ * <i>This package is deprecated and has been replaced by the
+ * {@code org.osgi.framework.wiring} package.</i>
+ *
+ * <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.service.packageadmin; version="[1.2,2.0)"}
+ *
+ * @version 1.2
+ * @author $Id$
+ */
+
+package org.osgi.service.packageadmin;
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/packageinfo b/framework/src/main/java/org/osgi/service/packageadmin/packageinfo
new file mode 100644
index 0000000..ef7df68
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/packageadmin/packageinfo
@@ -0,0 +1 @@
+version 1.2
diff --git a/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java b/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
index b4b8816..2e299ed 100644
--- a/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
+++ b/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -68,7 +68,7 @@
*
* @ThreadSafe
* @noimplement
- * @version $Id: ec0295bdf246c0258261374b3ac0e4aef11f7315 $
+ * @author $Id: 42f3c6bbf682a69ea3914c737d5b0001694383db $
* @deprecated This service has been replaced by the
* <code>org.osgi.framework.startlevel</code> package.
*/
@@ -100,14 +100,13 @@
* At each intermediate start level value on the way to and including the
* target start level, the Framework must:
* <ol>
- * <li>Change the active start level to the intermediate start level value.
- * <li>Start bundles at the intermediate start level whose autostart
- * setting indicate they must be started. They are started as described in
- * the {@link Bundle#start(int)} method using the
- * {@link Bundle#START_TRANSIENT} option. The
- * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if
- * {@link #isBundleActivationPolicyUsed(Bundle)} returns {@code true}
- * for the bundle.
+ * <li>Change the active start level to the intermediate start level value.</li>
+ * <li>Start bundles at the intermediate start level whose autostart setting
+ * indicate they must be started. They are started as described in the
+ * {@link Bundle#start(int)} method using the {@link Bundle#START_TRANSIENT}
+ * option. The {@link Bundle#START_ACTIVATION_POLICY} option must also be
+ * used if {@link #isBundleActivationPolicyUsed(Bundle)} returns
+ * {@code true} for the bundle.</li>
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
@@ -124,8 +123,8 @@
* <ol>
* <li>Stop bundles at the intermediate start level as described in the
* {@link Bundle#stop(int)} method using the {@link Bundle#STOP_TRANSIENT}
- * option.
- * <li>Change the active start level to the intermediate start level value.
+ * option.</li>
+ * <li>Change the active start level to the intermediate start level value.</li>
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
diff --git a/framework/src/main/java/org/osgi/service/startlevel/package-info.java b/framework/src/main/java/org/osgi/service/startlevel/package-info.java
new file mode 100644
index 0000000..a3ee72a
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/startlevel/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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.
+ */
+
+/**
+ * Start Level Package Version 1.1.
+ *
+ * <p>
+ * <b>Deprecated.</b>
+ * <i>This package is deprecated and has been replaced by the
+ * {@code org.osgi.framework.startlevel} package.</i>
+ *
+ * <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.service.startlevel; version="[1.1,2.0)"}
+ *
+ * @version 1.1
+ * @author $Id$
+ */
+
+package org.osgi.service.startlevel;
diff --git a/framework/src/main/java/org/osgi/service/startlevel/packageinfo b/framework/src/main/java/org/osgi/service/startlevel/packageinfo
new file mode 100644
index 0000000..3987f9c
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/startlevel/packageinfo
@@ -0,0 +1 @@
+version 1.1
diff --git a/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java b/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
index 679583c..e641366 100644
--- a/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
+++ b/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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,7 +16,11 @@
package org.osgi.service.url;
-import java.net.*;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Abstract implementation of the {@code URLStreamHandlerService} interface. All
@@ -27,12 +31,14 @@
* {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)} methods.
*
* @ThreadSafe
- * @version $Id: b86572a4f13b7bb4a343ac4d6b6fb3487e01bd31 $
+ * @author $Id: 79cfc45d97b037436d50bda26111109bd5d42a37 $
*/
+@ConsumerType
public abstract class AbstractURLStreamHandlerService extends URLStreamHandler implements URLStreamHandlerService {
/**
* @see "java.net.URLStreamHandler.openConnection"
*/
+ @Override
public abstract URLConnection openConnection(URL u) throws java.io.IOException;
/**
@@ -50,7 +56,7 @@
* invoked for the specified URL.
* @see "java.net.URLStreamHandler.parseURL"
*/
- public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) {
+ public void parseURL(@SuppressWarnings("hiding") URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) {
this.realHandler = realHandler;
parseURL(u, spec, start, limit);
}
@@ -60,6 +66,7 @@
*
* @see "java.net.URLStreamHandler.toExternalForm"
*/
+ @Override
public String toExternalForm(URL u) {
return super.toExternalForm(u);
}
@@ -69,6 +76,7 @@
*
* @see "java.net.URLStreamHandler.equals(URL,URL)"
*/
+ @Override
public boolean equals(URL u1, URL u2) {
return super.equals(u1, u2);
}
@@ -78,6 +86,7 @@
*
* @see "java.net.URLStreamHandler.getDefaultPort"
*/
+ @Override
public int getDefaultPort() {
return super.getDefaultPort();
}
@@ -87,6 +96,7 @@
*
* @see "java.net.URLStreamHandler.getHostAddress"
*/
+ @Override
public InetAddress getHostAddress(URL u) {
return super.getHostAddress(u);
}
@@ -96,6 +106,7 @@
*
* @see "java.net.URLStreamHandler.hashCode(URL)"
*/
+ @Override
public int hashCode(URL u) {
return super.hashCode(u);
}
@@ -105,6 +116,7 @@
*
* @see "java.net.URLStreamHandler.hostsEqual"
*/
+ @Override
public boolean hostsEqual(URL u1, URL u2) {
return super.hostsEqual(u1, u2);
}
@@ -114,6 +126,7 @@
*
* @see "java.net.URLStreamHandler.sameFile"
*/
+ @Override
public boolean sameFile(URL u1, URL u2) {
return super.sameFile(u1, u2);
}
@@ -126,6 +139,7 @@
* @deprecated This method is only for compatibility with handlers written
* for JDK 1.1.
*/
+ @SuppressWarnings("javadoc")
protected void setURL(URL u, String proto, String host, int port, String file, String ref) {
realHandler.setURL(u, proto, host, port, file, ref);
}
@@ -137,6 +151,7 @@
*
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
*/
+ @Override
protected void setURL(URL u, String proto, String host, int port, String auth, String user, String path, String query, String ref) {
realHandler.setURL(u, proto, host, port, auth, user, path, query, ref);
}
diff --git a/framework/src/main/java/org/osgi/service/url/URLConstants.java b/framework/src/main/java/org/osgi/service/url/URLConstants.java
index 493f352..522c1b8 100644
--- a/framework/src/main/java/org/osgi/service/url/URLConstants.java
+++ b/framework/src/main/java/org/osgi/service/url/URLConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.service.url;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* Defines standard names for property keys associated with
* {@link URLStreamHandlerService} and {@code java.net.ContentHandler} services.
@@ -24,9 +26,9 @@
* The values associated with these keys are of type {@code java.lang.String[]}
* or {@code java.lang.String}, unless otherwise indicated.
*
- * @noimplement
- * @version $Id: ac2b9670972d6e41d989c51067219ff7be459831 $
+ * @author $Id: 490baaad326523bcb3915ef04572d3c28560db0b $
*/
+@ProviderType
public interface URLConstants {
/**
* Service property naming the protocols serviced by a
diff --git a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
index e6dd098..5ba4f7b 100644
--- a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
+++ b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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,7 +16,10 @@
package org.osgi.service.url;
-import java.net.*;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.URLConnection;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Service interface with public versions of the protected
@@ -33,12 +36,14 @@
* @see AbstractURLStreamHandlerService
*
* @ThreadSafe
- * @version $Id: 4a453f61b9acdc6449df389b2a0538d0ccb33ed2 $
+ * @author $Id: 810d8718f5ad689981fbb2c22886ad2695f17297 $
*/
+@ConsumerType
public interface URLStreamHandlerService {
/**
* @see "java.net.URLStreamHandler.openConnection"
*/
+ @SuppressWarnings("javadoc")
public URLConnection openConnection(URL u) throws java.io.IOException;
/**
@@ -50,40 +55,48 @@
* this URL.
* @see "java.net.URLStreamHandler.parseURL"
*/
+ @SuppressWarnings("javadoc")
public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit);
/**
* @see "java.net.URLStreamHandler.toExternalForm"
*/
+ @SuppressWarnings("javadoc")
public String toExternalForm(URL u);
/**
* @see "java.net.URLStreamHandler.equals(URL, URL)"
*/
+ @SuppressWarnings("javadoc")
public boolean equals(URL u1, URL u2);
/**
* @see "java.net.URLStreamHandler.getDefaultPort"
*/
+ @SuppressWarnings("javadoc")
public int getDefaultPort();
/**
* @see "java.net.URLStreamHandler.getHostAddress"
*/
+ @SuppressWarnings("javadoc")
public InetAddress getHostAddress(URL u);
/**
* @see "java.net.URLStreamHandler.hashCode(URL)"
*/
+ @SuppressWarnings("javadoc")
public int hashCode(URL u);
/**
* @see "java.net.URLStreamHandler.hostsEqual"
*/
+ @SuppressWarnings("javadoc")
public boolean hostsEqual(URL u1, URL u2);
/**
* @see "java.net.URLStreamHandler.sameFile"
*/
+ @SuppressWarnings("javadoc")
public boolean sameFile(URL u1, URL u2);
}
diff --git a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
index 90feae6..d7e222a 100644
--- a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
+++ b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.service.url;
import java.net.URL;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Interface used by {@code URLStreamHandlerService} objects to call the
@@ -31,8 +32,9 @@
* {@code java.net.URL} for the protocol.
*
* @ThreadSafe
- * @version $Id: 90f25e3961fea2150cfd31117a2237304f1518f9 $
+ * @author $Id: 96648b48a7ce8fb4baf50c7b118a0339f4efcf35 $
*/
+@ConsumerType
public interface URLStreamHandlerSetter {
/**
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
@@ -40,10 +42,12 @@
* @deprecated This method is only for compatibility with handlers written
* for JDK 1.1.
*/
+ @SuppressWarnings("javadoc")
public void setURL(URL u, String protocol, String host, int port, String file, String ref);
/**
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
*/
+ @SuppressWarnings("javadoc")
public void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref);
}
diff --git a/framework/src/main/java/org/osgi/service/url/package-info.java b/framework/src/main/java/org/osgi/service/url/package-info.java
new file mode 100644
index 0000000..7053546
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/url/package-info.java
@@ -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.
+ */
+
+/**
+ * URL Stream and Content Handlers 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.service.url; version="[1.0,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.service.url;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/service/url/packageinfo b/framework/src/main/java/org/osgi/service/url/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/java/org/osgi/service/url/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java b/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
index f3ddddc..9aa0bd4 100644
--- a/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
+++ b/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -34,7 +34,7 @@
* @param <T> The value mapped to the tracked item.
* @param <R> The reason the tracked item is being tracked or untracked.
* @ThreadSafe
- * @version $Id: 16340086b98d308c2d12f13bcd87fc6467a5a367 $
+ * @author $Id: 5988d793936c25139421a95bad2d3cd96e2ab355 $
* @since 1.4
*/
abstract class AbstractTracked<S, T, R> {
diff --git a/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java b/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
index 7e1bb53..18eaa99 100644
--- a/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
+++ b/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -44,7 +44,7 @@
*
* @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Id: f21db4fe54284d4810bd9b5fa2528957804e3a21 $
+ * @author $Id: 9a1b57568a8be735292700584f4eb936fc80f2ff $
* @since 1.4
*/
public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
@@ -218,6 +218,7 @@
* @see BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent)
*/
public T addingBundle(Bundle bundle, BundleEvent event) {
+ @SuppressWarnings("unchecked")
T result = (T) bundle;
return result;
}
@@ -463,6 +464,7 @@
* @return Customized object for the tracked item or {@code null} if the
* item is not to be tracked.
*/
+ @Override
T customizerAdding(final Bundle item, final BundleEvent related) {
return customizer.addingBundle(item, related);
}
@@ -475,6 +477,7 @@
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
+ @Override
void customizerModified(final Bundle item, final BundleEvent related, final T object) {
customizer.modifiedBundle(item, related, object);
}
@@ -487,6 +490,7 @@
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
+ @Override
void customizerRemoved(final Bundle item, final BundleEvent related, final T object) {
customizer.removedBundle(item, related, object);
}
diff --git a/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java b/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
index b0bb297..8a62f2c 100644
--- a/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
+++ b/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.util.tracker;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
@@ -42,9 +43,10 @@
*
* @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Id: 727e757d2fa2940c88c9b74c8d299de6b3a7d0d0 $
+ * @author $Id: 031b2979522768150d23ee70dfe62528432c19f7 $
* @since 1.4
*/
+@ConsumerType
public interface BundleTrackerCustomizer<T> {
/**
* A bundle is being added to the {@code BundleTracker}.
diff --git a/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java b/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
index 0c8022d..3ba97ab 100644
--- a/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
+++ b/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
@@ -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.
@@ -52,7 +52,7 @@
* @param <S> The type of the service being tracked.
* @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Id: 21926ad8717a91633face6bbf570febfcd23b1c7 $
+ * @author $Id: a0af979aa9c88a89f220c1b2d8d7c060ced41006 $
*/
public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/* set this to true to compile in debug messages */
@@ -298,6 +298,7 @@
} else {
if (trackReference != null) {
if (trackReference.getBundle() != null) {
+ @SuppressWarnings("unchecked")
ServiceReference<S>[] single = new ServiceReference[] {trackReference};
references = single;
}
@@ -331,6 +332,7 @@
* invalid syntax.
*/
private ServiceReference<S>[] getInitialReferences(boolean trackAllServices, String className, String filterString) throws InvalidSyntaxException {
+ @SuppressWarnings("unchecked")
ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context.getAllServiceReferences(className, filterString) : context.getServiceReferences(className, filterString));
return result;
}
@@ -408,6 +410,7 @@
* @see ServiceTrackerCustomizer#addingService(ServiceReference)
*/
public T addingService(ServiceReference<S> reference) {
+ @SuppressWarnings("unchecked")
T result = (T) context.getService(reference);
return result;
}
@@ -527,6 +530,7 @@
if (length == 0) {
return null;
}
+ @SuppressWarnings("unchecked")
ServiceReference<S>[] result = new ServiceReference[length];
return t.copyKeys(result);
}
@@ -540,7 +544,7 @@
* If multiple services are being tracked, the service with the highest
* ranking (as specified in its {@code service.ranking} property) is
* returned. If there is a tie in ranking, the service with the lowest
- * service ID (as specified in its {@code service.id} property); that is,
+ * service id (as specified in its {@code service.id} property); that is,
* the service that was registered first is returned. This is the same
* algorithm used by {@code BundleContext.getServiceReference}.
*
@@ -843,7 +847,9 @@
return array;
}
if (length > array.length) {
- array = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
+ @SuppressWarnings("unchecked")
+ T[] newInstance = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
+ array = newInstance;
}
for (int i = 0; i < length; i++) {
array[i] = getService(references[i]);
@@ -883,6 +889,7 @@
if (closed) {
return;
}
+ @SuppressWarnings("unchecked")
final ServiceReference<S> reference = (ServiceReference<S>) event.getServiceReference();
if (DEBUG) {
System.out.println("ServiceTracker.Tracked.serviceChanged[" + event.getType() + "]: " + reference);
@@ -914,6 +921,7 @@
*
* @GuardedBy this
*/
+ @Override
final void modified() {
super.modified(); /* increment the modification count */
ServiceTracker.this.modified();
@@ -928,6 +936,7 @@
* @return Customized object for the tracked item or {@code null} if the
* item is not to be tracked.
*/
+ @Override
final T customizerAdding(final ServiceReference<S> item, final ServiceEvent related) {
return customizer.addingService(item);
}
@@ -940,6 +949,7 @@
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
+ @Override
final void customizerModified(final ServiceReference<S> item, final ServiceEvent related, final T object) {
customizer.modifiedService(item, object);
}
@@ -952,6 +962,7 @@
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
+ @Override
final void customizerRemoved(final ServiceReference<S> item, final ServiceEvent related, final T object) {
customizer.removedService(item, object);
}
diff --git a/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java b/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
index 72bec7a..6aa95cb 100644
--- a/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
+++ b/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
@@ -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.
@@ -16,6 +16,7 @@
package org.osgi.util.tracker;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.ServiceReference;
/**
@@ -45,8 +46,9 @@
* @param <S> The type of the service being tracked.
* @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Id: c14b8d47026b6bd4ba1f2db7bf7e755d00fc6f6a $
+ * @author $Id: 0c3333455f7d80a7793c77ac9671baa4a02a89b9 $
*/
+@ConsumerType
public interface ServiceTrackerCustomizer<S, T> {
/**
* A service is being added to the {@code ServiceTracker}.
diff --git a/framework/src/main/java/org/osgi/util/tracker/package-info.java b/framework/src/main/java/org/osgi/util/tracker/package-info.java
new file mode 100644
index 0000000..2bb188f
--- /dev/null
+++ b/framework/src/main/java/org/osgi/util/tracker/package-info.java
@@ -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.
+ */
+
+/**
+ * Tracker Package Version 1.5.
+ *
+ * <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.util.tracker; version="[1.5,2.0)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.5.1")
+package org.osgi.util.tracker;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/framework/src/main/java/org/osgi/util/tracker/packageinfo b/framework/src/main/java/org/osgi/util/tracker/packageinfo
new file mode 100644
index 0000000..1213efd
--- /dev/null
+++ b/framework/src/main/java/org/osgi/util/tracker/packageinfo
@@ -0,0 +1 @@
+version 1.5.1