Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-03-08 20:35:03 +0000
committerThomas Watson2012-03-08 20:35:03 +0000
commita382228f00c02beb0223c30c9d80cf56ccc20413 (patch)
treeaf5bf1368cb8e81b585fc90df8ac05ae8ef6ff34
parente545f5e1428338ed3c28686ee22186898eca0a55 (diff)
downloadrt.equinox.framework-a382228f00c02beb0223c30c9d80cf56ccc20413.tar.gz
rt.equinox.framework-a382228f00c02beb0223c30c9d80cf56ccc20413.tar.xz
rt.equinox.framework-a382228f00c02beb0223c30c9d80cf56ccc20413.zip
Bug 373700 - [R5] javadoc update and code formattingv20120308-2035
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java64
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java362
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java53
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java349
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java53
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java30
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java45
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java37
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java137
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java88
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java7
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java16
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java590
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java24
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java181
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java39
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java28
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java5
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java40
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java232
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java69
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java33
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java94
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java144
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java24
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/EventHook.java31
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/FindHook.java27
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java22
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHookFactory.java110
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java9
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventListenerHook.java6
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java24
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java42
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java5
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java59
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java19
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java2
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java28
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java33
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java47
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevisions.java3
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java34
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java95
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java6
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java7
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java5
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java29
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java15
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java43
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java48
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java83
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java15
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java40
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java74
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java44
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLConstants.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerService.java29
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java9
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java55
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java143
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java63
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java434
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java37
69 files changed, 2064 insertions, 2531 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
index bc4c5d392..a528ae321 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework;
import java.io.IOException;
@@ -137,8 +138,7 @@ public class AdaptPermission extends BasicPermission {
* adapted.
* @param actions {@code adapt}.
*/
- public AdaptPermission(String adaptClass, Bundle adaptableBundle,
- String actions) {
+ public AdaptPermission(String adaptClass, Bundle adaptableBundle, String actions) {
super(adaptClass);
setTransients(null, parseActions(actions));
this.bundle = adaptableBundle;
@@ -201,9 +201,7 @@ public class AdaptPermission extends BasicPermission {
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -217,11 +215,9 @@ public class AdaptPermission extends BasicPermission {
matchlen = 5;
mask |= ACTION_ADAPT;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException("invalid actions: "
- + actions);
+ throw new IllegalArgumentException("invalid actions: " + actions);
}
// make sure we didn't just match the tail of a word
@@ -239,8 +235,7 @@ public class AdaptPermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -270,10 +265,8 @@ public class AdaptPermission extends BasicPermission {
}
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -387,10 +380,7 @@ public class AdaptPermission extends BasicPermission {
AdaptPermission cp = (AdaptPermission) obj;
- return (action_mask == cp.action_mask)
- && getName().equals(cp.getName())
- && ((bundle == cp.bundle) || ((bundle != null) && bundle
- .equals(cp.bundle)));
+ return (action_mask == cp.action_mask) && getName().equals(cp.getName()) && ((bundle == cp.bundle) || ((bundle != null) && bundle.equals(cp.bundle)));
}
/**
@@ -412,8 +402,7 @@ public class AdaptPermission extends BasicPermission {
* stream. The actions are serialized, and the superclass takes care of the
* name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -428,8 +417,7 @@ public class AdaptPermission extends BasicPermission {
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(parseFilter(getName()), parseActions(actions));
@@ -516,18 +504,15 @@ final class AdaptPermissionCollection extends PermissionCollection {
*/
public void add(final Permission permission) {
if (!(permission instanceof AdaptPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final AdaptPermission ap = (AdaptPermission) permission;
if (ap.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + ap);
+ throw new IllegalArgumentException("cannot add to collection: " + ap);
}
final String name = ap.getName();
@@ -538,12 +523,10 @@ final class AdaptPermissionCollection extends PermissionCollection {
final int oldMask = existing.action_mask;
final int newMask = ap.action_mask;
if (oldMask != newMask) {
- pc.put(name, new AdaptPermission(existing.filter, oldMask
- | newMask));
+ pc.put(name, new AdaptPermission(existing.filter, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, ap);
}
@@ -613,23 +596,18 @@ final class AdaptPermissionCollection extends PermissionCollection {
}
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", HashMap.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE) };
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", HashMap.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", permissions);
pfields.put("all_allowed", all_allowed);
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- permissions = (HashMap<String, AdaptPermission>) gfields.get(
- "permissions", null);
+ permissions = (HashMap<String, AdaptPermission>) gfields.get("permissions", null);
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
index 43baf9a6d..cd883e81f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,34 +41,34 @@ import java.util.Map;
* permission are:
*
* <pre>
- * Action Methods
- * class Bundle.loadClass
- * execute Bundle.start
- * Bundle.stop
- * BundleStartLevel.setStartLevel
- * extensionLifecycle BundleContext.installBundle for extension bundles
- * Bundle.update for extension bundles
- * Bundle.uninstall for extension bundles
- * lifecycle BundleContext.installBundle
- * Bundle.update
- * Bundle.uninstall
- * listener BundleContext.addBundleListener for SynchronousBundleListener
- * BundleContext.removeBundleListener for SynchronousBundleListener
- * metadata Bundle.getHeaders
- * Bundle.getLocation
- * resolve FrameworkWiring.refreshBundles
- * FrameworkWiring.resolveBundles
- * resource Bundle.getResource
- * Bundle.getResources
- * Bundle.getEntry
- * Bundle.getEntryPaths
- * Bundle.findEntries
- * Bundle resource/entry URL creation
- * startlevel FrameworkStartLevel.setStartLevel
- * FrameworkStartLevel.setInitialBundleStartLevel
- * context Bundle.getBundleContext
- * weave WovenClass.setBytes
- * WovenClass.getDynamicImports for modification
+ * Action Methods
+ * class Bundle.loadClass
+ * execute Bundle.start
+ * Bundle.stop
+ * BundleStartLevel.setStartLevel
+ * extensionLifecycle BundleContext.installBundle for extension bundles
+ * Bundle.update for extension bundles
+ * Bundle.uninstall for extension bundles
+ * lifecycle BundleContext.installBundle
+ * Bundle.update
+ * Bundle.uninstall
+ * listener BundleContext.addBundleListener for SynchronousBundleListener
+ * BundleContext.removeBundleListener for SynchronousBundleListener
+ * metadata Bundle.getHeaders
+ * Bundle.getLocation
+ * resolve FrameworkWiring.refreshBundles
+ * FrameworkWiring.resolveBundles
+ * resource Bundle.getResource
+ * Bundle.getResources
+ * Bundle.getEntry
+ * Bundle.getEntryPaths
+ * Bundle.findEntries
+ * Bundle resource/entry URL creation
+ * startlevel FrameworkStartLevel.setStartLevel
+ * FrameworkStartLevel.setInitialBundleStartLevel
+ * context Bundle.getBundleContext
+ * weave WovenClass.setBytes
+ * WovenClass.getDynamicImports for modification
* </pre>
*
* <p>
@@ -93,74 +93,73 @@ import java.util.Map;
*/
public final class AdminPermission extends BasicPermission {
- static final long serialVersionUID = 307051004521261705L;
+ static final long serialVersionUID = 307051004521261705L;
/**
- * The action string {@code class}. The {@code class} action
- * implies the {@code resolve} action.
+ * The action string {@code class}. The {@code class} action implies the
+ * {@code resolve} action.
*
* @since 1.3
*/
- public final static String CLASS = "class";
+ public final static String CLASS = "class";
/**
- * The action string {@code execute}. The {@code execute} action
- * implies the {@code resolve} action.
+ * The action string {@code execute}. The {@code execute} action implies the
+ * {@code resolve} action.
*
* @since 1.3
*/
- public final static String EXECUTE = "execute";
+ public final static String EXECUTE = "execute";
/**
* The action string {@code extensionLifecycle}.
*
* @since 1.3
*/
- public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
+ public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
/**
* The action string {@code lifecycle}.
*
* @since 1.3
*/
- public final static String LIFECYCLE = "lifecycle";
+ public final static String LIFECYCLE = "lifecycle";
/**
* The action string {@code listener}.
*
* @since 1.3
*/
- public final static String LISTENER = "listener";
+ public final static String LISTENER = "listener";
/**
* The action string {@code metadata}.
*
* @since 1.3
*/
- public final static String METADATA = "metadata";
+ public final static String METADATA = "metadata";
/**
- * The action string {@code resolve}. The {@code resolve} action
- * is implied by the {@code class}, {@code execute} and
- * {@code resource} actions.
+ * The action string {@code resolve}. The {@code resolve} action is implied
+ * by the {@code class}, {@code execute} and {@code resource} actions.
*
* @since 1.3
*/
- public final static String RESOLVE = "resolve";
+ public final static String RESOLVE = "resolve";
/**
- * The action string {@code resource}. The {@code resource} action
- * implies the {@code resolve} action.
+ * The action string {@code resource}. The {@code resource} action implies
+ * the {@code resolve} action.
*
* @since 1.3
*/
- public final static String RESOURCE = "resource";
+ public final static String RESOURCE = "resource";
/**
* The action string {@code startlevel}.
*
* @since 1.3
*/
- public final static String STARTLEVEL = "startlevel";
+ public final static String STARTLEVEL = "startlevel";
/**
* The action string {@code context}.
*
* @since 1.4
*/
- public final static String CONTEXT = "context";
+ public final static String CONTEXT = "context";
/**
* The action string {@code weave}.
@@ -169,52 +168,43 @@ public final class AdminPermission extends BasicPermission {
*/
public final static String WEAVE = "weave";
- private final static int ACTION_CLASS = 0x00000001;
- private final static int ACTION_EXECUTE = 0x00000002;
- private final static int ACTION_LIFECYCLE = 0x00000004;
- private final static int ACTION_LISTENER = 0x00000008;
- private final static int ACTION_METADATA = 0x00000010;
- private final static int ACTION_RESOLVE = 0x00000040;
- private final static int ACTION_RESOURCE = 0x00000080;
- private final static int ACTION_STARTLEVEL = 0x00000100;
- private final static int ACTION_EXTENSIONLIFECYCLE = 0x00000200;
- private final static int ACTION_CONTEXT = 0x00000400;
+ private final static int ACTION_CLASS = 0x00000001;
+ private final static int ACTION_EXECUTE = 0x00000002;
+ private final static int ACTION_LIFECYCLE = 0x00000004;
+ private final static int ACTION_LISTENER = 0x00000008;
+ private final static int ACTION_METADATA = 0x00000010;
+ private final static int ACTION_RESOLVE = 0x00000040;
+ private final static int ACTION_RESOURCE = 0x00000080;
+ private final static int ACTION_STARTLEVEL = 0x00000100;
+ private final static int ACTION_EXTENSIONLIFECYCLE = 0x00000200;
+ private final static int ACTION_CONTEXT = 0x00000400;
private final static int ACTION_WEAVE = 0x00000800;
- private final static int ACTION_ALL = ACTION_CLASS
- | ACTION_EXECUTE
- | ACTION_LIFECYCLE
- | ACTION_LISTENER
- | ACTION_METADATA
- | ACTION_RESOLVE
- | ACTION_RESOURCE
- | ACTION_STARTLEVEL
- | ACTION_EXTENSIONLIFECYCLE
- | ACTION_CONTEXT
- | ACTION_WEAVE;
- final static int ACTION_NONE = 0;
+ private final static int ACTION_ALL = ACTION_CLASS | ACTION_EXECUTE | ACTION_LIFECYCLE | ACTION_LISTENER | ACTION_METADATA | ACTION_RESOLVE
+ | ACTION_RESOURCE | ACTION_STARTLEVEL | ACTION_EXTENSIONLIFECYCLE | ACTION_CONTEXT | ACTION_WEAVE;
+ final static int ACTION_NONE = 0;
/**
* The actions in canonical form.
*
* @serial
*/
- private volatile String actions = null;
+ private volatile String actions = null;
/**
* The actions mask.
*/
- transient int action_mask;
+ transient int action_mask;
/**
* If this AdminPermission was constructed with a filter, this holds a
* Filter matching object used to evaluate the filter in implies.
*/
- transient Filter filter;
+ transient Filter filter;
/**
* The bundle governed by this AdminPermission - only used if filter == null
*/
- transient final Bundle bundle;
+ transient final Bundle bundle;
/**
* This map holds the properties of the permission, used to match a filter
@@ -227,14 +217,14 @@ public final class AdminPermission extends BasicPermission {
* ThreadLocal used to determine if we have recursively called
* getProperties.
*/
- private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
+ private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
/**
- * Creates a new {@code AdminPermission} object that matches all
- * bundles and has all actions. Equivalent to AdminPermission("*","*");
+ * Creates a new {@code AdminPermission} object that matches all bundles and
+ * has all actions. Equivalent to AdminPermission("*","*");
*/
public AdminPermission() {
- this(null, ACTION_ALL);
+ this(null, ACTION_ALL);
}
/**
@@ -346,29 +336,27 @@ public final class AdminPermission extends BasicPermission {
if ((actions == null) || actions.equals("*")) {
return ACTION_ALL;
}
-
+
boolean seencomma = false;
-
+
int mask = ACTION_NONE;
char[] a = actions.toCharArray();
-
+
int i = a.length - 1;
if (i < 0)
return mask;
-
+
while (i != -1) {
char c;
-
+
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
-
+
// check for the known strings
int matchlen;
-
+
if (i >= 4 && (a[i - 4] == 'c' || a[i - 4] == 'C')
&& (a[i - 3] == 'l' || a[i - 3] == 'L')
&& (a[i - 2] == 'a' || a[i - 2] == 'A')
@@ -376,9 +364,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 's' || a[i] == 'S')) {
matchlen = 5;
mask |= ACTION_CLASS | ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 6 && (a[i - 6] == 'e' || a[i - 6] == 'E')
&& (a[i - 5] == 'x' || a[i - 5] == 'X')
&& (a[i - 4] == 'e' || a[i - 4] == 'E')
@@ -388,9 +375,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_EXECUTE | ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 17 && (a[i - 17] == 'e' || a[i - 17] == 'E')
&& (a[i - 16] == 'x' || a[i - 16] == 'X')
&& (a[i - 15] == 't' || a[i - 15] == 'T')
@@ -411,9 +397,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 18;
mask |= ACTION_EXTENSIONLIFECYCLE;
-
- }
- else
+
+ } else
if (i >= 8 && (a[i - 8] == 'l' || a[i - 8] == 'L')
&& (a[i - 7] == 'i' || a[i - 7] == 'I')
&& (a[i - 6] == 'f' || a[i - 6] == 'F')
@@ -425,9 +410,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 9;
mask |= ACTION_LIFECYCLE;
-
- }
- else
+
+ } else
if (i >= 7 && (a[i - 7] == 'l' || a[i - 7] == 'L')
&& (a[i - 6] == 'i' || a[i - 6] == 'I')
&& (a[i - 5] == 's' || a[i - 5] == 'S')
@@ -438,9 +422,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'r' || a[i] == 'R')) {
matchlen = 8;
mask |= ACTION_LISTENER;
-
- }
- else
+
+ } else
if (i >= 7
&& (a[i - 7] == 'm' || a[i - 7] == 'M')
&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -452,9 +435,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'a' || a[i] == 'A')) {
matchlen = 8;
mask |= ACTION_METADATA;
-
- }
- else
+
+ } else
if (i >= 6
&& (a[i - 6] == 'r' || a[i - 6] == 'R')
&& (a[i - 5] == 'e' || a[i - 5] == 'E')
@@ -465,9 +447,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 7
&& (a[i - 7] == 'r' || a[i - 7] == 'R')
&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -480,9 +461,8 @@ public final class AdminPermission extends BasicPermission {
matchlen = 8;
mask |= ACTION_RESOURCE
| ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 9
&& (a[i - 9] == 's' || a[i - 9] == 'S')
&& (a[i - 8] == 't' || a[i - 8] == 'T')
@@ -496,9 +476,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 'l' || a[i] == 'L')) {
matchlen = 10;
mask |= ACTION_STARTLEVEL;
-
- }
- else
+
+ } else
if (i >= 6
&& (a[i - 6] == 'c' || a[i - 6] == 'C')
&& (a[i - 5] == 'o' || a[i - 5] == 'O')
@@ -509,9 +488,8 @@ public final class AdminPermission extends BasicPermission {
&& (a[i] == 't' || a[i] == 'T')) {
matchlen = 7;
mask |= ACTION_CONTEXT;
-
- }
- else
+
+ } else
if (i >= 4
&& (a[i - 4] == 'w' || a[i - 4] == 'W')
&& (a[i - 3] == 'e' || a[i - 3] == 'E')
@@ -521,21 +499,16 @@ public final class AdminPermission extends BasicPermission {
matchlen = 5;
mask |= ACTION_WEAVE;
- }
- else
- if (i >= 0
- && (a[i] == '*')) {
+ } else
+ if (i >= 0 && (a[i] == '*')) {
matchlen = 1;
mask |= ACTION_ALL;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException(
- "invalid permission: "
- + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
-
+
// make sure we didn't just match the tail of a word
// like "ackbarfstartlevel". Also, skip to the comma.
seencomma = false;
@@ -551,21 +524,19 @@ public final class AdminPermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
-
+
// point i at the location of the comma minus one (or -1).
i -= matchlen;
}
-
+
if (seencomma) {
- throw new IllegalArgumentException("invalid permission: " +
- actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
-
+
return mask;
}
@@ -574,8 +545,8 @@ public final class AdminPermission extends BasicPermission {
*
* @param filterString The filter string to parse.
* @return a Filter for this bundle. If the specified filterString is
- * {@code null} or equals "*", then {@code null} is
- * returned to indicate a wildcard.
+ * {@code null} or equals "*", then {@code null} is returned to
+ * indicate a wildcard.
* @throws IllegalArgumentException If the filter syntax is invalid.
*/
private static Filter parseFilter(String filterString) {
@@ -586,13 +557,11 @@ public final class AdminPermission extends BasicPermission {
if (filterString.equals("*")) {
return null;
}
-
+
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -616,9 +585,9 @@ public final class AdminPermission extends BasicPermission {
* actions.
* <p>
* Special case: if the specified permission was constructed with "*"
- * filter, then this method returns {@code true} if this object's
- * filter is "*" and this object's actions include all of the specified
- * permission's actions
+ * filter, then this method returns {@code true} if this object's filter is
+ * "*" and this object's actions include all of the specified permission's
+ * actions
*
* @param p The requested permission.
* @return {@code true} if the specified permission is implied by this
@@ -657,7 +626,7 @@ public final class AdminPermission extends BasicPermission {
if ((effective & desired) != desired) {
return false;
}
-
+
/* Get our filter */
Filter f = filter;
if (f == null) {
@@ -668,8 +637,7 @@ public final class AdminPermission extends BasicPermission {
if (requested.bundle == null) {
return false;
}
- Map<String, Object> requestedProperties = requested
- .getProperties();
+ Map<String, Object> requestedProperties = requested.getProperties();
if (requestedProperties == null) {
/*
* If the requested properties are null, then we have detected a
@@ -699,53 +667,53 @@ public final class AdminPermission extends BasicPermission {
String result = actions;
if (result == null) {
StringBuffer sb = new StringBuffer();
-
+
int mask = action_mask;
if ((mask & ACTION_CLASS) == ACTION_CLASS) {
sb.append(CLASS);
sb.append(',');
}
-
+
if ((mask & ACTION_EXECUTE) == ACTION_EXECUTE) {
sb.append(EXECUTE);
sb.append(',');
}
-
+
if ((mask & ACTION_EXTENSIONLIFECYCLE) == ACTION_EXTENSIONLIFECYCLE) {
sb.append(EXTENSIONLIFECYCLE);
sb.append(',');
}
-
+
if ((mask & ACTION_LIFECYCLE) == ACTION_LIFECYCLE) {
sb.append(LIFECYCLE);
sb.append(',');
}
-
+
if ((mask & ACTION_LISTENER) == ACTION_LISTENER) {
sb.append(LISTENER);
sb.append(',');
}
-
+
if ((mask & ACTION_METADATA) == ACTION_METADATA) {
sb.append(METADATA);
sb.append(',');
}
-
+
if ((mask & ACTION_RESOLVE) == ACTION_RESOLVE) {
sb.append(RESOLVE);
sb.append(',');
}
-
+
if ((mask & ACTION_RESOURCE) == ACTION_RESOURCE) {
sb.append(RESOURCE);
sb.append(',');
}
-
+
if ((mask & ACTION_STARTLEVEL) == ACTION_STARTLEVEL) {
sb.append(STARTLEVEL);
sb.append(',');
}
-
+
if ((mask & ACTION_CONTEXT) == ACTION_CONTEXT) {
sb.append(CONTEXT);
sb.append(',');
@@ -755,20 +723,20 @@ public final class AdminPermission extends BasicPermission {
sb.append(WEAVE);
sb.append(',');
}
-
+
// remove trailing comma
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
-
+
actions = result = sb.toString();
}
return result;
}
/**
- * Returns a new {@code PermissionCollection} object suitable for
- * storing {@code AdminPermission}s.
+ * Returns a new {@code PermissionCollection} object suitable for storing
+ * {@code AdminPermission}s.
*
* @return A new {@code PermissionCollection} object.
*/
@@ -794,11 +762,7 @@ public final class AdminPermission extends BasicPermission {
AdminPermission ap = (AdminPermission) obj;
- return (action_mask == ap.action_mask)
- && ((bundle == ap.bundle) || ((bundle != null) && bundle
- .equals(ap.bundle)))
- && (filter == null ? ap.filter == null : filter
- .equals(ap.filter));
+ return (action_mask == ap.action_mask) && ((bundle == ap.bundle) || ((bundle != null) && bundle.equals(ap.bundle))) && (filter == null ? ap.filter == null : filter.equals(ap.filter));
}
/**
@@ -820,8 +784,7 @@ public final class AdminPermission extends BasicPermission {
* stream. The actions are serialized, and the superclass takes care of the
* name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -836,8 +799,7 @@ public final class AdminPermission extends BasicPermission {
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the data, then initialize the transients
s.defaultReadObject();
setTransients(parseFilter(getName()), parseActions(actions));
@@ -870,8 +832,7 @@ public final class AdminPermission extends BasicPermission {
}
recurse.set(bundle);
try {
- final Map<String, Object> map = new HashMap<String, Object>(
- 4);
+ final Map<String, Object> map = new HashMap<String, Object>(4);
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
map.put("id", new Long(bundle.getBundleId()));
@@ -888,8 +849,7 @@ public final class AdminPermission extends BasicPermission {
}
});
return properties = map;
- }
- finally {
+ } finally {
recurse.set(null);
}
}
@@ -899,7 +859,7 @@ public final class AdminPermission extends BasicPermission {
* Stores a collection of {@code AdminPermission}s.
*/
final class AdminPermissionCollection extends PermissionCollection {
- private static final long serialVersionUID = 3906372644575328048L;
+ private static final long serialVersionUID = 3906372644575328048L;
/**
* Collection of permissions.
*
@@ -913,7 +873,7 @@ final class AdminPermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private boolean all_allowed;
+ private boolean all_allowed;
/**
* Create an empty AdminPermissions object.
@@ -928,24 +888,21 @@ final class AdminPermissionCollection extends PermissionCollection {
*
* @param permission The {@code AdminPermission} object to add.
* @throws IllegalArgumentException If the specified permission is not an
- * {@code AdminPermission} instance or was constructed with a
- * Bundle object.
+ * {@code AdminPermission} instance or was constructed with a Bundle
+ * object.
* @throws SecurityException If this {@code AdminPermissionCollection}
* object has been marked read-only.
*/
public void add(Permission permission) {
if (!(permission instanceof AdminPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final AdminPermission ap = (AdminPermission) permission;
if (ap.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + ap);
+ throw new IllegalArgumentException("cannot add to collection: " + ap);
}
final String name = ap.getName();
synchronized (this) {
@@ -956,11 +913,9 @@ final class AdminPermissionCollection extends PermissionCollection {
int newMask = ap.action_mask;
if (oldMask != newMask) {
- pc.put(name, new AdminPermission(existing.filter, oldMask
- | newMask));
+ pc.put(name, new AdminPermission(existing.filter, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, ap);
}
if (!all_allowed) {
@@ -978,8 +933,8 @@ final class AdminPermissionCollection extends PermissionCollection {
* @param permission The Permission object to compare with the
* {@code AdminPermission} objects in this collection.
* @return {@code true} if {@code permission} is implied by an
- * {@code AdminPermission} in this collection,
- * {@code false} otherwise.
+ * {@code AdminPermission} in this collection, {@code false}
+ * otherwise.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof AdminPermission)) {
@@ -1028,28 +983,21 @@ final class AdminPermissionCollection extends PermissionCollection {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
}
-
+
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE) };
-
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
- Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(
- permissions);
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
+
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+ Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
out.writeFields();
}
-
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException,
- ClassNotFoundException {
+
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields
- .get("permissions", null);
+ 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/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
index 35cee8a49..7a0c82db4 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,39 +17,36 @@
package org.osgi.framework;
/**
- * A {@code ServiceEvent} listener that does not filter based upon
- * package wiring. {@code AllServiceListener} is a listener interface
- * that may be implemented by a bundle developer. When a
- * {@code ServiceEvent} is fired, it is synchronously delivered to an
- * {@code AllServiceListener}. The Framework may deliver
- * {@code ServiceEvent} objects to an {@code AllServiceListener}
- * out of order and may concurrently call and/or reenter an
+ * A {@code ServiceEvent} listener that does not filter based upon package
+ * wiring. {@code AllServiceListener} is a listener interface that may be
+ * implemented by a bundle developer. When a {@code ServiceEvent} is fired, it
+ * is synchronously delivered to an {@code AllServiceListener}. The Framework
+ * may deliver {@code ServiceEvent} objects to an {@code AllServiceListener} out
+ * of order and may concurrently call and/or reenter an
* {@code AllServiceListener}.
* <p>
- * An {@code AllServiceListener} object is registered with the Framework
- * using the {@code BundleContext.addServiceListener} method.
- * {@code AllServiceListener} objects are called with a
- * {@code ServiceEvent} object when a service is registered, modified, or
- * is in the process of unregistering.
+ * An {@code AllServiceListener} object is registered with the Framework using
+ * the {@code BundleContext.addServiceListener} method.
+ * {@code AllServiceListener} objects are called with a {@code ServiceEvent}
+ * object when a service is registered, modified, or is in the process of
+ * unregistering.
*
* <p>
- * {@code ServiceEvent} object delivery to
- * {@code AllServiceListener} objects is filtered by the filter specified
- * when the listener was registered. If the Java Runtime Environment supports
- * permissions, then additional filtering is done. {@code ServiceEvent}
- * objects are only delivered to the listener if the bundle which defines the
- * listener object's class has the appropriate {@code ServicePermission}
- * to get the service using at least one of the named classes under which the
- * service was registered.
+ * {@code ServiceEvent} object delivery to {@code AllServiceListener} objects is
+ * filtered by the filter specified when the listener was registered. If the
+ * Java Runtime Environment supports permissions, then additional filtering is
+ * done. {@code ServiceEvent} objects are only delivered to the listener if the
+ * bundle which defines the listener object's class has the appropriate
+ * {@code ServicePermission} to get the service using at least one of the named
+ * classes under which the service was registered.
*
* <p>
- * Unlike normal {@code ServiceListener} objects,
- * {@code AllServiceListener} objects receive all
- * {@code ServiceEvent} objects regardless of whether the package source
- * of the listening bundle is equal to the package source of the bundle that
- * registered the service. This means that the listener may not be able to cast
- * the service object to any of its corresponding service interfaces if the
- * service object is retrieved.
+ * Unlike normal {@code ServiceListener} objects, {@code AllServiceListener}
+ * objects receive all {@code ServiceEvent} objects regardless of whether the
+ * package source of the listening bundle is equal to the package source of the
+ * bundle that registered the service. This means that the listener may not be
+ * able to cast the service object to any of its corresponding service
+ * interfaces if the service object is retrieved.
*
* @see ServiceEvent
* @see ServicePermission
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
index bc8954d89..8a58ab72a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
@@ -25,23 +25,22 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
-
import org.osgi.framework.wiring.FrameworkWiring;
/**
* An installed bundle in the Framework.
- *
+ *
* <p>
* A {@code Bundle} object is the access point to define the lifecycle of an
* installed bundle. Each bundle installed in the OSGi environment must have an
* associated {@code Bundle} object.
- *
+ *
* <p>
* A bundle must have a unique identity, a {@code long}, chosen by the
* Framework. This identity must not change during the lifecycle of a bundle,
* even when the bundle is updated. Uninstalling and then reinstalling the
* bundle must create a new unique identity.
- *
+ *
* <p>
* A bundle can be in one of six states:
* <ul>
@@ -56,24 +55,24 @@ import org.osgi.framework.wiring.FrameworkWiring;
* Values assigned to these states have no specified ordering; they represent
* bit values that may be ORed together to determine if a bundle is in one of
* the valid states.
- *
+ *
* <p>
* A bundle should only have active threads of execution when its state is one
- * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An {@code
- * UNINSTALLED} bundle can not be set to another state; it is a zombie and can
- * only be reached because references are kept somewhere.
- *
+ * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An
+ * {@code UNINSTALLED} bundle can not be set to another state; it is a zombie
+ * and can only be reached because references are kept somewhere.
+ *
* <p>
* The Framework is the only entity that is allowed to create {@code Bundle}
* objects, and these objects are only valid within the Framework that created
* them.
- *
+ *
* <p>
* Bundles have a natural ordering such that if two {@code Bundle}s have the
* same {@link #getBundleId() bundle id} they are equal. A {@code Bundle} is
* less than another {@code Bundle} if it has a lower {@link #getBundleId()
* bundle id} and is greater if it has a higher bundle id.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -81,7 +80,7 @@ import org.osgi.framework.wiring.FrameworkWiring;
public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is uninstalled and may not be used.
- *
+ *
* <p>
* The {@code UNINSTALLED} state is only visible after a bundle is
* uninstalled; the bundle is in an unusable state but references to the
@@ -93,7 +92,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is installed but not yet resolved.
- *
+ *
* <p>
* A bundle is in the {@code INSTALLED} state when it has been installed in
* the Framework but is not or cannot be resolved.
@@ -108,7 +107,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is resolved and is able to be started.
- *
+ *
* <p>
* A bundle is in the {@code RESOLVED} state when the Framework has
* successfully resolved the bundle's code dependencies. These dependencies
@@ -135,7 +134,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is in the process of starting.
- *
+ *
* <p>
* A bundle is in the {@code STARTING} state when its {@link #start(int)
* start} method is active. A bundle must be in this state when the bundle's
@@ -154,7 +153,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is in the process of stopping.
- *
+ *
* <p>
* A bundle is in the {@code STOPPING} state when its {@link #stop(int)
* stop} method is active. A bundle must be in this state when the bundle's
@@ -168,7 +167,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is now running.
- *
+ *
* <p>
* A bundle is in the {@code ACTIVE} state when it has been successfully
* started and activated.
@@ -180,13 +179,13 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle start operation is transient and the persistent autostart
* setting of the bundle is not modified.
- *
+ *
* <p>
* This bit may be set when calling {@link #start(int)} to notify the
* framework that the autostart setting of the bundle must not be modified.
* If this bit is not set, then the autostart setting of the bundle is
* modified.
- *
+ *
* @since 1.4
* @see #start(int)
*/
@@ -196,12 +195,12 @@ public interface Bundle extends Comparable<Bundle> {
* The bundle start operation must activate the bundle according to the
* bundle's declared {@link Constants#BUNDLE_ACTIVATIONPOLICY activation
* policy}.
- *
+ *
* <p>
* This bit may be set when calling {@link #start(int)} to notify the
* framework that the bundle must be activated using the bundle's declared
* activation policy.
- *
+ *
* @since 1.4
* @see Constants#BUNDLE_ACTIVATIONPOLICY
* @see #start(int)
@@ -211,13 +210,13 @@ public interface Bundle extends Comparable<Bundle> {
/**
* The bundle stop is transient and the persistent autostart setting of the
* bundle is not modified.
- *
+ *
* <p>
* This bit may be set when calling {@link #stop(int)} to notify the
* framework that the autostart setting of the bundle must not be modified.
* If this bit is not set, then the autostart setting of the bundle is
* modified.
- *
+ *
* @since 1.4
* @see #stop(int)
*/
@@ -225,7 +224,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Request that all certificates used to sign the bundle be returned.
- *
+ *
* @since 1.5
* @see #getSignerCertificates(int)
*/
@@ -234,7 +233,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Request that only certificates used to sign the bundle that are trusted
* by the framework be returned.
- *
+ *
* @since 1.5
* @see #getSignerCertificates(int)
*/
@@ -242,10 +241,10 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Returns this bundle's current state.
- *
+ *
* <p>
* A bundle can be in only one state at any time.
- *
+ *
* @return An element of {@code UNINSTALLED},{@code INSTALLED},
* {@code RESOLVED}, {@code STARTING}, {@code STOPPING},
* {@code ACTIVE}.
@@ -254,7 +253,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Starts this bundle.
- *
+ *
* <p>
* If this bundle's state is {@code UNINSTALLED} then an
* {@code IllegalStateException} is thrown.
@@ -264,7 +263,7 @@ public interface Bundle extends Comparable<Bundle> {
* <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.
- *
+ *
* <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
@@ -281,21 +280,21 @@ public interface Bundle extends Comparable<Bundle> {
* 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.
- *
+ *
* <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.
- *
+ *
* <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.
- *
+ *
* <li>If the {@link #START_ACTIVATION_POLICY} option is set and this
* bundle's declared activation policy is {@link Constants#ACTIVATION_LAZY
* lazy} then:
@@ -309,9 +308,9 @@ public interface Bundle extends Comparable<Bundle> {
* </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>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:
@@ -329,12 +328,12 @@ public interface Bundle extends Comparable<Bundle> {
* <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.
* </ol>
- *
+ *
* <b>Preconditions </b>
* <ul>
* <li>{@code getState()} in &#x007B; {@code INSTALLED}, {@code RESOLVED}
@@ -357,7 +356,7 @@ public interface Bundle extends Comparable<Bundle> {
* <li>{@code getState()} not in &#x007B; {@code STARTING}, {@code ACTIVE}
* &#x007D;.
* </ul>
- *
+ *
* @param options The options for starting this bundle. See
* {@link #START_TRANSIENT} and {@link #START_ACTIVATION_POLICY}. The
* Framework must ignore unrecognized options.
@@ -379,10 +378,10 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Starts this bundle with no options.
- *
+ *
* <p>
* This method performs the same function as calling {@code start(0)}.
- *
+ *
* @throws BundleException If this bundle could not be started.
* BundleException types thrown by this method include:
* {@link BundleException#NATIVECODE_ERROR},
@@ -400,13 +399,13 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Stops this bundle.
- *
+ *
* <p>
* 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.
- *
+ *
* <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
@@ -416,34 +415,34 @@ public interface Bundle extends Comparable<Bundle> {
* 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.
- *
+ *
* <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.
- *
+ *
* <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.
- *
+ *
* <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.
* </ol>
- *
+ *
* <b>Preconditions </b>
* <ul>
* <li>{@code getState()} in &#x007B; {@code ACTIVE} &#x007D;.
@@ -462,7 +461,7 @@ public interface Bundle extends Comparable<Bundle> {
* <li>Bundle autostart setting is modified unless the
* {@link #STOP_TRANSIENT} option was set.
* </ul>
- *
+ *
* @param options The options for stopping this bundle. See
* {@link #STOP_TRANSIENT}. The Framework must ignore unrecognized
* options.
@@ -480,10 +479,10 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Stops this bundle with no options.
- *
+ *
* <p>
* This method performs the same function as calling {@code stop(0)}.
- *
+ *
* @throws BundleException BundleException types thrown by this method
* include: {@link BundleException#STATECHANGE_ERROR} and
* {@link BundleException#ACTIVATOR_ERROR}.
@@ -498,53 +497,53 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Updates this bundle from an {@code InputStream}.
- *
+ *
* <p>
* If the specified {@code InputStream} is {@code null}, the Framework must
* create the {@code InputStream} from which to read the updated bundle by
* interpreting, in an implementation dependent manner, this bundle's
* {@link Constants#BUNDLE_UPDATELOCATION Bundle-UpdateLocation} Manifest
* header, if present, or this bundle's original location.
- *
+ *
* <p>
* If this bundle's state is {@code ACTIVE}, it must be stopped before the
* update and started after the update successfully completes.
- *
+ *
* <p>
* If this bundle has exported any packages that are imported by another
* bundle, these packages must remain exported until the
* {@link FrameworkWiring#refreshBundles(java.util.Collection, FrameworkListener...)
* FrameworkWiring.refreshBundles} method has been has been called or the
* Framework is relaunched.
- *
+ *
* <p>
* 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.
- *
+ *
* <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.
- *
+ *
* <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}.
- *
+ *
* <li>If the updated version of this bundle was successfully installed, a
* bundle event of type {@link BundleEvent#UPDATED} is fired.
- *
+ *
* <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.
* </ol>
- *
+ *
* <b>Preconditions </b>
* <ul>
* <li>{@code getState()} not in &#x007B; {@code UNINSTALLED} &#x007D;.
@@ -561,7 +560,7 @@ public interface Bundle extends Comparable<Bundle> {
* {@code ACTIVE} &#x007D;.
* <li>Original bundle is still used; no update occurred.
* </ul>
- *
+ *
* @param input The {@code InputStream} from which to read the new bundle or
* {@code null} to indicate the Framework must create the input
* stream from this bundle's {@link Constants#BUNDLE_UPDATELOCATION
@@ -590,11 +589,11 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Updates this bundle.
- *
+ *
* <p>
* This method performs the same function as calling
* {@link #update(InputStream)} with a {@code null} InputStream.
- *
+ *
* @throws BundleException If this bundle could not be updated.
* BundleException types thrown by this method include:
* {@link BundleException#READ_ERROR},
@@ -616,40 +615,40 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Uninstalls this bundle.
- *
+ *
* <p>
* This method causes the Framework to notify other bundles that this bundle
* is being uninstalled, and then puts this bundle into the
* {@code UNINSTALLED} state. The Framework must remove any resources
* related to this bundle that it is able to remove.
- *
+ *
* <p>
* If this bundle has exported any packages, the Framework must continue to
* make these packages available to their importing bundles until the
* {@link FrameworkWiring#refreshBundles(java.util.Collection, FrameworkListener...)
* FrameworkWiring.refreshBundles} method has been called or the Framework
* is relaunched.
- *
+ *
* <p>
* 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.
- *
+ *
* <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.
- *
+ *
* <li>This bundle and any persistent storage area provided for this bundle
* by the Framework are removed.
* </ol>
- *
+ *
* <b>Preconditions </b>
* <ul>
* <li>{@code getState()} not in &#x007B; {@code UNINSTALLED} &#x007D;.
@@ -664,7 +663,7 @@ public interface Bundle extends Comparable<Bundle> {
* <li>{@code getState()} not in &#x007B; {@code UNINSTALLED} &#x007D;.
* <li>This Bundle has not been uninstalled.
* </ul>
- *
+ *
* @throws BundleException If the uninstall failed. This can occur if
* another thread is attempting to change this bundle's state and
* does not complete in a timely manner. BundleException types
@@ -683,21 +682,21 @@ public interface Bundle extends Comparable<Bundle> {
* Returns this bundle's Manifest headers and values. This method returns
* all the Manifest headers and values from the main section of this
* bundle's Manifest file; that is, all lines prior to the first blank line.
- *
+ *
* <p>
* Manifest header names are case-insensitive. The methods of the returned
* {@code Dictionary} object must operate on header names in a
* case-insensitive manner.
- *
+ *
* If a Manifest header value starts with &quot;%&quot;, it must be
* localized according to the default locale. If no localization is found
* for a header value, the header value without the leading &quot;%&quot; is
* returned.
- *
+ *
* <p>
* For example, the following Manifest headers and values are included if
* they are present in the Manifest file:
- *
+ *
* <pre>
* Bundle-Name
* Bundle-Vendor
@@ -706,11 +705,11 @@ public interface Bundle extends Comparable<Bundle> {
* Bundle-DocURL
* Bundle-ContactAddress
* </pre>
- *
+ *
* <p>
* This method must continue to return Manifest header information while
* this bundle is in the {@code UNINSTALLED} state.
- *
+ *
* @return An unmodifiable {@code Dictionary} object containing this
* bundle's Manifest headers and values.
* @throws SecurityException If the caller does not have the appropriate
@@ -724,7 +723,7 @@ public interface Bundle extends Comparable<Bundle> {
* Returns this bundle's unique identifier. This bundle is assigned a unique
* identifier by the Framework when it was installed in the OSGi
* environment.
- *
+ *
* <p>
* A bundle's unique identifier has the following attributes:
* <ul>
@@ -735,28 +734,28 @@ public interface Bundle extends Comparable<Bundle> {
* <li>Does not change while a bundle remains installed.
* <li>Does not change when a bundle is updated.
* </ul>
- *
+ *
* <p>
* This method must continue to return this bundle's unique identifier while
* this bundle is in the {@code UNINSTALLED} state.
- *
+ *
* @return The unique identifier of this bundle.
*/
long getBundleId();
/**
* Returns this bundle's location identifier.
- *
+ *
* <p>
- * The location identifier is the location passed to {@code
- * BundleContext.installBundle} when a bundle is installed. The location
- * identifier does not change while this bundle remains installed, even if
- * this bundle is updated.
- *
+ * The location identifier is the location passed to
+ * {@code BundleContext.installBundle} when a bundle is installed. The
+ * location identifier does not change while this bundle remains installed,
+ * even if this bundle is updated.
+ *
* <p>
* This method must continue to return this bundle's location identifier
* while this bundle is in the {@code UNINSTALLED} state.
- *
+ *
* @return The string representation of this bundle's location identifier.
* @throws SecurityException If the caller does not have the appropriate
* {@code AdminPermission[this,METADATA]}, and the Java Runtime
@@ -767,52 +766,53 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Returns this bundle's {@code ServiceReference} list for all services it
* has registered or {@code null} if this bundle has no registered services.
- *
+ *
* <p>
* If the Java runtime supports permissions, a {@code ServiceReference}
* object to a service is included in the returned list only if the caller
* has the {@code ServicePermission} to get the service using at least one
* of the named classes the service was registered under.
- *
+ *
* <p>
* The list is valid at the time of the call to this method, however, as the
* Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
- *
+ *
* @return An array of {@code ServiceReference} objects or {@code null}.
* @throws IllegalStateException If this bundle has been uninstalled.
* @see ServiceRegistration
* @see ServiceReference
* @see ServicePermission
*/
- ServiceReference< ? >[] getRegisteredServices();
+ ServiceReference<?>[] getRegisteredServices();
/**
* 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.
- *
+ *
* <p>
- * If the Java Runtime Environment supports permissions, a {@code
- * ServiceReference} object to a service is included in the returned list
- * only if the caller has the {@code ServicePermission} to get the service
- * using at least one of the named classes the service was registered under.
+ * If the Java Runtime Environment supports permissions, a
+ * {@code ServiceReference} object to a service is included in the returned
+ * list only if the caller has the {@code ServicePermission} to get the
+ * service using at least one of the named classes the service was
+ * registered under.
* <p>
* The list is valid at the time of the call to this method, however, as the
* Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
- *
+ *
* @return An array of {@code ServiceReference} objects or {@code null}.
* @throws IllegalStateException If this bundle has been uninstalled.
* @see ServiceReference
* @see ServicePermission
*/
- ServiceReference< ? >[] getServicesInUse();
+ ServiceReference<?>[] getServicesInUse();
/**
* Determines if this bundle has the specified permissions.
- *
+ *
* <p>
* If the Java Runtime Environment does not support permissions, this method
* always returns {@code true}.
@@ -821,26 +821,26 @@ public interface Bundle extends Comparable<Bundle> {
* {@code java.security.Permission} class directly. This is to allow the
* Framework to be implemented in Java environments which do not support
* permissions.
- *
+ *
* <p>
* If the Java Runtime Environment does support permissions, this bundle and
* all its resources including embedded JAR files, belong to the same
* {@code java.security.ProtectionDomain}; that is, they must share the same
* set of permissions.
- *
+ *
* @param permission The permission to verify.
* @return {@code true} if this bundle has the specified permission or the
* permissions possessed by this bundle imply the specified
* permission; {@code false} if this bundle does not have the
- * specified permission or {@code permission} is not an {@code
- * instanceof} {@code java.security.Permission}.
+ * specified permission or {@code permission} is not an
+ * {@code instanceof} {@code java.security.Permission}.
* @throws IllegalStateException If this bundle has been uninstalled.
*/
boolean hasPermission(Object permission);
/**
* Find the specified resource from this bundle's class loader.
- *
+ *
* This bundle's class loader is called to search for the specified
* resource. If this bundle's state is {@code INSTALLED}, this method must
* attempt to resolve this bundle before attempting to get the specified
@@ -852,7 +852,7 @@ public interface Bundle extends Comparable<Bundle> {
* Note: Jar and zip files are not required to include directory entries.
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
- *
+ *
* @param name The name of the resource. See {@code ClassLoader.getResource}
* for a description of the format of a resource name.
* @return A URL to the named resource, or {@code null} if the resource
@@ -870,17 +870,17 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Returns this bundle's Manifest headers and values localized to the
* specified locale.
- *
+ *
* <p>
* This method performs the same function as {@code Bundle.getHeaders()}
* except the manifest header values are localized to the specified locale.
- *
+ *
* <p>
* If a Manifest header value starts with &quot;%&quot;, it must be
* localized according to the specified locale. If a locale is specified and
* cannot be found, then the header values must be returned using the
* default locale. Localizations are searched for in the following order:
- *
+ *
* <pre>
* bn + &quot;_&quot; + Ls + &quot;_&quot; + Cs + &quot;_&quot; + Vs
* bn + &quot;_&quot; + Ls + &quot;_&quot; + Cs
@@ -890,24 +890,24 @@ public interface Bundle extends Comparable<Bundle> {
* bn + &quot;_&quot; + Ld
* bn
* </pre>
- *
+ *
* Where {@code bn} is this bundle's localization basename, {@code Ls},
* {@code Cs} and {@code Vs} are the specified locale (language, country,
* variant) and {@code Ld}, {@code Cd} and {@code Vd} are the default locale
* (language, country, variant).
- *
+ *
* If {@code null} is specified as the locale string, the header values must
* be localized using the default locale. If the empty string (&quot;&quot;)
* is specified as the locale string, the header values must not be
* localized and the raw (unlocalized) header values, including any leading
* &quot;%&quot;, must be returned. If no localization is found for a header
* value, the header value without the leading &quot;%&quot; is returned.
- *
+ *
* <p>
* This method must continue to return Manifest header information while
* this bundle is in the {@code UNINSTALLED} state, however the header
* values must only be available in the raw and default locale values.
- *
+ *
* @param locale The locale name into which the header values are to be
* localized. If the specified locale is {@code null} then the locale
* returned by {@code java.util.Locale.getDefault} is used. If the
@@ -926,15 +926,15 @@ public interface Bundle extends Comparable<Bundle> {
Dictionary<String, String> getHeaders(String locale);
/**
- * Returns the symbolic name of this bundle as specified by its {@code
- * Bundle-SymbolicName} manifest header. The bundle symbolic name should be
- * based on the reverse domain name naming convention like that used for
- * java packages.
- *
+ * Returns the symbolic name of this bundle as specified by its
+ * {@code Bundle-SymbolicName} manifest header. The bundle symbolic name
+ * should be based on the reverse domain name naming convention like that
+ * used for java packages.
+ *
* <p>
* This method must continue to return this bundle's symbolic name while
* this bundle is in the {@code UNINSTALLED} state.
- *
+ *
* @return The symbolic name of this bundle or {@code null} if this bundle
* does not have a symbolic name.
* @since 1.3
@@ -943,25 +943,25 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Loads the specified class using this bundle's class loader.
- *
+ *
* <p>
- * If this bundle is a fragment bundle then this method must throw a {@code
- * ClassNotFoundException}.
- *
+ * If this bundle is a fragment bundle then this method must throw a
+ * {@code ClassNotFoundException}.
+ *
* <p>
* If this bundle's state is {@code INSTALLED}, this method must attempt to
* resolve this bundle before attempting to load the class.
- *
+ *
* <p>
* If this bundle cannot be resolved, a Framework event of type
- * {@link FrameworkEvent#ERROR} is fired containing a {@code
- * BundleException} with details of the reason this bundle could not be
- * resolved. This method must then throw a {@code ClassNotFoundException}.
- *
- * <p>
- * If this bundle's state is {@code UNINSTALLED}, then an {@code
- * IllegalStateException} is thrown.
- *
+ * {@link FrameworkEvent#ERROR} is fired containing a
+ * {@code BundleException} with details of the reason this bundle could not
+ * be resolved. This method must then throw a {@code ClassNotFoundException}.
+ *
+ * <p>
+ * If this bundle's state is {@code UNINSTALLED}, then an
+ * {@code IllegalStateException} is thrown.
+ *
* @param name The name of the class to load.
* @return The Class object for the requested class.
* @throws ClassNotFoundException If no such class can be found or if this
@@ -971,11 +971,11 @@ public interface Bundle extends Comparable<Bundle> {
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
- Class< ? > loadClass(String name) throws ClassNotFoundException;
+ Class<?> loadClass(String name) throws ClassNotFoundException;
/**
* Find the specified resources from this bundle's class loader.
- *
+ *
* This bundle's class loader is called to search for the specified
* resources. If this bundle's state is {@code INSTALLED}, this method must
* attempt to resolve this bundle before attempting to get the specified
@@ -987,15 +987,15 @@ public interface Bundle extends Comparable<Bundle> {
* Note: Jar and zip files are not required to include directory entries.
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
- *
- * @param name The name of the resource. See {@code
- * ClassLoader.getResources} for a description of the format of a
- * resource name.
+ *
+ * @param name The name of the resource. See
+ * {@code ClassLoader.getResources} for a description of the format
+ * of a resource name.
* @return An enumeration of URLs to the named resources, or {@code null} if
* the resource could not be found or if this bundle is a fragment
- * bundle or if the caller does not have the appropriate {@code
- * AdminPermission[this,RESOURCE]}, and the Java Runtime Environment
- * supports permissions.
+ * bundle or if the caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
+ * Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
* @throws IOException If there is an I/O error.
* @since 1.3
@@ -1019,7 +1019,7 @@ public interface Bundle extends Comparable<Bundle> {
* Note: Jar and zip files are not required to include directory entries.
* Paths to directory entries will not be returned if the bundle contents do
* not contain directory entries.
- *
+ *
* @param path The path name for which to return entry paths.
* @return An Enumeration of the entry paths ({@code String} objects) or
* {@code null} if no entry could be found or if the caller does not
@@ -1042,12 +1042,12 @@ public interface Bundle extends Comparable<Bundle> {
* Note: Jar and zip files are not required to include directory entries.
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
- *
+ *
* @param path The path name of the entry.
* @return A URL to the entry, or {@code null} if no entry could be found or
- * if the caller does not have the appropriate {@code
- * AdminPermission[this,RESOURCE]} and the Java Runtime Environment
- * supports permissions.
+ * if the caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]} and the Java Runtime
+ * Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
@@ -1056,11 +1056,11 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Returns the time when this bundle was last modified. A bundle is
* considered to be modified when it 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 this bundle was last modified.
* @since 1.3
*/
@@ -1096,10 +1096,10 @@ public interface Bundle extends Comparable<Bundle> {
* Enumeration e = b.findEntries(&quot;OSGI-INF&quot;, &quot;*.xml&quot;, true);
*
* // Find a specific localization file
- * Enumeration e = b
- * .findEntries(&quot;OSGI-INF/l10n&quot;, &quot;bundle_nl_DU.properties&quot;, false);
+ * Enumeration e = b.findEntries(&quot;OSGI-INF/l10n&quot;,
+ * &quot;bundle_nl_DU.properties&quot;, false);
* if (e.hasMoreElements())
- * return (URL) e.nextElement();
+ * return (URL) e.nextElement();
* </pre>
*
* <p>
@@ -1134,19 +1134,19 @@ public interface Bundle extends Comparable<Bundle> {
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
- Enumeration<URL> findEntries(String path, String filePattern,
- boolean recurse);
+ Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
/**
- * Returns this bundle's {@link BundleContext}. The returned {@code
- * BundleContext} can be used by the caller to act on behalf of this bundle.
- *
+ * Returns this bundle's {@link BundleContext}. The returned
+ * {@code BundleContext} can be used by the caller to act on behalf of this
+ * bundle.
+ *
* <p>
* If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
* {@link #STOPPING} states or this bundle is a fragment bundle, then this
* bundle has no valid {@code BundleContext}. This method will return
* {@code null} if this bundle has no valid {@code BundleContext}.
- *
+ *
* @return A {@code BundleContext} for this bundle or {@code null} if this
* bundle has no valid {@code BundleContext}.
* @throws SecurityException If the caller does not have the appropriate
@@ -1159,7 +1159,7 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Return the certificates for the signers of this bundle and the
* certificate chains for those signers.
- *
+ *
* @param signersType If {@link #SIGNERS_ALL} is specified, then information
* on all signers of this bundle is returned. If
* {@link #SIGNERS_TRUSTED} is specified, then only information on
@@ -1178,18 +1178,17 @@ public interface Bundle extends Comparable<Bundle> {
* not {@link #SIGNERS_ALL} or {@link #SIGNERS_TRUSTED}.
* @since 1.5
*/
- Map<X509Certificate, List<X509Certificate>> getSignerCertificates(
- int signersType);
+ Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType);
/**
- * Returns the version of this bundle as specified by its {@code
- * Bundle-Version} manifest header. If this bundle does not have a specified
- * version then {@link Version#emptyVersion} is returned.
- *
+ * Returns the version of this bundle as specified by its
+ * {@code Bundle-Version} manifest header. If this bundle does not have a
+ * specified version then {@link Version#emptyVersion} is returned.
+ *
* <p>
* This method must continue to return this bundle's version while this
* bundle is in the {@code UNINSTALLED} state.
- *
+ *
* @return The version of this bundle.
* @since 1.5
*/
@@ -1197,12 +1196,12 @@ public interface Bundle extends Comparable<Bundle> {
/**
* Adapt this bundle to the specified type.
- *
+ *
* <p>
* Adapting this bundle to the specified type may require certain checks,
* including security checks, to succeed. If a check does not succeed, then
* this bundle cannot be adapted and {@code null} is returned.
- *
+ *
* @param <A> The type to which this bundle is to be adapted.
* @param type Class object for the type to which this bundle is to be
* adapted.
@@ -1221,18 +1220,18 @@ public interface Bundle extends Comparable<Bundle> {
* provided for this bundle by the Framework. This method will return
* {@code null} if the platform does not have file system support or this
* bundle is a fragment bundle.
- *
+ *
* <p>
* A {@code File} object for the base directory of the persistent storage
* area provided for this bundle by the Framework can be obtained by calling
* this method with an empty string as {@code filename}.
- *
+ *
* <p>
* If the Java Runtime Environment supports permissions, the Framework will
* ensure that this bundle has the {@code java.io.FilePermission} with
* actions {@code read},{@code write},{@code delete} for all files
* (recursively) in the persistent storage area provided for this bundle.
- *
+ *
* @param filename A relative name to the file to be accessed.
* @return A {@code File} object that represents the requested file or
* {@code null} if the platform does not have file system support or
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
index 1b73057bd..f5b2debe0 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,20 +19,19 @@ package org.osgi.framework;
/**
* Customizes the starting and stopping of a bundle.
* <p>
- * {@code BundleActivator} is an interface that may be implemented when a
- * bundle is started or stopped. The Framework can create instances of a
- * bundle's {@code BundleActivator} as required. If an instance's
- * {@code BundleActivator.start} method executes successfully, it is
- * guaranteed that the same instance's {@code BundleActivator.stop}
- * method will be called when the bundle is to be stopped. The Framework must
- * not concurrently call a {@code BundleActivator} object.
+ * {@code BundleActivator} is an interface that may be implemented when a bundle
+ * is started or stopped. The Framework can create instances of a bundle's
+ * {@code BundleActivator} as required. If an instance's
+ * {@code BundleActivator.start} method executes successfully, it is guaranteed
+ * that the same instance's {@code BundleActivator.stop} method will be called
+ * when the bundle is to be stopped. The Framework must not concurrently call a
+ * {@code BundleActivator} object.
*
* <p>
- * {@code BundleActivator} is specified through the
- * {@code Bundle-Activator} Manifest header. A bundle can only specify a
- * single {@code BundleActivator} in the Manifest file. Fragment bundles
- * must not have a {@code BundleActivator}. The form of the Manifest
- * header is:
+ * {@code BundleActivator} is specified through the {@code Bundle-Activator}
+ * Manifest header. A bundle can only specify a single {@code BundleActivator}
+ * in the Manifest file. Fragment bundles must not have a
+ * {@code BundleActivator}. The form of the Manifest header is:
*
* <p>
* {@code Bundle-Activator: <i>class-name</i>}
@@ -40,9 +39,9 @@ package org.osgi.framework;
* <p>
* where {@code <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()}.
+ * 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$
@@ -59,29 +58,29 @@ public interface BundleActivator {
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being started.
- * @throws Exception If this method throws an exception, this
- * bundle is marked as stopped and the Framework will remove this
- * bundle's listeners, unregister all services registered by this
- * bundle, and release all services used by this bundle.
+ * @throws Exception If this method throws an exception, this bundle is
+ * marked as stopped and the Framework will remove this bundle's
+ * listeners, unregister all services registered by this bundle, and
+ * release all services used by this bundle.
*/
public void start(BundleContext context) throws Exception;
/**
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle. In general, this
- * method should undo the work that the {@code BundleActivator.start}
- * method started. There should be no active threads that were started by
- * this bundle when this bundle returns. A stopped bundle must not call any
+ * method should undo the work that the {@code BundleActivator.start} method
+ * started. There should be no active threads that were started by this
+ * bundle when this bundle returns. A stopped bundle must not call any
* Framework objects.
*
* <p>
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being stopped.
- * @throws Exception If this method throws an exception, the
- * bundle is still marked as stopped, and the Framework will remove
- * the bundle's listeners, unregister all services registered by the
- * bundle, and release all services used by the bundle.
+ * @throws Exception If this method throws an exception, the bundle is still
+ * marked as stopped, and the Framework will remove the bundle's
+ * listeners, unregister all services registered by the bundle, and
+ * release all services used by the bundle.
*/
public void stop(BundleContext context) throws Exception;
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
index b51aaae4a..4f166fd27 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -175,8 +175,7 @@ public interface BundleContext extends BundleReference {
* Runtime Environment supports permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- Bundle installBundle(String location, InputStream input)
- throws BundleException;
+ Bundle installBundle(String location, InputStream input) throws BundleException;
/**
* Installs a bundle from the specified {@code location} identifier.
@@ -270,8 +269,7 @@ public interface BundleContext extends BundleReference {
* @see ServiceListener
* @see ServicePermission
*/
- void addServiceListener(ServiceListener listener, String filter)
- throws InvalidSyntaxException;
+ void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException;
/**
* Adds the specified {@code ServiceListener} object to the context bundle's
@@ -437,8 +435,7 @@ public interface BundleContext extends BundleReference {
* @see ServiceRegistration
* @see ServiceFactory
*/
- ServiceRegistration< ? > registerService(String[] clazzes, Object service,
- Dictionary<String, ? > properties);
+ ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties);
/**
* Registers the specified service object with the specified properties
@@ -461,8 +458,7 @@ public interface BundleContext extends BundleReference {
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #registerService(String[], Object, Dictionary)
*/
- ServiceRegistration< ? > registerService(String clazz, Object service,
- Dictionary<String, ? > properties);
+ ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties);
/**
* Registers the specified service object with the specified properties
@@ -484,8 +480,7 @@ public interface BundleContext extends BundleReference {
* @see #registerService(String, Object, Dictionary)
* @since 1.6
*/
- <S> ServiceRegistration<S> registerService(Class<S> clazz, S service,
- Dictionary<String, ? > properties);
+ <S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties);
/**
* Returns an array of {@code ServiceReference} objects. The returned array
@@ -539,8 +534,7 @@ public interface BundleContext extends BundleReference {
* an invalid filter expression that cannot be parsed.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- ServiceReference< ? >[] getServiceReferences(String clazz, String filter)
- throws InvalidSyntaxException;
+ ServiceReference<?>[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
/**
* Returns an array of {@code ServiceReference} objects. The returned array
@@ -589,8 +583,7 @@ public interface BundleContext extends BundleReference {
* @throws IllegalStateException If this BundleContext is no longer valid.
* @since 1.3
*/
- ServiceReference< ? >[] getAllServiceReferences(String clazz, String filter)
- throws InvalidSyntaxException;
+ ServiceReference<?>[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
/**
* Returns a {@code ServiceReference} object for a service that implements
@@ -623,7 +616,7 @@ public interface BundleContext extends BundleReference {
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #getServiceReferences(String, String)
*/
- ServiceReference< ? > getServiceReference(String clazz);
+ ServiceReference<?> getServiceReference(String clazz);
/**
* Returns a {@code ServiceReference} object for a service that implements
@@ -711,8 +704,7 @@ public interface BundleContext extends BundleReference {
* @throws IllegalStateException If this BundleContext is no longer valid.
* @since 1.6
*/
- <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
- String filter) throws InvalidSyntaxException;
+ <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) throws InvalidSyntaxException;
/**
* Returns the service object referenced by the specified
@@ -813,7 +805,7 @@ public interface BundleContext extends BundleReference {
* @see #getService(ServiceReference)
* @see ServiceFactory
*/
- boolean ungetService(ServiceReference< ? > reference);
+ boolean ungetService(ServiceReference<?> reference);
/**
* Creates a {@code File} object for a file in the persistent storage area
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
index 30ed6fc36..9e2102212 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@ import java.util.EventObject;
* An event from the Framework describing a bundle lifecycle change.
* <p>
* {@code BundleEvent} objects are delivered to
- * {@code SynchronousBundleListener}s and {@code BundleListener}s
- * when a change occurs in a bundle's lifecycle. A type code is used to identify
- * the event type for future extendability.
+ * {@code SynchronousBundleListener}s and {@code BundleListener}s when a change
+ * occurs in a bundle's lifecycle. A type code is used to identify the event
+ * type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
@@ -57,9 +57,9 @@ public class BundleEvent extends EventObject {
/**
* The bundle has been started.
* <p>
- * The bundle's
- * {@link BundleActivator#start(BundleContext) BundleActivator start} method
- * has been executed if the bundle has a bundle activator class.
+ * The bundle's {@link BundleActivator#start(BundleContext) BundleActivator
+ * start} method has been executed if the bundle has a bundle activator
+ * class.
*
* @see Bundle#start()
*/
@@ -68,9 +68,9 @@ public class BundleEvent extends EventObject {
/**
* The bundle has been stopped.
* <p>
- * The bundle's
- * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
- * has been executed if the bundle has a bundle activator class.
+ * The bundle's {@link BundleActivator#stop(BundleContext) BundleActivator
+ * stop} method has been executed if the bundle has a bundle activator
+ * class.
*
* @see Bundle#stop()
*/
@@ -109,11 +109,10 @@ public class BundleEvent extends EventObject {
/**
* The bundle is about to be activated.
* <p>
- * The bundle's
- * {@link BundleActivator#start(BundleContext) BundleActivator start} method
- * is about to be called if the bundle has a bundle activator class. This
- * event is only delivered to {@link SynchronousBundleListener}s. It is not
- * delivered to {@code BundleListener}s.
+ * The bundle's {@link BundleActivator#start(BundleContext) BundleActivator
+ * start} method is about to be called if the bundle has a bundle activator
+ * class. This event is only delivered to {@link SynchronousBundleListener}
+ * s. It is not delivered to {@code BundleListener}s.
*
* @see Bundle#start()
* @since 1.3
@@ -123,11 +122,10 @@ public class BundleEvent extends EventObject {
/**
* The bundle is about to deactivated.
* <p>
- * The bundle's
- * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
- * is about to be called if the bundle has a bundle activator class. This
- * event is only delivered to {@link SynchronousBundleListener}s. It is not
- * delivered to {@code BundleListener}s.
+ * The bundle's {@link BundleActivator#stop(BundleContext) BundleActivator
+ * stop} method is about to be called if the bundle has a bundle activator
+ * class. This event is only delivered to {@link SynchronousBundleListener}
+ * s. It is not delivered to {@code BundleListener}s.
*
* @see Bundle#stop()
* @since 1.3
@@ -138,10 +136,9 @@ public class BundleEvent extends EventObject {
* The bundle will be lazily activated.
* <p>
* The bundle has a {@link Constants#ACTIVATION_LAZY lazy activation policy}
- * and is waiting to be activated. It is now in the
- * {@link Bundle#STARTING STARTING} state and has a valid
- * {@code BundleContext}. This event is only delivered to
- * {@link SynchronousBundleListener}s. It is not delivered to
+ * and is waiting to be activated. It is now in the {@link Bundle#STARTING
+ * STARTING} state and has a valid {@code BundleContext}. This event is only
+ * delivered to {@link SynchronousBundleListener}s. It is not delivered to
* {@code BundleListener}s.
*
* @since 1.4
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
index dfd1f76ca..0c97ed269 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@ package org.osgi.framework;
* occurred.
*
* <p>
- * A {@code BundleException} object is created by the Framework to denote
- * an exception condition in the lifecycle of a bundle.
- * {@code BundleException}s should not be created by bundle developers.
- * A type code is used to identify the exception type for future extendability.
+ * A {@code BundleException} object is created by the Framework to denote an
+ * exception condition in the lifecycle of a bundle. {@code BundleException}s
+ * should not be created by bundle developers. A type code is used to identify
+ * the exception type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
@@ -51,7 +51,7 @@ public class BundleException extends Exception {
*/
public static final int UNSPECIFIED = 0;
/**
- * The operation was unsupported. This type can be used anywhere a
+ * The operation was unsupported. This type can be used anywhere a
* BundleException can be thrown.
*
* @since 1.5
@@ -112,8 +112,8 @@ public class BundleException extends Exception {
* @since 1.5
*/
public static final int DUPLICATE_BUNDLE_ERROR = 9;
-
- /**
+
+ /**
* The start transient operation failed because the start level of the
* bundle is greater than the current framework start level
*
@@ -157,8 +157,8 @@ public class BundleException extends Exception {
}
/**
- * Creates a {@code BundleException} with the specified message, type
- * and exception cause.
+ * Creates a {@code BundleException} with the specified message, type and
+ * exception cause.
*
* @param msg The associated message.
* @param type The type for this exception.
@@ -171,8 +171,7 @@ public class BundleException extends Exception {
}
/**
- * Creates a {@code BundleException} with the specified message and
- * type.
+ * Creates a {@code BundleException} with the specified message and type.
*
* @param msg The message.
* @param type The type for this exception.
@@ -189,8 +188,8 @@ public class BundleException extends Exception {
*
* <p>
* This method predates the general purpose exception chaining mechanism.
- * The {@code getCause()} method is now the preferred means of
- * obtaining this information.
+ * The {@code getCause()} method is now the preferred means of obtaining
+ * this information.
*
* @return The result of calling {@code getCause()}.
*/
@@ -199,11 +198,9 @@ public class BundleException extends Exception {
}
/**
- * Returns the cause of this exception or {@code null} if no cause was
- * set.
+ * Returns the cause of this exception or {@code null} if no cause was set.
*
- * @return The cause of this exception or {@code null} if no cause was
- * set.
+ * @return The cause of this exception or {@code null} if no cause was set.
* @since 1.3
*/
public Throwable getCause() {
@@ -226,8 +223,8 @@ public class BundleException extends Exception {
}
/**
- * Returns the type for this exception or {@code UNSPECIFIED} if the
- * type was unspecified or unknown.
+ * Returns the type for this exception or {@code UNSPECIFIED} if the type
+ * was unspecified or unknown.
*
* @return The type of this exception.
* @since 1.5
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
index d30c9c987..ccba905e3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -52,9 +52,9 @@ import java.util.Map;
* </pre>
*
* <p>
- * {@code BundlePermission} has four actions: {@code provide},
- * {@code require},{@code host}, and {@code fragment}. The
- * {@code provide} action implies the {@code require} action.
+ * {@code BundlePermission} has four actions: {@code provide}, {@code require},
+ * {@code host}, and {@code fragment}. The {@code provide} action implies the
+ * {@code require} action.
*
* @since 1.3
* @ThreadSafe
@@ -66,14 +66,14 @@ public final class BundlePermission extends BasicPermission {
private static final long serialVersionUID = 3257846601685873716L;
/**
- * The action string {@code provide}. The {@code provide} action
- * implies the {@code require} action.
+ * The action string {@code provide}. The {@code provide} action implies the
+ * {@code require} action.
*/
public final static String PROVIDE = "provide";
/**
- * The action string {@code require}. The {@code require} action
- * is implied by the {@code provide} action.
+ * The action string {@code require}. The {@code require} action is implied
+ * by the {@code provide} action.
*/
public final static String REQUIRE = "require";
@@ -91,10 +91,7 @@ public final class BundlePermission extends BasicPermission {
private final static int ACTION_REQUIRE = 0x00000002;
private final static int ACTION_HOST = 0x00000004;
private final static int ACTION_FRAGMENT = 0x00000008;
- private final static int ACTION_ALL = ACTION_PROVIDE
- | ACTION_REQUIRE
- | ACTION_HOST
- | ACTION_FRAGMENT;
+ private final static int ACTION_ALL = ACTION_PROVIDE | ACTION_REQUIRE | ACTION_HOST | ACTION_FRAGMENT;
final static int ACTION_NONE = 0;
/**
* The actions mask.
@@ -115,14 +112,14 @@ public final class BundlePermission extends BasicPermission {
* Bundle Permissions are granted over all possible versions of a bundle.
*
* A bundle that needs to provide a bundle must have the appropriate
- * {@code BundlePermission} for the symbolic name; a bundle that
- * requires a bundle must have the appropriate {@code BundlePermssion}
- * for that symbolic name; a bundle that specifies a fragment host must have
- * the appropriate {@code BundlePermission} for that symbolic name.
+ * {@code BundlePermission} for the symbolic name; a bundle that requires a
+ * bundle must have the appropriate {@code BundlePermssion} for that
+ * symbolic name; a bundle that specifies a fragment host must have the
+ * appropriate {@code BundlePermission} for that symbolic name.
*
* @param symbolicName The bundle symbolic name.
- * @param actions {@code provide},{@code require},
- * {@code host},{@code fragment} (canonical order).
+ * @param actions {@code provide},{@code require}, {@code host},
+ * {@code fragment} (canonical order).
*/
public BundlePermission(String symbolicName, String actions) {
this(symbolicName, parseActions(actions));
@@ -188,9 +185,7 @@ public final class BundlePermission extends BasicPermission {
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -205,8 +200,7 @@ public final class BundlePermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_PROVIDE | ACTION_REQUIRE;
- }
- else
+ } else
if (i >= 6 && (a[i - 6] == 'r' || a[i - 6] == 'R')
&& (a[i - 5] == 'e' || a[i - 5] == 'E')
&& (a[i - 4] == 'q' || a[i - 4] == 'Q')
@@ -216,16 +210,14 @@ public final class BundlePermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_REQUIRE;
- }
- else
+ } else
if (i >= 3 && (a[i - 3] == 'h' || a[i - 3] == 'H')
&& (a[i - 2] == 'o' || a[i - 2] == 'O')
&& (a[i - 1] == 's' || a[i - 1] == 'S')
&& (a[i] == 't' || a[i] == 'T')) {
matchlen = 4;
mask |= ACTION_HOST;
- }
- else
+ } else
if (i >= 7 && (a[i - 7] == 'f' || a[i - 7] == 'F')
&& (a[i - 6] == 'r' || a[i - 6] == 'R')
&& (a[i - 5] == 'a' || a[i - 5] == 'A')
@@ -236,11 +228,9 @@ public final class BundlePermission extends BasicPermission {
&& (a[i] == 't' || a[i] == 'T')) {
matchlen = 8;
mask |= ACTION_FRAGMENT;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
// make sure we didn't just match the tail of a word
@@ -258,8 +248,7 @@ public final class BundlePermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -295,8 +284,8 @@ public final class BundlePermission extends BasicPermission {
* </pre>
*
* @param p The requested permission.
- * @return {@code true} if the specified {@code BundlePermission}
- * action is implied by this object; {@code false} otherwise.
+ * @return {@code true} if the specified {@code BundlePermission} action is
+ * implied by this object; {@code false} otherwise.
*/
public boolean implies(Permission p) {
if (!(p instanceof BundlePermission)) {
@@ -306,8 +295,7 @@ public final class BundlePermission extends BasicPermission {
final int effective = getActionsMask();
final int desired = requested.getActionsMask();
- return ((effective & desired) == desired)
- && super.implies(requested);
+ return ((effective & desired) == desired) && super.implies(requested);
}
/**
@@ -315,9 +303,8 @@ public final class BundlePermission extends BasicPermission {
* {@code BundlePermission} actions.
*
* <p>
- * Always returns present {@code BundlePermission} actions in the
- * following order: {@code provide}, {@code require},
- * {@code host}, {@code fragment}.
+ * Always returns present {@code BundlePermission} actions in the following
+ * order: {@code provide}, {@code require}, {@code host}, {@code fragment}.
*
* @return Canonical string representation of the {@code BundlePermission
* } actions.
@@ -359,8 +346,8 @@ public final class BundlePermission extends BasicPermission {
}
/**
- * Returns a new {@code PermissionCollection} object suitable for
- * storing {@code BundlePermission} objects.
+ * Returns a new {@code PermissionCollection} object suitable for storing
+ * {@code BundlePermission} objects.
*
* @return A new {@code PermissionCollection} object.
*/
@@ -377,10 +364,9 @@ public final class BundlePermission extends BasicPermission {
*
* @param obj The object to test for equality with this
* {@code BundlePermission} object.
- * @return {@code true} if {@code obj} is a
- * {@code BundlePermission}, and has the same bundle symbolic
- * name and actions as this {@code BundlePermission} object;
- * {@code false} otherwise.
+ * @return {@code true} if {@code obj} is a {@code BundlePermission}, and
+ * has the same bundle symbolic name and actions as this
+ * {@code BundlePermission} object; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -393,8 +379,7 @@ public final class BundlePermission extends BasicPermission {
BundlePermission bp = (BundlePermission) obj;
- return (getActionsMask() == bp.getActionsMask())
- && getName().equals(bp.getName());
+ return (getActionsMask() == bp.getActionsMask()) && getName().equals(bp.getName());
}
/**
@@ -409,12 +394,11 @@ public final class BundlePermission extends BasicPermission {
}
/**
- * WriteObject is called to save the state of the
- * {@code BundlePermission} object to a stream. The actions are
- * serialized, and the superclass takes care of the name.
+ * WriteObject is called to save the state of the {@code BundlePermission}
+ * object to a stream. The actions are serialized, and the superclass takes
+ * care of the name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
// Write out the actions. The superclass takes care of the name
// call getActions to make sure actions field is initialized
if (actions == null)
@@ -426,8 +410,7 @@ public final class BundlePermission extends BasicPermission {
* readObject is called to restore the state of the BundlePermission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(parseActions(actions));
@@ -443,7 +426,7 @@ public final class BundlePermission extends BasicPermission {
*/
final class BundlePermissionCollection extends PermissionCollection {
- private static final long serialVersionUID = 3258407326846433079L;
+ private static final long serialVersionUID = 3258407326846433079L;
/**
* Table of permissions.
@@ -458,7 +441,7 @@ final class BundlePermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private boolean all_allowed;
+ private boolean all_allowed;
/**
* Create an empty BundlePermissions object.
@@ -480,12 +463,10 @@ final class BundlePermissionCollection extends PermissionCollection {
*/
public void add(final Permission permission) {
if (!(permission instanceof BundlePermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final BundlePermission bp = (BundlePermission) permission;
final String name = bp.getName();
@@ -496,12 +477,10 @@ final class BundlePermissionCollection extends PermissionCollection {
final int oldMask = existing.getActionsMask();
final int newMask = bp.getActionsMask();
if (oldMask != newMask) {
- pc.put(name, new BundlePermission(name, oldMask
- | newMask));
+ pc.put(name, new BundlePermission(name, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, bp);
}
@@ -518,8 +497,8 @@ final class BundlePermissionCollection extends PermissionCollection {
*
* @param permission The Permission object to compare with this
* {@code BundlePermission} object.
- * @return {@code true} if {@code permission} is a proper subset
- * of a permission in the set; {@code false} otherwise.
+ * @return {@code true} if {@code permission} is a proper subset of a
+ * permission in the set; {@code false} otherwise.
*/
public boolean implies(final Permission permission) {
if (!(permission instanceof BundlePermission)) {
@@ -575,8 +554,8 @@ final class BundlePermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all {@code BundlePermission} objects in
- * the container.
+ * Returns an enumeration of all {@code BundlePermission} objects in the
+ * container.
*
* @return Enumeration of all {@code BundlePermission} objects.
*/
@@ -584,27 +563,21 @@ final class BundlePermissionCollection extends PermissionCollection {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
}
-
+
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE) };
-
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
- Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(
- permissions);
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
+
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+ Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields
- .get("permissions", null);
+ 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/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
index f65f518fc..b17bcaec9 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
@@ -64,8 +64,7 @@ public final class CapabilityPermission extends BasicPermission {
private final static int ACTION_REQUIRE = 0x00000001;
private final static int ACTION_PROVIDE = 0x00000002;
- private final static int ACTION_ALL = ACTION_REQUIRE
- | ACTION_PROVIDE;
+ private final static int ACTION_ALL = ACTION_REQUIRE | ACTION_PROVIDE;
final static int ACTION_NONE = 0;
/**
@@ -156,10 +155,8 @@ public final class CapabilityPermission extends BasicPermission {
*/
public CapabilityPermission(String name, String actions) {
this(name, parseActions(actions));
- if ((this.filter != null)
- && ((action_mask & ACTION_ALL) != ACTION_REQUIRE)) {
- throw new IllegalArgumentException(
- "invalid action string for filter expression");
+ if ((this.filter != null) && ((action_mask & ACTION_ALL) != ACTION_REQUIRE)) {
+ throw new IllegalArgumentException("invalid action string for filter expression");
}
}
@@ -178,8 +175,7 @@ public final class CapabilityPermission extends BasicPermission {
* {@code require} or attributes or providingBundle are {@code null}
* .
*/
- public CapabilityPermission(String namespace, Map<String, ? > attributes,
- Bundle providingBundle, String actions) {
+ public CapabilityPermission(String namespace, Map<String, ?> attributes, Bundle providingBundle, String actions) {
super(namespace);
setTransients(namespace, parseActions(actions));
if (attributes == null) {
@@ -246,9 +242,7 @@ public final class CapabilityPermission extends BasicPermission {
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -263,8 +257,7 @@ public final class CapabilityPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_REQUIRE;
- }
- else
+ } else
if (i >= 6 && (a[i - 6] == 'p' || a[i - 6] == 'P')
&& (a[i - 5] == 'r' || a[i - 5] == 'R')
&& (a[i - 4] == 'o' || a[i - 4] == 'O')
@@ -274,11 +267,9 @@ public final class CapabilityPermission extends BasicPermission {
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_PROVIDE;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException("invalid permission: "
- + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
// make sure we didn't just match the tail of a word
@@ -296,8 +287,7 @@ public final class CapabilityPermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -329,10 +319,8 @@ public final class CapabilityPermission extends BasicPermission {
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -451,12 +439,8 @@ public final class CapabilityPermission extends BasicPermission {
CapabilityPermission cp = (CapabilityPermission) obj;
- return (action_mask == cp.action_mask)
- && getName().equals(cp.getName())
- && ((attributes == cp.attributes) || ((attributes != null) && (attributes
- .equals(cp.attributes))))
- && ((bundle == cp.bundle) || ((bundle != null) && bundle
- .equals(cp.bundle)));
+ return (action_mask == cp.action_mask) && getName().equals(cp.getName()) && ((attributes == cp.attributes) || ((attributes != null) && (attributes.equals(cp.attributes))))
+ && ((bundle == cp.bundle) || ((bundle != null) && bundle.equals(cp.bundle)));
}
/**
@@ -480,8 +464,7 @@ public final class CapabilityPermission extends BasicPermission {
* WriteObject is called to save the state of this permission to a stream.
* The actions are serialized, and the superclass takes care of the name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -496,8 +479,7 @@ public final class CapabilityPermission extends BasicPermission {
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(getName(), parseActions(actions));
@@ -543,8 +525,7 @@ public final class CapabilityPermission extends BasicPermission {
private final Map<String, Object> attributes;
private transient volatile Set<Map.Entry<String, Object>> entries;
- Properties(Map<String, Object> properties,
- Map<String, Object> attributes) {
+ Properties(Map<String, Object> properties, Map<String, Object> attributes) {
this.properties = properties;
this.attributes = attributes;
entries = null;
@@ -569,8 +550,7 @@ public final class CapabilityPermission extends BasicPermission {
if (entries != null) {
return entries;
}
- Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(
- attributes.size() + properties.size());
+ Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(attributes.size() + properties.size());
all.addAll(attributes.entrySet());
all.addAll(properties.entrySet());
return entries = Collections.unmodifiableSet(all);
@@ -631,18 +611,15 @@ final class CapabilityPermissionCollection extends PermissionCollection {
*/
public void add(final Permission permission) {
if (!(permission instanceof CapabilityPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final CapabilityPermission cp = (CapabilityPermission) permission;
if (cp.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + cp);
+ throw new IllegalArgumentException("cannot add to collection: " + cp);
}
final String name = cp.getName();
@@ -655,8 +632,7 @@ final class CapabilityPermissionCollection extends PermissionCollection {
if (pc == null) {
filterPermissions = pc = new HashMap<String, CapabilityPermission>();
}
- }
- else {
+ } else {
pc = permissions;
}
final CapabilityPermission existing = pc.get(name);
@@ -665,11 +641,9 @@ final class CapabilityPermissionCollection extends PermissionCollection {
final int oldMask = existing.action_mask;
final int newMask = cp.action_mask;
if (oldMask != newMask) {
- pc.put(name, new CapabilityPermission(name, oldMask
- | newMask));
+ pc.put(name, new CapabilityPermission(name, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, cp);
}
@@ -779,13 +753,10 @@ final class CapabilityPermissionCollection extends PermissionCollection {
}
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", HashMap.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE),
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", HashMap.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
new ObjectStreamField("filterPermissions", HashMap.class) };
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", permissions);
pfields.put("all_allowed", all_allowed);
@@ -793,15 +764,12 @@ final class CapabilityPermissionCollection extends PermissionCollection {
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- HashMap<String, CapabilityPermission> p = (HashMap<String, CapabilityPermission>) gfields
- .get("permissions", null);
+ HashMap<String, CapabilityPermission> p = (HashMap<String, CapabilityPermission>) gfields.get("permissions", null);
permissions = p;
all_allowed = gfields.get("all_allowed", false);
- HashMap<String, CapabilityPermission> fp = (HashMap<String, CapabilityPermission>) gfields
- .get("filterPermissions", null);
+ HashMap<String, CapabilityPermission> fp = (HashMap<String, CapabilityPermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
index 29705c0c2..1018601ae 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,9 +42,8 @@ public interface Configurable {
* returning the configuration object.
*
* @return The configuration object for this service.
- * @throws SecurityException If the caller does not have an
- * appropriate permission and the Java Runtime Environment supports
- * permissions.
+ * @throws SecurityException If the caller does not have an appropriate
+ * permission and the Java Runtime Environment supports permissions.
* @deprecated As of 1.2. Please use Configuration Admin service.
*/
public Object getConfigurationObject();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
index 743270de7..807a04ac0 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework;
import java.util.Dictionary;
@@ -56,7 +57,7 @@ public interface Filter {
* @return {@code true} if the service's properties match this
* {@code Filter}; {@code false} otherwise.
*/
- boolean match(ServiceReference< ? > reference);
+ boolean match(ServiceReference<?> reference);
/**
* Filter using a {@code Dictionary} with case insensitive key lookup. This
@@ -70,7 +71,7 @@ public interface Filter {
* @throws IllegalArgumentException If {@code dictionary} contains case
* variants of the same key name.
*/
- boolean match(Dictionary<String, ? > dictionary);
+ boolean match(Dictionary<String, ?> dictionary);
/**
* Returns this {@code Filter}'s filter string.
@@ -90,9 +91,8 @@ public interface Filter {
* {@code this.toString().equals(obj.toString())}.
*
* @param obj The object to compare against this {@code Filter}.
- * @return If the other object is a {@code Filter} object, then returns
- * the result of calling
- * {@code this.toString().equals(obj.toString())};
+ * @return If the other object is a {@code Filter} object, then returns the
+ * result of calling {@code this.toString().equals(obj.toString())};
* {@code false} otherwise.
*/
boolean equals(Object obj);
@@ -119,7 +119,7 @@ public interface Filter {
* filter; {@code false} otherwise.
* @since 1.3
*/
- boolean matchCase(Dictionary<String, ? > dictionary);
+ boolean matchCase(Dictionary<String, ?> dictionary);
/**
* Filter using a {@code Map}. This {@code Filter} is executed using the
@@ -133,5 +133,5 @@ public interface Filter {
* {@code false} otherwise.
* @since 1.6
*/
- boolean matches(Map<String, ? > map);
+ boolean matches(Map<String, ?> map);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
index 4182bd635..f679c7581 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework;
import java.util.EventObject;
-
import org.osgi.framework.startlevel.FrameworkStartLevel;
import org.osgi.framework.wiring.FrameworkWiring;
@@ -25,10 +24,9 @@ import org.osgi.framework.wiring.FrameworkWiring;
* A general event from the Framework.
*
* <p>
- * {@code FrameworkEvent} objects are delivered to
- * {@code FrameworkListener}s when a general event occurs within the OSGi
- * environment. A type code is used to identify the event type for future
- * extendability.
+ * {@code FrameworkEvent} objects are delivered to {@code FrameworkListener}s
+ * when a general event occurs within the OSGi environment. A type code is used
+ * to identify the event type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of event types.
@@ -191,8 +189,8 @@ public class FrameworkEvent extends EventObject {
*
* @param type The event type.
* @param bundle The event source.
- * @param throwable The related exception. This argument may be
- * {@code null} if there is no related exception.
+ * @param throwable The related exception. This argument may be {@code null}
+ * if there is no related exception.
*/
public FrameworkEvent(int type, Bundle bundle, Throwable throwable) {
super(bundle);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
index 4e665ff58..b2a9c9607 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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.
@@ -32,16 +32,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.security.auth.x500.X500Principal;
/**
* Framework Utility class.
- *
+ *
* <p>
* This class contains utility methods which access Framework functions that may
* be useful to bundles.
- *
+ *
* @since 1.3
* @ThreadSafe
* @version $Id$
@@ -55,29 +54,28 @@ public class FrameworkUtil {
}
/**
- * Creates a {@code Filter} object. This {@code Filter} object may
- * be used to match a {@code ServiceReference} object or a
- * {@code Dictionary} object.
- *
+ * Creates a {@code Filter} object. This {@code Filter} object may be used
+ * to match a {@code ServiceReference} object or a {@code Dictionary}
+ * object.
+ *
* <p>
* If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
* thrown with a human readable message where the filter became unparsable.
- *
+ *
* <p>
* This method returns a Filter implementation which may not perform as well
* as the framework implementation-specific Filter implementation returned
* by {@link BundleContext#createFilter(String)}.
- *
+ *
* @param filter The filter string.
* @return A {@code Filter} object encapsulating the filter string.
* @throws InvalidSyntaxException If {@code filter} contains an invalid
* filter string that cannot be parsed.
* @throws NullPointerException If {@code filter} is null.
- *
+ *
* @see Filter
*/
- public static Filter createFilter(String filter)
- throws InvalidSyntaxException {
+ public static Filter createFilter(String filter) throws InvalidSyntaxException {
return FilterImpl.newInstance(filter);
}
@@ -94,13 +92,13 @@ public class FrameworkUtil {
* ignored, except in values.
* <p>
* The format of a wildcard match pattern is:
- *
+ *
* <pre>
- * matchPattern ::= dn-match ( ';' dn-match ) *
- * dn-match ::= ( '*' | rdn-match ) ( ',' rdn-match ) * | '-'
- * rdn-match ::= name '=' value-match
- * value-match ::= '*' | value-star
- * value-star ::= &lt; value, requires escaped '*' and '-' &gt;
+ * matchPattern ::= dn-match ( ';' dn-match ) *
+ * dn-match ::= ( '*' | rdn-match ) ( ',' rdn-match ) * | '-'
+ * rdn-match ::= name '=' value-match
+ * value-match ::= '*' | value-star
+ * value-star ::= &lt; value, requires escaped '*' and '-' &gt;
* </pre>
* <p>
* The most simple case is a single wildcard; it must match any DN. A
@@ -109,13 +107,13 @@ public class FrameworkUtil {
* <p>
* For example, a match pattern with a wildcard that matches all DNs that
* end with RDNs of o=ACME and c=US would look like this:
- *
+ *
* <pre>
* *, o=ACME, c=US
* </pre>
- *
+ *
* This match pattern would match the following DNs:
- *
+ *
* <pre>
* cn = Bugs Bunny, o = ACME, c = US
* ou = Carrots, cn=Daffy Duck, o=ACME, c=US
@@ -123,37 +121,37 @@ public class FrameworkUtil {
* dc=www, dc=acme, dc=com, o=ACME, c=US
* o=ACME, c=US
* </pre>
- *
+ *
* The following DNs would not match:
- *
+ *
* <pre>
* street = 9C\, Avenue St. Drézéry, o=ACME, c=FR
* dc=www, dc=acme, dc=com, c=US
* </pre>
- *
+ *
* If a wildcard is used for a value of an RDN, the value must be exactly *.
* The wildcard must match any value, and no substring matching must be
* done. For example:
- *
+ *
* <pre>
* cn=*,o=ACME,c=*
* </pre>
- *
+ *
* This match pattern with wildcard must match the following DNs:
- *
+ *
* <pre>
* cn=Bugs Bunny,o=ACME,c=US
* cn = Daffy Duck , o = ACME , c = US
* cn=Road Runner, o=ACME, c=NL
* </pre>
- *
+ *
* But not:
- *
+ *
* <pre>
* o=ACME, c=NL
* dc=acme.com, cn=Bugs Bunny, o=ACME, c=US
* </pre>
- *
+ *
* <p>
* A match pattern may contain a chain of DN match patterns. The
* semicolon(';' &#92;u003B) must be used to separate DN match patterns in a
@@ -163,7 +161,7 @@ public class FrameworkUtil {
* The following example matches a certificate signed by Tweety Inc. in the
* US.
* </p>
- *
+ *
* <pre>
* * ; ou=S &amp; V, o=Tweety Inc., c=US
* </pre>
@@ -174,11 +172,11 @@ public class FrameworkUtil {
* represents a single DN. For example, to match a DN where the Tweety Inc.
* is in the DN chain, use the following expression:
* </p>
- *
+ *
* <pre>
* - ; *, o=Tweety Inc., c=US
* </pre>
- *
+ *
* @param matchPattern The pattern against which to match the DN chain.
* @param dnChain The DN chain to match against the specified pattern. Each
* element of the chain must be of type {@code String} and use the
@@ -190,8 +188,7 @@ public class FrameworkUtil {
* chain is invalid.
* @since 1.5
*/
- public static boolean matchDistinguishedNameChain(String matchPattern,
- List<String> dnChain) {
+ public static boolean matchDistinguishedNameChain(String matchPattern, List<String> dnChain) {
return DNChainMatching.match(matchPattern, dnChain);
}
@@ -199,18 +196,16 @@ public class FrameworkUtil {
* Return a {@code Bundle} for the specified bundle class. The returned
* {@code Bundle} is the bundle associated with the bundle class loader
* which defined the specified class.
- *
+ *
* @param classFromBundle A class defined by a bundle class loader.
- * @return A {@code Bundle} for the specified bundle class or
- * {@code null} if the specified class was not defined by a
- * bundle class loader.
+ * @return A {@code Bundle} for the specified bundle class or {@code null}
+ * if the specified class was not defined by a bundle class loader.
* @since 1.5
*/
- public static Bundle getBundle(final Class< ? > classFromBundle) {
+ public static Bundle getBundle(final Class<?> classFromBundle) {
// We use doPriv since the caller may not have permission
// to call getClassLoader.
- Object cl = AccessController
- .doPrivileged(new PrivilegedAction<Object>() {
+ Object cl = AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return classFromBundle.getClassLoader();
}
@@ -227,7 +222,7 @@ public class FrameworkUtil {
* constructor with the desired filter string. A Filter object can be called
* numerous times to determine if the match argument matches the filter
* string that was used to create the Filter object.
- *
+ *
* <p>
* The syntax of a filter string is the string representation of LDAP search
* filters as defined in RFC 1960: <i>A String Representation of LDAP Search
@@ -236,11 +231,11 @@ public class FrameworkUtil {
* Filters</i> (available at http://www.ietf.org/rfc/rfc2254.txt) supersedes
* RFC 1960 but only adds extensible matching and is not applicable for this
* API.
- *
+ *
* <p>
* The string representation of an LDAP search filter is defined by the
* following grammar. It uses a prefix format.
- *
+ *
* <pre>
* &lt;filter&gt; ::= '(' &lt;filtercomp&gt; ')'
* &lt;filtercomp&gt; ::= &lt;and&gt; | &lt;or&gt; | &lt;not&gt; | &lt;item&gt;
@@ -262,41 +257,41 @@ public class FrameworkUtil {
* &lt;starval&gt; ::= NULL | &lt;value&gt; '*' &lt;starval&gt;
* &lt;final&gt; ::= NULL | &lt;value&gt;
* </pre>
- *
- * {@code &lt;attr&gt;} is a string representing an attribute, or key,
- * in the properties objects of the registered services. Attribute names are
+ *
+ * {@code &lt;attr&gt;} is a string representing an attribute, or key, in
+ * the properties objects of the registered services. Attribute names are
* not case sensitive; that is cn and CN both refer to the same attribute.
- * {@code &lt;value&gt;} is a string representing the value, or part of
- * one, of a key in the properties objects of the registered services. If a
- * {@code &lt;value&gt;} must contain one of the characters '
- * {@code *}' or '{@code (}' or '{@code )}', these characters
- * should be escaped by preceding them with the backslash '{@code \}'
- * character. Note that although both the {@code &lt;substring&gt;} and
- * {@code &lt;present&gt;} productions can produce the {@code 'attr=*'}
- * construct, this construct is used only to denote a presence filter.
- *
+ * {@code &lt;value&gt;} is a string representing the value, or part of one,
+ * of a key in the properties objects of the registered services. If a
+ * {@code &lt;value&gt;} must contain one of the characters ' {@code *}' or
+ * '{@code (}' or '{@code )}', these characters should be escaped by
+ * preceding them with the backslash '{@code \}' character. Note that
+ * although both the {@code &lt;substring&gt;} and {@code &lt;present&gt;}
+ * productions can produce the {@code 'attr=*'} construct, this construct is
+ * used only to denote a presence filter.
+ *
* <p>
* Examples of LDAP filters are:
- *
+ *
* <pre>
* &quot;(cn=Babs Jensen)&quot;
* &quot;(!(cn=Tim Howes))&quot;
* &quot;(&amp;(&quot; + Constants.OBJECTCLASS + &quot;=Person)(|(sn=Jensen)(cn=Babs J*)))&quot;
* &quot;(o=univ*of*mich*)&quot;
* </pre>
- *
+ *
* <p>
- * The approximate match ({@code ~=}) is implementation specific but
- * should at least ignore case and white space differences. Optional are
- * codes like soundex or other smart "closeness" comparisons.
- *
+ * The approximate match ({@code ~=}) is implementation specific but should
+ * at least ignore case and white space differences. Optional are codes like
+ * soundex or other smart "closeness" comparisons.
+ *
* <p>
* Comparison of values is not straightforward. Strings are compared
* differently than numbers and it is possible for a key to have multiple
* values. Note that that keys in the match argument must always be strings.
* The comparison is defined by the object type of the key's value. The
* following rules apply for comparison:
- *
+ *
* <blockquote>
* <TABLE BORDER=0>
* <TR>
@@ -329,17 +324,17 @@ public class FrameworkUtil {
* </TR>
* </TABLE>
* Note: arrays of primitives are also supported. </blockquote>
- *
+ *
* A filter matches a key that has multiple values if it matches at least
* one of those values. For example,
- *
+ *
* <pre>
* Dictionary d = new Hashtable();
* d.put(&quot;cn&quot;, new String[] {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;});
* </pre>
- *
+ *
* d will match {@code (cn=a)} and also {@code (cn=b)}
- *
+ *
* <p>
* A filter component that references a key having an unrecognizable data
* type will evaluate to {@code false} .
@@ -369,18 +364,17 @@ public class FrameworkUtil {
/**
* Constructs a {@link FilterImpl} object. This filter object may be
* used to match a {@link ServiceReference} or a Dictionary.
- *
+ *
* <p>
* If the filter cannot be parsed, an {@link InvalidSyntaxException}
* will be thrown with a human readable message where the filter became
* unparsable.
- *
+ *
* @param filterString the filter string.
* @throws InvalidSyntaxException If the filter parameter contains an
- * invalid filter string that cannot be parsed.
+ * invalid filter string that cannot be parsed.
*/
- static FilterImpl newInstance(String filterString)
- throws InvalidSyntaxException {
+ static FilterImpl newInstance(String filterString) throws InvalidSyntaxException {
return new Parser(filterString).parse();
}
@@ -397,13 +391,13 @@ public class FrameworkUtil {
* This {@code Filter} is executed using the keys and values of the
* referenced service's properties. The keys are looked up in a case
* insensitive manner.
- *
+ *
* @param reference The reference to the service whose properties are
* used in the match.
* @return {@code true} if the service's properties match this
* {@code Filter}; {@code false} otherwise.
*/
- public boolean match(ServiceReference< ? > reference) {
+ public boolean match(ServiceReference<?> reference) {
return matches(new ServiceReferenceMap(reference));
}
@@ -412,7 +406,7 @@ public class FrameworkUtil {
* This {@code Filter} is executed using the specified
* {@code Dictionary}'s keys and values. The keys are looked up in a
* case insensitive manner.
- *
+ *
* @param dictionary The {@code Dictionary} whose key/value pairs are
* used in the match.
* @return {@code true} if the {@code Dictionary}'s values match this
@@ -420,7 +414,7 @@ public class FrameworkUtil {
* @throws IllegalArgumentException If {@code dictionary} contains case
* variants of the same key name.
*/
- public boolean match(Dictionary<String, ? > dictionary) {
+ public boolean match(Dictionary<String, ?> dictionary) {
return matches(new CaseInsensitiveMap(dictionary));
}
@@ -428,14 +422,14 @@ public class FrameworkUtil {
* Filter using a {@code Dictionary}. This {@code Filter} is executed
* using the specified {@code Dictionary}'s keys and values. The keys
* are looked up in a normal manner respecting case.
- *
+ *
* @param dictionary The {@code Dictionary} whose key/value pairs are
* used in the match.
* @return {@code true} if the {@code Dictionary}'s values match this
* filter; {@code false} otherwise.
* @since 1.3
*/
- public boolean matchCase(Dictionary<String, ? > dictionary) {
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
switch (op) {
case AND : {
FilterImpl[] filters = (FilterImpl[]) value;
@@ -467,14 +461,12 @@ public class FrameworkUtil {
case GREATER :
case LESS :
case APPROX : {
- Object prop = (dictionary == null) ? null : dictionary
- .get(attr);
+ Object prop = (dictionary == null) ? null : dictionary.get(attr);
return compare(op, prop, value);
}
case PRESENT : {
- Object prop = (dictionary == null) ? null : dictionary
- .get(attr);
+ Object prop = (dictionary == null) ? null : dictionary.get(attr);
return prop != null;
}
}
@@ -486,7 +478,7 @@ public class FrameworkUtil {
* Filter using a {@code Map}. This {@code Filter} is executed using the
* specified {@code Map}'s keys and values. The keys are looked up in a
* normal manner respecting case.
- *
+ *
* @param map The {@code Map} whose key/value pairs are used in the
* match. Maps with {@code null} key or values are not supported.
* A {@code null} value is considered not present to the filter.
@@ -494,7 +486,7 @@ public class FrameworkUtil {
* {@code false} otherwise.
* @since 1.6
*/
- public boolean matches(Map<String, ? > map) {
+ public boolean matches(Map<String, ?> map) {
switch (op) {
case AND : {
FilterImpl[] filters = (FilterImpl[]) value;
@@ -544,7 +536,7 @@ public class FrameworkUtil {
* <p>
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
- *
+ *
* @return This {@code Filter}'s filter string.
*/
public String toString() {
@@ -560,7 +552,7 @@ public class FrameworkUtil {
* <p>
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
- *
+ *
* @return This {@code Filter}'s filter string.
*/
private StringBuffer normalize() {
@@ -607,8 +599,7 @@ public class FrameworkUtil {
for (String substr : substrings) {
if (substr == null) /* * */{
sb.append('*');
- }
- else /* xxx */{
+ } else /* xxx */{
sb.append(encodeValue(substr));
}
}
@@ -659,16 +650,16 @@ public class FrameworkUtil {
/**
* Compares this {@code Filter} to another {@code Filter}.
- *
+ *
* <p>
* This implementation returns the result of calling
* {@code this.toString().equals(obj.toString()}.
- *
+ *
* @param obj The object to compare against this {@code Filter}.
- * @return If the other object is a {@code Filter} object, then
- * returns the result of calling
- * {@code this.toString().equals(obj.toString()};
- * {@code false} otherwise.
+ * @return If the other object is a {@code Filter} object, then returns
+ * the result of calling
+ * {@code this.toString().equals(obj.toString()}; {@code false}
+ * otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -684,11 +675,11 @@ public class FrameworkUtil {
/**
* Returns the hashCode for this {@code Filter}.
- *
+ *
* <p>
* This implementation returns the result of calling
* {@code this.toString().hashCode()}.
- *
+ *
* @return The hashCode of this {@code Filter}.
*/
public int hashCode() {
@@ -697,7 +688,7 @@ public class FrameworkUtil {
/**
* Encode the value string such that '(', '*', ')' and '\' are escaped.
- *
+ *
* @param value unencoded value string.
* @return encoded value string.
*/
@@ -741,60 +732,49 @@ public class FrameworkUtil {
return compare_String(operation, (String) value1, value2);
}
- Class< ? > clazz = value1.getClass();
+ Class<?> clazz = value1.getClass();
if (clazz.isArray()) {
- Class< ? > type = clazz.getComponentType();
+ Class<?> type = clazz.getComponentType();
if (type.isPrimitive()) {
- return compare_PrimitiveArray(operation, type, value1,
- value2);
+ return compare_PrimitiveArray(operation, type, value1, value2);
}
return compare_ObjectArray(operation, (Object[]) value1, value2);
}
- if (value1 instanceof Collection< ? >) {
- return compare_Collection(operation, (Collection< ? >) value1,
- value2);
+ if (value1 instanceof Collection<?>) {
+ return compare_Collection(operation, (Collection<?>) value1, value2);
}
if (value1 instanceof Integer) {
- return compare_Integer(operation,
- ((Integer) value1).intValue(), value2);
+ return compare_Integer(operation, ((Integer) value1).intValue(), value2);
}
if (value1 instanceof Long) {
- return compare_Long(operation, ((Long) value1).longValue(),
- value2);
+ return compare_Long(operation, ((Long) value1).longValue(), value2);
}
if (value1 instanceof Byte) {
- return compare_Byte(operation, ((Byte) value1).byteValue(),
- value2);
+ return compare_Byte(operation, ((Byte) value1).byteValue(), value2);
}
if (value1 instanceof Short) {
- return compare_Short(operation, ((Short) value1).shortValue(),
- value2);
+ return compare_Short(operation, ((Short) value1).shortValue(), value2);
}
if (value1 instanceof Character) {
- return compare_Character(operation, ((Character) value1)
- .charValue(), value2);
+ return compare_Character(operation, ((Character) value1).charValue(), value2);
}
if (value1 instanceof Float) {
- return compare_Float(operation, ((Float) value1).floatValue(),
- value2);
+ return compare_Float(operation, ((Float) value1).floatValue(), value2);
}
if (value1 instanceof Double) {
- return compare_Double(operation, ((Double) value1)
- .doubleValue(), value2);
+ return compare_Double(operation, ((Double) value1).doubleValue(), value2);
}
if (value1 instanceof Boolean) {
- return compare_Boolean(operation, ((Boolean) value1)
- .booleanValue(), value2);
+ return compare_Boolean(operation, ((Boolean) value1).booleanValue(), value2);
}
- if (value1 instanceof Comparable< ? >) {
+ if (value1 instanceof Comparable<?>) {
Comparable<Object> comparable = (Comparable<Object>) value1;
return compare_Comparable(operation, comparable, value2);
}
return compare_Unknown(operation, value1, value2);
}
- private boolean compare_Collection(int operation,
- Collection< ? > collection, Object value2) {
+ private boolean compare_Collection(int operation, Collection<?> collection, Object value2) {
for (Object value1 : collection) {
if (compare(operation, value1, value2)) {
return true;
@@ -803,8 +783,7 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_ObjectArray(int operation, Object[] array,
- Object value2) {
+ private boolean compare_ObjectArray(int operation, Object[] array, Object value2) {
for (Object value1 : array) {
if (compare(operation, value1, value2)) {
return true;
@@ -813,8 +792,7 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_PrimitiveArray(int operation, Class< ? > type,
- Object primarray, Object value2) {
+ private boolean compare_PrimitiveArray(int operation, Class<?> type, Object primarray, Object value2) {
if (Integer.TYPE.isAssignableFrom(type)) {
int[] array = (int[]) primarray;
for (int value1 : array) {
@@ -890,8 +868,7 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_String(int operation, String string,
- Object value2) {
+ private boolean compare_String(int operation, String string, Object value2) {
switch (operation) {
case SUBSTRING : {
String[] substrings = (String[]) value2;
@@ -919,18 +896,15 @@ public class FrameworkUtil {
// to do the last substr
// check
i++;
- }
- else /* xxx */{
+ } else /* xxx */{
int len = substr.length();
if (string.regionMatches(pos, substr, 0, len)) {
pos += len;
- }
- else {
+ } else {
return false;
}
}
- }
- else /* last substr */{
+ } else /* last substr */{
if (substr == null) /* * */{
return true;
}
@@ -967,8 +941,7 @@ public class FrameworkUtil {
int intval2;
try {
intval2 = Integer.parseInt(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
switch (operation) {
@@ -993,8 +966,7 @@ public class FrameworkUtil {
long longval2;
try {
longval2 = Long.parseLong(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
@@ -1020,8 +992,7 @@ public class FrameworkUtil {
byte byteval2;
try {
byteval2 = Byte.parseByte(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
@@ -1040,16 +1011,14 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_Short(int operation, short shortval,
- Object value2) {
+ private boolean compare_Short(int operation, short shortval, Object value2) {
if (operation == SUBSTRING) {
return false;
}
short shortval2;
try {
shortval2 = Short.parseShort(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
@@ -1068,16 +1037,14 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_Character(int operation, char charval,
- Object value2) {
+ private boolean compare_Character(int operation, char charval, Object value2) {
if (operation == SUBSTRING) {
return false;
}
char charval2;
try {
charval2 = ((String) value2).charAt(0);
- }
- catch (IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException e) {
return false;
}
@@ -1086,11 +1053,7 @@ public class FrameworkUtil {
return charval == charval2;
}
case APPROX : {
- return (charval == charval2)
- || (Character.toUpperCase(charval) == Character
- .toUpperCase(charval2))
- || (Character.toLowerCase(charval) == Character
- .toLowerCase(charval2));
+ return (charval == charval2) || (Character.toUpperCase(charval) == Character.toUpperCase(charval2)) || (Character.toLowerCase(charval) == Character.toLowerCase(charval2));
}
case GREATER : {
return charval >= charval2;
@@ -1102,13 +1065,11 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_Boolean(int operation, boolean boolval,
- Object value2) {
+ private boolean compare_Boolean(int operation, boolean boolval, Object value2) {
if (operation == SUBSTRING) {
return false;
}
- boolean boolval2 = Boolean.valueOf(((String) value2).trim())
- .booleanValue();
+ boolean boolval2 = Boolean.valueOf(((String) value2).trim()).booleanValue();
switch (operation) {
case APPROX :
case EQUAL :
@@ -1120,16 +1081,14 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_Float(int operation, float floatval,
- Object value2) {
+ private boolean compare_Float(int operation, float floatval, Object value2) {
if (operation == SUBSTRING) {
return false;
}
float floatval2;
try {
floatval2 = Float.parseFloat(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
@@ -1148,16 +1107,14 @@ public class FrameworkUtil {
return false;
}
- private boolean compare_Double(int operation, double doubleval,
- Object value2) {
+ private boolean compare_Double(int operation, double doubleval, Object value2) {
if (operation == SUBSTRING) {
return false;
}
double doubleval2;
try {
doubleval2 = Double.parseDouble(((String) value2).trim());
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
@@ -1176,49 +1133,41 @@ public class FrameworkUtil {
return false;
}
- private static Object valueOf(Class< ? > target, String value2) {
+ private static Object valueOf(Class<?> target, String value2) {
do {
Method method;
try {
method = target.getMethod("valueOf", String.class);
- }
- catch (NoSuchMethodException e) {
+ } catch (NoSuchMethodException e) {
break;
}
- if (Modifier.isStatic(method.getModifiers())
- && target.isAssignableFrom(method.getReturnType())) {
+ if (Modifier.isStatic(method.getModifiers()) && target.isAssignableFrom(method.getReturnType())) {
setAccessible(method);
try {
return method.invoke(null, value2.trim());
- }
- catch (IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
return null;
- }
- catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
return null;
}
}
} while (false);
do {
- Constructor< ? > constructor;
+ Constructor<?> constructor;
try {
constructor = target.getConstructor(String.class);
- }
- catch (NoSuchMethodException e) {
+ } catch (NoSuchMethodException e) {
break;
}
setAccessible(constructor);
try {
return constructor.newInstance(value2.trim());
- }
- catch (IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
return null;
- }
- catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
return null;
- }
- catch (InstantiationException e) {
+ } catch (InstantiationException e) {
return null;
}
} while (false);
@@ -1228,13 +1177,11 @@ public class FrameworkUtil {
private static void setAccessible(AccessibleObject accessible) {
if (!accessible.isAccessible()) {
- AccessController.doPrivileged(new SetAccessibleAction(
- accessible));
+ AccessController.doPrivileged(new SetAccessibleAction(accessible));
}
}
- private boolean compare_Comparable(int operation,
- Comparable<Object> value1, Object value2) {
+ private boolean compare_Comparable(int operation, Comparable<Object> value1, Object value2) {
if (operation == SUBSTRING) {
return false;
}
@@ -1255,16 +1202,14 @@ public class FrameworkUtil {
return value1.compareTo(value2) <= 0;
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
// if the compareTo method throws an exception; return false
return false;
}
return false;
}
- private boolean compare_Unknown(int operation, Object value1,
- Object value2) {
+ private boolean compare_Unknown(int operation, Object value1, Object value2) {
if (operation == SUBSTRING) {
return false;
}
@@ -1281,8 +1226,7 @@ public class FrameworkUtil {
return value1.equals(value2);
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
// if the equals method throws an exception; return false
return false;
}
@@ -1291,10 +1235,10 @@ public class FrameworkUtil {
/**
* Map a string for an APPROX (~=) comparison.
- *
+ *
* This implementation removes white spaces. This is the minimum
* implementation allowed by the OSGi spec.
- *
+ *
* @param input Input string.
* @return String ready for APPROX comparison.
*/
@@ -1335,16 +1279,12 @@ public class FrameworkUtil {
FilterImpl filter;
try {
filter = parse_filter();
- }
- catch (ArrayIndexOutOfBoundsException e) {
- throw new InvalidSyntaxException("Filter ended abruptly",
- filterstring, e);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new InvalidSyntaxException("Filter ended abruptly", filterstring, e);
}
if (pos != filterChars.length) {
- throw new InvalidSyntaxException(
- "Extraneous trailing characters: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Extraneous trailing characters: " + filterstring.substring(pos), filterstring);
}
return filter;
}
@@ -1354,8 +1294,7 @@ public class FrameworkUtil {
skipWhiteSpace();
if (filterChars[pos] != '(') {
- throw new InvalidSyntaxException("Missing '(': "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Missing '(': " + filterstring.substring(pos), filterstring);
}
pos++;
@@ -1365,8 +1304,7 @@ public class FrameworkUtil {
skipWhiteSpace();
if (filterChars[pos] != ')') {
- throw new InvalidSyntaxException("Missing ')': "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Missing ')': " + filterstring.substring(pos), filterstring);
}
pos++;
@@ -1414,8 +1352,7 @@ public class FrameworkUtil {
operands.add(child);
}
- return new FilterImpl(FilterImpl.AND, null, operands
- .toArray(new FilterImpl[operands.size()]));
+ return new FilterImpl(FilterImpl.AND, null, operands.toArray(new FilterImpl[operands.size()]));
}
private FilterImpl parse_or() throws InvalidSyntaxException {
@@ -1434,8 +1371,7 @@ public class FrameworkUtil {
operands.add(child);
}
- return new FilterImpl(FilterImpl.OR, null, operands
- .toArray(new FilterImpl[operands.size()]));
+ return new FilterImpl(FilterImpl.OR, null, operands.toArray(new FilterImpl[operands.size()]));
}
private FilterImpl parse_not() throws InvalidSyntaxException {
@@ -1461,24 +1397,21 @@ public class FrameworkUtil {
case '~' : {
if (filterChars[pos + 1] == '=') {
pos += 2;
- return new FilterImpl(FilterImpl.APPROX, attr,
- parse_value());
+ return new FilterImpl(FilterImpl.APPROX, attr, parse_value());
}
break;
}
case '>' : {
if (filterChars[pos + 1] == '=') {
pos += 2;
- return new FilterImpl(FilterImpl.GREATER, attr,
- parse_value());
+ return new FilterImpl(FilterImpl.GREATER, attr, parse_value());
}
break;
}
case '<' : {
if (filterChars[pos + 1] == '=') {
pos += 2;
- return new FilterImpl(FilterImpl.LESS, attr,
- parse_value());
+ return new FilterImpl(FilterImpl.LESS, attr, parse_value());
}
break;
}
@@ -1488,8 +1421,7 @@ public class FrameworkUtil {
pos += 2;
skipWhiteSpace();
if (filterChars[pos] == ')') {
- return new FilterImpl(FilterImpl.PRESENT, attr,
- null);
+ return new FilterImpl(FilterImpl.PRESENT, attr, null);
}
pos = oldpos;
}
@@ -1498,16 +1430,13 @@ public class FrameworkUtil {
Object string = parse_substring();
if (string instanceof String) {
- return new FilterImpl(FilterImpl.EQUAL, attr,
- string);
+ return new FilterImpl(FilterImpl.EQUAL, attr, string);
}
- return new FilterImpl(FilterImpl.SUBSTRING, attr,
- string);
+ return new FilterImpl(FilterImpl.SUBSTRING, attr, string);
}
}
- throw new InvalidSyntaxException("Invalid operator: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Invalid operator: " + filterstring.substring(pos), filterstring);
}
private String parse_attr() throws InvalidSyntaxException {
@@ -1518,8 +1447,7 @@ public class FrameworkUtil {
char c = filterChars[pos];
- while (c != '~' && c != '<' && c != '>' && c != '=' && c != '('
- && c != ')') {
+ while (c != '~' && c != '<' && c != '>' && c != '=' && c != '(' && c != ')') {
pos++;
if (!Character.isWhitespace(c)) {
@@ -1532,8 +1460,7 @@ public class FrameworkUtil {
int length = end - begin;
if (length == 0) {
- throw new InvalidSyntaxException("Missing attr: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Missing attr: " + filterstring.substring(pos), filterstring);
}
return new String(filterChars, begin, length);
@@ -1551,8 +1478,7 @@ public class FrameworkUtil {
}
case '(' : {
- throw new InvalidSyntaxException("Invalid value: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Invalid value: " + filterstring.substring(pos), filterstring);
}
case '\\' : {
@@ -1570,8 +1496,7 @@ public class FrameworkUtil {
}
if (sb.length() == 0) {
- throw new InvalidSyntaxException("Missing value: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Missing value: " + filterstring.substring(pos), filterstring);
}
return sb.toString();
@@ -1595,8 +1520,7 @@ public class FrameworkUtil {
}
case '(' : {
- throw new InvalidSyntaxException("Invalid value: "
- + filterstring.substring(pos), filterstring);
+ throw new InvalidSyntaxException("Invalid value: " + filterstring.substring(pos), filterstring);
}
case '*' : {
@@ -1644,8 +1568,7 @@ public class FrameworkUtil {
}
private void skipWhiteSpace() {
- for (int length = filterChars.length; (pos < length)
- && Character.isWhitespace(filterChars[pos]);) {
+ for (int length = filterChars.length; (pos < length) && Character.isWhitespace(filterChars[pos]);) {
pos++;
}
}
@@ -1658,20 +1581,18 @@ public class FrameworkUtil {
* a String key as no other operations are used by the Filter
* implementation.
*/
- static private final class CaseInsensitiveMap extends
- AbstractMap<String, Object>
- implements Map<String, Object> {
- private final Dictionary<String, ? > dictionary;
- private final String[] keys;
+ static private final class CaseInsensitiveMap extends AbstractMap<String, Object> implements Map<String, Object> {
+ private final Dictionary<String, ?> dictionary;
+ private final String[] keys;
/**
* Create a case insensitive map from the specified dictionary.
- *
+ *
* @param dictionary
* @throws IllegalArgumentException If {@code dictionary} contains case
* variants of the same key name.
*/
- CaseInsensitiveMap(Dictionary<String, ? > dictionary) {
+ CaseInsensitiveMap(Dictionary<String, ?> dictionary) {
if (dictionary == null) {
this.dictionary = null;
this.keys = new String[0];
@@ -1715,11 +1636,10 @@ public class FrameworkUtil {
* a String key as no other operations are used by the Filter
* implementation.
*/
- static private final class ServiceReferenceMap extends
- AbstractMap<String, Object> implements Map<String, Object> {
- private final ServiceReference< ? > reference;
+ static private final class ServiceReferenceMap extends AbstractMap<String, Object> implements Map<String, Object> {
+ private final ServiceReference<?> reference;
- ServiceReferenceMap(ServiceReference< ? > reference) {
+ ServiceReferenceMap(ServiceReference<?> reference) {
this.reference = reference;
}
@@ -1735,8 +1655,7 @@ public class FrameworkUtil {
}
}
- static private final class SetAccessibleAction implements
- PrivilegedAction<Object> {
+ static private final class SetAccessibleAction implements PrivilegedAction<Object> {
private final AccessibleObject accessible;
SetAccessibleAction(AccessibleObject accessible) {
@@ -1758,17 +1677,16 @@ public class FrameworkUtil {
* what we refer to as the DN chain. Each DN is made up of relative
* distinguished names (RDN) which in turn are made up of key value pairs.
* For example:
- *
+ *
* <pre>
* cn=ben+ou=research,o=ACME,c=us;ou=Super CA,c=CA
* </pre>
- *
- * is made up of two DNs: "{@code cn=ben+ou=research,o=ACME,c=us}
- * " and " {@code ou=Super CA,c=CA}
- * ". The first DN is made of of three RDNs: "
- * {@code cn=ben+ou=research}" and "{@code o=ACME}" and "
- * {@code c=us}". The first RDN has two name value pairs: "
- * {@code cn=ben}" and "{@code ou=research}".
+ *
+ * is made up of two DNs: "{@code cn=ben+ou=research,o=ACME,c=us} " and "
+ * {@code ou=Super CA,c=CA} ". The first DN is made of of three RDNs: "
+ * {@code cn=ben+ou=research}" and "{@code o=ACME}" and " {@code c=us}
+ * ". The first RDN has two name value pairs: " {@code cn=ben}" and "
+ * {@code ou=research}".
* <p>
* A chain pattern makes use of wildcards ('*' or '-') to match against DNs,
* and wildcards ('*') to match againts DN prefixes, and value. If a DN in a
@@ -1786,12 +1704,12 @@ public class FrameworkUtil {
/**
* Check the name/value pairs of the rdn against the pattern.
- *
+ *
* @param rdn List of name value pairs for a given RDN.
* @param rdnPattern List of name value pattern pairs.
* @return true if the list of name value pairs match the pattern.
*/
- private static boolean rdnmatch(List< ? > rdn, List< ? > rdnPattern) {
+ private static boolean rdnmatch(List<?> rdn, List<?> rdnPattern) {
if (rdn.size() != rdnPattern.size()) {
return false;
}
@@ -1800,22 +1718,19 @@ public class FrameworkUtil {
String patNameValue = (String) rdnPattern.get(i);
int rdnNameEnd = rdnNameValue.indexOf('=');
int patNameEnd = patNameValue.indexOf('=');
- if (rdnNameEnd != patNameEnd
- || !rdnNameValue.regionMatches(0, patNameValue, 0,
- rdnNameEnd)) {
+ if (rdnNameEnd != patNameEnd || !rdnNameValue.regionMatches(0, patNameValue, 0, rdnNameEnd)) {
return false;
}
String patValue = patNameValue.substring(patNameEnd);
String rdnValue = rdnNameValue.substring(rdnNameEnd);
- if (!rdnValue.equals(patValue) && !patValue.equals("=*")
- && !patValue.equals("=#16012a")) {
+ if (!rdnValue.equals(patValue) && !patValue.equals("=*") && !patValue.equals("=#16012a")) {
return false;
}
}
return true;
}
- private static boolean dnmatch(List< ? > dn, List< ? > dnPattern) {
+ private static boolean dnmatch(List<?> dn, List<?> dnPattern) {
int dnStart = 0;
int patStart = 0;
int patLen = dnPattern.size();
@@ -1828,8 +1743,7 @@ public class FrameworkUtil {
}
if (dn.size() < patLen) {
return false;
- }
- else {
+ } else {
if (dn.size() > patLen) {
if (!dnPattern.get(0).equals(STAR_WILDCARD)) {
// If the number of rdns do not match we must have a
@@ -1842,9 +1756,7 @@ public class FrameworkUtil {
}
}
for (int i = 0; i < patLen; i++) {
- if (!rdnmatch((List< ? >) dn.get(i + dnStart),
- (List< ? >) dnPattern
- .get(i + patStart))) {
+ if (!rdnmatch((List<?>) dn.get(i + dnStart), (List<?>) dnPattern.get(i + patStart))) {
return false;
}
}
@@ -1859,15 +1771,14 @@ public class FrameworkUtil {
* in the RDN List will be a String, if the element represents a
* wildcard ("*"), or a List of Strings, each String representing a
* name/value pair in the RDN.
- *
+ *
* @param dnChain
* @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.");
+ throw new IllegalArgumentException("The DN chain must not be null.");
}
List<Object> parsed = new ArrayList<Object>();
int startIndex = 0;
@@ -1908,14 +1819,11 @@ public class FrameworkUtil {
List<Object> rdns = new ArrayList<Object>();
if (dn.charAt(0) == '*') {
if (dn.charAt(1) != ',') {
- throw new IllegalArgumentException(
- "invalid wildcard prefix");
+ throw new IllegalArgumentException("invalid wildcard prefix");
}
rdns.add(STAR_WILDCARD);
- dn = new X500Principal(dn.substring(2))
- .getName(X500Principal.CANONICAL);
- }
- else {
+ dn = new X500Principal(dn.substring(2)).getName(X500Principal.CANONICAL);
+ } else {
dn = new X500Principal(dn).getName(X500Principal.CANONICAL);
}
// Now dn is a nice CANONICAL DN
@@ -1953,8 +1861,7 @@ public class FrameworkUtil {
* the index of a non-space character.
*/
private static int skipSpaces(String dnChain, int startIndex) {
- while (startIndex < dnChain.length()
- && dnChain.charAt(startIndex) == ' ') {
+ while (startIndex < dnChain.length() && dnChain.charAt(startIndex) == ' ') {
startIndex++;
}
return startIndex;
@@ -1963,7 +1870,7 @@ public class FrameworkUtil {
/**
* Takes a distinguished name in canonical form and fills in the
* rdnArray with the extracted RDNs.
- *
+ *
* @param dn the distinguished name in canonical form.
* @param rdn the list to fill in with RDNs extracted from the dn
* @throws IllegalArgumentException if a formatting error is found.
@@ -1984,24 +1891,21 @@ public class FrameworkUtil {
}
}
if (endIndex > dn.length()) {
- throw new IllegalArgumentException("unterminated escape "
- + dn);
+ throw new IllegalArgumentException("unterminated escape " + dn);
}
nameValues.add(dn.substring(startIndex, endIndex));
if (c != '+') {
rdn.add(nameValues);
if (endIndex != dn.length()) {
nameValues = new ArrayList<String>();
- }
- else {
+ } else {
nameValues = null;
}
}
startIndex = endIndex + 1;
}
if (nameValues != null) {
- throw new IllegalArgumentException("improperly terminated DN "
- + dn);
+ throw new IllegalArgumentException("improperly terminated DN " + dn);
}
}
@@ -2009,28 +1913,22 @@ public class FrameworkUtil {
* This method will return an 'index' which points to a non-wildcard DN
* or the end-of-list.
*/
- private static int skipWildCards(List<Object> dnChainPattern,
- int dnChainPatternIndex) {
+ private static int skipWildCards(List<Object> dnChainPattern, int dnChainPatternIndex) {
int i;
for (i = dnChainPatternIndex; i < dnChainPattern.size(); i++) {
Object dnPattern = dnChainPattern.get(i);
if (dnPattern instanceof String) {
- if (!dnPattern.equals(STAR_WILDCARD)
- && !dnPattern.equals(MINUS_WILDCARD)) {
- throw new IllegalArgumentException(
- "expected wildcard in DN pattern");
+ if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+ throw new IllegalArgumentException("expected wildcard in DN pattern");
}
// otherwise continue skipping over wild cards
- }
- else {
- if (dnPattern instanceof List< ? >) {
+ } else {
+ if (dnPattern instanceof List<?>) {
// if its a list then we have our 'non-wildcard' DN
break;
- }
- else {
+ } else {
// unknown member of the DNChainPattern
- throw new IllegalArgumentException(
- "expected String or List in DN Pattern");
+ throw new IllegalArgumentException("expected String or List in DN Pattern");
}
}
}
@@ -2044,10 +1942,7 @@ public class FrameworkUtil {
* where DNChain is of the format: "DN;DN;DN;" and DNChainPattern is of
* the format: "DNPattern;*;DNPattern" (or combinations of this)
*/
- private static boolean dnChainMatch(List<Object> dnChain,
- int dnChainIndex, List<Object> dnChainPattern,
- int dnChainPatternIndex)
- throws IllegalArgumentException {
+ private static boolean dnChainMatch(List<Object> dnChain, int dnChainIndex, List<Object> dnChainPattern, int dnChainPatternIndex) throws IllegalArgumentException {
if (dnChainIndex >= dnChain.size()) {
return false;
}
@@ -2057,25 +1952,20 @@ public class FrameworkUtil {
// check to see what the pattern starts with
Object dnPattern = dnChainPattern.get(dnChainPatternIndex);
if (dnPattern instanceof String) {
- if (!dnPattern.equals(STAR_WILDCARD)
- && !dnPattern.equals(MINUS_WILDCARD)) {
- throw new IllegalArgumentException(
- "expected wildcard in DN pattern");
+ if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+ throw new IllegalArgumentException("expected wildcard in DN pattern");
}
// here we are processing a wild card as the first DN
// skip all wildcard DN's
if (dnPattern.equals(MINUS_WILDCARD)) {
- dnChainPatternIndex = skipWildCards(dnChainPattern,
- dnChainPatternIndex);
- }
- else {
+ dnChainPatternIndex = skipWildCards(dnChainPattern, dnChainPatternIndex);
+ } else {
dnChainPatternIndex++; // only skip the '*' wildcard
}
if (dnChainPatternIndex >= dnChainPattern.size()) {
// return true iff the wild card is '-' or if we are at the
// end of the chain
- return dnPattern.equals(MINUS_WILDCARD) ? true : dnChain
- .size() - 1 == dnChainIndex;
+ return dnPattern.equals(MINUS_WILDCARD) ? true : dnChain.size() - 1 == dnChainIndex;
}
//
// we will now recursively call to see if the rest of the
@@ -2084,45 +1974,36 @@ public class FrameworkUtil {
//
if (dnPattern.equals(STAR_WILDCARD)) {
// '*' option: only wildcard on 0 or 1
- return dnChainMatch(dnChain, dnChainIndex, dnChainPattern,
- dnChainPatternIndex)
- || dnChainMatch(dnChain, dnChainIndex + 1,
- dnChainPattern, dnChainPatternIndex);
+ return dnChainMatch(dnChain, dnChainIndex, dnChainPattern, dnChainPatternIndex) || dnChainMatch(dnChain, dnChainIndex + 1, dnChainPattern, dnChainPatternIndex);
}
for (int i = dnChainIndex; i < dnChain.size(); i++) {
// '-' option: wildcard 0 or more
- if (dnChainMatch(dnChain, i, dnChainPattern,
- dnChainPatternIndex)) {
+ if (dnChainMatch(dnChain, i, dnChainPattern, dnChainPatternIndex)) {
return true;
}
}
// if we are here, then we didn't find a match.. fall through to
// failure
- }
- else {
- if (dnPattern instanceof List< ? >) {
+ } else {
+ if (dnPattern instanceof List<?>) {
// here we have to do a deeper check for each DN in the
// pattern until we hit a wild card
do {
- if (!dnmatch((List< ? >) dnChain.get(dnChainIndex),
- (List< ? >) dnPattern)) {
+ if (!dnmatch((List<?>) dnChain.get(dnChainIndex), (List<?>) dnPattern)) {
return false;
}
// go to the next set of DN's in both chains
dnChainIndex++;
dnChainPatternIndex++;
// if we finished the pattern then it all matched
- if ((dnChainIndex >= dnChain.size())
- && (dnChainPatternIndex >= dnChainPattern
- .size())) {
+ if ((dnChainIndex >= dnChain.size()) && (dnChainPatternIndex >= dnChainPattern.size())) {
return true;
}
// if the DN Chain is finished, but the pattern isn't
// finished then if the rest of the pattern is not
// wildcard then we are done
if (dnChainIndex >= dnChain.size()) {
- dnChainPatternIndex = skipWildCards(dnChainPattern,
- dnChainPatternIndex);
+ dnChainPatternIndex = skipWildCards(dnChainPattern, dnChainPatternIndex);
// return TRUE iff the pattern index moved past the
// list-size (implying that the rest of the pattern
// is all wildcards)
@@ -2136,20 +2017,15 @@ public class FrameworkUtil {
// get the next DN Pattern
dnPattern = dnChainPattern.get(dnChainPatternIndex);
if (dnPattern instanceof String) {
- if (!dnPattern.equals(STAR_WILDCARD)
- && !dnPattern.equals(MINUS_WILDCARD)) {
- throw new IllegalArgumentException(
- "expected wildcard in DN pattern");
+ if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+ throw new IllegalArgumentException("expected wildcard in DN pattern");
}
// if the next DN is a 'wildcard', then we will
// recurse
- return dnChainMatch(dnChain, dnChainIndex,
- dnChainPattern, dnChainPatternIndex);
- }
- else {
- if (!(dnPattern instanceof List< ? >)) {
- throw new IllegalArgumentException(
- "expected String or List in DN Pattern");
+ return dnChainMatch(dnChain, dnChainIndex, dnChainPattern, dnChainPatternIndex);
+ } else {
+ if (!(dnPattern instanceof List<?>)) {
+ throw new IllegalArgumentException("expected String or List in DN Pattern");
}
}
// if we are here, then we will just continue to the
@@ -2157,10 +2033,8 @@ public class FrameworkUtil {
// DNChainPattern since both are lists
} while (true);
// should never reach here?
- }
- else {
- throw new IllegalArgumentException(
- "expected String or List in DN Pattern");
+ } else {
+ throw new IllegalArgumentException("expected String or List in DN Pattern");
}
}
// if we get here, the the default return is 'mis-match'
@@ -2170,7 +2044,7 @@ public class FrameworkUtil {
/**
* Matches a distinguished name chain against a pattern of a
* distinguished name chain.
- *
+ *
* @param dnChain
* @param pattern the pattern of distinguished name (DN) chains to match
* against the dnChain. Wildcards ("*" or "-") can be used in
@@ -2205,31 +2079,27 @@ public class FrameworkUtil {
List<Object> parsedDNPattern;
try {
parsedDNChain = parseDNchain(dnChain);
- }
- catch (RuntimeException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "Invalid DN chain: " + toString(dnChain));
+ } catch (RuntimeException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("Invalid DN chain: " + toString(dnChain));
iae.initCause(e);
throw iae;
}
try {
parsedDNPattern = parseDNchainPattern(pattern);
- }
- catch (RuntimeException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "Invalid match pattern: " + pattern);
+ } catch (RuntimeException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("Invalid match pattern: " + pattern);
iae.initCause(e);
throw iae;
}
return dnChainMatch(parsedDNChain, 0, parsedDNPattern, 0);
}
- private static String toString(List< ? > dnChain) {
+ private static String toString(List<?> dnChain) {
if (dnChain == null) {
return null;
}
StringBuffer sb = new StringBuffer();
- for (Iterator< ? > iChain = dnChain.iterator(); iChain.hasNext();) {
+ for (Iterator<?> iChain = dnChain.iterator(); iChain.hasNext();) {
sb.append(iChain.next());
if (iChain.hasNext()) {
sb.append("; ");
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
index 5a185b0f2..8820ca2db 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@ package org.osgi.framework;
* syntax.
*
* <p>
- * An {@code InvalidSyntaxException} object indicates that a filter
- * string parameter has an invalid syntax and cannot be parsed. See
- * {@link Filter} for a description of the filter string syntax.
+ * An {@code InvalidSyntaxException} object indicates that a filter string
+ * parameter has an invalid syntax and cannot be parsed. See {@link Filter} for
+ * a description of the filter string syntax.
*
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
@@ -42,9 +42,8 @@ public class InvalidSyntaxException extends Exception {
* Creates an exception of type {@code InvalidSyntaxException}.
*
* <p>
- * This method creates an {@code InvalidSyntaxException} object with
- * the specified message and the filter string which generated the
- * exception.
+ * This method creates an {@code InvalidSyntaxException} object with the
+ * specified message and the filter string which generated the exception.
*
* @param msg The message.
* @param filter The invalid filter string.
@@ -58,9 +57,8 @@ public class InvalidSyntaxException extends Exception {
* Creates an exception of type {@code InvalidSyntaxException}.
*
* <p>
- * This method creates an {@code InvalidSyntaxException} object with
- * the specified message and the filter string which generated the
- * exception.
+ * This method creates an {@code InvalidSyntaxException} object with the
+ * specified message and the filter string which generated the exception.
*
* @param msg The message.
* @param filter The invalid filter string.
@@ -96,11 +94,9 @@ public class InvalidSyntaxException extends Exception {
}
/**
- * Returns the cause of this exception or {@code null} if no cause was
- * set.
+ * Returns the cause of this exception or {@code null} if no cause was set.
*
- * @return The cause of this exception or {@code null} if no cause was
- * set.
+ * @return The cause of this exception or {@code null} if no cause was set.
* @since 1.3
*/
public Throwable getCause() {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
index a286af944..e993fbc36 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,65 +50,64 @@ import java.util.Map;
*
* <p>
* {@code PackagePermission} has three actions: {@code exportonly},
- * {@code import} and {@code export}. The {@code export} action,
- * which is deprecated, implies the {@code import} action.
+ * {@code import} and {@code export}. The {@code export} action, which is
+ * deprecated, implies the {@code import} action.
*
* @ThreadSafe
* @version $Id$
*/
public final class PackagePermission extends BasicPermission {
- static final long serialVersionUID = -5107705877071099135L;
+ static final long serialVersionUID = -5107705877071099135L;
/**
- * The action string {@code export}. The {@code export} action
- * implies the {@code import} action.
+ * The action string {@code export}. The {@code export} action implies the
+ * {@code import} action.
*
* @deprecated Since 1.5. Use {@code exportonly} instead.
*/
- public final static String EXPORT = "export";
+ public final static String EXPORT = "export";
/**
- * The action string {@code exportonly}. The {@code exportonly}
- * action does not imply the {@code import} action.
+ * The action string {@code exportonly}. The {@code exportonly} action does
+ * not imply the {@code import} action.
*
* @since 1.5
*/
- public final static String EXPORTONLY = "exportonly";
+ public final static String EXPORTONLY = "exportonly";
/**
* The action string {@code import}.
*/
- public final static String IMPORT = "import";
+ public final static String IMPORT = "import";
- private final static int ACTION_EXPORT = 0x00000001;
- private final static int ACTION_IMPORT = 0x00000002;
- private final static int ACTION_ALL = ACTION_EXPORT
- | ACTION_IMPORT;
- final static int ACTION_NONE = 0;
+ private final static int ACTION_EXPORT = 0x00000001;
+ private final static int ACTION_IMPORT = 0x00000002;
+ private final static int ACTION_ALL = ACTION_EXPORT | ACTION_IMPORT;
+ final static int ACTION_NONE = 0;
/**
* The actions mask.
*/
- transient int action_mask;
+ transient int action_mask;
/**
* The actions in canonical form.
*
* @serial
*/
- private volatile String actions = null;
+ private volatile String actions = null;
/**
* The bundle used by this PackagePermission.
*/
- transient final Bundle bundle;
+ transient final Bundle bundle;
/**
* If this PackagePermission was constructed with a filter, this holds a
* Filter matching object used to evaluate the filter in implies.
*/
- transient Filter filter;
+ transient Filter filter;
/**
* This map holds the properties of the permission, used to match a filter
@@ -136,8 +135,8 @@ public final class PackagePermission extends BasicPermission {
* *
* </pre>
*
- * For the {@code import} action, the name can also be a filter
- * expression. The filter gives access to the following attributes:
+ * For the {@code import} action, the name can also be a filter expression.
+ * The filter gives access to the following attributes:
* <ul>
* <li>signer - A Distinguished Name chain used to sign the exporting
* bundle. Wildcards in a DN are not matched according to the filter string
@@ -161,27 +160,23 @@ public final class PackagePermission extends BasicPermission {
*
* @param name Package name or filter expression. A filter expression can
* only be specified if the specified action is {@code import}.
- * @param actions {@code exportonly},{@code import} (canonical
- * order).
+ * @param actions {@code exportonly},{@code import} (canonical order).
* @throws IllegalArgumentException If the specified name is a filter
- * expression and either the specified action is not
- * {@code import} or the filter has an invalid syntax.
+ * expression and either the specified action is not {@code import}
+ * or the filter has an invalid syntax.
*/
public PackagePermission(String name, String actions) {
this(name, parseActions(actions));
- if ((filter != null)
- && ((action_mask & ACTION_ALL) != ACTION_IMPORT)) {
- throw new IllegalArgumentException(
- "invalid action string for filter expression");
+ if ((filter != null) && ((action_mask & ACTION_ALL) != ACTION_IMPORT)) {
+ throw new IllegalArgumentException("invalid action string for filter expression");
}
}
/**
- * Creates a new requested {@code PackagePermission} object to be used
- * by code that must perform {@code checkPermission} for the
- * {@code import} action. {@code PackagePermission} objects
- * created with this constructor cannot be added to a
- * {@code PackagePermission} permission collection.
+ * Creates a new requested {@code PackagePermission} object to be used by
+ * code that must perform {@code checkPermission} for the {@code import}
+ * action. {@code PackagePermission} objects created with this constructor
+ * cannot be added to a {@code PackagePermission} permission collection.
*
* @param name The name of the requested package to import.
* @param exportingBundle The bundle exporting the requested package.
@@ -255,9 +250,7 @@ public final class PackagePermission extends BasicPermission {
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -272,8 +265,7 @@ public final class PackagePermission extends BasicPermission {
matchlen = 6;
mask |= ACTION_IMPORT;
- }
- else
+ } else
if (i >= 5 && (a[i - 5] == 'e' || a[i - 5] == 'E')
&& (a[i - 4] == 'x' || a[i - 4] == 'X')
&& (a[i - 3] == 'p' || a[i - 3] == 'P')
@@ -283,8 +275,7 @@ public final class PackagePermission extends BasicPermission {
matchlen = 6;
mask |= ACTION_EXPORT | ACTION_IMPORT;
- }
- else {
+ } else {
if (i >= 9 && (a[i - 9] == 'e' || a[i - 9] == 'E')
&& (a[i - 8] == 'x' || a[i - 8] == 'X')
&& (a[i - 7] == 'p' || a[i - 7] == 'P')
@@ -298,11 +289,9 @@ public final class PackagePermission extends BasicPermission {
matchlen = 10;
mask |= ACTION_EXPORT;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
}
@@ -321,8 +310,7 @@ public final class PackagePermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -354,10 +342,8 @@ public final class PackagePermission extends BasicPermission {
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -432,11 +418,11 @@ public final class PackagePermission extends BasicPermission {
* {@code PackagePermission} actions.
*
* <p>
- * Always returns present {@code PackagePermission} actions in the
- * following order: {@code EXPORTONLY},{@code IMPORT}.
+ * Always returns present {@code PackagePermission} actions in the following
+ * order: {@code EXPORTONLY},{@code IMPORT}.
*
- * @return Canonical string representation of the
- * {@code PackagePermission} actions.
+ * @return Canonical string representation of the {@code PackagePermission}
+ * actions.
*/
public String getActions() {
String result = actions;
@@ -462,8 +448,8 @@ public final class PackagePermission extends BasicPermission {
}
/**
- * Returns a new {@code PermissionCollection} object suitable for
- * storing {@code PackagePermission} objects.
+ * Returns a new {@code PermissionCollection} object suitable for storing
+ * {@code PackagePermission} objects.
*
* @return A new {@code PermissionCollection} object.
*/
@@ -475,15 +461,14 @@ public final class PackagePermission extends BasicPermission {
* Determines the equality of two {@code PackagePermission} objects.
*
* This method checks that specified package has the same package name and
- * {@code PackagePermission} actions as this
- * {@code PackagePermission} object.
+ * {@code PackagePermission} actions as this {@code PackagePermission}
+ * object.
*
* @param obj The object to test for equality with this
* {@code PackagePermission} object.
- * @return {@code true} if {@code obj} is a
- * {@code PackagePermission}, and has the same package name and
- * actions as this {@code PackagePermission} object;
- * {@code false} otherwise.
+ * @return {@code true} if {@code obj} is a {@code PackagePermission}, and
+ * has the same package name and actions as this
+ * {@code PackagePermission} object; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -496,10 +481,7 @@ public final class PackagePermission extends BasicPermission {
PackagePermission pp = (PackagePermission) obj;
- return (action_mask == pp.action_mask)
- && getName().equals(pp.getName())
- && ((bundle == pp.bundle) || ((bundle != null) && bundle
- .equals(pp.bundle)));
+ return (action_mask == pp.action_mask) && getName().equals(pp.getName()) && ((bundle == pp.bundle) || ((bundle != null) && bundle.equals(pp.bundle)));
}
/**
@@ -521,8 +503,7 @@ public final class PackagePermission extends BasicPermission {
* stream. The actions are serialized, and the superclass takes care of the
* name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -537,8 +518,7 @@ public final class PackagePermission extends BasicPermission {
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(getName(), parseActions(actions));
@@ -588,7 +568,7 @@ public final class PackagePermission extends BasicPermission {
*/
final class PackagePermissionCollection extends PermissionCollection {
- static final long serialVersionUID = -3350758995234427603L;
+ static final long serialVersionUID = -3350758995234427603L;
/**
* Table of permissions with names.
*
@@ -602,7 +582,7 @@ final class PackagePermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private boolean all_allowed;
+ private boolean all_allowed;
/**
* Table of permissions with filter expressions.
@@ -627,24 +607,20 @@ final class PackagePermissionCollection extends PermissionCollection {
* @throws IllegalArgumentException If the specified permission is not a
* {@code PackagePermission} instance or was constructed with a
* Bundle object.
- * @throws SecurityException If this
- * {@code PackagePermissionCollection} object has been marked
- * read-only.
+ * @throws SecurityException If this {@code PackagePermissionCollection}
+ * object has been marked read-only.
*/
public void add(final Permission permission) {
if (!(permission instanceof PackagePermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final PackagePermission pp = (PackagePermission) permission;
if (pp.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + pp);
+ throw new IllegalArgumentException("cannot add to collection: " + pp);
}
final String name = pp.getName();
@@ -657,23 +633,19 @@ final class PackagePermissionCollection extends PermissionCollection {
if (pc == null) {
filterPermissions = pc = new HashMap<String, PackagePermission>();
}
- }
- else {
+ } else {
pc = permissions;
}
-
+
final PackagePermission existing = pc.get(name);
if (existing != null) {
final int oldMask = existing.action_mask;
final int newMask = pp.action_mask;
if (oldMask != newMask) {
- pc
- .put(name, new PackagePermission(name, oldMask
- | newMask));
+ pc.put(name, new PackagePermission(name, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, pp);
}
@@ -691,8 +663,8 @@ final class PackagePermissionCollection extends PermissionCollection {
*
* @param permission The Permission object to compare with this
* {@code PackagePermission} object.
- * @return {@code true} if {@code permission} is a proper subset
- * of a permission in the set; {@code false} otherwise.
+ * @return {@code true} if {@code permission} is a proper subset of a
+ * permission in the set; {@code false} otherwise.
*/
public boolean implies(final Permission permission) {
if (!(permission instanceof PackagePermission)) {
@@ -767,8 +739,8 @@ final class PackagePermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all {@code PackagePermission} objects in
- * the container.
+ * Returns an enumeration of all {@code PackagePermission} objects in the
+ * container.
*
* @return Enumeration of all {@code PackagePermission} objects.
*/
@@ -782,15 +754,11 @@ final class PackagePermissionCollection extends PermissionCollection {
}
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE),
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
new ObjectStreamField("filterPermissions", HashMap.class) };
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
- Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(
- permissions);
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+ Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -798,15 +766,12 @@ final class PackagePermissionCollection extends PermissionCollection {
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields
- .get("permissions", null);
+ Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields.get("permissions", null);
permissions = new HashMap<String, PackagePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
- HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields
- .get("filterPermissions", null);
+ HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
index 670625e50..49e34e0ad 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +22,9 @@ import java.util.EventObject;
/**
* An event from the Framework describing a service lifecycle change.
* <p>
- * {@code ServiceEvent} objects are delivered to
- * {@code ServiceListener}s and {@code AllServiceListener}s when a
- * change occurs in this service's lifecycle. A type code is used to identify
- * the event type for future extendability.
+ * {@code ServiceEvent} objects are delivered to {@code ServiceListener}s and
+ * {@code AllServiceListener}s when a change occurs in this service's lifecycle.
+ * A type code is used to identify the event type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
@@ -37,16 +36,16 @@ import java.util.EventObject;
*/
public class ServiceEvent extends EventObject {
- static final long serialVersionUID = 8792901483909409299L;
+ static final long serialVersionUID = 8792901483909409299L;
/**
* Reference to the service that had a change occur in its lifecycle.
*/
- private final ServiceReference< ? > reference;
+ private final ServiceReference<?> reference;
/**
* Type of service lifecycle change.
*/
- private final int type;
+ private final int type;
/**
* This service has been registered.
@@ -56,7 +55,7 @@ public class ServiceEvent extends EventObject {
*
* @see BundleContext#registerService(String[],Object,Dictionary)
*/
- public final static int REGISTERED = 0x00000001;
+ public final static int REGISTERED = 0x00000001;
/**
* The properties of a registered service have been modified.
@@ -66,7 +65,7 @@ public class ServiceEvent extends EventObject {
*
* @see ServiceRegistration#setProperties(Dictionary)
*/
- public final static int MODIFIED = 0x00000002;
+ public final static int MODIFIED = 0x00000002;
/**
* This service is in the process of being unregistered.
@@ -84,7 +83,7 @@ public class ServiceEvent extends EventObject {
* @see ServiceRegistration#unregister()
* @see BundleContext#ungetService(ServiceReference)
*/
- public final static int UNREGISTERING = 0x00000004;
+ public final static int UNREGISTERING = 0x00000004;
/**
* The properties of a registered service have been modified and the new
@@ -99,16 +98,16 @@ public class ServiceEvent extends EventObject {
* @see ServiceRegistration#setProperties(Dictionary)
* @since 1.5
*/
- public final static int MODIFIED_ENDMATCH = 0x00000008;
+ public final static int MODIFIED_ENDMATCH = 0x00000008;
/**
* Creates a new service event object.
*
* @param type The event type.
- * @param reference A {@code ServiceReference} object to the service
- * that had a lifecycle change.
+ * @param reference A {@code ServiceReference} object to the service that
+ * had a lifecycle change.
*/
- public ServiceEvent(int type, ServiceReference< ? > reference) {
+ public ServiceEvent(int type, ServiceReference<?> reference) {
super(reference);
this.reference = reference;
this.type = type;
@@ -122,17 +121,17 @@ public class ServiceEvent extends EventObject {
*
* @return Reference to the service that had a lifecycle change.
*/
- public ServiceReference< ? > getServiceReference() {
+ public ServiceReference<?> getServiceReference() {
return reference;
}
/**
* Returns the type of event. The event type values are:
* <ul>
- * <li>{@link #REGISTERED} </li>
- * <li>{@link #MODIFIED} </li>
- * <li>{@link #MODIFIED_ENDMATCH} </li>
- * <li>{@link #UNREGISTERING} </li>
+ * <li>{@link #REGISTERED}</li>
+ * <li>{@link #MODIFIED}</li>
+ * <li>{@link #MODIFIED_ENDMATCH}</li>
+ * <li>{@link #UNREGISTERING}</li>
* </ul>
*
* @return Type of service lifecycle change.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java
index 453b6021e..9f7634126 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -20,13 +20,12 @@ package org.osgi.framework;
* A service exception used to indicate that a service problem occurred.
*
* <p>
- * A {@code ServiceException} object is created by the Framework or
- * service implementation to denote an exception condition in the service. A
- * type code is used to identify the exception type for future extendability.
- * Service implementations may also create subclasses of
- * {@code ServiceException}. When subclassing, the subclass should set
- * the type to {@link #SUBCLASSED} to indicate that
- * {@code ServiceException} has been subclassed.
+ * A {@code ServiceException} object is created by the Framework or service
+ * implementation to denote an exception condition in the service. A type code
+ * is used to identify the exception type for future extendability. Service
+ * implementations may also create subclasses of {@code ServiceException}. When
+ * subclassing, the subclass should set the type to {@link #SUBCLASSED} to
+ * indicate that {@code ServiceException} has been subclassed.
*
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
@@ -67,7 +66,7 @@ public class ServiceException extends RuntimeException {
/**
* An error occurred invoking a remote service.
*/
- public static final int REMOTE = 5;
+ public static final int REMOTE = 5;
/**
* The service factory resulted in a recursive call to itself for the
* requesting bundle.
@@ -97,8 +96,8 @@ public class ServiceException extends RuntimeException {
}
/**
- * Creates a {@code ServiceException} with the specified message,
- * type and exception cause.
+ * Creates a {@code ServiceException} with the specified message, type and
+ * exception cause.
*
* @param msg The associated message.
* @param type The type for this exception.
@@ -110,8 +109,7 @@ public class ServiceException extends RuntimeException {
}
/**
- * Creates a {@code ServiceException} with the specified message and
- * type.
+ * Creates a {@code ServiceException} with the specified message and type.
*
* @param msg The message.
* @param type The type for this exception.
@@ -122,8 +120,8 @@ public class ServiceException extends RuntimeException {
}
/**
- * Returns the type for this exception or {@code UNSPECIFIED} if the
- * type was unspecified or unknown.
+ * Returns the type for this exception or {@code UNSPECIFIED} if the type
+ * was unspecified or unknown.
*
* @return The type of this exception.
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
index c241514f2..535776e70 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,6 +110,5 @@ public interface ServiceFactory<S> {
* method.
* @see BundleContext#ungetService(ServiceReference)
*/
- public void ungetService(Bundle bundle, ServiceRegistration<S> registration,
- S service);
+ public void ungetService(Bundle bundle, ServiceRegistration<S> registration, S service);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
index d73f8e9b4..601dfda61 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,33 +19,31 @@ package org.osgi.framework;
import java.util.EventListener;
/**
- * A {@code ServiceEvent} listener. {@code ServiceListener} is a
- * listener interface that may be implemented by a bundle developer. When a
+ * A {@code ServiceEvent} listener. {@code ServiceListener} is a listener
+ * interface that may be implemented by a bundle developer. When a
* {@code ServiceEvent} is fired, it is synchronously delivered to a
- * {@code ServiceListener}. The Framework may deliver
- * {@code ServiceEvent} objects to a {@code ServiceListener} out
- * of order and may concurrently call and/or reenter a
- * {@code ServiceListener}.
+ * {@code ServiceListener}. The Framework may deliver {@code ServiceEvent}
+ * objects to a {@code ServiceListener} out of order and may concurrently call
+ * and/or reenter a {@code ServiceListener}.
*
* <p>
- * A {@code ServiceListener} object is registered with the Framework
- * using the {@code BundleContext.addServiceListener} method.
- * {@code ServiceListener} objects are called with a
- * {@code ServiceEvent} object when a service is registered, modified, or
- * is in the process of unregistering.
+ * A {@code ServiceListener} object is registered with the Framework using the
+ * {@code BundleContext.addServiceListener} method. {@code ServiceListener}
+ * objects are called with a {@code ServiceEvent} object when a service is
+ * registered, modified, or is in the process of unregistering.
*
* <p>
- * {@code ServiceEvent} object delivery to {@code ServiceListener}
- * objects is filtered by the filter specified when the listener was registered.
- * If the Java Runtime Environment supports permissions, then additional
- * filtering is done. {@code ServiceEvent} objects are only delivered to
- * the listener if the bundle which defines the listener object's class has the
- * appropriate {@code ServicePermission} to get the service using at
- * least one of the named classes under which the service was registered.
+ * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
+ * filtered by the filter specified when the listener was registered. If the
+ * Java Runtime Environment supports permissions, then additional filtering is
+ * done. {@code ServiceEvent} objects are only delivered to the listener if the
+ * bundle which defines the listener object's class has the appropriate
+ * {@code ServicePermission} to get the service using at least one of the named
+ * classes under which the service was registered.
*
* <p>
- * {@code ServiceEvent} object delivery to {@code ServiceListener}
- * objects is further filtered according to package sources as defined in
+ * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
+ * further filtered according to package sources as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
*
* @see ServiceEvent
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
index 1b6ee9543..96438ad16 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,66 +41,64 @@ import java.util.Set;
/**
* A bundle's authority to register or get a service.
* <ul>
- * <li>The {@code register} action allows a bundle to register a service on
- * the specified names.
- * <li>The {@code get} action allows a bundle to detect a service and get
- * it.
+ * <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.
* </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
- * certain services unless they have the appropriate
- * {@code ServicePermission} to get the specific service.
+ * certain services unless they have the appropriate {@code ServicePermission}
+ * to get the specific service.
*
* @ThreadSafe
* @version $Id$
*/
public final class ServicePermission extends BasicPermission {
- static final long serialVersionUID = -7662148639076511574L;
+ static final long serialVersionUID = -7662148639076511574L;
/**
* The action string {@code get}.
*/
- public final static String GET = "get";
+ public final static String GET = "get";
/**
* The action string {@code register}.
*/
- public final static String REGISTER = "register";
+ public final static String REGISTER = "register";
- private final static int ACTION_GET = 0x00000001;
- private final static int ACTION_REGISTER = 0x00000002;
- private final static int ACTION_ALL = ACTION_GET
- | ACTION_REGISTER;
- final static int ACTION_NONE = 0;
+ private final static int ACTION_GET = 0x00000001;
+ private final static int ACTION_REGISTER = 0x00000002;
+ private final static int ACTION_ALL = ACTION_GET | ACTION_REGISTER;
+ final static int ACTION_NONE = 0;
/**
* The actions mask.
*/
- transient int action_mask;
+ transient int action_mask;
/**
* The actions in canonical form.
*
* @serial
*/
- private volatile String actions = null;
+ private volatile String actions = null;
/**
* The service used by this ServicePermission. Must be null if not
* constructed with a service.
*/
- transient final ServiceReference< ? > service;
+ transient final ServiceReference<?> service;
/**
* The object classes for this ServicePermission. Must be null if not
* constructed with a service.
*/
- transient final String[] objectClass;
+ transient final String[] objectClass;
/**
* If this ServicePermission was constructed with a filter, this holds a
* Filter matching object used to evaluate the filter in implies.
*/
- transient Filter filter;
+ transient Filter filter;
/**
* This map holds the properties of the permission, used to match a filter
@@ -112,13 +110,13 @@ public final class ServicePermission extends BasicPermission {
/**
* True if constructed with a name and the name is "*" or ends with ".*".
*/
- private transient boolean wildcard;
+ private transient boolean wildcard;
/**
* If constructed with a name and the name ends with ".*", this contains the
* name without the final "*".
*/
- private transient String prefix;
+ private transient String prefix;
/**
* Create a new ServicePermission.
@@ -139,9 +137,9 @@ public final class ServicePermission extends BasicPermission {
* *
* </pre>
*
- * For the {@code get} action, the name can also be a filter
- * expression. The filter gives access to the service properties as well as
- * the following attributes:
+ * For the {@code get} action, the name can also be a filter expression. The
+ * filter gives access to the service properties as well as the following
+ * attributes:
* <ul>
* <li>signer - A Distinguished Name chain used to sign the bundle
* publishing the service. Wildcards in a DN are not matched according to
@@ -159,33 +157,29 @@ public final class ServicePermission extends BasicPermission {
* Service properties names are case insensitive.
*
* <p>
- * There are two possible actions: {@code get} and
- * {@code register}. The {@code get} permission allows the owner
- * of this permission to obtain a service with this name. The
- * {@code register} permission allows the bundle to register a service
- * under that name.
+ * There are two possible actions: {@code get} and {@code register}. The
+ * {@code get} permission allows the owner of this permission to obtain a
+ * service with this name. The {@code register} permission allows the bundle
+ * to register a service under that name.
*
* @param name The service class name
* @param actions {@code get},{@code register} (canonical order)
* @throws IllegalArgumentException If the specified name is a filter
- * expression and either the specified action is not
- * {@code get} or the filter has an invalid syntax.
+ * expression and either the specified action is not {@code get} or
+ * the filter has an invalid syntax.
*/
public ServicePermission(String name, String actions) {
this(name, parseActions(actions));
- if ((filter != null)
- && ((action_mask & ACTION_ALL) != ACTION_GET)) {
- throw new IllegalArgumentException(
- "invalid action string for filter expression");
+ if ((filter != null) && ((action_mask & ACTION_ALL) != ACTION_GET)) {
+ throw new IllegalArgumentException("invalid action string for filter expression");
}
}
/**
- * Creates a new requested {@code ServicePermission} object to be used
- * by code that must perform {@code checkPermission} for the
- * {@code get} action. {@code ServicePermission} objects created
- * with this constructor cannot be added to a {@code ServicePermission}
- * permission collection.
+ * Creates a new requested {@code ServicePermission} object to be used by
+ * code that must perform {@code checkPermission} for the {@code get}
+ * action. {@code ServicePermission} objects created with this constructor
+ * cannot be added to a {@code ServicePermission} permission collection.
*
* @param reference The requested service.
* @param actions The action {@code get}.
@@ -193,12 +187,11 @@ public final class ServicePermission extends BasicPermission {
* {@code get} or reference is {@code null}.
* @since 1.5
*/
- public ServicePermission(ServiceReference< ? > reference, String actions) {
+ public ServicePermission(ServiceReference<?> reference, String actions) {
super(createName(reference));
setTransients(null, parseActions(actions));
this.service = reference;
- this.objectClass = (String[]) reference
- .getProperty(Constants.OBJECTCLASS);
+ this.objectClass = (String[]) reference.getProperty(Constants.OBJECTCLASS);
if ((action_mask & ACTION_ALL) != ACTION_GET) {
throw new IllegalArgumentException("invalid action string");
}
@@ -210,7 +203,7 @@ public final class ServicePermission extends BasicPermission {
* @param reference ServiceReference to use to create permission name.
* @return permission name.
*/
- private static String createName(ServiceReference< ? > reference) {
+ private static String createName(ServiceReference<?> reference) {
if (reference == null) {
throw new IllegalArgumentException("reference must not be null");
}
@@ -248,8 +241,7 @@ public final class ServicePermission extends BasicPermission {
String name = getName();
int l = name.length();
/* if "*" or endsWith ".*" */
- wildcard = ((name.charAt(l - 1) == '*') && ((l == 1) || (name
- .charAt(l - 2) == '.')));
+ wildcard = ((name.charAt(l - 1) == '*') && ((l == 1) || (name.charAt(l - 2) == '.')));
if (wildcard && (l > 1)) {
prefix = name.substring(0, l - 1);
}
@@ -281,9 +273,7 @@ public final class ServicePermission extends BasicPermission {
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -295,8 +285,7 @@ public final class ServicePermission extends BasicPermission {
matchlen = 3;
mask |= ACTION_GET;
- }
- else
+ } else
if (i >= 7 && (a[i - 7] == 'r' || a[i - 7] == 'R')
&& (a[i - 6] == 'e' || a[i - 6] == 'E')
&& (a[i - 5] == 'g' || a[i - 5] == 'G')
@@ -308,11 +297,9 @@ public final class ServicePermission extends BasicPermission {
matchlen = 8;
mask |= ACTION_REGISTER;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException("invalid permission: "
- + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
// make sure we didn't just match the tail of a word
@@ -322,7 +309,7 @@ public final class ServicePermission extends BasicPermission {
switch (a[i - matchlen]) {
case ',' :
seencomma = true;
- /* FALLTHROUGH */
+ /* FALLTHROUGH */
case ' ' :
case '\r' :
case '\n' :
@@ -330,8 +317,7 @@ public final class ServicePermission extends BasicPermission {
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -363,18 +349,16 @@ public final class ServicePermission extends BasicPermission {
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
}
/**
- * Determines if a {@code ServicePermission} object "implies" the
- * specified permission.
+ * Determines if a {@code ServicePermission} object "implies" the specified
+ * permission.
*
* @param p The target permission to check.
* @return {@code true} if the specified permission is implied by this
@@ -432,13 +416,11 @@ public final class ServicePermission extends BasicPermission {
int pl = prefix.length();
for (int i = 0, l = requestedNames.length; i < l; i++) {
String requestedName = requestedNames[i];
- if ((requestedName.length() > pl)
- && requestedName.startsWith(prefix)) {
+ if ((requestedName.length() > pl) && requestedName.startsWith(prefix)) {
return true;
}
}
- }
- else {
+ } else {
String name = getName();
for (int i = 0, l = requestedNames.length; i < l; i++) {
if (requestedNames[i].equals(name)) {
@@ -499,8 +481,8 @@ public final class ServicePermission extends BasicPermission {
*
* @param obj The object to test for equality.
* @return true if obj is a {@code ServicePermission}, and has the same
- * class name and actions as this {@code ServicePermission}
- * object; {@code false} otherwise.
+ * class name and actions as this {@code ServicePermission} object;
+ * {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -513,10 +495,7 @@ public final class ServicePermission extends BasicPermission {
ServicePermission sp = (ServicePermission) obj;
- return (action_mask == sp.action_mask)
- && getName().equals(sp.getName())
- && ((service == sp.service) || ((service != null) && (service
- .compareTo(sp.service) == 0)));
+ return (action_mask == sp.action_mask) && getName().equals(sp.getName()) && ((service == sp.service) || ((service != null) && (service.compareTo(sp.service) == 0)));
}
/**
@@ -537,8 +516,7 @@ public final class ServicePermission extends BasicPermission {
* WriteObject is called to save the state of this permission to a stream.
* The actions are serialized, and the superclass takes care of the name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (service != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -553,8 +531,7 @@ public final class ServicePermission extends BasicPermission {
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(parseFilter(getName()), parseActions(actions));
@@ -598,13 +575,13 @@ public final class ServicePermission extends BasicPermission {
}
return properties = new Properties(props, service);
}
-
+
static private final class Properties extends AbstractMap<String, Object> {
- private final Map<String, Object> properties;
- private final ServiceReference< ? > service;
+ private final Map<String, Object> properties;
+ private final ServiceReference<?> service;
private transient volatile Set<Map.Entry<String, Object>> entries;
- Properties(Map<String, Object> properties, ServiceReference< ? > service) {
+ Properties(Map<String, Object> properties, ServiceReference<?> service) {
this.properties = properties;
this.service = service;
entries = null;
@@ -629,8 +606,7 @@ public final class ServicePermission extends BasicPermission {
if (entries != null) {
return entries;
}
- Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(
- properties.entrySet());
+ Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(properties.entrySet());
add: for (String key : service.getPropertyKeys()) {
for (String k : properties.keySet()) {
if (key.equalsIgnoreCase(k)) {
@@ -641,7 +617,7 @@ public final class ServicePermission extends BasicPermission {
}
return entries = Collections.unmodifiableSet(all);
}
-
+
static private final class Entry implements Map.Entry<String, Object> {
private final String k;
private final Object v;
@@ -650,22 +626,27 @@ public final class ServicePermission extends BasicPermission {
this.k = key;
this.v = value;
}
+
public String getKey() {
return k;
}
+
public Object getValue() {
return v;
}
+
public Object setValue(Object value) {
throw new UnsupportedOperationException();
}
+
public String toString() {
return k + "=" + v;
}
+
public int hashCode() {
- return ((k == null) ? 0 : k.hashCode())
- ^ ((v == null) ? 0 : v.hashCode());
+ return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
}
+
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -673,7 +654,7 @@ public final class ServicePermission extends BasicPermission {
if (!(obj instanceof Map.Entry)) {
return false;
}
- Map.Entry< ? , ? > e = (Map.Entry< ? , ? >) obj;
+ Map.Entry<?, ?> e = (Map.Entry<?, ?>) obj;
final Object key = e.getKey();
if ((k == key) || ((k != null) && k.equals(key))) {
final Object value = e.getValue();
@@ -695,7 +676,7 @@ public final class ServicePermission extends BasicPermission {
* @see java.security.PermissionCollection
*/
final class ServicePermissionCollection extends PermissionCollection {
- static final long serialVersionUID = 662615640374640621L;
+ static final long serialVersionUID = 662615640374640621L;
/**
* Table of permissions.
*
@@ -709,7 +690,7 @@ final class ServicePermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private boolean all_allowed;
+ private boolean all_allowed;
/**
* Table of permissions with filter expressions.
@@ -733,26 +714,22 @@ final class ServicePermissionCollection extends PermissionCollection {
* @param permission The Permission object to add.
* @throws IllegalArgumentException If the specified permission is not a
* ServicePermission object.
- * @throws SecurityException If this
- * {@code ServicePermissionCollection} object has been marked
- * read-only.
+ * @throws SecurityException If this {@code ServicePermissionCollection}
+ * object has been marked read-only.
*/
public void add(final Permission permission) {
if (!(permission instanceof ServicePermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final ServicePermission sp = (ServicePermission) permission;
if (sp.service != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + sp);
+ throw new IllegalArgumentException("cannot add to collection: " + sp);
}
-
+
final String name = sp.getName();
final Filter f = sp.filter;
synchronized (this) {
@@ -763,25 +740,21 @@ final class ServicePermissionCollection extends PermissionCollection {
if (pc == null) {
filterPermissions = pc = new HashMap<String, ServicePermission>();
}
- }
- else {
+ } else {
pc = permissions;
}
final ServicePermission existing = pc.get(name);
-
+
if (existing != null) {
final int oldMask = existing.action_mask;
final int newMask = sp.action_mask;
if (oldMask != newMask) {
- pc
- .put(name, new ServicePermission(name, oldMask
- | newMask));
+ pc.put(name, new ServicePermission(name, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, sp);
}
-
+
if (!all_allowed) {
if (name.equals("*")) {
all_allowed = true;
@@ -795,9 +768,8 @@ final class ServicePermissionCollection extends PermissionCollection {
* {@code permission}.
*
* @param permission The Permission object to compare.
- * @return {@code true} if {@code permission} is a proper
- * subset of a permission in the set; {@code false}
- * otherwise.
+ * @return {@code true} if {@code permission} is a proper subset of a
+ * permission in the set; {@code false} otherwise.
*/
public boolean implies(final Permission permission) {
if (!(permission instanceof ServicePermission)) {
@@ -823,7 +795,7 @@ final class ServicePermissionCollection extends PermissionCollection {
}
}
}
-
+
String[] requestedNames = requested.objectClass;
/* if requested permission not created with ServiceReference */
if (requestedNames == null) {
@@ -846,7 +818,7 @@ final class ServicePermissionCollection extends PermissionCollection {
}
perms = pc.values();
}
-
+
/* iterate one by one over filteredPermissions */
for (ServicePermission perm : perms) {
if (perm.implies0(requested, effective)) {
@@ -865,8 +837,7 @@ final class ServicePermissionCollection extends PermissionCollection {
* @param effective The effective actions.
* @return The new effective actions.
*/
- private int effective(String requestedName, final int desired,
- int effective) {
+ private int effective(String requestedName, final int desired, int effective) {
final Map<String, ServicePermission> pc = permissions;
ServicePermission sp = pc.get(requestedName);
// strategy:
@@ -899,10 +870,10 @@ final class ServicePermissionCollection extends PermissionCollection {
*/
return effective;
}
-
+
/**
- * Returns an enumeration of all the {@code ServicePermission}
- * objects in the container.
+ * Returns an enumeration of all the {@code ServicePermission} objects in
+ * the container.
*
* @return Enumeration of all the ServicePermission objects.
*/
@@ -914,17 +885,13 @@ final class ServicePermissionCollection extends PermissionCollection {
}
return Collections.enumeration(all);
}
-
+
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE),
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
new ObjectStreamField("filterPermissions", HashMap.class) };
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
- Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(
- permissions);
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+ Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -932,15 +899,12 @@ final class ServicePermissionCollection extends PermissionCollection {
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields
- .get("permissions", null);
+ Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields.get("permissions", null);
permissions = new HashMap<String, ServicePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
- HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields
- .get("filterPermissions", null);
+ HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields.get("filterPermissions", null);
filterPermissions = fp;
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
index 3adba50fc..75352193f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,8 +54,8 @@ import java.util.Dictionary;
public interface ServiceReference<S> extends Comparable<Object> {
/**
* Returns the property value to which the specified property key is mapped
- * in the properties {@code Dictionary} object of the service
- * referenced by this {@code ServiceReference} object.
+ * in the properties {@code Dictionary} object of the service referenced by
+ * this {@code ServiceReference} object.
*
* <p>
* Property keys are case-insensitive.
@@ -63,12 +63,12 @@ public interface ServiceReference<S> extends Comparable<Object> {
* <p>
* This method must continue to return property values after the service has
* been unregistered. This is so references to unregistered services (for
- * example, {@code ServiceReference} objects stored in the log) can
- * still be interrogated.
+ * example, {@code ServiceReference} objects stored in the log) can still be
+ * interrogated.
*
* @param key The property key.
- * @return The property value to which the key is mapped; {@code null}
- * if there is no property named after the key.
+ * @return The property value to which the key is mapped; {@code null} if
+ * there is no property named after the key.
*/
public Object getProperty(String key);
@@ -103,21 +103,20 @@ public interface ServiceReference<S> extends Comparable<Object> {
* unregistered.
*
* @return The bundle that registered the service referenced by this
- * {@code ServiceReference} object; {@code null} if that
- * service has already been unregistered.
+ * {@code ServiceReference} object; {@code null} if that service has
+ * already been unregistered.
* @see BundleContext#registerService(String[],Object,Dictionary)
*/
public Bundle getBundle();
/**
* Returns the bundles that are using the service referenced by this
- * {@code ServiceReference} object. Specifically, this method returns
- * the bundles whose usage count for that service is greater than zero.
+ * {@code ServiceReference} object. Specifically, this method returns the
+ * bundles whose usage count for that service is greater than zero.
*
* @return An array of bundles whose usage count for the service referenced
- * by this {@code ServiceReference} object is greater than
- * zero; {@code null} if no bundles are currently using that
- * service.
+ * by this {@code ServiceReference} object is greater than zero;
+ * {@code null} if no bundles are currently using that service.
*
* @since 1.1
*/
@@ -125,17 +124,16 @@ public interface ServiceReference<S> extends Comparable<Object> {
/**
* Tests if the bundle that registered the service referenced by this
- * {@code ServiceReference} and the specified bundle use the same
- * source for the package of the specified class name.
+ * {@code ServiceReference} and the specified bundle use the same source for
+ * the package of the specified class name.
* <p>
* This method performs the following checks:
* <ol>
* <li>Get the package name from the specified class name.</li>
* <li>For the bundle that registered the service referenced by this
- * {@code ServiceReference} (registrant bundle); find the source for
- * the package. If no source is found then return {@code true} if the
- * registrant bundle is equal to the specified bundle; otherwise return
- * {@code false}.</li>
+ * {@code ServiceReference} (registrant bundle); find the source for the
+ * package. If no source is found then return {@code true} if the registrant
+ * bundle is equal to the specified bundle; otherwise return {@code false}.</li>
* <li>If the package source of the registrant bundle is equal to the
* package source of the specified bundle then return {@code true};
* otherwise return {@code false}.</li>
@@ -144,11 +142,11 @@ public interface ServiceReference<S> extends Comparable<Object> {
* @param bundle The {@code Bundle} object to check.
* @param className The class name to check.
* @return {@code true} if the bundle which registered the service
- * referenced by this {@code ServiceReference} and the
- * specified bundle use the same source for the package of the
- * specified class name. Otherwise {@code false} is returned.
- * @throws IllegalArgumentException If the specified {@code Bundle} was
- * not created by the same framework instance as this
+ * referenced by this {@code ServiceReference} and the specified
+ * bundle use the same source for the package of the specified class
+ * name. Otherwise {@code false} is returned.
+ * @throws IllegalArgumentException If the specified {@code Bundle} was not
+ * created by the same framework instance as this
* {@code ServiceReference}.
* @since 1.3
*/
@@ -161,24 +159,23 @@ public interface ServiceReference<S> extends Comparable<Object> {
* <p>
* If this {@code ServiceReference} and the specified
* {@code ServiceReference} have the same {@link Constants#SERVICE_ID
- * service id} they are equal. This {@code ServiceReference} is less
- * than the specified {@code ServiceReference} if it has a lower
+ * service id} they are equal. This {@code ServiceReference} is less than
+ * the specified {@code ServiceReference} if it has a lower
* {@link Constants#SERVICE_RANKING service ranking} and greater if it has a
- * higher service ranking. Otherwise, if this {@code ServiceReference}
- * and the specified {@code ServiceReference} have the same
+ * higher service ranking. Otherwise, if this {@code ServiceReference} and
+ * the specified {@code ServiceReference} have the same
* {@link Constants#SERVICE_RANKING service ranking}, this
* {@code ServiceReference} is less than the specified
- * {@code ServiceReference} if it has a higher
- * {@link Constants#SERVICE_ID service id} and greater if it has a lower
- * service id.
+ * {@code ServiceReference} if it has a higher {@link Constants#SERVICE_ID
+ * service id} and greater if it has a lower service id.
*
* @param reference The {@code ServiceReference} to be compared.
* @return Returns a negative integer, zero, or a positive integer if this
- * {@code ServiceReference} is less than, equal to, or greater
- * than the specified {@code ServiceReference}.
+ * {@code ServiceReference} is less than, equal to, or greater than
+ * the specified {@code ServiceReference}.
* @throws IllegalArgumentException If the specified
- * {@code ServiceReference} was not created by the same
- * framework instance as this {@code ServiceReference}.
+ * {@code ServiceReference} was not created by the same framework
+ * instance as this {@code ServiceReference}.
* @since 1.4
*/
public int compareTo(Object reference);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
index f8da04fc7..a84248da0 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,12 +23,12 @@ import java.util.Dictionary;
*
* <p>
* The Framework returns a {@code ServiceRegistration} object when a
- * {@code BundleContext.registerService} method invocation is successful.
- * The {@code ServiceRegistration} object is for the private use of the
- * registering bundle and should not be shared with other bundles.
+ * {@code BundleContext.registerService} method invocation is successful. The
+ * {@code ServiceRegistration} object is for the private use of the registering
+ * bundle and should not be shared with other bundles.
* <p>
- * The {@code ServiceRegistration} object may be used to update the
- * properties of the service or to unregister the service.
+ * The {@code ServiceRegistration} object may be used to update the properties
+ * of the service or to unregister the service.
*
* @param <S> Type of Service.
* @see BundleContext#registerService(String[],Object,Dictionary)
@@ -39,15 +39,12 @@ import java.util.Dictionary;
public interface ServiceRegistration<S> {
/**
- * Returns a {@code ServiceReference} object for a service being
- * registered.
+ * Returns a {@code ServiceReference} object for a service being registered.
* <p>
- * The {@code ServiceReference} object may be shared with other
- * bundles.
+ * The {@code ServiceReference} object may be shared with other bundles.
*
- * @throws IllegalStateException If this
- * {@code ServiceRegistration} object has already been
- * unregistered.
+ * @throws IllegalStateException If this {@code ServiceRegistration} object
+ * has already been unregistered.
* @return {@code ServiceReference} object.
*/
public ServiceReference<S> getReference();
@@ -72,12 +69,12 @@ public interface ServiceRegistration<S> {
* be made to this object after calling this method. To update the
* service's properties this method should be called again.
*
- * @throws IllegalStateException If this {@code ServiceRegistration}
- * object has already been unregistered.
- * @throws IllegalArgumentException If {@code properties} contains
- * case variants of the same key name.
+ * @throws IllegalStateException If this {@code ServiceRegistration} object
+ * has already been unregistered.
+ * @throws IllegalArgumentException If {@code properties} contains case
+ * variants of the same key name.
*/
- public void setProperties(Dictionary<String, ? > properties);
+ public void setProperties(Dictionary<String, ?> properties);
/**
* Unregisters a service. Remove a {@code ServiceRegistration} object from
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
index 3589831a7..94eea1905 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,20 +70,17 @@ final class SignerProperty {
SignerProperty other = (SignerProperty) o;
Bundle matchBundle = bundle != null ? bundle : other.bundle;
String matchPattern = bundle != null ? other.pattern : pattern;
- Map<X509Certificate, List<X509Certificate>> signers = matchBundle
- .getSignerCertificates(Bundle.SIGNERS_TRUSTED);
+ Map<X509Certificate, List<X509Certificate>> signers = matchBundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
for (List<X509Certificate> signerCerts : signers.values()) {
List<String> dnChain = new ArrayList<String>(signerCerts.size());
for (X509Certificate signerCert : signerCerts) {
dnChain.add(signerCert.getSubjectDN().getName());
}
try {
- if (FrameworkUtil.matchDistinguishedNameChain(matchPattern,
- dnChain)) {
+ if (FrameworkUtil.matchDistinguishedNameChain(matchPattern, dnChain)) {
return true;
}
- }
- catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
continue; // bad pattern
}
}
@@ -107,8 +104,7 @@ final class SignerProperty {
if (bundle == null) {
return false;
}
- Map<X509Certificate, List<X509Certificate>> signers = bundle
- .getSignerCertificates(Bundle.SIGNERS_TRUSTED);
+ Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
return !signers.isEmpty();
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
index a87c21913..a0b5a865f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
@@ -21,7 +21,7 @@ import java.util.StringTokenizer;
/**
* Version identifier for capabilities such as bundles and packages.
- *
+ *
* <p>
* Version identifiers have four components.
* <ol>
@@ -31,10 +31,10 @@ import java.util.StringTokenizer;
* <li>Qualifier. A text string. See {@code Version(String)} for the format of
* the qualifier string.</li>
* </ol>
- *
+ *
* <p>
* {@code Version} objects are immutable.
- *
+ *
* @since 1.3
* @Immutable
* @version $Id$
@@ -45,22 +45,21 @@ public class Version implements Comparable<Version> {
private final int minor;
private final int micro;
private final String qualifier;
- private static final String SEPARATOR = ".";
+ private static final String SEPARATOR = ".";
private transient String versionString /* default to null */;
private transient int hash /* default to 0 */;
-
/**
* The empty version "0.0.0".
*/
- public static final Version emptyVersion = new Version(0, 0, 0);
+ public static final Version emptyVersion = new Version(0, 0, 0);
/**
* Creates a version identifier from the specified numerical components.
- *
+ *
* <p>
* The qualifier is set to the empty string.
- *
+ *
* @param major Major component of the version identifier.
* @param minor Minor component of the version identifier.
* @param micro Micro component of the version identifier.
@@ -73,7 +72,7 @@ public class Version implements Comparable<Version> {
/**
* Creates a version identifier from the specified components.
- *
+ *
* @param major Major component of the version identifier.
* @param minor Minor component of the version identifier.
* @param micro Micro component of the version identifier.
@@ -97,10 +96,10 @@ public class Version implements Comparable<Version> {
/**
* Creates a version identifier from the specified string.
- *
+ *
* <p>
* Version string grammar:
- *
+ *
* <pre>
* version ::= major('.'minor('.'micro('.'qualifier)?)?)?
* major ::= digit+
@@ -110,7 +109,7 @@ public class Version implements Comparable<Version> {
* digit ::= [0..9]
* alpha ::= [a..zA..Z]
* </pre>
- *
+ *
* @param version String representation of the version identifier. There
* must be no whitespace in the argument.
* @throws IllegalArgumentException If {@code version} is improperly
@@ -139,17 +138,13 @@ public class Version implements Comparable<Version> {
qual = st.nextToken(""); // remaining string
if (st.hasMoreTokens()) { // fail safe
- throw new IllegalArgumentException(
- "invalid version \"" + version
- + "\": invalid format");
+ throw new IllegalArgumentException("invalid version \"" + version + "\": invalid format");
}
}
}
}
- }
- catch (NoSuchElementException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid version \"" + version + "\": invalid format");
+ } catch (NoSuchElementException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": invalid format");
iae.initCause(e);
throw iae;
}
@@ -163,7 +158,7 @@ public class Version implements Comparable<Version> {
/**
* Parse numeric component into an int.
- *
+ *
* @param value Numeric component
* @param version Complete version string for exception message, if any
* @return int value of numeric component
@@ -171,11 +166,8 @@ public class Version implements Comparable<Version> {
private static int parseInt(String value, String version) {
try {
return Integer.parseInt(value);
- }
- catch (NumberFormatException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid version \"" + version + "\": non-numeric \""
- + value + "\"");
+ } catch (NumberFormatException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\"");
iae.initCause(e);
throw iae;
}
@@ -183,22 +175,19 @@ public class Version implements Comparable<Version> {
/**
* Called by the Version constructors to validate the version components.
- *
+ *
* @throws IllegalArgumentException If the numerical components are negative
* or the qualifier string is invalid.
*/
private void validate() {
if (major < 0) {
- throw new IllegalArgumentException("invalid version \""
- + toString0() + "\": negative number \"" + major + "\"");
+ throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + major + "\"");
}
if (minor < 0) {
- throw new IllegalArgumentException("invalid version \""
- + toString0() + "\": negative number \"" + minor + "\"");
+ throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + minor + "\"");
}
if (micro < 0) {
- throw new IllegalArgumentException("invalid version \""
- + toString0() + "\": negative number \"" + micro + "\"");
+ throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + micro + "\"");
}
for (char ch : qualifier.toCharArray()) {
if (('A' <= ch) && (ch <= 'Z')) {
@@ -213,18 +202,16 @@ public class Version implements Comparable<Version> {
if ((ch == '_') || (ch == '-')) {
continue;
}
- throw new IllegalArgumentException("invalid version \""
- + toString0() + "\": invalid qualifier \"" + qualifier
- + "\"");
+ throw new IllegalArgumentException("invalid version \"" + toString0() + "\": invalid qualifier \"" + qualifier + "\"");
}
}
/**
* Parses a version identifier from the specified string.
- *
+ *
* <p>
* See {@code 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
@@ -248,7 +235,7 @@ public class Version implements Comparable<Version> {
/**
* Returns the major component of this version identifier.
- *
+ *
* @return The major component.
*/
public int getMajor() {
@@ -257,7 +244,7 @@ public class Version implements Comparable<Version> {
/**
* Returns the minor component of this version identifier.
- *
+ *
* @return The minor component.
*/
public int getMinor() {
@@ -266,7 +253,7 @@ public class Version implements Comparable<Version> {
/**
* Returns the micro component of this version identifier.
- *
+ *
* @return The micro component.
*/
public int getMicro() {
@@ -275,7 +262,7 @@ public class Version implements Comparable<Version> {
/**
* Returns the qualifier component of this version identifier.
- *
+ *
* @return The qualifier component.
*/
public String getQualifier() {
@@ -284,12 +271,12 @@ public class Version implements Comparable<Version> {
/**
* Returns the string representation of this version identifier.
- *
+ *
* <p>
- * The format of the version string will be {@code major.minor.micro}
- * if qualifier is the empty string or
- * {@code major.minor.micro.qualifier} otherwise.
- *
+ * The format of the version string will be {@code major.minor.micro} if
+ * qualifier is the empty string or {@code major.minor.micro.qualifier}
+ * otherwise.
+ *
* @return The string representation of this version identifier.
*/
public String toString() {
@@ -298,7 +285,7 @@ public class Version implements Comparable<Version> {
/**
* Internal toString behavior
- *
+ *
* @return The string representation of this version identifier.
*/
String toString0() {
@@ -338,12 +325,12 @@ public class Version implements Comparable<Version> {
/**
* Compares this {@code Version} object to another object.
- *
+ *
* <p>
* A version is considered to be <b>equal to </b> another version if the
* major, minor and micro components are equal and the qualifier component
* is equal (using {@code String.equals}).
- *
+ *
* @param object The {@code Version} object to be compared.
* @return {@code true} if {@code object} is a {@code Version} and is equal
* to this object; {@code false} otherwise.
@@ -358,13 +345,12 @@ public class Version implements Comparable<Version> {
}
Version other = (Version) object;
- return (major == other.major) && (minor == other.minor)
- && (micro == other.micro) && qualifier.equals(other.qualifier);
+ return (major == other.major) && (minor == other.minor) && (micro == other.micro) && qualifier.equals(other.qualifier);
}
/**
* Compares this {@code Version} object to another {@code Version}.
- *
+ *
* <p>
* A version is considered to be <b>less than</b> another version if its
* major component is less than the other version's major component, or the
@@ -374,12 +360,12 @@ public class Version implements Comparable<Version> {
* or the major, minor and micro components are equal and it's qualifier
* component is less than the other version's qualifier component (using
* {@code String.compareTo}).
- *
+ *
* <p>
* A version is considered to be <b>equal to</b> another version if the
* major, minor and micro components are equal and the qualifier component
* is equal (using {@code String.compareTo}).
- *
+ *
* @param other The {@code Version} object to be compared.
* @return A negative integer, zero, or a positive integer if this version
* is less than, equal to, or greater than the specified
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java
index 9baa9cf9c..d0c21e6a5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java
@@ -22,14 +22,14 @@ import java.util.StringTokenizer;
/**
* Version range. A version range is an interval describing a set of
* {@link Version versions}.
- *
+ *
* <p>
* A range has a left (lower) endpoint and a right (upper) endpoint. Each
* endpoint can be open (excluded from the set) or closed (included in the set).
- *
+ *
* <p>
* {@code VersionRange} objects are immutable.
- *
+ *
* @since 1.7
* @Immutable
* @version $Id$
@@ -72,17 +72,15 @@ public class VersionRange {
private static final String LEFT_OPEN_DELIMITER = "(";
private static final String LEFT_CLOSED_DELIMITER = "[";
- private static final String LEFT_DELIMITERS = LEFT_CLOSED_DELIMITER
- + LEFT_OPEN_DELIMITER;
+ private static final String LEFT_DELIMITERS = LEFT_CLOSED_DELIMITER + LEFT_OPEN_DELIMITER;
private static final String RIGHT_OPEN_DELIMITER = ")";
private static final String RIGHT_CLOSED_DELIMITER = "]";
- private static final String RIGHT_DELIMITERS = RIGHT_OPEN_DELIMITER
- + RIGHT_CLOSED_DELIMITER;
+ private static final String RIGHT_DELIMITERS = RIGHT_OPEN_DELIMITER + RIGHT_CLOSED_DELIMITER;
private static final String ENDPOINT_DELIMITER = ",";
/**
* Creates a version range from the specified versions.
- *
+ *
* @param leftType Must be either {@link #LEFT_CLOSED} or {@link #LEFT_OPEN}
* .
* @param leftEndpoint Left endpoint of range. Must not be {@code null}.
@@ -92,15 +90,12 @@ public class VersionRange {
* {@link #RIGHT_OPEN}.
* @throws IllegalArgumentException If the arguments are invalid.
*/
- public VersionRange(char leftType, Version leftEndpoint,
- Version rightEndpoint, char rightType) {
+ public VersionRange(char leftType, Version leftEndpoint, Version rightEndpoint, char rightType) {
if ((leftType != LEFT_CLOSED) && (leftType != LEFT_OPEN)) {
- throw new IllegalArgumentException("invalid leftType \""
- + leftType + "\"");
+ throw new IllegalArgumentException("invalid leftType \"" + leftType + "\"");
}
if ((rightType != RIGHT_OPEN) && (rightType != RIGHT_CLOSED)) {
- throw new IllegalArgumentException("invalid rightType \""
- + rightType + "\"");
+ throw new IllegalArgumentException("invalid rightType \"" + rightType + "\"");
}
if (leftEndpoint == null) {
throw new IllegalArgumentException("null leftEndpoint argument");
@@ -114,10 +109,10 @@ public class VersionRange {
/**
* Creates a version range from the specified string.
- *
+ *
* <p>
* Version range string grammar:
- *
+ *
* <pre>
* range ::= interval | atleast
* interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' )
@@ -125,7 +120,7 @@ public class VersionRange {
* right ::= version
* atleast ::= version
* </pre>
- *
+ *
* @param range String representation of the version range. The versions in
* the range must contain no whitespace. Other whitespace in the
* range string is ignored.
@@ -139,8 +134,7 @@ public class VersionRange {
Version endpointRight;
try {
- StringTokenizer st = new StringTokenizer(range, LEFT_DELIMITERS,
- true);
+ StringTokenizer st = new StringTokenizer(range, LEFT_DELIMITERS, true);
String token = st.nextToken().trim(); // whitespace or left delim
if (token.length() == 0) { // leading whitespace
token = st.nextToken(); // left delim
@@ -149,8 +143,7 @@ public class VersionRange {
if (!closedLeft && !LEFT_OPEN_DELIMITER.equals(token)) {
// first token is not a delimiter, so it must be "atleast"
if (st.hasMoreTokens()) { // there must be no more tokens
- throw new IllegalArgumentException("invalid range \""
- + range + "\": invalid format");
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
}
leftClosed = true;
rightClosed = false;
@@ -166,22 +159,18 @@ public class VersionRange {
token = st.nextToken(); // right delim
closedRight = RIGHT_CLOSED_DELIMITER.equals(token);
if (!closedRight && !RIGHT_OPEN_DELIMITER.equals(token)) {
- throw new IllegalArgumentException("invalid range \"" + range
- + "\": invalid format");
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
}
endpointRight = parseVersion(version, range);
if (st.hasMoreTokens()) { // any more tokens have to be whitespace
token = st.nextToken("").trim();
if (token.length() != 0) { // trailing whitespace
- throw new IllegalArgumentException("invalid range \""
- + range + "\": invalid format");
+ throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
}
}
- }
- catch (NoSuchElementException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid range \"" + range + "\": invalid format");
+ } catch (NoSuchElementException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
iae.initCause(e);
throw iae;
}
@@ -195,7 +184,7 @@ public class VersionRange {
/**
* Parse version component into a Version.
- *
+ *
* @param version version component string
* @param range Complete range string for exception message, if any
* @return Version
@@ -203,10 +192,8 @@ public class VersionRange {
private static Version parseVersion(String version, String range) {
try {
return Version.parseVersion(version);
- }
- catch (IllegalArgumentException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid range \"" + range + "\": " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
iae.initCause(e);
throw iae;
}
@@ -214,7 +201,7 @@ public class VersionRange {
/**
* Returns the left endpoint of this version range.
- *
+ *
* @return The left endpoint.
*/
public Version getLeft() {
@@ -223,7 +210,7 @@ public class VersionRange {
/**
* Returns the right endpoint of this version range.
- *
+ *
* @return The right endpoint. May be {@code null} which indicates the right
* endpoint is <i>Infinity</i>.
*/
@@ -233,7 +220,7 @@ public class VersionRange {
/**
* Returns the type of the left endpoint of this version range.
- *
+ *
* @return {@link #LEFT_CLOSED} if the left endpoint is closed or
* {@link #LEFT_OPEN} if the left endpoint is open.
*/
@@ -243,7 +230,7 @@ public class VersionRange {
/**
* Returns the type of the right endpoint of this version range.
- *
+ *
* @return {@link #RIGHT_CLOSED} if the right endpoint is closed or
* {@link #RIGHT_OPEN} if the right endpoint is open.
*/
@@ -253,7 +240,7 @@ public class VersionRange {
/**
* Returns whether this version range includes the specified version.
- *
+ *
* @param version The version to test for inclusion in this version range.
* @return {@code true} if the specified version is included in this version
* range; {@code false} otherwise.
@@ -274,7 +261,7 @@ public class VersionRange {
/**
* Returns the intersection of this version range with the specified version
* ranges.
- *
+ *
* @param ranges The version ranges to intersect with this version range.
* @return A version range representing the intersection of this version
* range and the specified version ranges. If no version ranges are
@@ -294,8 +281,7 @@ public class VersionRange {
int comparison = endpointLeft.compareTo(range.left);
if (comparison == 0) {
closedLeft = closedLeft && range.leftClosed;
- }
- else {
+ } else {
if (comparison < 0) { // move endpointLeft to the right
endpointLeft = range.left;
closedLeft = range.leftClosed;
@@ -305,13 +291,11 @@ public class VersionRange {
if (endpointRight == null) {
endpointRight = range.right;
closedRight = range.rightClosed;
- }
- else {
+ } else {
comparison = endpointRight.compareTo(range.right);
if (comparison == 0) {
closedRight = closedRight && range.rightClosed;
- }
- else {
+ } else {
if (comparison > 0) { // move endpointRight to the left
endpointRight = range.right;
closedRight = range.rightClosed;
@@ -321,15 +305,13 @@ public class VersionRange {
}
}
- return new VersionRange(closedLeft ? LEFT_CLOSED : LEFT_OPEN,
- endpointLeft, endpointRight, closedRight ? RIGHT_CLOSED
- : RIGHT_OPEN);
+ return new VersionRange(closedLeft ? LEFT_CLOSED : LEFT_OPEN, endpointLeft, endpointRight, closedRight ? RIGHT_CLOSED : RIGHT_OPEN);
}
/**
* Returns whether this version range is empty. A version range is empty if
* the set of versions defined by the interval is empty.
- *
+ *
* @return {@code true} if this version range is empty; {@code false}
* otherwise.
*/
@@ -339,7 +321,7 @@ public class VersionRange {
/**
* Internal isEmpty behavior.
- *
+ *
* @return {@code true} if this version range is empty; {@code false}
* otherwise.
*/
@@ -368,28 +350,19 @@ public class VersionRange {
if (rightClosed) {
// [l,r]: exact if l == r
return left.equals(right);
- }
- else {
+ } else {
// [l,r): exact if l++ >= r
- Version adjacent1 = new Version(left.getMajor(),
- left.getMinor(), left.getMicro(), left.getQualifier()
- + "-");
+ Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
return adjacent1.compareTo(right) >= 0;
}
- }
- else {
+ } else {
if (rightClosed) {
// (l,r] is equivalent to [l++,r]: exact if l++ == r
- Version adjacent1 = new Version(left.getMajor(),
- left.getMinor(), left.getMicro(), left.getQualifier()
- + "-");
+ Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
return adjacent1.equals(right);
- }
- else {
+ } else {
// (l,r) is equivalent to [l++,r): exact if (l++)++ >=r
- Version adjacent2 = new Version(left.getMajor(),
- left.getMinor(), left.getMicro(), left.getQualifier()
- + "--");
+ Version adjacent2 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "--");
return adjacent2.compareTo(right) >= 0;
}
}
@@ -397,11 +370,11 @@ public class VersionRange {
/**
* Returns the string representation of this version range.
- *
+ *
* <p>
* The format of the version range string will be a version string if the
* right end point is <i>Infinity</i> ({@code null}) or an interval string.
- *
+ *
* @return The string representation of this version range.
*/
public String toString() {
@@ -415,8 +388,7 @@ public class VersionRange {
return versionRangeString = result.toString();
}
String rightVerion = right.toString();
- StringBuffer result = new StringBuffer(leftVersion.length()
- + rightVerion.length() + 5);
+ StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5);
result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN);
result.append(left.toString0());
result.append(ENDPOINT_DELIMITER);
@@ -427,7 +399,7 @@ public class VersionRange {
/**
* Returns a hash code value for the object.
- *
+ *
* @return An integer which is a hash code value for this object.
*/
public int hashCode() {
@@ -448,12 +420,12 @@ public class VersionRange {
/**
* Compares this {@code VersionRange} object to another object.
- *
+ *
* <p>
* A version range is considered to be <b>equal to </b> another version
* range if both the endpoints and their types are equal or if both version
* ranges are {@link #isEmpty() empty}.
- *
+ *
* @param object The {@code VersionRange} object to be compared.
* @return {@code true} if {@code object} is a {@code VersionRange} and is
* equal to this object; {@code false} otherwise.
@@ -470,37 +442,31 @@ public class VersionRange {
return true;
}
if (right == null) {
- return (leftClosed == other.leftClosed) && (other.right == null)
- && left.equals(other.left);
+ return (leftClosed == other.leftClosed) && (other.right == null) && left.equals(other.left);
}
- return (leftClosed == other.leftClosed)
- && (rightClosed == other.rightClosed)
- && left.equals(other.left) && right.equals(other.right);
+ return (leftClosed == other.leftClosed) && (rightClosed == other.rightClosed) && left.equals(other.left) && right.equals(other.right);
}
/**
* Returns the filter string for this version range using the specified
* attribute name.
- *
+ *
* @param attributeName The attribute name to use in the returned filter
* string.
* @return A filter string for this version range using the specified
* attribute name.
* @throws IllegalArgumentException If the specified attribute name is not a
* valid attribute name.
- *
+ *
* @see "Core Specification, Filters, for a description of the filter string syntax."
*/
public String toFilterString(String attributeName) {
if (attributeName.length() == 0) {
- throw new IllegalArgumentException("invalid attributeName \""
- + attributeName + "\"");
+ throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
}
for (char ch : attributeName.toCharArray()) {
- if ((ch == '=') || (ch == '>') || (ch == '<') || (ch == '~')
- || (ch == '(') || (ch == ')')) {
- throw new IllegalArgumentException("invalid attributeName \""
- + attributeName + "\"");
+ if ((ch == '=') || (ch == '>') || (ch == '<') || (ch == '~') || (ch == '(') || (ch == ')')) {
+ throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
}
}
@@ -514,8 +480,7 @@ public class VersionRange {
result.append(">=");
result.append(left.toString0());
result.append(')');
- }
- else {
+ } else {
result.append("(!(");
result.append(attributeName);
result.append("<=");
@@ -529,8 +494,7 @@ public class VersionRange {
result.append("<=");
result.append(right.toString0());
result.append(')');
- }
- else {
+ } else {
result.append("(!(");
result.append(attributeName);
result.append(">=");
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
index 9f4ee5c02..a1a25ee04 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -27,8 +27,8 @@ import org.osgi.framework.Constants;
* <p>
* If the framework was launched with the {@link Constants#FRAMEWORK_BSNVERSION
* org.osgi.framework.bsnversion} framework launching property set to
- * {@link Constants#FRAMEWORK_BSNVERSION_MANAGED managed}, then bundles
- * registering this service will be called during framework bundle install and
+ * {@link Constants#FRAMEWORK_BSNVERSION_MANAGED managed}, then all registered
+ * collision hook services will be called during framework bundle install and
* update operations to determine if an install or update operation will result
* in a bundle symbolic name and version collision.
*
@@ -41,6 +41,7 @@ public interface CollisionHook {
* Specifies a bundle install operation is being performed.
*/
int INSTALLING = 1;
+
/**
* Specifies a bundle update operation is being performed.
*/
@@ -65,21 +66,20 @@ public interface CollisionHook {
* the same symbolic name and version as the content the target bundle is
* being updated to.
* </ul>
- * This method can filter the list of collision candidates by removing
- * potential collisions. Removing a collision candidate will allow the
- * specified operation to succeed as if the collision candidate is not
- * installed.
+ * This method can filter the collection of collision candidates by removing
+ * potential collisions. For the specified operation to succeed, the
+ * collection of collision candidates must be empty after all registered
+ * collision hook services have been called.
*
- * @param operationType the operation type. Must be the value of
+ * @param operationType The operation type. Must be the value of
* {@link #INSTALLING installing} or {@link #UPDATING updating}.
- * @param target the target bundle used to determine what collision
+ * @param target The target bundle used to determine what collision
* candidates to filter.
- * @param collisionCandidates a collection of collision candidates. The
+ * @param collisionCandidates The collection of collision candidates. The
* collection supports all the optional {@code Collection} operations
* except {@code add} and {@code addAll}. Attempting to add to the
* collection will result in an {@code UnsupportedOperationException}
* . The collection is not synchronized.
*/
- void filterCollisions(int operationType, Bundle target,
- Collection<Bundle> collisionCandidates);
+ void filterCollisions(int operationType, Bundle target, Collection<Bundle> collisionCandidates);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/EventHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/EventHook.java
index 18ea1ec1f..e1471b364 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/EventHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/EventHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,10 @@
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
-/**
+/**
* OSGi Framework Bundle Event Hook Service.
*
* <p>
@@ -34,16 +33,18 @@ import org.osgi.framework.BundleEvent;
public interface EventHook {
/**
- * Bundle event hook method. This method is called prior to bundle event
- * delivery when a bundle is installed, resolved, started, stopped, unresolved, or
- * uninstalled. This method can filter the bundles which receive the event.
+ * Bundle event hook method. This method is called prior to bundle event
+ * delivery when a bundle is installed, resolved, started, stopped,
+ * unresolved, or uninstalled. This method can filter the bundles which
+ * receive the event.
* <p>
- * This method must be called by the framework one and only one time for each bundle
- * event generated, this included bundle events which are generated when there are no
- * bundle listeners registered. This method must be called on the same thread that is
- * performing the action which generated the specified event. The specified
- * collection includes bundle contexts with synchronous and asynchronous bundle
- * listeners registered with them.
+ * This method must be called by the framework one and only one time for
+ * each bundle event generated, this included bundle events which are
+ * generated when there are no bundle listeners registered. This method must
+ * be called on the same thread that is performing the action which
+ * generated the specified event. The specified collection includes bundle
+ * contexts with synchronous and asynchronous bundle listeners registered
+ * with them.
*
* @param event The bundle event to be delivered
* @param contexts A collection of Bundle Contexts for bundles which have
@@ -52,9 +53,9 @@ public interface EventHook {
* collection to prevent the event from being delivered to the
* associated bundles. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void event(BundleEvent event, Collection<BundleContext> contexts);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/FindHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/FindHook.java
index 4492a677d..ae6bf5fc5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/FindHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/FindHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework.hooks.bundle;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -48,19 +48,16 @@ public interface FindHook {
* {@link BundleException#REJECTED_BY_HOOK} exception.</li>
* </ul>
*
- * @param context
- * The bundle context of the bundle performing the find
- * operation.
- * @param bundles
- * A collection of Bundles to be returned as a result of the find
- * operation. The implementation of this method may remove
- * bundles from the collection to prevent the bundles from being
- * returned to the bundle performing the find operation. The
- * collection supports all the optional {@code Collection}
- * operations except {@code add} and {@code addAll}. Attempting
- * to add to the collection will result in an
- * {@code UnsupportedOperationException}. The collection is not
- * synchronized.
+ * @param context The bundle context of the bundle performing the find
+ * operation.
+ * @param bundles A collection of Bundles to be returned as a result of the
+ * find operation. The implementation of this method may remove
+ * bundles from the collection to prevent the bundles from being
+ * returned to the bundle performing the find operation. The
+ * collection supports all the optional {@code Collection} operations
+ * except {@code add} and {@code addAll}. Attempting to add to the
+ * collection will result in an {@code UnsupportedOperationException}
+ * . The collection is not synchronized.
*/
void find(BundleContext context, Collection<Bundle> bundles);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
index 3db4f8cf3..9d3ef6240 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
@@ -17,7 +17,6 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -139,14 +138,14 @@ import org.osgi.framework.wiring.FrameworkWiring;
*/
public interface ResolverHook {
/**
- * Filter resolvable candidates hook method. This method may be called
- * multiple times during a single resolve process.
- * This method can filter the collection of candidates by removing
- * potential candidates. Removing a candidate will prevent the candidate
- * from resolving during the current resolve process.
+ * Filter resolvable candidates hook method. This method may be called
+ * multiple times during a single resolve process. This method can filter
+ * the collection of candidates by removing potential candidates. Removing a
+ * candidate will prevent the candidate from resolving during the current
+ * resolve process.
*
- * @param candidates the collection of resolvable candidates available during
- * a resolve process.
+ * @param candidates the collection of resolvable candidates available
+ * during a resolve process.
*/
void filterResolvable(Collection<BundleRevision> candidates);
@@ -200,10 +199,9 @@ public interface ResolverHook {
void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates);
/**
- * This method is called once at the end of the resolve process.
- * After the end method is called the resolve process has ended.
- * The framework must not hold onto this resolver hook instance
- * after end has been called.
+ * This method is called once at the end of the resolve process. After the
+ * end method is called the resolve process has ended. The framework must
+ * not hold onto this resolver hook instance after end has been called.
*/
void end();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHookFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
index 402356636..e0a2f3ad0 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,17 +17,16 @@
package org.osgi.framework.hooks.resolver;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.FrameworkWiring;
-/**
+/**
* OSGi Framework Resolver Hook Factory Service.
*
* <p>
- * Bundles registering this service will be called by the framework during
- * a bundle resolver process to obtain a {@link ResolverHook resolver hook}
+ * Bundles registering this service will be called by the framework during a
+ * bundle resolver process to obtain a {@link ResolverHook resolver hook}
* instance which will be used for the duration of a resolve process.
*
* @ThreadSafe
@@ -37,58 +36,69 @@ import org.osgi.framework.wiring.FrameworkWiring;
public interface ResolverHookFactory {
/**
* This method is called by the framework each time a resolve process begins
- * to obtain a {@link ResolverHook resolver hook} instance. This resolver hook
- * instance will be used for the duration of the resolve process. At the end of
- * the resolve process the method {@link ResolverHook#end()} must be called by
- * the framework and the framework must not hold any references of the resolver
- * hook instance.
+ * to obtain a {@link ResolverHook resolver hook} instance. This resolver
+ * hook instance will be used for the duration of the resolve process. At
+ * the end of the resolve process the method {@link ResolverHook#end()} must
+ * be called by the framework and the framework must not hold any references
+ * of the resolver hook instance.
* <p>
- * The triggers represent the collection of bundles which triggered
- * the resolve process. This collection may be empty if the triggers
- * cannot be determined by the framework. In most cases the triggers
- * can easily be determined. Calling certain methods on
- * {@link Bundle bundle} when a bundle is in the {@link Bundle#INSTALLED INSTALLED}
- * state will cause the framework to begin a resolve process in order to resolve the
- * bundle. The following methods will start a resolve process in this case:
+ * The triggers represent the collection of bundles which triggered the
+ * resolve process. This collection may be empty if the triggers cannot be
+ * determined by the framework. In most cases the triggers can easily be
+ * determined. Calling certain methods on {@link Bundle bundle} when a
+ * bundle is in the {@link Bundle#INSTALLED INSTALLED} state will cause the
+ * framework to begin a resolve process in order to resolve the bundle. The
+ * following methods will start a resolve process in this case:
* <ul>
- * <li>{@link Bundle#start() start}</li>
- * <li>{@link Bundle#loadClass(String) loadClass}</li>
- * <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
- * <li>{@link Bundle#getResource(String) getResource}</li>
- * <li>{@link Bundle#getResources(String) getResources}</li>
- * </ul>
+ * <li>{@link Bundle#start() start}</li>
+ * <li>{@link Bundle#loadClass(String) loadClass}</li>
+ * <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
+ * <li>{@link Bundle#getResource(String) getResource}</li>
+ * <li>{@link Bundle#getResources(String) getResources}</li>
+ * </ul>
* In such cases the collection will contain the single bundle which the
- * framework is trying to resolve. Other cases will cause multiple bundles to be
- * included in the trigger bundles collection. When {@link FrameworkWiring#resolveBundles(Collection)
- * resolveBundles} is called the collection of triggers must include all the current bundle
- * revisions for bundles passed to resolveBundles which are in the {@link Bundle#INSTALLED INSTALLED}
- * state.
+ * framework is trying to resolve. Other cases will cause multiple bundles
+ * to be included in the trigger bundles collection. When
+ * {@link FrameworkWiring#resolveBundles(Collection) resolveBundles} is
+ * called the collection of triggers must include all the current bundle
+ * revisions for bundles passed to resolveBundles which are in the
+ * {@link Bundle#INSTALLED INSTALLED} state.
* <p>
- * When {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
- * is called the collection of triggers is determined with the following steps:
+ * When
+ * {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
+ * is called the collection of triggers is determined with the following
+ * steps:
* <ul>
- * <li>If the collection of bundles passed is null then {@link FrameworkWiring#getRemovalPendingBundles()}
- * is called to get the initial collection of bundles.</li>
- * <li>The equivalent of calling {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
- * the initial collection of bundles to get the dependency closure collection of the bundles being refreshed.</li>
- * <li>Remove any non-active bundles from the dependency closure collection.</li>
- * <li>For each bundle remaining in the dependency closure collection get the current bundle revision
- * and add it to the collection of triggers.</li>
+ * <li>If the collection of bundles passed is null then
+ * {@link FrameworkWiring#getRemovalPendingBundles()} is called to get the
+ * initial collection of bundles.</li>
+ * <li>The equivalent of calling
+ * {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
+ * the initial collection of bundles to get the dependency closure
+ * collection of the bundles being refreshed.</li>
+ * <li>Remove any non-active bundles from the dependency closure collection.
+ * </li>
+ * <li>For each bundle remaining in the dependency closure collection get
+ * the current bundle revision and add it to the collection of triggers.</li>
* </ul>
* <p>
- * As described above, a resolve process is typically initiated as a result of calling API that causes the
- * framework to attempt to resolve one or more bundles.
- * The framework is free to start a resolve process at any time for reasons other than calls to framework API.
- * For example, a resolve process may be used by the framework for diagnostic purposes and result in no
- * bundles actually becoming resolved at the end of the process.
- * Resolver hook implementations must be prepared for resolve processes that are initiated for other reasons
- * besides calls to framework API.
- * @param triggers an unmodifiable collection of bundles which triggered the resolve process.
- * This collection may be empty if the collection of trigger bundles cannot be
- * determined.
- * @return a resolver hook instance to be used for the duration of the resolve process.
- * A {@code null} value may be returned which indicates this resolver hook factory abstains from
- * the resolve process.
+ * As described above, a resolve process is typically initiated as a result
+ * of calling API that causes the framework to attempt to resolve one or
+ * more bundles. The framework is free to start a resolve process at any
+ * time for reasons other than calls to framework API. For example, a
+ * resolve process may be used by the framework for diagnostic purposes and
+ * result in no bundles actually becoming resolved at the end of the
+ * process. Resolver hook implementations must be prepared for resolve
+ * processes that are initiated for other reasons besides calls to framework
+ * API.
+ *
+ * @param triggers an unmodifiable collection of bundles which triggered the
+ * resolve process. This collection may be empty if the collection of
+ * trigger bundles cannot be determined.
+ * @return a resolver hook instance to be used for the duration of the
+ * resolve process. A {@code null} value may be returned which
+ * indicates this resolver hook factory abstains from the resolve
+ * process.
*/
ResolverHook begin(Collection<BundleRevision> triggers);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java
index 8fb8cfa2c..84757a5f7 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
@@ -46,9 +45,9 @@ public interface EventHook {
* collection to prevent the event from being delivered to the
* associated bundles. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void event(ServiceEvent event, Collection<BundleContext> contexts);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventListenerHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventListenerHook.java
index 61c6aa7e7..b0b99b292 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventListenerHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventListenerHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.osgi.framework.hooks.service;
import java.util.Collection;
import java.util.Map;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
@@ -56,6 +55,5 @@ public interface EventListenerHook {
* collection will result in an {@code UnsupportedOperationException}
* . The map and the collections are not synchronized.
*/
- void event(ServiceEvent event,
- Map<BundleContext, Collection<ListenerInfo>> listeners);
+ void event(ServiceEvent event, Map<BundleContext, Collection<ListenerInfo>> listeners);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java
index 4a939200f..45612d6a1 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -40,12 +39,12 @@ public interface FindHook {
*
* @param context The bundle context of the bundle performing the find
* operation.
- * @param name The class name of the services to find or {@code null}
- * to find all services.
- * @param filter The filter criteria of the services to find or
- * {@code null} for no filter criteria.
- * @param allServices {@code true} if the find operation is the result
- * of a call to
+ * @param name The class name of the services to find or {@code null} to
+ * find all services.
+ * @param filter The filter criteria of the services to find or {@code null}
+ * for no filter criteria.
+ * @param allServices {@code true} if the find operation is the result of a
+ * call to
* {@link BundleContext#getAllServiceReferences(String, String)}
* @param references A collection of Service References to be returned as a
* result of the find operation. The implementation of this method
@@ -53,10 +52,9 @@ public interface FindHook {
* references from being returned to the bundle performing the find
* operation. The collection supports all the optional
* {@code Collection} operations except {@code add} and
- * {@code addAll}. Attempting to add to the collection will
- * result in an {@code UnsupportedOperationException}. The
- * collection is not synchronized.
+ * {@code addAll}. Attempting to add to the collection will result in
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
- void find(BundleContext context, String name, String filter,
- boolean allServices, Collection<ServiceReference< ? >> references);
+ void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java
index 959ee37e1..94029e2b7 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.hooks.service;
import java.util.Collection;
-
import org.osgi.framework.BundleContext;
/**
@@ -43,8 +42,8 @@ public interface ListenerHook {
* @param listeners A collection of {@link ListenerInfo}s for newly added
* service listeners which are now listening to service events.
* Attempting to add to or remove from the collection will result in
- * an {@code UnsupportedOperationException}. The collection is
- * not synchronized.
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void added(Collection<ListenerInfo> listeners);
@@ -57,8 +56,8 @@ public interface ListenerHook {
* @param listeners A collection of {@link ListenerInfo}s for newly removed
* service listeners which are no longer listening to service events.
* Attempting to add to or remove from the collection will result in
- * an {@code UnsupportedOperationException}. The collection is
- * not synchronized.
+ * an {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
*/
void removed(Collection<ListenerInfo> listeners);
@@ -81,17 +80,15 @@ public interface ListenerHook {
* Return the filter string with which the listener was added.
*
* @return The filter string with which the listener was added. This may
- * be {@code null} if the listener was added without a
- * filter.
+ * be {@code null} if the listener was added without a filter.
*/
String getFilter();
/**
* Return the state of the listener for this addition and removal life
- * cycle. Initially this method will return {@code false}
- * indicating the listener has been added but has not been removed.
- * After the listener has been removed, this method must always return
- * {@code true}.
+ * cycle. Initially this method will return {@code false} indicating the
+ * listener has been added but has not been removed. After the listener
+ * has been removed, this method must always return {@code true}.
*
* <p>
* There is an extremely rare case in which removed notification to
@@ -109,19 +106,16 @@ public interface ListenerHook {
boolean isRemoved();
/**
- * Compares this {@code ListenerInfo} to another
- * {@code ListenerInfo}. Two {@code ListenerInfo}s are equals
- * if they refer to the same listener for a given addition and removal
- * life cycle. If the same listener is added again, it must have a
- * different {@code ListenerInfo} which is not equal to this
- * {@code ListenerInfo}.
+ * Compares this {@code ListenerInfo} to another {@code ListenerInfo}.
+ * Two {@code ListenerInfo}s are equals if they refer to the same
+ * listener for a given addition and removal life cycle. If the same
+ * listener is added again, it must have a different
+ * {@code ListenerInfo} which is not equal to this {@code ListenerInfo}.
*
- * @param obj The object to compare against this
- * {@code ListenerInfo}.
- * @return {@code true} if the other object is a
- * {@code ListenerInfo} object and both objects refer to
- * the same listener for a given addition and removal life
- * cycle.
+ * @param obj The object to compare against this {@code ListenerInfo}.
+ * @return {@code true} if the other object is a {@code ListenerInfo}
+ * object and both objects refer to the same listener for a
+ * given addition and removal life cycle.
*/
boolean equals(Object obj);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java
index 61361a379..549caef41 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.osgi.framework.hooks.weaving;
import java.security.ProtectionDomain;
import java.util.List;
-
import org.osgi.framework.wiring.BundleWiring;
/**
@@ -147,7 +146,7 @@ public interface WovenClass {
* weaving is not complete, the class definition failed or this
* woven class was not used to define the class.
*/
- public Class< ? > getDefinedClass();
+ public Class<?> getDefinedClass();
/**
* Returns the bundle wiring whose class loader will define the woven class.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java
index ae7fc29f8..e76240d5d 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package org.osgi.framework.launch;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -76,13 +75,12 @@ public interface Framework extends Bundle {
void init() throws BundleException;
/**
- * Wait until this Framework has completely stopped. The {@code stop}
- * and {@code update} methods on a Framework performs an asynchronous
- * stop of the Framework. This method can be used to wait until the
- * asynchronous stop of this Framework has completed. This method will only
- * wait if called when this Framework is in the {@link #STARTING},
- * {@link #ACTIVE}, or {@link #STOPPING} states. Otherwise it will return
- * immediately.
+ * Wait until this Framework has completely stopped. The {@code stop} and
+ * {@code update} methods on a Framework performs an asynchronous stop of
+ * the Framework. This method can be used to wait until the asynchronous
+ * stop of this Framework has completed. This method will only wait if
+ * called when this Framework is in the {@link #STARTING}, {@link #ACTIVE},
+ * or {@link #STOPPING} states. Otherwise it will return immediately.
* <p>
* A Framework Event is returned to indicate why this Framework has stopped.
*
@@ -90,8 +88,8 @@ public interface Framework extends Bundle {
* Framework has completely stopped. A value of zero will wait
* indefinitely.
* @return A Framework Event indicating the reason this method returned. The
- * following {@code FrameworkEvent} types may be returned by
- * this method.
+ * following {@code FrameworkEvent} types may be returned by this
+ * method.
* <ul>
* <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
* been stopped. </li>
@@ -230,8 +228,8 @@ public interface Framework extends Bundle {
*
* @throws BundleException This Framework cannot be uninstalled.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void uninstall() throws BundleException;
@@ -251,8 +249,8 @@ public interface Framework extends Bundle {
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void update() throws BundleException;
@@ -268,8 +266,8 @@ public interface Framework extends Bundle {
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[this,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+ * Environment supports permissions.
*/
void update(InputStream in) throws BundleException;
@@ -284,8 +282,8 @@ public interface Framework extends Bundle {
/**
* Returns the Framework location identifier. This Framework is assigned the
- * unique location &quot;{@code System Bundle}&quot; since this
- * Framework is also a System Bundle.
+ * unique location &quot;{@code System Bundle}&quot; since this Framework is
+ * also a System Bundle.
*
* @return The string &quot;{@code System Bundle}&quot;.
* @throws SecurityException If the caller does not have the appropriate
@@ -299,8 +297,8 @@ public interface Framework extends Bundle {
/**
* Returns the symbolic name of this Framework. The symbolic name is unique
* for the implementation of the framework. However, the symbolic name
- * &quot;{@code system.bundle}&quot; must be recognized as an alias to
- * the implementation-defined symbolic name since this Framework is also a
+ * &quot;{@code system.bundle}&quot; must be recognized as an alias to the
+ * implementation-defined symbolic name since this Framework is also a
* System Bundle.
*
* @return The symbolic name of this Framework.
@@ -310,22 +308,22 @@ public interface Framework extends Bundle {
String getSymbolicName();
/**
- * Returns {@code null} as a framework implementation does not have a
- * proper bundle from which to return entry paths.
+ * Returns {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entry paths.
*
* @param path Ignored.
- * @return {@code null} as a framework implementation does not have a
- * proper bundle from which to return entry paths.
+ * @return {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entry paths.
*/
Enumeration<String> getEntryPaths(String path);
/**
- * Returns {@code null} as a framework implementation does not have a
- * proper bundle from which to return an entry.
+ * Returns {@code null} as a framework implementation does not have a proper
+ * bundle from which to return an entry.
*
* @param path Ignored.
- * @return {@code null} as a framework implementation does not have a
- * proper bundle from which to return an entry.
+ * @return {@code null} as a framework implementation does not have a proper
+ * bundle from which to return an entry.
*/
URL getEntry(String path);
@@ -339,8 +337,7 @@ public interface Framework extends Bundle {
* @return {@code null} as a framework implementation does not have a proper
* bundle from which to return entries.
*/
- Enumeration<URL> findEntries(String path, String filePattern,
- boolean recurse);
+ Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
/**
* Adapt this Framework to the specified type.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java
index c370e19db..c398d278c 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.launch;
import java.util.Map;
-
import org.osgi.framework.Bundle;
/**
@@ -41,8 +40,8 @@ import org.osgi.framework.Bundle;
* the resource and then load and construct a FrameworkFactory object for the
* framework implementation. The FrameworkFactory implementation class must have
* a public, no-argument constructor. Java&#8482; SE 6 introduced the
- * {@code ServiceLoader} class which can create a FrameworkFactory instance
- * from the resource.
+ * {@code ServiceLoader} class which can create a FrameworkFactory instance from
+ * the resource.
*
* @ThreadSafe
* @noimplement
@@ -59,15 +58,15 @@ public interface FrameworkFactory {
* use some reasonable default configuration appropriate for the
* current VM. For example, the system packages for the current
* execution environment should be properly exported. The specified
- * configuration argument may be {@code null}. The created
- * framework instance must copy any information needed from the
- * specified configuration argument since the configuration argument
- * can be changed after the framework instance has been created.
+ * configuration argument may be {@code null}. The created framework
+ * instance must copy any information needed from the specified
+ * configuration argument since the configuration argument can be
+ * changed after the framework instance has been created.
* @return A new, configured {@link Framework} instance. The framework
* instance must be in the {@link Bundle#INSTALLED} state.
* @throws SecurityException If the caller does not have
- * {@code AllPermission}, and the Java Runtime Environment
- * supports permissions.
+ * {@code AllPermission}, and the Java Runtime Environment supports
+ * permissions.
*/
Framework newFramework(Map<String, String> configuration);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java
index e16d0353e..0332b3e66 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java
@@ -77,7 +77,7 @@ public final class BundleNamespace extends AbstractWiringNamespace {
* Also, the capability attribute used to specify the symbolic name of the
* bundle.
*/
- public static final String BUNDLE_NAMESPACE = "osgi.wiring.bundle";
+ public static final String BUNDLE_NAMESPACE = "osgi.wiring.bundle";
/**
* The capability directive identifying if the resource is a singleton. A
@@ -91,7 +91,7 @@ public final class BundleNamespace extends AbstractWiringNamespace {
*
* @see IdentityNamespace#CAPABILITY_SINGLETON_DIRECTIVE
*/
- public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
+ public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
/**
* The capability directive identifying if and when a fragment may attach to
@@ -124,7 +124,7 @@ public final class BundleNamespace extends AbstractWiringNamespace {
* @see #VISIBILITY_PRIVATE private
* @see #VISIBILITY_REEXPORT reexport
*/
- public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
/**
* The directive value identifying a private
@@ -135,7 +135,7 @@ public final class BundleNamespace extends AbstractWiringNamespace {
*
* @see #REQUIREMENT_VISIBILITY_DIRECTIVE
*/
- public final static String VISIBILITY_PRIVATE = "private";
+ public final static String VISIBILITY_PRIVATE = "private";
/**
* The directive value identifying a reexport
@@ -145,7 +145,7 @@ public final class BundleNamespace extends AbstractWiringNamespace {
*
* @see #REQUIREMENT_VISIBILITY_DIRECTIVE
*/
- public final static String VISIBILITY_REEXPORT = "reexport";
+ public final static String VISIBILITY_REEXPORT = "reexport";
private BundleNamespace() {
// empty
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java
index 583d066e2..5c3378e59 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java
@@ -92,7 +92,7 @@ public final class HostNamespace extends AbstractWiringNamespace {
*
* @see IdentityNamespace#CAPABILITY_SINGLETON_DIRECTIVE
*/
- public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
+ public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
/**
* The capability directive identifying if and when a fragment may attach to
@@ -166,7 +166,7 @@ public final class HostNamespace extends AbstractWiringNamespace {
*
* @see BundleNamespace#REQUIREMENT_VISIBILITY_DIRECTIVE
*/
- public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
private HostNamespace() {
// empty
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java
index 48664b1dd..de0d2d851 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java
@@ -124,7 +124,7 @@ public final class IdentityNamespace extends Namespace {
/**
* The capability attribute that contains the URL to the license for the
- * resource. See the {@name} portion of the {@code Bundle-License}
+ * resource. See the {@code name} portion of the {@code Bundle-License}
* manifest header.
*/
public static final String CAPABILITY_LICENSE_ATTRIBUTE = "license";
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
index eacfd606b..39086f7e6 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
@@ -17,14 +17,13 @@
package org.osgi.framework.wiring;
import java.util.Map;
-
import org.osgi.framework.namespace.AbstractWiringNamespace;
import org.osgi.resource.Capability;
/**
* A capability that has been declared from a {@link BundleRevision bundle
* revision}.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -33,37 +32,48 @@ public interface BundleCapability extends Capability {
/**
* Returns the bundle revision declaring this capability.
- *
+ *
* @return The bundle revision declaring this capability.
*/
BundleRevision getRevision();
/**
- * {@inheritDoc}
+ * Returns the namespace of this capability.
+ *
+ * @return The namespace of this capability.
*/
String getNamespace();
/**
- * {@inheritDoc}
+ * Returns the directives of this capability.
*
* <p>
* All capability directives not specified by the
* {@link AbstractWiringNamespace wiring namespaces} have no specified
* semantics and are considered extra user defined information.
+ *
+ * @return An unmodifiable map of directive names to directive values for
+ * this capability, or an empty map if this capability has no
+ * directives.
*/
Map<String, String> getDirectives();
/**
- * {@inheritDoc}
+ * Returns the attributes of this capability.
+ *
+ * @return An unmodifiable map of attribute names to attribute values for
+ * this capability, or an empty map if this capability has no
+ * attributes.
*/
Map<String, Object> getAttributes();
/**
- * {@inheritDoc}
- *
+ * Returns the resource declaring this capability.
+ *
* <p>
* This method returns the same value as {@link #getRevision()}.
- *
+ *
+ * @return The resource declaring this capability.
* @since 1.1
*/
BundleRevision getResource();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
index bc4807252..212ffb64f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
@@ -17,14 +17,13 @@
package org.osgi.framework.wiring;
import java.util.Map;
-
import org.osgi.framework.namespace.AbstractWiringNamespace;
import org.osgi.resource.Requirement;
/**
* A requirement that has been declared from a {@link BundleRevision bundle
* revision}.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -32,7 +31,7 @@ import org.osgi.resource.Requirement;
public interface BundleRequirement extends Requirement {
/**
* Returns the bundle revision declaring this requirement.
- *
+ *
* @return The bundle revision declaring this requirement.
*/
BundleRevision getRevision();
@@ -50,31 +49,47 @@ public interface BundleRequirement extends Requirement {
boolean matches(BundleCapability capability);
/**
- * {@inheritDoc}
+ * Returns the namespace of this requirement.
+ *
+ * @return The namespace of this requirement.
*/
String getNamespace();
/**
- * {@inheritDoc}
+ * Returns the directives of this requirement.
*
* <p>
* All requirement directives not specified by the
* {@link AbstractWiringNamespace wiring namespaces} have no specified
* semantics and are considered extra user defined information.
+ *
+ * @return An unmodifiable map of directive names to directive values for
+ * this requirement, or an empty map if this requirement has no
+ * directives.
*/
Map<String, String> getDirectives();
/**
- * {@inheritDoc}
+ * Returns the attributes of this requirement.
+ *
+ * <p>
+ * Requirement attributes have no specified semantics and are considered
+ * extra user defined information.
+ *
+ * @return An unmodifiable map of attribute names to attribute values for
+ * this requirement, or an empty map if this requirement has no
+ * attributes.
*/
Map<String, Object> getAttributes();
/**
- * {@inheritDoc}
- *
+ * Returns the resource declaring this requirement.
+ *
* <p>
* This method returns the same value as {@link #getRevision()}.
- *
+ *
+ * @return The resource declaring this requirement. This can be {@code null}
+ * if this requirement is synthesized.
* @since 1.1
*/
BundleRevision getResource();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
index edc3350c0..e68e01a67 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
@@ -17,7 +17,6 @@
package org.osgi.framework.wiring;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Constants;
@@ -58,7 +57,7 @@ import org.osgi.resource.Resource;
public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the symbolic name for this bundle revision.
- *
+ *
* @return The symbolic name for this bundle revision.
* @see Bundle#getSymbolicName()
*/
@@ -66,7 +65,7 @@ public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the version for this bundle revision.
- *
+ *
* @return The version for this bundle revision, or
* {@link Version#emptyVersion} if this bundle revision has no
* version information.
@@ -147,7 +146,7 @@ public interface BundleRevision extends BundleReference, Resource {
*
* @see PackageNamespace
*/
- String PACKAGE_NAMESPACE = PackageNamespace.PACKAGE_NAMESPACE;
+ String PACKAGE_NAMESPACE = PackageNamespace.PACKAGE_NAMESPACE;
/**
* Namespace for bundle capabilities and requirements.
@@ -187,7 +186,7 @@ public interface BundleRevision extends BundleReference, Resource {
*
* @see BundleNamespace
*/
- String BUNDLE_NAMESPACE = BundleNamespace.BUNDLE_NAMESPACE;
+ String BUNDLE_NAMESPACE = BundleNamespace.BUNDLE_NAMESPACE;
/**
* Namespace for host capabilities and requirements.
@@ -230,7 +229,7 @@ public interface BundleRevision extends BundleReference, Resource {
*
* @see HostNamespace
*/
- String HOST_NAMESPACE = HostNamespace.HOST_NAMESPACE;
+ String HOST_NAMESPACE = HostNamespace.HOST_NAMESPACE;
/**
* Returns the special types of this bundle revision. The bundle revision
@@ -238,14 +237,14 @@ public interface BundleRevision extends BundleReference, Resource {
* <ul>
* <li>{@link #TYPE_FRAGMENT}
* </ul>
- *
+ *
* A bundle revision may be more than one type at a time. A type code is
* used to identify the bundle revision type for future extendability.
- *
+ *
* <p>
* If this bundle revision is not one or more of the defined types then 0 is
* returned.
- *
+ *
* @return The special types of this bundle revision. The type values are
* ORed together.
*/
@@ -253,14 +252,14 @@ public interface BundleRevision extends BundleReference, Resource {
/**
* Bundle revision type indicating the bundle revision is a fragment.
- *
+ *
* @see #getTypes()
*/
int TYPE_FRAGMENT = 0x00000001;
/**
* Returns the bundle wiring which is using this bundle revision.
- *
+ *
* @return The bundle wiring which is using this bundle revision or
* {@code null} if no bundle wiring is using this bundle revision.
* @see BundleWiring#getRevision()
@@ -268,23 +267,37 @@ public interface BundleRevision extends BundleReference, Resource {
BundleWiring getWiring();
/**
- * {@inheritDoc}
- *
+ * Returns the capabilities declared by this resource.
+ *
* <p>
* This method returns the same value as
* {@link #getDeclaredCapabilities(String)}.
- *
+ *
+ * @param namespace The namespace of the declared capabilities to return or
+ * {@code null} to return the declared capabilities from all
+ * namespaces.
+ * @return An unmodifiable list containing the declared {@link Capability}s
+ * from the specified namespace. The returned list will be empty if
+ * this resource declares no capabilities in the specified
+ * namespace.
* @since 1.1
*/
List<Capability> getCapabilities(String namespace);
/**
- * {@inheritDoc}
- *
+ * Returns the requirements declared by this bundle resource.
+ *
* <p>
* This method returns the same value as
* {@link #getDeclaredRequirements(String)}.
- *
+ *
+ * @param namespace The namespace of the declared requirements to return or
+ * {@code null} to return the declared requirements from all
+ * namespaces.
+ * @return An unmodifiable list containing the declared {@link Requirement}
+ * s from the specified namespace. The returned list will be empty
+ * if this resource declares no requirements in the specified
+ * namespace.
* @since 1.1
*/
List<Requirement> getRequirements(String namespace);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevisions.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevisions.java
index 1d95ad10f..842324207 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevisions.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevisions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.wiring;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
index e95bd614c..02e7cd6ec 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
@@ -18,10 +18,9 @@ package org.osgi.framework.wiring;
import org.osgi.resource.Wire;
-
/**
* A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -29,14 +28,14 @@ import org.osgi.resource.Wire;
public interface BundleWire extends Wire {
/**
* Returns the {@link BundleCapability} for this wire.
- *
+ *
* @return The {@link BundleCapability} for this wire.
*/
BundleCapability getCapability();
/**
* Return the {@link BundleRequirement} for this wire.
- *
+ *
* @return The {@link BundleRequirement} for this wire.
*/
BundleRequirement getRequirement();
@@ -44,12 +43,12 @@ public interface BundleWire extends Wire {
/**
* Returns the bundle wiring {@link BundleWiring#getProvidedWires(String)
* providing} the {@link #getCapability() capability}.
- *
+ *
* <p>
* The bundle revision referenced by the returned bundle wiring may differ
* from the bundle revision referenced by the {@link #getCapability()
* capability}.
- *
+ *
* @return The bundle wiring providing the capability. If the bundle wiring
* providing the capability is not {@link BundleWiring#isInUse() in
* use}, {@code null} will be returned.
@@ -60,12 +59,12 @@ public interface BundleWire extends Wire {
* Returns the bundle wiring who
* {@link BundleWiring#getRequiredWires(String) requires} the
* {@link #getCapability() capability}.
- *
+ *
* <p>
* The bundle revision referenced by the returned bundle wiring may differ
* from the bundle revision referenced by the {@link #getRequirement()
* requirement}.
- *
+ *
* @return The bundle wiring whose requirement is wired to the capability.
* If the bundle wiring requiring the capability is not
* {@link BundleWiring#isInUse() in use}, {@code null} will be
@@ -74,23 +73,34 @@ public interface BundleWire extends Wire {
BundleWiring getRequirerWiring();
/**
- * {@inheritDoc}
- *
+ * Returns the resource providing the {@link #getCapability() capability}.
+ *
+ * <p>
+ * The returned resource may differ from the resource referenced by the
+ * {@link #getCapability() capability}.
+ *
* <p>
* This method returns the same value as {@link #getProviderWiring()}.
* {@link BundleWiring#getRevision() getRevision()}.
- *
+ *
+ * @return The resource providing the capability.
* @since 1.1
*/
BundleRevision getProvider();
/**
- * {@inheritDoc}
+ * Returns the resource who {@link #getRequirement() requires} the
+ * {@link #getCapability() capability}.
+ *
+ * <p>
+ * The returned resource may differ from the resource referenced by the
+ * {@link #getRequirement() requirement}.
*
* <p>
* This method returns the same value as {@link #getRequirerWiring()}.
* {@link BundleWiring#getRevision() getRevision()}.
*
+ * @return The resource who requires the capability.
* @since 1.1
*/
BundleRevision getRequirer();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
index aaaaf6dbe..a3b3fd7ad 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
@@ -19,7 +19,6 @@ package org.osgi.framework.wiring;
import java.net.URL;
import java.util.Collection;
import java.util.List;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -332,8 +331,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* must contain no duplicate resource names. If this bundle wiring
* is not {@link #isInUse() in use}, {@code null} must be returned.
*/
- Collection<String> listResources(String path, String filePattern,
- int options);
+ Collection<String> listResources(String path, String filePattern, int options);
/**
* The list resource names operation must recurse into subdirectories.
@@ -372,51 +370,132 @@ public interface BundleWiring extends BundleReference, Wiring {
int LISTRESOURCES_LOCAL = 0x00000002;
/**
- * {@inheritDoc}
+ * Returns the capabilities provided by this wiring.
+ *
+ * <p>
+ * Only capabilities considered by the resolver are returned. For example,
+ * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} are not returned.
+ *
+ * <p>
+ * A capability may not be required by any wiring and thus there may be no
+ * {@link #getProvidedResourceWires(String) wires} for the capability.
+ *
+ * <p>
+ * A wiring for a non-fragment resource provides a subset of the declared
+ * capabilities from the resource and all attached fragment
+ * resources<sup>&#8224;</sup>. Not all declared capabilities may be
+ * provided since some may be discarded. For example, if a package is
+ * declared to be both exported and imported, only one is selected and the
+ * other is discarded.
+ * <p>
+ * A wiring for a fragment resource with a symbolic name must provide
+ * exactly one {@code osgi.identity} capability.
+ * <p>
+ * &#8224; The {@code osgi.identity} capability provided by attached
+ * fragment resource must not be included in the capabilities of the host
+ * wiring.
*
* <p>
* This method returns the same value as {@link #getCapabilities(String)}.
*
+ * @param namespace The namespace of the capabilities to return or
+ * {@code null} to return the capabilities from all namespaces.
+ * @return A list containing a snapshot of the {@link Capability}s, or an
+ * empty list if this wiring provides no capabilities in the
+ * specified namespace. For a given namespace, the list contains the
+ * wires in the order the capabilities were specified in the
+ * manifests of the {@link #getResource() resource} and the attached
+ * fragment resources<sup>&#8224;</sup> of this wiring. There is no
+ * ordering defined between capabilities in different namespaces.
* @since 1.1
*/
List<Capability> getResourceCapabilities(String namespace);
/**
- * {@inheritDoc}
+ * Returns the requirements of this wiring.
+ *
+ * <p>
+ * Only requirements considered by the resolver are returned. For example,
+ * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} are not returned.
+ *
+ * <p>
+ * A wiring for a non-fragment resource has a subset of the declared
+ * requirements from the resource and all attached fragment resources. Not
+ * all declared requirements may be present since some may be discarded. For
+ * example, if a package is declared to be optionally imported and is not
+ * actually imported, the requirement must be discarded.
*
* <p>
* This method returns the same value as {@link #getRequirements(String)}.
*
+ * @param namespace The namespace of the requirements to return or
+ * {@code null} to return the requirements from all namespaces.
+ * @return A list containing a snapshot of the {@link Requirement}s, or an
+ * empty list if this wiring uses no requirements in the specified
+ * namespace. For a given namespace, the list contains the wires in
+ * the order the requirements were specified in the manifests of the
+ * {@link #getResource() resource} and the attached fragment
+ * resources of this wiring. There is no ordering defined between
+ * requirements in different namespaces.
* @since 1.1
*/
List<Requirement> getResourceRequirements(String namespace);
/**
- * {@inheritDoc}
+ * Returns the {@link Wire}s to the provided {@link Capability capabilities}
+ * of this wiring.
*
* <p>
* This method returns the same value as {@link #getProvidedWires(String)}.
*
+ * @param namespace The namespace of the capabilities for which to return
+ * wires or {@code null} to return the wires for the capabilities in
+ * all namespaces.
+ * @return A list containing a snapshot of the {@link Wire}s for the
+ * {@link Capability capabilities} of this wiring, or an empty list
+ * if this wiring has no capabilities in the specified namespace.
+ * For a given namespace, the list contains the wires in the order
+ * the capabilities were specified in the manifests of the
+ * {@link #getResource() resource} and the attached fragment
+ * resources of this wiring. There is no ordering defined between
+ * capabilities in different namespaces.
* @since 1.1
*/
List<Wire> getProvidedResourceWires(String namespace);
/**
- * {@inheritDoc}
+ * Returns the {@link Wire}s to the {@link Requirement requirements} in use
+ * by this wiring.
*
* <p>
* This method returns the same value as {@link #getRequiredWires(String)}.
*
+ * @param namespace The namespace of the requirements for which to return
+ * wires or {@code null} to return the wires for the requirements in
+ * all namespaces.
+ * @return A list containing a snapshot of the {@link Wire}s for the
+ * {@link Requirement requirements} of this wiring, or an empty list
+ * if this wiring has no requirements in the specified namespace.
+ * For a given namespace, the list contains the wires in the order
+ * the requirements were specified in the manifests of the
+ * {@link #getResource() resource} and the attached fragment
+ * resources of this wiring. There is no ordering defined between
+ * requirements in different namespaces.
* @since 1.1
*/
List<Wire> getRequiredResourceWires(String namespace);
/**
- * {@inheritDoc}
+ * Returns the resource associated with this wiring.
*
* <p>
* This method returns the same value as {@link #getRevision()}.
*
+ * @return The resource associated with this wiring.
* @since 1.1
*/
BundleRevision getResource();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java
index cd0d36e50..bff4cdf85 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.osgi.framework.wiring;
import java.util.Collection;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.FrameworkListener;
@@ -110,8 +109,7 @@ public interface FrameworkWiring extends BundleReference {
* {@code AdminPermission[System Bundle,RESOLVE]} and the Java
* runtime environment supports permissions.
*/
- void refreshBundles(Collection<Bundle> bundles,
- FrameworkListener... listeners);
+ void refreshBundles(Collection<Bundle> bundles, FrameworkListener... listeners);
/**
* Resolves the specified bundles. The Framework must attempt to resolve the
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java
index 1ffc6301b..40958d577 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java
@@ -19,15 +19,14 @@ package org.osgi.resource;
import java.util.List;
/**
- * A resource is the representation of a uniquely identified and typed data.
- *
- * A resource declares requirements that need to be satisfied by capabilities
+ * A resource is the representation of a uniquely identified and typed data. A
+ * resource declares requirements that need to be satisfied by capabilities
* before it can provide its capabilities.
*
* <p>
* Instances of this type must be <i>effectively immutable</i>. That is, for a
* given instance of this interface, the methods defined by this interface must
- * always return the same result. A Resource can be wired through a Resolver.
+ * always return the same result.
*
* @ThreadSafe
* @version $Id$
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java
index 965c12752..d7ca9a5d3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java
@@ -30,24 +30,25 @@ package org.osgi.resource;
public interface Wire {
/**
* Returns the {@link Capability} for this wire.
- *
+ *
* @return The {@link Capability} for this wire.
*/
Capability getCapability();
/**
* Returns the {@link Requirement} for this wire.
- *
+ *
* @return The {@link Requirement} for this wire.
*/
Requirement getRequirement();
/**
* Returns the resource providing the {@link #getCapability() capability}.
+ *
* <p>
* The returned resource may differ from the resource referenced by the
* {@link #getCapability() capability}.
- *
+ *
* @return The resource providing the capability.
*/
Resource getProvider();
@@ -55,10 +56,11 @@ public interface Wire {
/**
* Returns the resource who {@link #getRequirement() requires} the
* {@link #getCapability() capability}.
+ *
* <p>
* The returned resource may differ from the resource referenced by the
* {@link #getRequirement() requirement}.
- *
+ *
* @return The resource who requires the capability.
*/
Resource getRequirer();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java
index 3fce7b49b..b65dec388 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java
@@ -76,9 +76,8 @@ public interface Wiring {
*
* <p>
* Only requirements considered by the resolver are returned. For example,
- * requirements with
- * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
- * directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+ * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
* resolve} are not returned.
*
* <p>
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
index 7b466c710..43b6af515 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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.
@@ -20,7 +20,6 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Dictionary;
import java.util.Hashtable;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
@@ -61,34 +60,28 @@ public class BundleLocationCondition {
* ignored.
* @return Condition object for the requested condition.
*/
- static public Condition getCondition(final Bundle bundle,
- final ConditionInfo info) {
+ static public Condition getCondition(final Bundle bundle, final ConditionInfo info) {
if (!CONDITION_TYPE.equals(info.getType()))
- throw new IllegalArgumentException(
- "ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
+ throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
String[] args = info.getArgs();
if (args.length != 1 && args.length != 2)
throw new IllegalArgumentException("Illegal number of args: " + args.length);
- String bundleLocation = AccessController
- .doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return bundle.getLocation();
- }
- });
+ String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return bundle.getLocation();
+ }
+ });
Filter filter = null;
try {
- filter = FrameworkUtil.createFilter("(location="
- + escapeLocation(args[0]) + ")");
- }
- catch (InvalidSyntaxException e) {
+ filter = FrameworkUtil.createFilter("(location=" + escapeLocation(args[0]) + ")");
+ } catch (InvalidSyntaxException e) {
// this should never happen, but just in case
throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
}
Dictionary<String, String> matchProps = new Hashtable<String, String>(2);
matchProps.put("location", bundleLocation);
boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
- return (negate ^ filter.match(matchProps)) ? Condition.TRUE
- : Condition.FALSE;
+ return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE;
}
private BundleLocationCondition() {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
index 6e10febd6..8f8619a99 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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.
@@ -20,7 +20,6 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -72,18 +71,14 @@ public class BundleSignerCondition {
* then the second argument is ignored.
* @return A Condition which checks the signers of the specified bundle.
*/
- public static Condition getCondition(final Bundle bundle,
- final ConditionInfo info) {
+ public static Condition getCondition(final Bundle bundle, final ConditionInfo info) {
if (!CONDITION_TYPE.equals(info.getType()))
- throw new IllegalArgumentException(
- "ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
+ throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
String[] args = info.getArgs();
if (args.length != 1 && args.length != 2)
- throw new IllegalArgumentException("Illegal number of args: "
- + args.length);
+ throw new IllegalArgumentException("Illegal number of args: " + args.length);
- Map<X509Certificate, List<X509Certificate>> signers = bundle
- .getSignerCertificates(Bundle.SIGNERS_TRUSTED);
+ Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
boolean match = false;
for (List<X509Certificate> signerCerts : signers.values()) {
List<String> dnChain = new ArrayList<String>(signerCerts.size());
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
index 7e80cf578..ae2500276 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -41,11 +41,11 @@ public interface Condition {
/**
* Returns whether the evaluation must be postponed until the end of the
- * permission check. If this method returns {@code false} (or this
- * Condition is immutable), then this Condition must be able to directly
- * answer the {@link #isSatisfied()} method. In other words, isSatisfied()
- * will return very quickly since no external sources, such as for example
- * users or networks, need to be consulted. <br/>
+ * permission check. If this method returns {@code false} (or this Condition
+ * is immutable), then this Condition must be able to directly answer the
+ * {@link #isSatisfied()} method. In other words, isSatisfied() will return
+ * very quickly since no external sources, such as for example users or
+ * networks, need to be consulted. <br/>
* This method must always return the same value whenever it is called so
* that the Conditional Permission Admin can cache its result.
*
@@ -63,29 +63,28 @@ public interface Condition {
* {@link #isSatisfied(Condition[],Dictionary)} at the end of the permission
* check.
*
- * @return {@code true} to indicate the Conditions is satisfied.
- * Otherwise, {@code false} if the Condition is not satisfied.
+ * @return {@code true} to indicate the Conditions is satisfied. Otherwise,
+ * {@code false} if the Condition is not satisfied.
*/
boolean isSatisfied();
/**
* Returns whether the Condition is mutable. A Condition can go from mutable
- * ({@code true}) to immutable ({@code false}) over time but never
- * from immutable ({@code false}) to mutable ({@code true}).
+ * ({@code true}) to immutable ({@code false}) over time but never from
+ * immutable ({@code false}) to mutable ({@code true}).
*
* @return {@code true} {@link #isSatisfied()} can change. Otherwise,
- * {@code false} if the value returned by
- * {@link #isSatisfied()} will not change for this condition.
+ * {@code false} if the value returned by {@link #isSatisfied()}
+ * will not change for this condition.
*/
boolean isMutable();
/**
* Returns whether the specified set of Condition objects are satisfied.
- * Although this method is not static, it must be implemented as if it
- * were static. All of the passed Condition objects will be of the same
- * type and will correspond to the class type of the object on which this
- * method is invoked. This method must be called inside a permission check
- * only.
+ * Although this method is not static, it must be implemented as if it were
+ * static. All of the passed Condition objects will be of the same type and
+ * will correspond to the class type of the object on which this method is
+ * invoked. This method must be called inside a permission check only.
*
* @param conditions The array of Condition objects, which must all be of
* the same class and mutable. The receiver must be one of those
@@ -97,11 +96,10 @@ public interface Condition {
* object and simply creates an empty dictionary and passes it to
* subsequent invocations if multiple invocations are needed.
* @return {@code true} if all the Condition objects are satisfied.
- * Otherwise, {@code false} if one of the Condition objects is
- * not satisfied.
+ * Otherwise, {@code false} if one of the Condition objects is not
+ * satisfied.
*/
- boolean isSatisfied(Condition conditions[],
- Dictionary<Object, Object> context);
+ boolean isSatisfied(Condition conditions[], Dictionary<Object, Object> context);
}
/**
@@ -129,8 +127,7 @@ final class BooleanCondition implements Condition {
return false;
}
- public boolean isSatisfied(Condition[] conds,
- Dictionary<Object, Object> context) {
+ public boolean isSatisfied(Condition[] conds, Dictionary<Object, Object> context) {
for (int i = 0, length = conds.length; i < length; i++) {
if (!conds[i].isSatisfied())
return false;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
index 983971f8e..c2497fefb 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -24,8 +24,8 @@ import java.util.List;
*
* <p>
* This class encapsulates two pieces of information: a Condition <i>type</i>
- * (class name), which must implement {@code Condition}, and the
- * arguments passed to its constructor.
+ * (class name), which must implement {@code Condition}, and the arguments
+ * passed to its constructor.
*
* <p>
* In order for a Condition represented by a {@code ConditionInfo} to be
@@ -36,12 +36,12 @@ import java.util.List;
* The Condition class must either:
* <ul>
* <li>Declare a public static {@code getCondition} method that takes a
- * {@code Bundle} object and a {@code ConditionInfo} object as
- * arguments. That method must return an object that implements the
- * {@code Condition} interface.</li>
- * <li>Implement the {@code Condition} interface and define a public
- * constructor that takes a {@code Bundle} object and a
- * {@code ConditionInfo} object as arguments.
+ * {@code Bundle} object and a {@code ConditionInfo} object as arguments. That
+ * method must return an object that implements the {@code Condition} interface.
+ * </li>
+ * <li>Implement the {@code Condition} interface and define a public constructor
+ * that takes a {@code Bundle} object and a {@code ConditionInfo} object as
+ * arguments.
* </ul>
*
* @Immutable
@@ -109,8 +109,7 @@ public class ConditionInfo {
/* type is not quoted or encoded */
int begin = pos;
- while (!Character.isWhitespace(encoded[pos])
- && (encoded[pos] != ']')) {
+ while (!Character.isWhitespace(encoded[pos]) && (encoded[pos] != ']')) {
pos++;
}
if (pos == begin || encoded[begin] == '"') {
@@ -155,8 +154,7 @@ public class ConditionInfo {
if ((c != ']') || (pos != length)) {
throw new IllegalArgumentException("expecting close bracket");
}
- }
- catch (ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
throw new IllegalArgumentException("parsing terminated abruptly");
}
}
@@ -173,9 +171,9 @@ public class ConditionInfo {
* </pre>
*
* where <i>argN</i> are strings that must be encoded for proper parsing.
- * Specifically, the {@code &quot;}, {@code \}, carriage return,
- * and line feed characters must be escaped using {@code \&quot;},
- * {@code \\}, {@code \r}, and {@code \n}, respectively.
+ * Specifically, the {@code &quot;}, {@code \}, carriage return, and line
+ * feed characters must be escaped using {@code \&quot;}, {@code \\},
+ * {@code \r}, and {@code \n}, respectively.
*
* <p>
* The encoded string contains no leading or trailing whitespace characters.
@@ -201,9 +199,9 @@ public class ConditionInfo {
}
/**
- * Returns the string representation of this {@code ConditionInfo}.
- * The string is created by calling the {@code getEncoded} method on
- * this {@code ConditionInfo}.
+ * Returns the string representation of this {@code ConditionInfo}. The
+ * string is created by calling the {@code getEncoded} method on this
+ * {@code ConditionInfo}.
*
* @return The string representation of this {@code ConditionInfo}.
*/
@@ -225,9 +223,8 @@ public class ConditionInfo {
/**
* Returns arguments of this {@code ConditionInfo}.
*
- * @return The arguments of this {@code ConditionInfo}. An empty
- * array is returned if the {@code ConditionInfo} has no
- * arguments.
+ * @return The arguments of this {@code ConditionInfo}. An empty array is
+ * returned if the {@code ConditionInfo} has no arguments.
*/
public final String[] getArgs() {
return args.clone();
@@ -241,10 +238,9 @@ public class ConditionInfo {
*
* @param obj The object to test for equality with this
* {@code ConditionInfo} object.
- * @return {@code true} if {@code obj} is a
- * {@code ConditionInfo}, and has the same type and args as
- * this {@code ConditionInfo} object; {@code false}
- * otherwise.
+ * @return {@code true} if {@code obj} is a {@code ConditionInfo}, and has
+ * the same type and args as this {@code ConditionInfo} object;
+ * {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
index 660da8b29..5be9948e8 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.osgi.service.condpermadmin;
import java.security.AccessControlContext;
import java.util.Enumeration;
-
import org.osgi.service.permissionadmin.PermissionInfo;
/**
@@ -46,9 +45,9 @@ public interface ConditionalPermissionAdmin {
* this method can no longer be committed.
*
* @param conditions The conditions that need to be satisfied to enable the
- * specified permissions. This argument can be {@code null} or
- * an empty array indicating the specified permissions are not
- * guarded by any conditions.
+ * specified permissions. This argument can be {@code null} or an
+ * empty array indicating the specified permissions are not guarded
+ * by any conditions.
* @param permissions The permissions that are enabled when the specified
* conditions, if any, are satisfied. This argument must not be
* {@code null} and must specify at least one permission.
@@ -60,33 +59,31 @@ public interface ConditionalPermissionAdmin {
* @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()}
* instead.
*/
- ConditionalPermissionInfo addConditionalPermissionInfo(
- ConditionInfo[] conditions, PermissionInfo[] permissions);
+ ConditionalPermissionInfo addConditionalPermissionInfo(ConditionInfo[] conditions, PermissionInfo[] permissions);
/**
* Set or create a Conditional Permission Info with a specified name in the
* Conditional Permission Table.
* <p>
- * If the specified name is {@code null}, a new Conditional Permission
- * Info must be created and will be given a unique, never reused name. If
- * there is currently no Conditional Permission Info with the specified
- * name, a new Conditional Permission Info must be created with the
- * specified name. Otherwise, the Conditional Permission Info with the
- * specified name must be updated with the specified Conditions and
- * Permissions. If a new entry was created in the Conditional Permission
- * Table it will be added at the beginning of the table with an access
- * decision of {@link ConditionalPermissionInfo#ALLOW ALLOW}.
+ * If the specified name is {@code null}, a new Conditional Permission Info
+ * must be created and will be given a unique, never reused name. If there
+ * is currently no Conditional Permission Info with the specified name, a
+ * new Conditional Permission Info must be created with the specified name.
+ * Otherwise, the Conditional Permission Info with the specified name must
+ * be updated with the specified Conditions and Permissions. If a new entry
+ * was created in the Conditional Permission Table it will be added at the
+ * beginning of the table with an access decision of
+ * {@link ConditionalPermissionInfo#ALLOW ALLOW}.
* <p>
* Since this method changes the underlying permission table any
* {@link ConditionalPermissionUpdate}s that were created prior to calling
* this method can no longer be committed.
*
- * @param name The name of the Conditional Permission Info, or
- * {@code null}.
+ * @param name The name of the Conditional Permission Info, or {@code null}.
* @param conditions The conditions that need to be satisfied to enable the
- * specified permissions. This argument can be {@code null} or
- * an empty array indicating the specified permissions are not
- * guarded by any conditions.
+ * specified permissions. This argument can be {@code null} or an
+ * empty array indicating the specified permissions are not guarded
+ * by any conditions.
* @param permissions The permissions that are enabled when the specified
* conditions, if any, are satisfied. This argument must not be
* {@code null} and must specify at least one permission.
@@ -98,8 +95,7 @@ public interface ConditionalPermissionAdmin {
* @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()}
* instead.
*/
- ConditionalPermissionInfo setConditionalPermissionInfo(String name,
- ConditionInfo[] conditions, PermissionInfo[] permissions);
+ ConditionalPermissionInfo setConditionalPermissionInfo(String name, ConditionInfo[] conditions, PermissionInfo[] permissions);
/**
* Returns the Conditional Permission Infos from the Conditional Permission
@@ -125,8 +121,8 @@ public interface ConditionalPermissionAdmin {
*
* @param name The name of the Conditional Permission Info to be returned.
* @return The Conditional Permission Info with the specified name or
- * {@code null} if no Conditional Permission Info with the
- * specified name exists in the Conditional Permission Table.
+ * {@code null} if no Conditional Permission Info with the specified
+ * name exists in the Conditional Permission Table.
* @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()}
* instead.
*/
@@ -146,9 +142,11 @@ public interface ConditionalPermissionAdmin {
* <li>It has no headers</li>
* <li>It has the empty version (0.0.0)</li>
* <li>Its last modified time=0</li>
- * <li>Many methods will throw {@code IllegalStateException} because the state is UNINSTALLED</li>
+ * <li>Many methods will throw {@code IllegalStateException} because the
+ * state is UNINSTALLED</li>
* <li>All other methods return a {@code null}</li>
- * </ul>
+ * </ul>
+ *
* @param signers The signers for which to return an Access Control Context.
* @return An {@code AccessControlContext} that has the Permissions
* associated with the signer.
@@ -172,19 +170,17 @@ public interface ConditionalPermissionAdmin {
/**
* Creates a new ConditionalPermissionInfo with the specified fields
* suitable for insertion into a {@link ConditionalPermissionUpdate}. The
- * {@code delete} method on {@code ConditionalPermissionInfo}
- * objects created with this method must throw
- * UnsupportedOperationException.
+ * {@code delete} method on {@code ConditionalPermissionInfo} objects
+ * created with this method must throw UnsupportedOperationException.
*
- * @param name The name of the created
- * {@code ConditionalPermissionInfo} or {@code null} to
- * have a unique name generated when the returned
- * {@code ConditionalPermissionInfo} is committed in an update
- * to the Conditional Permission Table.
+ * @param name The name of the created {@code ConditionalPermissionInfo} or
+ * {@code null} to have a unique name generated when the returned
+ * {@code ConditionalPermissionInfo} is committed in an update to the
+ * Conditional Permission Table.
* @param conditions The conditions that need to be satisfied to enable the
- * specified permissions. This argument can be {@code null} or
- * an empty array indicating the specified permissions are not
- * guarded by any conditions.
+ * specified permissions. This argument can be {@code null} or an
+ * empty array indicating the specified permissions are not guarded
+ * by any conditions.
* @param permissions The permissions that are enabled when the specified
* conditions, if any, are satisfied. This argument must not be
* {@code null} and must specify at least one permission.
@@ -195,15 +191,13 @@ public interface ConditionalPermissionAdmin {
* </ul>
* The specified access decision value must be evaluated case
* insensitively.
- * @return A {@code ConditionalPermissionInfo} object suitable for
- * insertion into a {@link ConditionalPermissionUpdate}.
+ * @return A {@code ConditionalPermissionInfo} object suitable for insertion
+ * into a {@link ConditionalPermissionUpdate}.
* @throws IllegalArgumentException If no permissions are specified or if
* the specified access decision is not a valid value.
* @since 1.1
*/
- ConditionalPermissionInfo newConditionalPermissionInfo(String name,
- ConditionInfo[] conditions, PermissionInfo[] permissions,
- String access);
+ ConditionalPermissionInfo newConditionalPermissionInfo(String name, ConditionInfo[] conditions, PermissionInfo[] permissions, String access);
/**
* Creates a new {@code ConditionalPermissionInfo} from the specified
@@ -230,6 +224,5 @@ public interface ConditionalPermissionAdmin {
* @see ConditionalPermissionInfo#getEncoded()
* @since 1.1
*/
- ConditionalPermissionInfo newConditionalPermissionInfo(
- String encodedConditionalPermissionInfo);
+ ConditionalPermissionInfo newConditionalPermissionInfo(String encodedConditionalPermissionInfo);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
index c9373ca82..c4222b04d 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -152,9 +152,8 @@ public interface ConditionalPermissionInfo {
/**
* Returns the string representation of this
- * {@code ConditionalPermissionInfo}. The string is created by calling
- * the {@code getEncoded} method on this
- * {@code ConditionalPermissionInfo}.
+ * {@code ConditionalPermissionInfo}. The string is created by calling the
+ * {@code getEncoded} method on this {@code ConditionalPermissionInfo}.
*
* @return The string representation of this
* {@code ConditionalPermissionInfo}.
@@ -163,8 +162,7 @@ public interface ConditionalPermissionInfo {
String toString();
/**
- * Determines the equality of two {@code ConditionalPermissionInfo}
- * objects.
+ * Determines the equality of two {@code ConditionalPermissionInfo} objects.
*
* This method checks that specified object has the same access decision,
* conditions, permissions and name as this
@@ -179,8 +177,8 @@ public interface ConditionalPermissionInfo {
* otherwise.
* @since 1.1
*/
- boolean equals(Object obj);
-
+ boolean equals(Object obj);
+
/**
* Returns the hash code value for this object.
*
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java
index 47169b8c2..7487aa7d2 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,14 +70,13 @@ public interface ConditionalPermissionUpdate {
* Conditional Permissions are determined to be inconsistent in some way
* then an {@code IllegalStateException} will be thrown.
* <p>
- * This method returns {@code false} if the commit did not occur
- * because the Conditional Permission Table has been modified since the
- * creation of this update.
+ * This method returns {@code false} if the commit did not occur because the
+ * Conditional Permission Table has been modified since the creation of this
+ * update.
*
- * @return {@code true} if the commit was successful.
- * {@code false} if the commit did not occur because the
- * Conditional Permission Table has been modified since the creation
- * of this update.
+ * @return {@code true} if the commit was successful. {@code false} if the
+ * commit did not occur because the Conditional Permission Table has
+ * been modified since the creation of this update.
* @throws SecurityException If the caller does not have
* {@code AllPermission}.
* @throws IllegalStateException If this update's Conditional Permissions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
index 91132d707..846b7ff8d 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,38 +22,37 @@ package org.osgi.service.permissionadmin;
* in the OSGi environment.
* <p>
* Access to the Permission Admin service is protected by corresponding
- * {@code ServicePermission}. In addition {@code AdminPermission}
- * is required to actually set permissions.
+ * {@code ServicePermission}. In addition {@code AdminPermission} is required to
+ * actually set permissions.
*
* <p>
* Bundle permissions are managed using a permission table. A bundle's location
* serves as the key into this permission table. The value of a table entry is
- * the set of permissions (of type {@code PermissionInfo}) granted to
- * the bundle named by the given location. A bundle may have an entry in the
- * permission table prior to being installed in the Framework.
+ * the set of permissions (of type {@code PermissionInfo}) granted to the bundle
+ * named by the given location. A bundle may have an entry in the permission
+ * table prior to being installed in the Framework.
*
* <p>
- * The permissions specified in {@code setDefaultPermissions} are used as
- * the default permissions which are granted to all bundles that do not have an
+ * The permissions specified in {@code setDefaultPermissions} are used as the
+ * default permissions which are granted to all bundles that do not have an
* entry in the permission table.
*
* <p>
* Any changes to a bundle's permissions in the permission table will take
- * effect no later than when bundle's
- * {@code java.security.ProtectionDomain} is next involved in a
- * permission check, and will be made persistent.
+ * effect no later than when bundle's {@code java.security.ProtectionDomain} is
+ * next involved in a permission check, and will be made persistent.
*
* <p>
* Only permission classes on the system classpath or from an exported package
* are considered during a permission check. Additionally, only permission
- * classes that are subclasses of {@code java.security.Permission} and
- * define a 2-argument constructor that takes a <i>name </i> string and an
- * <i>actions </i> string can be used.
+ * classes that are subclasses of {@code java.security.Permission} and define a
+ * 2-argument constructor that takes a <i>name </i> string and an <i>actions
+ * </i> string can be used.
* <p>
* Permissions implicitly granted by the Framework (for example, a bundle's
* permission to access its persistent storage area) cannot be changed, and are
- * not reflected in the permissions returned by {@code getPermissions}
- * and {@code getDefaultPermissions}.
+ * not reflected in the permissions returned by {@code getPermissions} and
+ * {@code getDefaultPermissions}.
*
* @ThreadSafe
* @noimplement
@@ -67,8 +66,8 @@ public interface PermissionAdmin {
* returned.
*
* @return The permissions assigned to the bundle with the specified
- * location, or {@code null} if that bundle has not been
- * assigned any permissions.
+ * location, or {@code null} if that bundle has not been assigned
+ * any permissions.
*/
PermissionInfo[] getPermissions(String location);
@@ -78,9 +77,8 @@ public interface PermissionAdmin {
*
* @param location The location of the bundle that will be assigned the
* permissions.
- * @param permissions The permissions to be assigned, or {@code null}
- * if the specified location is to be removed from the permission
- * table.
+ * @param permissions The permissions to be assigned, or {@code null} if the
+ * specified location is to be removed from the permission table.
* @throws SecurityException If the caller does not have
* {@code AllPermission}.
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
index 64ea7f043..d904a01a7 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,26 +42,26 @@ public class PermissionInfo {
private final String actions;
/**
- * Constructs a {@code PermissionInfo} from the specified type, name,
- * and actions.
+ * Constructs a {@code PermissionInfo} from the specified type, name, and
+ * actions.
*
* @param type The fully qualified class name of the permission represented
- * by this {@code PermissionInfo}. The class must be a subclass
- * of {@code java.security.Permission} and must define a
- * 2-argument constructor that takes a <i>name</i> string and an
- * <i>actions</i> string.
+ * by this {@code PermissionInfo}. The class must be a subclass of
+ * {@code java.security.Permission} and must define a 2-argument
+ * constructor that takes a <i>name</i> string and an <i>actions</i>
+ * string.
*
* @param name The permission name that will be passed as the first argument
- * to the constructor of the {@code Permission} class identified
- * by {@code type}.
+ * to the constructor of the {@code Permission} class identified by
+ * {@code type}.
*
* @param actions The permission actions that will be passed as the second
* argument to the constructor of the {@code Permission} class
* identified by {@code type}.
*
* @throws NullPointerException If {@code type} is {@code null}.
- * @throws IllegalArgumentException If {@code action} is not
- * {@code null} and {@code name} is {@code null}.
+ * @throws IllegalArgumentException If {@code action} is not {@code null}
+ * and {@code name} is {@code null}.
*/
public PermissionInfo(String type, String name, String actions) {
this.type = type;
@@ -119,8 +119,7 @@ public class PermissionInfo {
/* type is not quoted or encoded */
int begin = pos;
- while (!Character.isWhitespace(encoded[pos])
- && (encoded[pos] != ')')) {
+ while (!Character.isWhitespace(encoded[pos]) && (encoded[pos] != ')')) {
pos++;
}
if (pos == begin || encoded[begin] == '"') {
@@ -183,11 +182,9 @@ public class PermissionInfo {
pos++;
}
if ((c != ')') || (pos != length)) {
- throw new IllegalArgumentException(
- "expecting close parenthesis");
+ throw new IllegalArgumentException("expecting close parenthesis");
}
- }
- catch (ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
throw new IllegalArgumentException("parsing terminated abruptly");
}
@@ -220,10 +217,9 @@ public class PermissionInfo {
* </pre>
*
* where <i>name</i> and <i>actions</i> are strings that must be encoded for
- * proper parsing. Specifically, the {@code &quot;},{@code \},
- * carriage return, and line feed characters must be escaped using
- * {@code \&quot;}, {@code \\},{@code \r}, and
- * {@code \n}, respectively.
+ * proper parsing. Specifically, the {@code &quot;},{@code \}, carriage
+ * return, and line feed characters must be escaped using {@code \&quot;},
+ * {@code \\},{@code \r}, and {@code \n}, respectively.
*
* <p>
* The encoded string contains no leading or trailing whitespace characters.
@@ -234,11 +230,7 @@ public class PermissionInfo {
* @return The string encoding of this {@code PermissionInfo}.
*/
public final String getEncoded() {
- StringBuffer output = new StringBuffer(
- 8
- + type.length()
- + ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0
- : actions.length())) << 1));
+ StringBuffer output = new StringBuffer(8 + type.length() + ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0 : actions.length())) << 1));
output.append('(');
output.append(type);
if (name != null) {
@@ -255,9 +247,9 @@ public class PermissionInfo {
}
/**
- * Returns the string representation of this {@code PermissionInfo}.
- * The string is created by calling the {@code getEncoded} method on
- * this {@code PermissionInfo}.
+ * Returns the string representation of this {@code PermissionInfo}. The
+ * string is created by calling the {@code getEncoded} method on this
+ * {@code PermissionInfo}.
*
* @return The string representation of this {@code PermissionInfo}.
*/
@@ -281,8 +273,8 @@ public class PermissionInfo {
* {@code PermissionInfo}.
*
* @return The name of the permission represented by this
- * {@code PermissionInfo}, or {@code null} if the
- * permission does not have a name.
+ * {@code PermissionInfo}, or {@code null} if the permission does
+ * not have a name.
*/
public final String getName() {
return name;
@@ -293,8 +285,8 @@ public class PermissionInfo {
* {@code PermissionInfo}.
*
* @return The actions of the permission represented by this
- * {@code PermissionInfo}, or {@code null} if the
- * permission does not have any actions associated with it.
+ * {@code PermissionInfo}, or {@code null} if the permission does
+ * not have any actions associated with it.
*/
public final String getActions() {
return actions;
@@ -308,10 +300,9 @@ public class PermissionInfo {
*
* @param obj The object to test for equality with this
* {@code PermissionInfo} object.
- * @return {@code true} if {@code obj} is a
- * {@code PermissionInfo}, and has the same type, name and
- * actions as this {@code PermissionInfo} object;
- * {@code false} otherwise.
+ * @return {@code true} if {@code obj} is a {@code PermissionInfo}, and has
+ * the same type, name and actions as this {@code PermissionInfo}
+ * object; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -321,19 +312,16 @@ public class PermissionInfo {
return false;
}
PermissionInfo other = (PermissionInfo) obj;
- if (!type.equals(other.type) || ((name == null) ^ (other.name == null))
- || ((actions == null) ^ (other.actions == null))) {
+ if (!type.equals(other.type) || ((name == null) ^ (other.name == null)) || ((actions == null) ^ (other.actions == null))) {
return false;
}
if (name != null) {
if (actions != null) {
return name.equals(other.name) && actions.equals(other.actions);
- }
- else {
+ } else {
return name.equals(other.name);
}
- }
- else {
+ } else {
return true;
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java
index 465a0ed86..b86572a4f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,43 +19,38 @@ package org.osgi.service.url;
import java.net.*;
/**
- * Abstract implementation of the {@code URLStreamHandlerService}
- * interface. All the methods simply invoke the corresponding methods on
- * {@code java.net.URLStreamHandler} except for {@code parseURL}
- * and {@code setURL}, which use the {@code URLStreamHandlerSetter}
- * parameter. Subclasses of this abstract class should not need to override the
- * {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)}
- * methods.
+ * Abstract implementation of the {@code URLStreamHandlerService} interface. All
+ * the methods simply invoke the corresponding methods on
+ * {@code java.net.URLStreamHandler} except for {@code parseURL} and
+ * {@code setURL}, which use the {@code URLStreamHandlerSetter} parameter.
+ * Subclasses of this abstract class should not need to override the
+ * {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)} methods.
*
* @ThreadSafe
* @version $Id$
*/
-public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
- implements URLStreamHandlerService {
+public abstract class AbstractURLStreamHandlerService extends URLStreamHandler implements URLStreamHandlerService {
/**
* @see "java.net.URLStreamHandler.openConnection"
*/
- public abstract URLConnection openConnection(URL u)
- throws java.io.IOException;
+ public abstract URLConnection openConnection(URL u) throws java.io.IOException;
/**
- * The {@code URLStreamHandlerSetter} object passed to the parseURL
- * method.
+ * The {@code URLStreamHandlerSetter} object passed to the parseURL method.
*/
protected volatile URLStreamHandlerSetter realHandler;
/**
- * Parse a URL using the {@code URLStreamHandlerSetter} object. This
- * method sets the {@code realHandler} field with the specified
+ * Parse a URL using the {@code URLStreamHandlerSetter} object. This method
+ * sets the {@code realHandler} field with the specified
* {@code URLStreamHandlerSetter} object and then calls
* {@code parseURL(URL,String,int,int)}.
*
- * @param realHandler The object on which the {@code setURL} method
- * must be invoked for the specified URL.
+ * @param realHandler The object on which the {@code setURL} method must be
+ * 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(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) {
this.realHandler = realHandler;
parseURL(u, spec, start, limit);
}
@@ -131,19 +126,18 @@ public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
* @deprecated This method is only for compatibility with handlers written
* for JDK 1.1.
*/
- protected void setURL(URL u, String proto, String host, int port,
- String file, String ref) {
+ protected void setURL(URL u, String proto, String host, int port, String file, String ref) {
realHandler.setURL(u, proto, host, port, file, ref);
}
/**
* This method calls
- * {@code realHandler.setURL(URL,String,String,int,String,String,String,String)}.
+ * {@code realHandler.setURL(URL,String,String,int,String,String,String,String)}
+ * .
*
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
*/
- protected void setURL(URL u, String proto, String host, int port,
- String auth, String user, String path, String query, String ref) {
+ 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/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLConstants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLConstants.java
index 5ec8db316..ac2b96709 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLConstants.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,11 @@ package org.osgi.service.url;
/**
* Defines standard names for property keys associated with
- * {@link URLStreamHandlerService} and {@code java.net.ContentHandler}
- * services.
+ * {@link URLStreamHandlerService} and {@code java.net.ContentHandler} services.
*
* <p>
- * The values associated with these keys are of type
- * {@code java.lang.String[]} or {@code java.lang.String}, unless
- * otherwise indicated.
+ * The values associated with these keys are of type {@code java.lang.String[]}
+ * or {@code java.lang.String}, unless otherwise indicated.
*
* @noimplement
* @version $Id$
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerService.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerService.java
index 4982ef5b4..4a453f61b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerService.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -23,14 +23,12 @@ import java.net.*;
* {@code java.net.URLStreamHandler} methods.
* <p>
* The important differences between this interface and the
- * {@code URLStreamHandler} class are that the {@code setURL}
- * method is absent and the {@code parseURL} method takes a
- * {@link URLStreamHandlerSetter} object as the first argument. Classes
- * implementing this interface must call the {@code setURL} method on the
- * {@code URLStreamHandlerSetter} object received in the
- * {@code parseURL} method instead of
- * {@code URLStreamHandler.setURL} to avoid a
- * {@code SecurityException}.
+ * {@code URLStreamHandler} class are that the {@code setURL} method is absent
+ * and the {@code parseURL} method takes a {@link URLStreamHandlerSetter} object
+ * as the first argument. Classes implementing this interface must call the
+ * {@code setURL} method on the {@code URLStreamHandlerSetter} object received
+ * in the {@code parseURL} method instead of {@code URLStreamHandler.setURL} to
+ * avoid a {@code SecurityException}.
*
* @see AbstractURLStreamHandlerService
*
@@ -44,16 +42,15 @@ public interface URLStreamHandlerService {
public URLConnection openConnection(URL u) throws java.io.IOException;
/**
- * Parse a URL. This method is called by the {@code URLStreamHandler}
- * proxy, instead of {@code java.net.URLStreamHandler.parseURL},
- * passing a {@code URLStreamHandlerSetter} object.
+ * Parse a URL. This method is called by the {@code URLStreamHandler} proxy,
+ * instead of {@code java.net.URLStreamHandler.parseURL}, passing a
+ * {@code URLStreamHandlerSetter} object.
*
- * @param realHandler The object on which {@code setURL} must be
- * invoked for this URL.
+ * @param realHandler The object on which {@code setURL} must be invoked for
+ * this URL.
* @see "java.net.URLStreamHandler.parseURL"
*/
- public void parseURL(URLStreamHandlerSetter realHandler, URL u,
- String spec, int start, int limit);
+ public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit);
/**
* @see "java.net.URLStreamHandler.toExternalForm"
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java
index d624a8e6e..90f25e396 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -40,13 +40,10 @@ public interface URLStreamHandlerSetter {
* @deprecated This method is only for compatibility with handlers written
* for JDK 1.1.
*/
- public void setURL(URL u, String protocol, String host, int port,
- String file, String ref);
+ 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)"
*/
- public void setURL(URL u, String protocol, String host, int port,
- String authority, String userInfo, String path, String query,
- String ref);
+ public void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
index 79452e6c2..16340086b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -117,8 +117,8 @@ abstract class AbstractTracked<S, T, R> {
* This method must be called from Tracker's open method while synchronized
* on this object in the same synchronized block as the add listener call.
*
- * @param list The initial list of items to be tracked. {@code null}
- * entries in the list are ignored.
+ * @param list The initial list of items to be tracked. {@code null} entries
+ * in the list are ignored.
* @GuardedBy this
*/
void setInitial(S[] list) {
@@ -162,8 +162,7 @@ abstract class AbstractTracked<S, T, R> {
if (tracked.get(item) != null) {
/* if we are already tracking this item */
if (DEBUG) {
- System.out
- .println("AbstractTracked.trackInitial[already tracked]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.trackInitial[already tracked]: " + item); //$NON-NLS-1$
}
continue; /* skip this item */
}
@@ -172,8 +171,7 @@ abstract class AbstractTracked<S, T, R> {
* if this item is already in the process of being added.
*/
if (DEBUG) {
- System.out
- .println("AbstractTracked.trackInitial[already adding]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.trackInitial[already adding]: " + item); //$NON-NLS-1$
}
continue; /* skip this item */
}
@@ -214,17 +212,14 @@ abstract class AbstractTracked<S, T, R> {
if (adding.contains(item)) {
/* if this item is already in the process of being added. */
if (DEBUG) {
- System.out
- .println("AbstractTracked.track[already adding]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.track[already adding]: " + item); //$NON-NLS-1$
}
return;
}
adding.add(item); /* mark this item is being added */
- }
- else { /* we are currently tracking this item */
+ } else { /* we are currently tracking this item */
if (DEBUG) {
- System.out
- .println("AbstractTracked.track[modified]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.track[modified]: " + item); //$NON-NLS-1$
}
modified(); /* increment modification count */
}
@@ -232,8 +227,7 @@ abstract class AbstractTracked<S, T, R> {
if (object == null) { /* we are not tracking the item */
trackAdding(item, related);
- }
- else {
+ } else {
/* Call customizer outside of synchronized region */
customizerModified(item, related, object);
/*
@@ -264,8 +258,7 @@ abstract class AbstractTracked<S, T, R> {
* If the customizer throws an unchecked exception, it will
* propagate after the finally
*/
- }
- finally {
+ } finally {
synchronized (this) {
if (adding.remove(item) && !closed) {
/*
@@ -277,8 +270,7 @@ abstract class AbstractTracked<S, T, R> {
modified(); /* increment modification count */
notifyAll(); /* notify any waiters */
}
- }
- else {
+ } else {
becameUntracked = true;
}
}
@@ -288,8 +280,7 @@ abstract class AbstractTracked<S, T, R> {
*/
if (becameUntracked && (object != null)) {
if (DEBUG) {
- System.out
- .println("AbstractTracked.trackAdding[removed]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.trackAdding[removed]: " + item); //$NON-NLS-1$
}
/* Call customizer outside of synchronized region */
customizerRemoved(item, related, object);
@@ -314,8 +305,7 @@ abstract class AbstractTracked<S, T, R> {
* of initial references to process
*/
if (DEBUG) {
- System.out
- .println("AbstractTracked.untrack[removed from initial]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.untrack[removed from initial]: " + item); //$NON-NLS-1$
}
return; /*
* we have removed it from the list and it will not be
@@ -328,8 +318,7 @@ abstract class AbstractTracked<S, T, R> {
* being added
*/
if (DEBUG) {
- System.out
- .println("AbstractTracked.untrack[being added]: " + item); //$NON-NLS-1$
+ System.out.println("AbstractTracked.untrack[being added]: " + item); //$NON-NLS-1$
}
return; /*
* in case the item is untracked while in the process of
@@ -430,8 +419,8 @@ abstract class AbstractTracked<S, T, R> {
/**
* Copy the tracked items and associated values into the specified map.
*
- * @param <M> Type of {@code Map} to hold the tracked items and
- * associated values.
+ * @param <M> Type of {@code Map} to hold the tracked items and associated
+ * values.
* @param map The map into which to copy the tracked items and associated
* values. This map must not be a user provided map so that user code
* is not executed while synchronized on this.
@@ -439,7 +428,7 @@ abstract class AbstractTracked<S, T, R> {
* @GuardedBy this
* @since 1.5
*/
- <M extends Map< ? super S, ? super T>> M copyEntries(final M map) {
+ <M extends Map<? super S, ? super T>> M copyEntries(final M map) {
map.putAll(tracked);
return map;
}
@@ -450,8 +439,8 @@ abstract class AbstractTracked<S, T, R> {
*
* @param item Item to be tracked.
* @param related Action related object.
- * @return Customized object for the tracked item or {@code null} if
- * the item is not to be tracked.
+ * @return Customized object for the tracked item or {@code null} if the
+ * item is not to be tracked.
*/
abstract T customizerAdding(final S item, final R related);
@@ -463,8 +452,7 @@ abstract class AbstractTracked<S, T, R> {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerModified(final S item, final R related,
- final T object);
+ abstract void customizerModified(final S item, final R related, final T object);
/**
* Call the specific customizer removed method. This method must not be
@@ -474,6 +462,5 @@ abstract class AbstractTracked<S, T, R> {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerRemoved(final S item, final R related,
- final T object);
+ abstract void customizerRemoved(final S item, final R related, final T object);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
index ebfd73a4e..f21db4fe5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,32 +18,29 @@ package org.osgi.util.tracker;
import java.util.HashMap;
import java.util.Map;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.SynchronousBundleListener;
/**
- * The {@code BundleTracker} class simplifies tracking bundles much like
- * the {@code ServiceTracker} simplifies tracking services.
+ * The {@code BundleTracker} class simplifies tracking bundles much like the
+ * {@code ServiceTracker} simplifies tracking services.
* <p>
* A {@code BundleTracker} is constructed with state criteria and a
- * {@code BundleTrackerCustomizer} object. A {@code BundleTracker} can
- * use the {@code BundleTrackerCustomizer} to select which bundles are
- * tracked and to create a customized object to be tracked with the bundle. The
- * {@code BundleTracker} can then be opened to begin tracking all bundles
- * whose state matches the specified state criteria.
+ * {@code BundleTrackerCustomizer} object. A {@code BundleTracker} can use the
+ * {@code BundleTrackerCustomizer} to select which bundles are tracked and to
+ * create a customized object to be tracked with the bundle. The
+ * {@code BundleTracker} can then be opened to begin tracking all bundles whose
+ * state matches the specified state criteria.
* <p>
- * The {@code getBundles} method can be called to get the
- * {@code Bundle} objects of the bundles being tracked. The
- * {@code getObject} method can be called to get the customized object for
- * a tracked bundle.
+ * The {@code getBundles} method can be called to get the {@code Bundle} objects
+ * of the bundles being tracked. The {@code getObject} method can be called to
+ * get the customized object for a tracked bundle.
* <p>
* The {@code BundleTracker} class is thread-safe. It does not call a
* {@code BundleTrackerCustomizer} while holding any locks.
- * {@code BundleTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code BundleTrackerCustomizer} implementations must also be thread-safe.
*
* @param <T> The type of the tracked object.
* @ThreadSafe
@@ -88,28 +85,25 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
final int mask;
/**
- * Create a {@code BundleTracker} for bundles whose state is present in
- * the specified state mask.
+ * Create a {@code BundleTracker} for bundles whose state is present in the
+ * specified state mask.
*
* <p>
* Bundles whose state is present on the specified state mask will be
* tracked by this {@code BundleTracker}.
*
- * @param context The {@code BundleContext} against which the tracking
- * is done.
- * @param stateMask The bit mask of the {@code OR}ing of the bundle
- * states to be tracked.
+ * @param context The {@code BundleContext} against which the tracking is
+ * done.
+ * @param stateMask The bit mask of the {@code OR}ing of the bundle states
+ * to be tracked.
* @param customizer The customizer object to call when bundles are added,
- * modified, or removed in this {@code BundleTracker}. If
- * customizer is {@code null}, then this
- * {@code BundleTracker} will be used as the
- * {@code BundleTrackerCustomizer} and this
- * {@code BundleTracker} will call the
- * {@code BundleTrackerCustomizer} methods on itself.
+ * modified, or removed in this {@code BundleTracker}. If customizer
+ * is {@code null}, then this {@code BundleTracker} will be used as
+ * the {@code BundleTrackerCustomizer} and this {@code BundleTracker}
+ * will call the {@code BundleTrackerCustomizer} methods on itself.
* @see Bundle#getState()
*/
- public BundleTracker(BundleContext context, int stateMask,
- BundleTrackerCustomizer<T> customizer) {
+ public BundleTracker(BundleContext context, int stateMask, BundleTrackerCustomizer<T> customizer) {
this.context = context;
this.mask = stateMask;
this.customizer = (customizer == null) ? this : customizer;
@@ -123,13 +117,12 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* {@code BundleTracker} was created are now tracked by this
* {@code BundleTracker}.
*
- * @throws java.lang.IllegalStateException If the {@code BundleContext}
- * with which this {@code BundleTracker} was created is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+ * which this {@code BundleTracker} was created is no longer valid.
* @throws java.lang.SecurityException If the caller and this class do not
* have the appropriate
- * {@code AdminPermission[context bundle,LISTENER]}, and the
- * Java Runtime Environment supports permissions.
+ * {@code AdminPermission[context bundle,LISTENER]}, and the Java
+ * Runtime Environment supports permissions.
*/
public void open() {
final Tracked t;
@@ -167,8 +160,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* Close this {@code BundleTracker}.
*
* <p>
- * This method should be called when this {@code BundleTracker} should
- * end the tracking of bundles.
+ * This method should be called when this {@code BundleTracker} should end
+ * the tracking of bundles.
*
* <p>
* This implementation calls {@link #getBundles()} to get the list of
@@ -190,8 +183,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
tracked = null;
try {
context.removeBundleListener(outgoing);
- }
- catch (IllegalStateException e) {
+ } catch (IllegalStateException e) {
/* In case the context was stopped. */
}
}
@@ -220,8 +212,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* @param bundle The {@code Bundle} being added to this
* {@code BundleTracker} object.
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
* @return The specified bundle.
* @see BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent)
*/
@@ -243,8 +235,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
*
* @param bundle The {@code Bundle} whose state has been modified.
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
* @param object The customized object for the specified Bundle.
* @see BundleTrackerCustomizer#modifiedBundle(Bundle, BundleEvent, Object)
*/
@@ -265,8 +257,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
*
* @param bundle The {@code Bundle} being removed.
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
* @param object The customized object for the specified bundle.
* @see BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Object)
*/
@@ -275,11 +267,11 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
}
/**
- * Return an array of {@code Bundle}s for all bundles being tracked by
- * this {@code BundleTracker}.
+ * Return an array of {@code Bundle}s for all bundles being tracked by this
+ * {@code BundleTracker}.
*
- * @return An array of {@code Bundle}s or {@code null} if no
- * bundles are being tracked.
+ * @return An array of {@code Bundle}s or {@code null} if no bundles are
+ * being tracked.
*/
public Bundle[] getBundles() {
final Tracked t = tracked();
@@ -296,13 +288,13 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
}
/**
- * Returns the customized object for the specified {@code Bundle} if
- * the specified bundle is being tracked by this {@code BundleTracker}.
+ * Returns the customized object for the specified {@code Bundle} if the
+ * specified bundle is being tracked by this {@code BundleTracker}.
*
* @param bundle The {@code Bundle} being tracked.
* @return The customized object for the specified {@code Bundle} or
- * {@code null} if the specified {@code Bundle} is not
- * being tracked.
+ * {@code null} if the specified {@code Bundle} is not being
+ * tracked.
*/
public T getObject(Bundle bundle) {
final Tracked t = tracked();
@@ -317,10 +309,10 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
/**
* Remove a bundle from this {@code BundleTracker}.
*
- * The specified bundle will be removed from this {@code BundleTracker}
- * . If the specified bundle was being tracked then the
- * {@code BundleTrackerCustomizer.removedBundle} method will be called
- * for that bundle.
+ * The specified bundle will be removed from this {@code BundleTracker} . If
+ * the specified bundle was being tracked then the
+ * {@code BundleTrackerCustomizer.removedBundle} method will be called for
+ * that bundle.
*
* @param bundle The {@code Bundle} to be removed.
*/
@@ -333,8 +325,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
}
/**
- * Return the number of bundles being tracked by this
- * {@code BundleTracker}.
+ * Return the number of bundles being tracked by this {@code BundleTracker}.
*
* @return The number of bundles being tracked.
*/
@@ -377,13 +368,12 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
}
/**
- * Return a {@code Map} with the {@code Bundle}s and customized
- * objects for all bundles being tracked by this {@code BundleTracker}.
+ * Return a {@code Map} with the {@code Bundle}s and customized objects for
+ * all bundles being tracked by this {@code BundleTracker}.
*
- * @return A {@code Map} with the {@code Bundle}s and customized
- * objects for all services being tracked by this
- * {@code BundleTracker}. If no bundles are being tracked, then
- * the returned map is empty.
+ * @return A {@code Map} with the {@code Bundle}s and customized objects for
+ * all services being tracked by this {@code BundleTracker}. If no
+ * bundles are being tracked, then the returned map is empty.
* @since 1.5
*/
public Map<Bundle, T> getTracked() {
@@ -421,9 +411,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* @ThreadSafe
* @since 1.4
*/
- private final class Tracked extends AbstractTracked<Bundle, T, BundleEvent>
- implements
- SynchronousBundleListener {
+ private final class Tracked extends AbstractTracked<Bundle, T, BundleEvent> implements SynchronousBundleListener {
/**
* Tracked constructor.
*/
@@ -432,9 +420,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
}
/**
- * {@code BundleListener} method for the {@code BundleTracker}
- * class. This method must NOT be synchronized to avoid deadlock
- * potential.
+ * {@code BundleListener} method for the {@code BundleTracker} class.
+ * This method must NOT be synchronized to avoid deadlock potential.
*
* @param event {@code BundleEvent} object from the framework.
*/
@@ -449,8 +436,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
final Bundle bundle = event.getBundle();
final int state = bundle.getState();
if (DEBUG) {
- System.out
- .println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle); //$NON-NLS-1$ //$NON-NLS-2$
}
if ((state & mask) != 0) {
@@ -459,8 +445,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* If the customizer throws an unchecked exception, it is safe
* to let it propagate
*/
- }
- else {
+ } else {
untrack(bundle, event);
/*
* If the customizer throws an unchecked exception, it is safe
@@ -475,8 +460,8 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
*
* @param item Item to be tracked.
* @param related Action related object.
- * @return Customized object for the tracked item or {@code null}
- * if the item is not to be tracked.
+ * @return Customized object for the tracked item or {@code null} if the
+ * item is not to be tracked.
*/
T customizerAdding(final Bundle item, final BundleEvent related) {
return customizer.addingBundle(item, related);
@@ -490,8 +475,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- void customizerModified(final Bundle item, final BundleEvent related,
- final T object) {
+ void customizerModified(final Bundle item, final BundleEvent related, final T object) {
customizer.modifiedBundle(item, related, object);
}
@@ -503,8 +487,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- void customizerRemoved(final Bundle item, final BundleEvent related,
- final T object) {
+ void customizerRemoved(final Bundle item, final BundleEvent related, final T object) {
customizer.removedBundle(item, related, object);
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java
index 0e80f2555..727e757d2 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 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.
@@ -20,28 +20,25 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
/**
- * The {@code BundleTrackerCustomizer} interface allows a
- * {@code BundleTracker} to customize the {@code Bundle}s that are
- * tracked. A {@code BundleTrackerCustomizer} is called when a bundle is
- * being added to a {@code BundleTracker}. The
- * {@code BundleTrackerCustomizer} can then return an object for the
- * tracked bundle. A {@code BundleTrackerCustomizer} is also called when a
- * tracked bundle is modified or has been removed from a
+ * The {@code BundleTrackerCustomizer} interface allows a {@code BundleTracker}
+ * to customize the {@code Bundle}s that are tracked. A
+ * {@code BundleTrackerCustomizer} is called when a bundle is being added to a
+ * {@code BundleTracker}. The {@code BundleTrackerCustomizer} can then return an
+ * object for the tracked bundle. A {@code BundleTrackerCustomizer} is also
+ * called when a tracked bundle is modified or has been removed from a
* {@code BundleTracker}.
*
* <p>
* The methods in this interface may be called as the result of a
- * {@code BundleEvent} being received by a {@code BundleTracker}.
- * Since {@code BundleEvent}s are received synchronously by the
- * {@code BundleTracker}, it is highly recommended that implementations of
- * these methods do not alter bundle states while being synchronized on any
- * object.
+ * {@code BundleEvent} being received by a {@code BundleTracker}. Since
+ * {@code BundleEvent}s are received synchronously by the {@code BundleTracker},
+ * it is highly recommended that implementations of these methods do not alter
+ * bundle states while being synchronized on any object.
*
* <p>
* The {@code BundleTracker} class is thread-safe. It does not call a
* {@code BundleTrackerCustomizer} while holding any locks.
- * {@code BundleTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code BundleTrackerCustomizer} implementations must also be thread-safe.
*
* @param <T> The type of the tracked object.
* @ThreadSafe
@@ -54,20 +51,20 @@ public interface BundleTrackerCustomizer<T> {
*
* <p>
* This method is called before a bundle which matched the search parameters
- * of the {@code BundleTracker} is added to the
- * {@code BundleTracker}. This method should return the object to be
- * tracked for the specified {@code Bundle}. The returned object is
- * stored in the {@code BundleTracker} and is available from the
+ * of the {@code BundleTracker} is added to the {@code BundleTracker}. This
+ * method should return the object to be tracked for the specified
+ * {@code Bundle}. The returned object is stored in the
+ * {@code BundleTracker} and is available from the
* {@link BundleTracker#getObject(Bundle) getObject} method.
*
- * @param bundle The {@code Bundle} being added to the
- * {@code BundleTracker}.
+ * @param bundle The {@code Bundle} being added to the {@code BundleTracker}
+ * .
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
- * @return The object to be tracked for the specified {@code Bundle}
- * object or {@code null} if the specified {@code Bundle}
- * object should not be tracked.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
+ * @return The object to be tracked for the specified {@code Bundle} object
+ * or {@code null} if the specified {@code Bundle} object should not
+ * be tracked.
*/
public T addingBundle(Bundle bundle, BundleEvent event);
@@ -80,12 +77,11 @@ public interface BundleTrackerCustomizer<T> {
*
* @param bundle The {@code Bundle} whose state has been modified.
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
* @param object The tracked object for the specified bundle.
*/
- public void modifiedBundle(Bundle bundle, BundleEvent event,
- T object);
+ public void modifiedBundle(Bundle bundle, BundleEvent event, T object);
/**
* A bundle tracked by the {@code BundleTracker} has been removed.
@@ -96,10 +92,9 @@ public interface BundleTrackerCustomizer<T> {
*
* @param bundle The {@code Bundle} that has been removed.
* @param event The bundle event which caused this customizer method to be
- * called or {@code null} if there is no bundle event associated
- * with the call to this method.
+ * called or {@code null} if there is no bundle event associated with
+ * the call to this method.
* @param object The tracked object for the specified bundle.
*/
- public void removedBundle(Bundle bundle, BundleEvent event,
- T object);
+ public void removedBundle(Bundle bundle, BundleEvent event, T object);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
index 99037affc..21926ad87 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
@@ -20,7 +20,6 @@ import java.lang.reflect.Array;
import java.util.Collections;
import java.util.SortedMap;
import java.util.TreeMap;
-
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -34,25 +33,22 @@ import org.osgi.framework.ServiceReference;
* The {@code ServiceTracker} class simplifies using services from the
* Framework's service registry.
* <p>
- * A {@code ServiceTracker} object is constructed with search criteria and
- * a {@code ServiceTrackerCustomizer} object. A {@code ServiceTracker}
- * can use a {@code ServiceTrackerCustomizer} to customize the service
- * objects to be tracked. The {@code ServiceTracker} can then be opened to
- * begin tracking all services in the Framework's service registry that match
- * the specified search criteria. The {@code ServiceTracker} correctly
- * handles all of the details of listening to {@code ServiceEvent}s and
- * getting and ungetting services.
+ * A {@code ServiceTracker} object is constructed with search criteria and a
+ * {@code ServiceTrackerCustomizer} object. A {@code ServiceTracker} can use a
+ * {@code ServiceTrackerCustomizer} to customize the service objects to be
+ * tracked. The {@code ServiceTracker} can then be opened to begin tracking all
+ * services in the Framework's service registry that match the specified search
+ * criteria. The {@code ServiceTracker} correctly handles all of the details of
+ * listening to {@code ServiceEvent}s and getting and ungetting services.
* <p>
- * The {@code getServiceReferences} method can be called to get references
- * to the services being tracked. The {@code getService} and
- * {@code getServices} methods can be called to get the service objects for
- * the tracked service.
+ * The {@code getServiceReferences} method can be called to get references to
+ * the services being tracked. The {@code getService} and {@code getServices}
+ * methods can be called to get the service objects for the tracked service.
* <p>
* The {@code ServiceTracker} class is thread-safe. It does not call a
* {@code ServiceTrackerCustomizer} while holding any locks.
- * {@code ServiceTrackerCustomizer} implementations must also be
- * thread-safe.
- *
+ * {@code ServiceTrackerCustomizer} implementations must also be thread-safe.
+ *
* @param <S> The type of the service being tracked.
* @param <T> The type of the tracked object.
* @ThreadSafe
@@ -66,9 +62,9 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
*/
protected final BundleContext context;
/**
- * The Filter used by this {@code ServiceTracker} which specifies the
- * search criteria for the services to track.
- *
+ * The Filter used by this {@code ServiceTracker} which specifies the search
+ * criteria for the services to track.
+ *
* @since 1.1
*/
protected final Filter filter;
@@ -102,7 +98,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* Accessor method for the current Tracked object. This method is only
* intended to be used by the unsynchronized methods which do not modify the
* tracked field.
- *
+ *
* @return The current Tracked object.
*/
private Tracked tracked() {
@@ -111,56 +107,50 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Cached ServiceReference for getServiceReference.
- *
+ *
* This field is volatile since it is accessed by multiple threads.
*/
private volatile ServiceReference<S> cachedReference;
/**
* Cached service object for getService.
- *
+ *
* This field is volatile since it is accessed by multiple threads.
*/
private volatile T cachedService;
/**
- * Create a {@code ServiceTracker} on the specified
- * {@code ServiceReference}.
- *
+ * Create a {@code ServiceTracker} on the specified {@code ServiceReference}
+ * .
+ *
* <p>
- * The service referenced by the specified {@code ServiceReference}
- * will be tracked by this {@code ServiceTracker}.
- *
- * @param context The {@code BundleContext} against which the tracking
- * is done.
+ * The service referenced by the specified {@code ServiceReference} will be
+ * tracked by this {@code ServiceTracker}.
+ *
+ * @param context The {@code BundleContext} against which the tracking is
+ * done.
* @param reference The {@code ServiceReference} for the service to be
* tracked.
* @param customizer The customizer object to call when services are added,
- * modified, or removed in this {@code ServiceTracker}. If
- * customizer is {@code null}, then this
- * {@code ServiceTracker} will be used as the
- * {@code ServiceTrackerCustomizer} and this
+ * modified, or removed in this {@code ServiceTracker}. If customizer
+ * is {@code null}, then this {@code ServiceTracker} will be used as
+ * the {@code ServiceTrackerCustomizer} and this
* {@code ServiceTracker} will call the
* {@code ServiceTrackerCustomizer} methods on itself.
*/
- public ServiceTracker(final BundleContext context,
- final ServiceReference<S> reference,
- final ServiceTrackerCustomizer<S, T> customizer) {
+ public ServiceTracker(final BundleContext context, final ServiceReference<S> reference, final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = reference;
this.trackClass = null;
this.customizer = (customizer == null) ? this : customizer;
- this.listenerFilter = "(" + Constants.SERVICE_ID + "="
- + reference.getProperty(Constants.SERVICE_ID).toString() + ")";
+ this.listenerFilter = "(" + Constants.SERVICE_ID + "=" + reference.getProperty(Constants.SERVICE_ID).toString() + ")";
try {
this.filter = context.createFilter(listenerFilter);
- }
- catch (InvalidSyntaxException e) {
+ } catch (InvalidSyntaxException e) {
/*
* we could only get this exception if the ServiceReference was
* invalid
*/
- IllegalArgumentException iae = new IllegalArgumentException(
- "unexpected InvalidSyntaxException: " + e.getMessage());
+ IllegalArgumentException iae = new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage());
iae.initCause(e);
throw iae;
}
@@ -168,68 +158,59 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Create a {@code ServiceTracker} on the specified class name.
- *
+ *
* <p>
* Services registered under the specified class name will be tracked by
* this {@code ServiceTracker}.
- *
- * @param context The {@code BundleContext} against which the tracking
- * is done.
+ *
+ * @param context The {@code BundleContext} against which the tracking is
+ * done.
* @param clazz The class name of the services to be tracked.
* @param customizer The customizer object to call when services are added,
- * modified, or removed in this {@code ServiceTracker}. If
- * customizer is {@code null}, then this
- * {@code ServiceTracker} will be used as the
- * {@code ServiceTrackerCustomizer} and this
+ * modified, or removed in this {@code ServiceTracker}. If customizer
+ * is {@code null}, then this {@code ServiceTracker} will be used as
+ * the {@code ServiceTrackerCustomizer} and this
* {@code ServiceTracker} will call the
* {@code ServiceTrackerCustomizer} methods on itself.
*/
- public ServiceTracker(final BundleContext context, final String clazz,
- final ServiceTrackerCustomizer<S, T> customizer) {
+ public ServiceTracker(final BundleContext context, final String clazz, final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = null;
this.trackClass = clazz;
this.customizer = (customizer == null) ? this : customizer;
// we call clazz.toString to verify clazz is non-null!
- this.listenerFilter = "(" + Constants.OBJECTCLASS + "="
- + clazz.toString() + ")";
+ this.listenerFilter = "(" + Constants.OBJECTCLASS + "=" + clazz.toString() + ")";
try {
this.filter = context.createFilter(listenerFilter);
- }
- catch (InvalidSyntaxException e) {
+ } catch (InvalidSyntaxException e) {
/*
* we could only get this exception if the clazz argument was
* malformed
*/
- IllegalArgumentException iae = new IllegalArgumentException(
- "unexpected InvalidSyntaxException: " + e.getMessage());
+ IllegalArgumentException iae = new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage());
iae.initCause(e);
throw iae;
}
}
/**
- * Create a {@code ServiceTracker} on the specified {@code Filter}
- * object.
- *
+ * Create a {@code ServiceTracker} on the specified {@code Filter} object.
+ *
* <p>
- * Services which match the specified {@code Filter} object will be
- * tracked by this {@code ServiceTracker}.
- *
- * @param context The {@code BundleContext} against which the tracking
- * is done.
- * @param filter The {@code Filter} to select the services to be
- * tracked.
+ * Services which match the specified {@code Filter} object will be tracked
+ * by this {@code ServiceTracker}.
+ *
+ * @param context The {@code BundleContext} against which the tracking is
+ * done.
+ * @param filter The {@code Filter} to select the services to be tracked.
* @param customizer The customizer object to call when services are added,
- * modified, or removed in this {@code ServiceTracker}. If
- * customizer is null, then this {@code ServiceTracker} will be
- * used as the {@code ServiceTrackerCustomizer} and this
- * {@code ServiceTracker} will call the
- * {@code ServiceTrackerCustomizer} methods on itself.
+ * modified, or removed in this {@code ServiceTracker}. If customizer
+ * is null, then this {@code ServiceTracker} will be used as the
+ * {@code ServiceTrackerCustomizer} and this {@code ServiceTracker}
+ * will call the {@code ServiceTrackerCustomizer} methods on itself.
* @since 1.1
*/
- public ServiceTracker(final BundleContext context, final Filter filter,
- final ServiceTrackerCustomizer<S, T> customizer) {
+ public ServiceTracker(final BundleContext context, final Filter filter, final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = null;
this.trackClass = null;
@@ -246,37 +227,34 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Create a {@code ServiceTracker} on the specified class.
- *
+ *
* <p>
* Services registered under the name of the specified class will be tracked
* by this {@code ServiceTracker}.
- *
- * @param context The {@code BundleContext} against which the tracking
- * is done.
+ *
+ * @param context The {@code BundleContext} against which the tracking is
+ * done.
* @param clazz The class of the services to be tracked.
* @param customizer The customizer object to call when services are added,
- * modified, or removed in this {@code ServiceTracker}. If
- * customizer is {@code null}, then this
- * {@code ServiceTracker} will be used as the
- * {@code ServiceTrackerCustomizer} and this
+ * modified, or removed in this {@code ServiceTracker}. If customizer
+ * is {@code null}, then this {@code ServiceTracker} will be used as
+ * the {@code ServiceTrackerCustomizer} and this
* {@code ServiceTracker} will call the
* {@code ServiceTrackerCustomizer} methods on itself.
* @since 1.5
*/
- public ServiceTracker(final BundleContext context, final Class<S> clazz,
- final ServiceTrackerCustomizer<S, T> customizer) {
+ public ServiceTracker(final BundleContext context, final Class<S> clazz, final ServiceTrackerCustomizer<S, T> customizer) {
this(context, clazz.getName(), customizer);
}
/**
* Open this {@code ServiceTracker} and begin tracking services.
- *
+ *
* <p>
* This implementation calls {@code open(false)}.
- *
- * @throws java.lang.IllegalStateException If the {@code BundleContext}
- * with which this {@code ServiceTracker} was created is no
- * longer valid.
+ *
+ * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+ * which this {@code ServiceTracker} was created is no longer valid.
* @see #open(boolean)
*/
public void open() {
@@ -285,22 +263,20 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Open this {@code ServiceTracker} and begin tracking services.
- *
+ *
* <p>
* Services which match the search criteria specified when this
* {@code ServiceTracker} was created are now tracked by this
* {@code ServiceTracker}.
- *
- * @param trackAllServices If {@code true}, then this
- * {@code ServiceTracker} will track all matching services
- * regardless of class loader accessibility. If {@code false},
- * then this {@code ServiceTracker} will only track matching
- * services which are class loader accessible to the bundle whose
- * {@code BundleContext} is used by this
- * {@code ServiceTracker}.
- * @throws java.lang.IllegalStateException If the {@code BundleContext}
- * with which this {@code ServiceTracker} was created is no
- * longer valid.
+ *
+ * @param trackAllServices If {@code true}, then this {@code ServiceTracker}
+ * will track all matching services regardless of class loader
+ * accessibility. If {@code false}, then this {@code ServiceTracker}
+ * will only track matching services which are class loader
+ * accessible to the bundle whose {@code BundleContext} is used by
+ * this {@code ServiceTracker}.
+ * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+ * which this {@code ServiceTracker} was created is no longer valid.
* @since 1.3
*/
public void open(boolean trackAllServices) {
@@ -318,28 +294,21 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
context.addServiceListener(t, listenerFilter);
ServiceReference<S>[] references = null;
if (trackClass != null) {
- references = getInitialReferences(trackAllServices,
- trackClass, null);
- }
- else {
+ references = getInitialReferences(trackAllServices, trackClass, null);
+ } else {
if (trackReference != null) {
if (trackReference.getBundle() != null) {
ServiceReference<S>[] single = new ServiceReference[] {trackReference};
references = single;
}
- }
- else { /* user supplied filter */
- references = getInitialReferences(trackAllServices,
- null, listenerFilter);
+ } else { /* user supplied filter */
+ references = getInitialReferences(trackAllServices, null, listenerFilter);
}
}
/* set tracked with the initial references */
t.setInitial(references);
- }
- catch (InvalidSyntaxException e) {
- throw new RuntimeException(
- "unexpected InvalidSyntaxException: "
- + e.getMessage(), e);
+ } catch (InvalidSyntaxException e) {
+ throw new RuntimeException("unexpected InvalidSyntaxException: " + e.getMessage(), e);
}
}
tracked = t;
@@ -351,33 +320,28 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Returns the list of initial {@code ServiceReference}s that will be
* tracked by this {@code ServiceTracker}.
- *
+ *
* @param trackAllServices If {@code true}, use
* {@code getAllServiceReferences}.
* @param className The class name with which the service was registered, or
* {@code null} for all services.
- * @param filterString The filter criteria or {@code null} for all
- * services.
+ * @param filterString The filter criteria or {@code null} for all services.
* @return The list of initial {@code ServiceReference}s.
* @throws InvalidSyntaxException If the specified filterString has an
* invalid syntax.
*/
- private ServiceReference<S>[] getInitialReferences(
- boolean trackAllServices, String className, String filterString)
- throws InvalidSyntaxException {
- ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context
- .getAllServiceReferences(className, filterString)
- : context.getServiceReferences(className, filterString));
+ private ServiceReference<S>[] getInitialReferences(boolean trackAllServices, String className, String filterString) throws InvalidSyntaxException {
+ ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context.getAllServiceReferences(className, filterString) : context.getServiceReferences(className, filterString));
return result;
}
/**
* Close this {@code ServiceTracker}.
- *
+ *
* <p>
- * This method should be called when this {@code ServiceTracker} should
- * end the tracking of services.
- *
+ * This method should be called when this {@code ServiceTracker} should end
+ * the tracking of services.
+ *
* <p>
* This implementation calls {@link #getServiceReferences()} to get the list
* of tracked services to remove.
@@ -398,8 +362,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
tracked = null;
try {
context.removeServiceListener(outgoing);
- }
- catch (IllegalStateException e) {
+ } catch (IllegalStateException e) {
/* In case the context was stopped. */
}
}
@@ -414,8 +377,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
if (DEBUG) {
if ((cachedReference == null) && (cachedService == null)) {
- System.out.println("ServiceTracker.close[cached cleared]: "
- + filter);
+ System.out.println("ServiceTracker.close[cached cleared]: " + filter);
}
}
}
@@ -423,23 +385,22 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Default implementation of the
* {@code ServiceTrackerCustomizer.addingService} method.
- *
+ *
* <p>
* This method is only called when this {@code ServiceTracker} has been
* constructed with a {@code null ServiceTrackerCustomizer} argument.
- *
+ *
* <p>
- * This implementation returns the result of calling {@code getService}
- * on the {@code BundleContext} with which this
- * {@code ServiceTracker} was created passing the specified
- * {@code ServiceReference}.
+ * This implementation returns the result of calling {@code getService} on
+ * the {@code BundleContext} with which this {@code ServiceTracker} was
+ * created passing the specified {@code ServiceReference}.
* <p>
* This method can be overridden in a subclass to customize the service
* object to be tracked for the service being added. In that case, take care
* not to rely on the default implementation of
* {@link #removedService(ServiceReference, Object) removedService} to unget
* the service.
- *
+ *
* @param reference The reference to the service being added to this
* {@code ServiceTracker}.
* @return The service object to be tracked for the service added to this
@@ -454,14 +415,14 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Default implementation of the
* {@code ServiceTrackerCustomizer.modifiedService} method.
- *
+ *
* <p>
* This method is only called when this {@code ServiceTracker} has been
* constructed with a {@code null ServiceTrackerCustomizer} argument.
- *
+ *
* <p>
* This implementation does nothing.
- *
+ *
* @param reference The reference to modified service.
* @param service The service object for the modified service.
* @see ServiceTrackerCustomizer#modifiedService(ServiceReference, Object)
@@ -473,20 +434,20 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Default implementation of the
* {@code ServiceTrackerCustomizer.removedService} method.
- *
+ *
* <p>
* This method is only called when this {@code ServiceTracker} has been
* constructed with a {@code null ServiceTrackerCustomizer} argument.
- *
+ *
* <p>
* This implementation calls {@code ungetService}, on the
- * {@code BundleContext} with which this {@code ServiceTracker}
- * was created, passing the specified {@code ServiceReference}.
+ * {@code BundleContext} with which this {@code ServiceTracker} was created,
+ * passing the specified {@code ServiceReference}.
* <p>
* This method can be overridden in a subclass. If the default
* implementation of {@link #addingService(ServiceReference) addingService}
* method was used, this method must unget the service.
- *
+ *
* @param reference The reference to removed service.
* @param service The service object for the removed service.
* @see ServiceTrackerCustomizer#removedService(ServiceReference, Object)
@@ -499,17 +460,17 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* Wait for at least one service to be tracked by this
* {@code ServiceTracker}. This method will also return when this
* {@code ServiceTracker} is closed.
- *
+ *
* <p>
- * It is strongly recommended that {@code waitForService} is not used
- * during the calling of the {@code BundleActivator} methods.
+ * It is strongly recommended that {@code waitForService} is not used during
+ * the calling of the {@code BundleActivator} methods.
* {@code BundleActivator} methods are expected to complete in a short
* period of time.
- *
+ *
* <p>
* This implementation calls {@link #getService()} to determine if a service
* is being tracked.
- *
+ *
* @param timeout The time interval in milliseconds to wait. If zero, the
* method will wait indefinitely.
* @return Returns the result of {@link #getService()}.
@@ -527,8 +488,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
return object;
}
- final long endTime = (timeout == 0) ? 0
- : (System.currentTimeMillis() + timeout);
+ final long endTime = (timeout == 0) ? 0 : (System.currentTimeMillis() + timeout);
do {
final Tracked t = tracked();
if (t == null) { /* if ServiceTracker is not open */
@@ -553,9 +513,9 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Return an array of {@code ServiceReference}s for all services being
* tracked by this {@code ServiceTracker}.
- *
- * @return Array of {@code ServiceReference}s or {@code null} if
- * no services are being tracked.
+ *
+ * @return Array of {@code ServiceReference}s or {@code null} if no services
+ * are being tracked.
*/
public ServiceReference<S>[] getServiceReferences() {
final Tracked t = tracked();
@@ -573,32 +533,30 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
/**
- * Returns a {@code ServiceReference} for one of the services being
- * tracked by this {@code ServiceTracker}.
- *
+ * Returns a {@code ServiceReference} for one of the services being tracked
+ * by this {@code ServiceTracker}.
+ *
* <p>
* 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, the service that was registered first is returned. This is the same
+ * 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}.
- *
+ *
* <p>
* This implementation calls {@link #getServiceReferences()} to get the list
* of references for the tracked services.
- *
- * @return A {@code ServiceReference} or {@code null} if no
- * services are being tracked.
+ *
+ * @return A {@code ServiceReference} or {@code null} if no services are
+ * being tracked.
* @since 1.1
*/
public ServiceReference<S> getServiceReference() {
ServiceReference<S> reference = cachedReference;
if (reference != null) {
if (DEBUG) {
- System.out
- .println("ServiceTracker.getServiceReference[cached]: "
- + filter);
+ System.out.println("ServiceTracker.getServiceReference[cached]: " + filter);
}
return reference;
}
@@ -616,18 +574,14 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
int count = 0;
int maxRanking = Integer.MIN_VALUE;
for (int i = 0; i < length; i++) {
- Object property = references[i]
- .getProperty(Constants.SERVICE_RANKING);
- int ranking = (property instanceof Integer) ? ((Integer) property)
- .intValue()
- : 0;
+ Object property = references[i].getProperty(Constants.SERVICE_RANKING);
+ int ranking = (property instanceof Integer) ? ((Integer) property).intValue() : 0;
rankings[i] = ranking;
if (ranking > maxRanking) {
index = i;
maxRanking = ranking;
count = 1;
- }
- else {
+ } else {
if (ranking == maxRanking) {
count++;
}
@@ -637,9 +591,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
long minId = Long.MAX_VALUE;
for (int i = 0; i < length; i++) {
if (rankings[i] == maxRanking) {
- long id = ((Long) (references[i]
- .getProperty(Constants.SERVICE_ID)))
- .longValue();
+ long id = ((Long) (references[i].getProperty(Constants.SERVICE_ID))).longValue();
if (id < minId) {
index = i;
minId = id;
@@ -652,14 +604,13 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
/**
- * Returns the service object for the specified
- * {@code ServiceReference} if the specified referenced service is
- * being tracked by this {@code ServiceTracker}.
- *
+ * Returns the service object for the specified {@code ServiceReference} if
+ * the specified referenced service is being tracked by this
+ * {@code ServiceTracker}.
+ *
* @param reference The reference to the desired service.
- * @return A service object or {@code null} if the service referenced
- * by the specified {@code ServiceReference} is not being
- * tracked.
+ * @return A service object or {@code null} if the service referenced by the
+ * specified {@code ServiceReference} is not being tracked.
*/
public T getService(ServiceReference<S> reference) {
final Tracked t = tracked();
@@ -674,15 +625,15 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Return an array of service objects for all services being tracked by this
* {@code ServiceTracker}.
- *
+ *
* <p>
* This implementation calls {@link #getServiceReferences()} to get the list
* of references for the tracked services and then calls
* {@link #getService(ServiceReference)} for each reference to get the
* tracked service object.
- *
- * @return An array of service objects or {@code null} if no services
- * are being tracked.
+ *
+ * @return An array of service objects or {@code null} if no services are
+ * being tracked.
*/
public Object[] getServices() {
final Tracked t = tracked();
@@ -706,11 +657,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Returns a service object for one of the services being tracked by this
* {@code ServiceTracker}.
- *
+ *
* <p>
* If any services are being tracked, this implementation returns the result
* of calling {@code getService(getServiceReference())}.
- *
+ *
* @return A service object or {@code null} if no services are being
* tracked.
*/
@@ -718,8 +669,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
T service = cachedService;
if (service != null) {
if (DEBUG) {
- System.out.println("ServiceTracker.getService[cached]: "
- + filter);
+ System.out.println("ServiceTracker.getService[cached]: " + filter);
}
return service;
}
@@ -735,12 +685,12 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Remove a service from this {@code ServiceTracker}.
- *
- * The specified service will be removed from this
- * {@code ServiceTracker}. If the specified service was being tracked
- * then the {@code ServiceTrackerCustomizer.removedService} method will
- * be called for that service.
- *
+ *
+ * The specified service will be removed from this {@code ServiceTracker}.
+ * If the specified service was being tracked then the
+ * {@code ServiceTrackerCustomizer.removedService} method will be called for
+ * that service.
+ *
* @param reference The reference to the service to be removed.
*/
public void remove(ServiceReference<S> reference) {
@@ -754,7 +704,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Return the number of services being tracked by this
* {@code ServiceTracker}.
- *
+ *
* @return The number of services being tracked.
*/
public int size() {
@@ -769,11 +719,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Returns the tracking count for this {@code ServiceTracker}.
- *
+ *
* The tracking count is initialized to 0 when this {@code ServiceTracker}
* is opened. Every time a service is added, modified or removed from this
* {@code ServiceTracker}, the tracking count is incremented.
- *
+ *
* <p>
* The tracking count can be used to determine if this
* {@code ServiceTracker} has added, modified or removed a service by
@@ -781,7 +731,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* tracking count value. If the value has not changed, then no service has
* been added, modified or removed from this {@code ServiceTracker} since
* the previous tracking count was collected.
- *
+ *
* @since 1.2
* @return The tracking count for this {@code ServiceTracker} or -1 if this
* {@code ServiceTracker} is not open.
@@ -814,21 +764,20 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
/**
- * Return a {@code SortedMap} of the {@code ServiceReference}s and
- * service objects for all services being tracked by this
- * {@code ServiceTracker}. The map is sorted in reverse natural order
- * of {@code ServiceReference}. That is, the first entry is the service
- * with the highest ranking and the lowest service id.
- *
- * @return A {@code SortedMap} with the {@code ServiceReference}s
- * and service objects for all services being tracked by this
- * {@code ServiceTracker}. If no services are being tracked,
- * then the returned map is empty.
+ * Return a {@code SortedMap} of the {@code ServiceReference}s and service
+ * objects for all services being tracked by this {@code ServiceTracker}.
+ * The map is sorted in reverse natural order of {@code ServiceReference}.
+ * That is, the first entry is the service with the highest ranking and the
+ * lowest service id.
+ *
+ * @return A {@code SortedMap} with the {@code ServiceReference}s and
+ * service objects for all services being tracked by this
+ * {@code ServiceTracker}. If no services are being tracked, then
+ * the returned map is empty.
* @since 1.5
*/
public SortedMap<ServiceReference<S>, T> getTracked() {
- SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(
- Collections.reverseOrder());
+ SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(Collections.reverseOrder());
final Tracked t = tracked();
if (t == null) { /* if ServiceTracker is not open */
return map;
@@ -840,7 +789,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Return if this {@code ServiceTracker} is empty.
- *
+ *
* @return {@code true} if this {@code ServiceTracker} is not tracking any
* services.
* @since 1.5
@@ -859,13 +808,13 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* Return an array of service objects for all services being tracked by this
* {@code ServiceTracker}. The runtime type of the returned array is that of
* the specified array.
- *
+ *
* <p>
* This implementation calls {@link #getServiceReferences()} to get the list
* of references for the tracked services and then calls
* {@link #getService(ServiceReference)} for each reference to get the
* tracked service object.
- *
+ *
* @param array An array into which the tracked service objects will be
* stored, if the array is large enough.
* @return An array of service objects being tracked. If the specified array
@@ -894,8 +843,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
return array;
}
if (length > array.length) {
- array = (T[]) Array.newInstance(array.getClass()
- .getComponentType(), length);
+ array = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
}
for (int i = 0; i < length; i++) {
array[i] = getService(references[i]);
@@ -910,12 +858,10 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Inner class which subclasses AbstractTracked. This class is the
* {@code ServiceListener} object for the tracker.
- *
+ *
* @ThreadSafe
*/
- private class Tracked extends
- AbstractTracked<ServiceReference<S>, T, ServiceEvent>
- implements ServiceListener {
+ private class Tracked extends AbstractTracked<ServiceReference<S>, T, ServiceEvent> implements ServiceListener {
/**
* Tracked constructor.
*/
@@ -924,10 +870,9 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
/**
- * {@code ServiceListener} method for the
- * {@code ServiceTracker} class. This method must NOT be
- * synchronized to avoid deadlock potential.
- *
+ * {@code ServiceListener} method for the {@code ServiceTracker} class.
+ * This method must NOT be synchronized to avoid deadlock potential.
+ *
* @param event {@code ServiceEvent} object from the framework.
*/
final public void serviceChanged(final ServiceEvent event) {
@@ -938,11 +883,9 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
if (closed) {
return;
}
- final ServiceReference<S> reference = (ServiceReference<S>) event
- .getServiceReference();
+ final ServiceReference<S> reference = (ServiceReference<S>) event.getServiceReference();
if (DEBUG) {
- System.out.println("ServiceTracker.Tracked.serviceChanged["
- + event.getType() + "]: " + reference);
+ System.out.println("ServiceTracker.Tracked.serviceChanged[" + event.getType() + "]: " + reference);
}
switch (event.getType()) {
@@ -968,7 +911,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Increment the tracking count and tell the tracker there was a
* modification.
- *
+ *
* @GuardedBy this
*/
final void modified() {
@@ -979,40 +922,37 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Call the specific customizer adding method. This method must not be
* called while synchronized on this object.
- *
+ *
* @param item Item to be tracked.
* @param related Action related object.
- * @return Customized object for the tracked item or {@code null}
- * if the item is not to be tracked.
+ * @return Customized object for the tracked item or {@code null} if the
+ * item is not to be tracked.
*/
- final T customizerAdding(final ServiceReference<S> item,
- final ServiceEvent related) {
+ final T customizerAdding(final ServiceReference<S> item, final ServiceEvent related) {
return customizer.addingService(item);
}
/**
* Call the specific customizer modified method. This method must not be
* called while synchronized on this object.
- *
+ *
* @param item Tracked item.
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- final void customizerModified(final ServiceReference<S> item,
- final ServiceEvent related, final T object) {
+ final void customizerModified(final ServiceReference<S> item, final ServiceEvent related, final T object) {
customizer.modifiedService(item, object);
}
/**
* Call the specific customizer removed method. This method must not be
* called while synchronized on this object.
- *
+ *
* @param item Tracked item.
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- final void customizerRemoved(final ServiceReference<S> item,
- final ServiceEvent related, final T object) {
+ final void customizerRemoved(final ServiceReference<S> item, final ServiceEvent related, final T object) {
customizer.removedService(item, object);
}
}
@@ -1020,7 +960,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Subclass of Tracked which implements the AllServiceListener interface.
* This class is used by the ServiceTracker if open is called with true.
- *
+ *
* @since 1.3
* @ThreadSafe
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java
index c654a9633..c14b8d470 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,29 +20,27 @@ import org.osgi.framework.ServiceReference;
/**
* The {@code ServiceTrackerCustomizer} interface allows a
- * {@code ServiceTracker} to customize the service objects that are
- * tracked. A {@code ServiceTrackerCustomizer} is called when a service is
- * being added to a {@code ServiceTracker}. The
- * {@code ServiceTrackerCustomizer} can then return an object for the
- * tracked service. A {@code ServiceTrackerCustomizer} is also called when
- * a tracked service is modified or has been removed from a
+ * {@code ServiceTracker} to customize the service objects that are tracked. A
+ * {@code ServiceTrackerCustomizer} is called when a service is being added to a
+ * {@code ServiceTracker}. The {@code ServiceTrackerCustomizer} can then return
+ * an object for the tracked service. A {@code ServiceTrackerCustomizer} is also
+ * called when a tracked service is modified or has been removed from a
* {@code ServiceTracker}.
*
* <p>
* The methods in this interface may be called as the result of a
- * {@code ServiceEvent} being received by a {@code ServiceTracker}.
- * Since {@code ServiceEvent}s are synchronously delivered by the
- * Framework, it is highly recommended that implementations of these methods do
- * not register ({@code BundleContext.registerService}), modify (
+ * {@code ServiceEvent} being received by a {@code ServiceTracker}. Since
+ * {@code ServiceEvent}s are synchronously delivered by the Framework, it is
+ * highly recommended that implementations of these methods do not register (
+ * {@code BundleContext.registerService}), modify (
* {@code ServiceRegistration.setProperties}) or unregister (
- * {@code ServiceRegistration.unregister}) a service while being
- * synchronized on any object.
+ * {@code ServiceRegistration.unregister}) a service while being synchronized on
+ * any object.
*
* <p>
* The {@code ServiceTracker} class is thread-safe. It does not call a
* {@code ServiceTrackerCustomizer} while holding any locks.
- * {@code ServiceTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code ServiceTrackerCustomizer} implementations must also be thread-safe.
*
* @param <S> The type of the service being tracked.
* @param <T> The type of the tracked object.
@@ -56,11 +54,10 @@ public interface ServiceTrackerCustomizer<S, T> {
* <p>
* This method is called before a service which matched the search
* parameters of the {@code ServiceTracker} is added to the
- * {@code ServiceTracker}. This method should return the service object
- * to be tracked for the specified {@code ServiceReference}. The
- * returned service object is stored in the {@code ServiceTracker} and
- * is available from the {@code getService} and
- * {@code getServices} methods.
+ * {@code ServiceTracker}. This method should return the service object to
+ * be tracked for the specified {@code ServiceReference}. The returned
+ * service object is stored in the {@code ServiceTracker} and is available
+ * from the {@code getService} and {@code getServices} methods.
*
* @param reference The reference to the service being added to the
* {@code ServiceTracker}.

Back to the top