Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-01-04 22:34:32 +0000
committerThomas Watson2012-01-04 22:34:32 +0000
commit6e11763dc527ed97bd1a72ed0345f81294048da6 (patch)
tree4063ea6e3774f96ac54c8bc71dfc3a7810399eb4
parent8e5d102a7fac4a328f1d15611566b4b03fcedf8e (diff)
downloadrt.equinox.framework-6e11763dc527ed97bd1a72ed0345f81294048da6.tar.gz
rt.equinox.framework-6e11763dc527ed97bd1a72ed0345f81294048da6.tar.xz
rt.equinox.framework-6e11763dc527ed97bd1a72ed0345f81294048da6.zip
Update to latest OSGi companion code for R5.
-rw-r--r--bundles/org.eclipse.osgi/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java30
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java44
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java31
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java29
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java9
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java12
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/FrameworkWiring.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java6
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java42
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java8
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java18
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java6
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/URLStreamHandlerSetter.java15
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java140
22 files changed, 264 insertions, 178 deletions
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
index ce127bd80..4f3b01d46 100644
--- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
@@ -35,7 +35,7 @@ Export-Package: org.eclipse.osgi.event;version="1.0",
org.osgi.service.permissionadmin;version="1.2",
org.osgi.service.startlevel;version="1.1",
org.osgi.service.url;version="1.0",
- org.osgi.util.tracker;version="1.5",
+ org.osgi.util.tracker;version="1.5.1",
org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.runtime",
org.eclipse.core.runtime.internal.adaptor;x-internal:=true,
org.eclipse.core.runtime.internal.stats;x-friends:="org.eclipse.core.runtime",
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 9e117ec96..658c5282e 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ package org.osgi.framework;
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id$
+ * @version $Id: dfd1f76ca54be00d888cb880e8dddd7ed8deffa2 $
*/
public class BundleException extends Exception {
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 e05c6ffd5..6dcef75dd 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import org.osgi.framework.wiring.FrameworkWiring;
*
* @Immutable
* @see FrameworkListener
- * @version $Id$
+ * @version $Id: 4182bd635ab3b667e46aa243bda0fca90267a086 $
*/
public class FrameworkEvent extends EventObject {
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 fdd638c67..f821cbd7c 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
@@ -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.
@@ -32,7 +32,7 @@ import java.util.StringTokenizer;
*
* @since 1.7
* @Immutable
- * @version $Id$
+ * @version $Id: 9afdb1cfae10edae6484aee798b206fe139b220a $
*/
public class VersionRange {
@@ -154,7 +154,7 @@ public class VersionRange {
}
leftClosed = true;
rightClosed = false;
- left = parseVersion(token, true, range);
+ left = parseVersion(token, false, range);
right = null;
empty = false;
return;
@@ -371,7 +371,9 @@ public class VersionRange {
}
String leftVersion = left.toString();
if (right == null) {
- return versionRangeString = leftVersion;
+ StringBuffer result = new StringBuffer(leftVersion.length() + 1);
+ left.appendTo(result);
+ return versionRangeString = result.toString();
}
String rightVerion = right.toString();
StringBuffer result = new StringBuffer(leftVersion.length()
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 c1687e95e..4c3924bf7 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import org.osgi.framework.BundleContext;
* addition and removal.
*
* @ThreadSafe
- * @version $Id$
+ * @version $Id: 959ee37e16fdbfb1088b8309907b11b6b784fa63 $
*/
public interface ListenerHook {
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 2be857d06..70dc5da1a 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import org.osgi.framework.FrameworkEvent;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: ae7fc29f8f5df58e9ed588d3d9e5ce7ebdc16ac5 $
*/
public interface Framework extends Bundle {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java
index 5597c6dd0..816786a21 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.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.
@@ -21,8 +21,13 @@ import java.util.Map;
/**
* A capability that has been declared from a {@link Resource}.
*
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ *
* @ThreadSafe
- * @version $Id$
+ * @version $Id: 1fb855c7c4fd0826455a28ed43b0e0d599b3b1ea $
*/
public interface Capability {
@@ -78,4 +83,25 @@ public interface Capability {
* @return The resource declaring this capability.
*/
Resource getResource();
+
+ /**
+ * Compares this {@code Capability} to another {@code Capability}.
+ *
+ * <p>
+ * This {@code Capability} is equal to another {@code Capability} if they
+ * have the same name space, directives and attributes and are declared by
+ * the same resource.
+ *
+ * @param obj The object to compare against this {@code Capability}.
+ * @return {@code true} if this {@code Capability} is equal to the other
+ * object; {@code false} otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hashCode of this {@code Capability}.
+ *
+ * @return The hashCode of this {@code Capability}.
+ */
+ int hashCode();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java
index 46f600c32..868da3114 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.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.
@@ -18,13 +18,16 @@ package org.osgi.framework.resource;
import java.util.Map;
-import org.osgi.framework.Constants;
-
/**
* A requirement that has been declared from a {@link Resource} .
*
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ *
* @ThreadSafe
- * @version $Id$
+ * @version $Id: 0f28402db2288a77016703f1b1514c0ebce29d0d $
*/
public interface Requirement {
/**
@@ -81,26 +84,23 @@ public interface Requirement {
Resource getResource();
/**
- * Returns whether the specified capability matches this requirement.
+ * Compares this {@code Requirement} to another {@code Requirement}.
*
* <p>
- * A capability matches this requirement when all of the following are true:
- * <ul>
- * <li>The specified capability has the same {@link #getNamespace() name
- * space} as this requirement.
- * <li>The filter specified by the {@link Constants#FILTER_DIRECTIVE filter}
- * directive of this requirement matches the
- * {@link Capability#getAttributes() attributes of the specified capability}.
- * <li>The standard capability {@link Capability#getDirectives() directives}
- * that influence matching and that apply to the name space are satisfied.
- * See the capability
- * {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory}
- * directive.
- * </ul>
+ * This {@code Requirement} is equal to another {@code Requirement} if they
+ * have the same name space, directives and attributes and are declared by
+ * the same resource.
+ *
+ * @param obj The object to compare against this {@code Requirement}.
+ * @return {@code true} if this {@code Requirement} is equal to the other
+ * object; {@code false} otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hashCode of this {@code Requirement}.
*
- * @param capability The capability to match to this requirement.
- * @return {@code true} if the specified capability matches this this
- * requirement; {@code false} otherwise.
+ * @return The hashCode of this {@code Requirement}.
*/
- boolean matches(Capability capability);
+ int hashCode();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java
index 3d95628ef..012b57ce3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.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.
@@ -23,9 +23,14 @@ import java.util.List;
* A resource is the representation of a uniquely identified and typed data.
*
* A resources can be wired together via capabilities and requirements.
+ *
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
*
* @ThreadSafe
- * @version $Id$
+ * @version $Id: 4b73a753df5566cdb46b4b53a04fd75e866224ea $
*/
public interface Resource {
/**
@@ -53,4 +58,26 @@ public interface Resource {
* space.
*/
List<Requirement> getRequirements(String namespace);
+
+ /**
+ * Compares this {@code Resource} to another {@code Resource}.
+ *
+ * <p>
+ * This {@code Resource} is equal to another {@code Resource} if they have
+ * they both have the same content and come from the same location. Location
+ * may be defined as the bundle location if the resource is an installed
+ * bundle or the repository location if the resource is in a repository.
+ *
+ * @param obj The object to compare against this {@code Resource}.
+ * @return {@code true} if this {@code Resource} is equal to the other
+ * object; {@code false} otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hashCode of this {@code Resource}.
+ *
+ * @return The hashCode of this {@code Resource}.
+ */
+ int hashCode();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java
index 41ff1d01d..389f59e25 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.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.
@@ -18,9 +18,14 @@ package org.osgi.framework.resource;
/**
* A wire connecting a {@link Capability} to a {@link Requirement}.
+ *
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
*
* @ThreadSafe
- * @version $Id$
+ * @version $Id: 7cab76f1c97c1fbe49ea95989a94fd363354e181 $
*/
public interface Wire {
/**
@@ -57,4 +62,24 @@ public interface Wire {
* @return The resource who requires the capability.
*/
Resource getRequirer();
+
+ /**
+ * Compares this {@code Wire} to another {@code Wire}.
+ *
+ * <p>
+ * This {@code Wire} is equal to another {@code Wire} if they have the same
+ * capability, requirement, provider and requirer.
+ *
+ * @param obj The object to compare against this {@code Wire}.
+ * @return {@code true} if this {@code Wire} is equal to the other object;
+ * {@code false} otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hashCode of this {@code Wire}.
+ *
+ * @return The hashCode of this {@code Wire}.
+ */
+ int hashCode();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java
index 1dcd04f83..4b03f6c6e 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.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.
@@ -21,9 +21,14 @@ import java.util.List;
/**
* A wiring for a resource. A wiring is associated with a resource and
* represents the dependencies with other wirings.
+ *
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
*
* @ThreadSafe
- * @version $Id$
+ * @version $Id: ac9bdc86f3ece3efd2aad9068b3bb09bf456dfbf $
*/
public interface Wiring {
/**
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 5971652e6..cc2b845ce 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
@@ -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.wiring;
import java.util.Map;
-import org.osgi.framework.resource.Capability;
import org.osgi.framework.resource.Requirement;
/**
@@ -27,7 +26,7 @@ import org.osgi.framework.resource.Requirement;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: bb292dc1bbd9f707652de164beb319867323785f $
*/
public interface BundleRequirement extends Requirement {
/**
@@ -73,11 +72,4 @@ public interface BundleRequirement extends Requirement {
* @since 1.1
*/
BundleRevision getResource();
-
- /**
- * {@inheritDoc}
- *
- * @since 1.1
- */
- boolean matches(Capability capability);
}
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 f9f3f89b5..0a563c006 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ import org.osgi.framework.FrameworkListener;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: cd0d36e50d7018789b25c3e6395d7d5369fa2771 $
*/
public interface FrameworkWiring extends BundleReference {
/**
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 dd1d84aa3..0cf410195 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ import java.util.List;
* </ul>
*
* @Immutable
- * @version $Id$
+ * @version $Id: 983971f8e41aac3d6baea7a811b58db03f4a81e9 $
*/
public class ConditionInfo {
private final String type;
@@ -75,7 +75,7 @@ public class ConditionInfo {
* {@code ConditionInfo} string is ignored.
*
* @param encodedCondition The encoded {@code ConditionInfo}.
- * @see #getEncoded
+ * @see #getEncoded()
* @throws IllegalArgumentException If the specified
* {@code encodedCondition} is not properly formatted.
*/
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 887450b65..60ef9f106 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.osgi.service.permissionadmin.PermissionInfo;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: 660da8b2938f7533af793018c68e8629e8ab84f8 $
*/
public interface ConditionalPermissionAdmin {
/**
@@ -61,7 +61,7 @@ public interface ConditionalPermissionAdmin {
* instead.
*/
ConditionalPermissionInfo addConditionalPermissionInfo(
- ConditionInfo conditions[], PermissionInfo permissions[]);
+ ConditionInfo[] conditions, PermissionInfo[] permissions);
/**
* Set or create a Conditional Permission Info with a specified name in the
@@ -99,7 +99,7 @@ public interface ConditionalPermissionAdmin {
* instead.
*/
ConditionalPermissionInfo setConditionalPermissionInfo(String name,
- ConditionInfo conditions[], PermissionInfo permissions[]);
+ ConditionInfo[] conditions, PermissionInfo[] permissions);
/**
* Returns the Conditional Permission Infos from the Conditional Permission
@@ -202,34 +202,32 @@ public interface ConditionalPermissionAdmin {
* @since 1.1
*/
ConditionalPermissionInfo newConditionalPermissionInfo(String name,
- ConditionInfo conditions[], PermissionInfo permissions[],
+ ConditionInfo[] conditions, PermissionInfo[] permissions,
String access);
/**
* Creates a new {@code ConditionalPermissionInfo} from the specified
- * encoded {@code ConditionalPermissionInfo} string suitable for
- * insertion into a {@link ConditionalPermissionUpdate}. The
- * {@code delete} method on {@code ConditionalPermissionInfo}
- * objects created with this method must throw
- * UnsupportedOperationException.
+ * encoded {@code ConditionalPermissionInfo} string suitable for insertion
+ * into a {@link ConditionalPermissionUpdate}. The {@code delete} method on
+ * {@code ConditionalPermissionInfo} objects created with this method must
+ * throw UnsupportedOperationException.
*
* @param encodedConditionalPermissionInfo The encoded
* {@code ConditionalPermissionInfo}. White space in the encoded
- * {@code ConditionalPermissionInfo} is ignored. The access
- * decision value in the encoded
- * {@code ConditionalPermissionInfo} must be evaluated case
- * insensitively. If the encoded
- * {@code ConditionalPermissionInfo} does not contain the
- * optional name, {@code null} must be used for the name and a
- * unique name will be generated when the returned
- * {@code ConditionalPermissionInfo} is committed in an update
- * to the Conditional Permission Table.
- * @return A {@code ConditionalPermissionInfo} object suitable for
- * insertion into a {@link ConditionalPermissionUpdate}.
+ * {@code ConditionalPermissionInfo} is ignored. The access decision
+ * value in the encoded {@code ConditionalPermissionInfo} must be
+ * evaluated case insensitively. If the encoded
+ * {@code ConditionalPermissionInfo} does not contain the optional
+ * name, {@code null} must be used for the name and a unique name
+ * will be generated when the returned
+ * {@code ConditionalPermissionInfo} is committed in an update to the
+ * Conditional Permission Table.
+ * @return A {@code ConditionalPermissionInfo} object suitable for insertion
+ * into a {@link ConditionalPermissionUpdate}.
* @throws IllegalArgumentException If the specified
* {@code encodedConditionalPermissionInfo} is not properly
* formatted.
- * @see ConditionalPermissionInfo#getEncoded
+ * @see ConditionalPermissionInfo#getEncoded()
* @since 1.1
*/
ConditionalPermissionInfo newConditionalPermissionInfo(
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 ca51e4dd6..7164fb59a 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import org.osgi.service.permissionadmin.PermissionInfo;
*
* @Immutable
* @noimplement
- * @version $Id$
+ * @version $Id: c9373ca8250d4c85a91fd7bf796295b69fdd33e7 $
*/
public interface ConditionalPermissionInfo {
/**
@@ -75,7 +75,9 @@ public interface ConditionalPermissionInfo {
* this method can no longer be committed.
*
* @throws UnsupportedOperationException If this object was created by
- * {@link ConditionalPermissionAdmin#newConditionalPermissionInfo}
+ * {@link ConditionalPermissionAdmin#newConditionalPermissionInfo(String)}
+ * or
+ * {@link ConditionalPermissionAdmin#newConditionalPermissionInfo(String, ConditionInfo[] , PermissionInfo[] , String)}
* or obtained from a {@link ConditionalPermissionUpdate}. This
* method only functions if this object was obtained from one of the
* {@link ConditionalPermissionAdmin} methods deprecated in version
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 3b16b47db..9ec9e6329 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ import java.util.List;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: 47169b8c2e510f755865d12c40920455aaa01407 $
* @since 1.1
*/
public interface ConditionalPermissionUpdate {
@@ -37,19 +37,19 @@ public interface ConditionalPermissionUpdate {
* method will be replace the Conditional Permission Table if commit is
* called and is successful.
* <p>
- * The {@link ConditionalPermissionInfo#delete delete} method of the
+ * The {@link ConditionalPermissionInfo#delete() delete} method of the
* ConditionalPermissionInfos in the list must throw
* UnsupportedOperationException.
* <p>
* The list returned by this method is ordered and the most significant
* table entry is the first entry in the list.
*
- * @return A {@code List} of the {@link ConditionalPermissionInfo}s
- * which represent the Conditional Permissions maintained by this
- * update. Modifications to this list will not affect the
- * Conditional Permission Table until successfully committed. The
- * list may be empty if the Conditional Permission Table was empty
- * when this update was created.
+ * @return A {@code List} of the {@link ConditionalPermissionInfo}s which
+ * represent the Conditional Permissions maintained by this update.
+ * Modifications to this list will not affect the Conditional
+ * Permission Table until successfully committed. The list may be
+ * empty if the Conditional Permission Table was empty when this
+ * update was created.
*/
List<ConditionalPermissionInfo> getConditionalPermissionInfos();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
index c56b99465..4dd3a3aac 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ import org.osgi.framework.Version;
* @noimplement
* @deprecated The PackageAdmin service has been replaced by the
* <code>org.osgi.framework.wiring</code> package.
- * @version $Id$
+ * @version $Id: 22ce5e8e388107b04edba3aea2f3036b8026798d $
*/
public interface ExportedPackage {
/**
@@ -83,9 +83,9 @@ public interface ExportedPackage {
/**
* Returns the version of this exported package.
*
- * @return The version of this exported package, or {@code null} if
- * no version information is available.
- * @deprecated As of 1.2, replaced by {@link #getVersion}.
+ * @return The version of this exported package, or {@code null} if no
+ * version information is available.
+ * @deprecated As of 1.2, replaced by {@link #getVersion()}.
*/
public String getSpecificationVersion();
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 b9516d07a..b6e2706fc 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ package org.osgi.service.permissionadmin;
* Permission class has been exported by a bundle.
*
* @Immutable
- * @version $Id$
+ * @version $Id: 64ea7f04345275266715291e22133938ecdb6a78 $
*/
public class PermissionInfo {
private final String type;
@@ -76,13 +76,13 @@ public class PermissionInfo {
}
/**
- * Constructs a {@code PermissionInfo} object from the specified
- * encoded {@code PermissionInfo} string. White space in the encoded
+ * Constructs a {@code PermissionInfo} object from the specified encoded
+ * {@code PermissionInfo} string. White space in the encoded
* {@code PermissionInfo} string is ignored.
*
*
* @param encodedPermission The encoded {@code PermissionInfo}.
- * @see #getEncoded
+ * @see #getEncoded()
* @throws IllegalArgumentException If the specified
* {@code encodedPermission} is not properly formatted.
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
index bf1b71ed6..b4b881611 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ import org.osgi.framework.Bundle;
*
* @ThreadSafe
* @noimplement
- * @version $Id$
+ * @version $Id: ec0295bdf246c0258261374b3ac0e4aef11f7315 $
* @deprecated This service has been replaced by the
* <code>org.osgi.framework.startlevel</code> package.
*/
@@ -202,7 +202,7 @@ public interface StartLevel {
* is first installed.
*
* @return The initial start level value for Bundles.
- * @see #setInitialBundleStartLevel
+ * @see #setInitialBundleStartLevel(int)
*/
public int getInitialBundleStartLevel();
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 f55d4c296..d29110644 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, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,19 +20,18 @@ import java.net.URL;
/**
* Interface used by {@code URLStreamHandlerService} objects to call the
- * {@code setURL} method on the proxy {@code URLStreamHandler}
- * object.
+ * {@code setURL} method on the proxy {@code URLStreamHandler} object.
*
* <p>
* Objects of this type are passed to the
- * {@link URLStreamHandlerService#parseURL} method. Invoking the
- * {@code setURL} method on the {@code URLStreamHandlerSetter}
- * object will invoke the {@code setURL} method on the proxy
- * {@code URLStreamHandler} object that is actually registered with
+ * {@link URLStreamHandlerService#parseURL(URLStreamHandlerSetter, URL, String, int, int)}
+ * method. Invoking the {@code setURL} method on the
+ * {@code URLStreamHandlerSetter} object will invoke the {@code setURL} method
+ * on the proxy {@code URLStreamHandler} object that is actually registered with
* {@code java.net.URL} for the protocol.
*
* @ThreadSafe
- * @version $Id$
+ * @version $Id: d624a8e6ec3e9aeac640ac2c10ea19b20e55d0c2 $
*/
public interface URLStreamHandlerSetter {
/**
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 df62459c9..93c8a5f04 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
@@ -1,6 +1,6 @@
/*
- * 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.
* You may obtain a copy of the License at
@@ -52,11 +52,11 @@ import org.osgi.framework.ServiceReference;
* {@code ServiceTrackerCustomizer} while holding any locks.
* {@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
- * @version $Id$
+ * @version $Id: 99037affc1bb66dbce13cfb6af1cbee1c74f07ea $
*/
public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/* set this to true to compile in debug messages */
@@ -68,7 +68,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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 +102,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,13 +111,13 @@ 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;
@@ -125,11 +125,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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.
* @param reference The {@code ServiceReference} for the service to be
@@ -168,11 +168,11 @@ 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 clazz The class name of the services to be tracked.
@@ -211,11 +211,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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
@@ -246,11 +246,11 @@ 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 clazz The class of the services to be tracked.
@@ -270,10 +270,10 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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.
@@ -285,12 +285,12 @@ 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},
@@ -351,7 +351,7 @@ 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
@@ -373,11 +373,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* Close this {@code ServiceTracker}.
- *
+ *
* <p>
* 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.
@@ -423,11 +423,11 @@ 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
@@ -439,7 +439,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* 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 +454,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,11 +473,11 @@ 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}
@@ -486,7 +486,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* 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 +499,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.
* {@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()}.
@@ -521,8 +521,15 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
if (timeout < 0) {
throw new IllegalArgumentException("timeout value is negative");
}
+
T object = getService();
- while (object == null) {
+ if (object != null) {
+ return object;
+ }
+
+ final long endTime = (timeout == 0) ? 0
+ : (System.currentTimeMillis() + timeout);
+ do {
final Tracked t = tracked();
if (t == null) { /* if ServiceTracker is not open */
return null;
@@ -533,17 +540,20 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
}
}
object = getService();
- if (timeout > 0) {
- return object;
+ if (endTime > 0) { // if we have a timeout
+ timeout = endTime - System.currentTimeMillis();
+ if (timeout <= 0) { // that has expired
+ break;
+ }
}
- }
+ } while (object == null);
return object;
}
/**
* 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.
*/
@@ -565,7 +575,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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
@@ -573,11 +583,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* 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.
* @since 1.1
@@ -645,7 +655,7 @@ 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}.
- *
+ *
* @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
@@ -664,13 +674,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}.
- *
+ *
* <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.
*/
@@ -696,11 +706,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.
*/
@@ -725,12 +735,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.
- *
+ *
* @param reference The reference to the service to be removed.
*/
public void remove(ServiceReference<S> reference) {
@@ -744,7 +754,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() {
@@ -759,11 +769,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
@@ -771,7 +781,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.
@@ -809,7 +819,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* {@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,
@@ -830,7 +840,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
@@ -849,13 +859,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
@@ -900,7 +910,7 @@ 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
@@ -917,7 +927,7 @@ 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.
- *
+ *
* @param event {@code ServiceEvent} object from the framework.
*/
final public void serviceChanged(final ServiceEvent event) {
@@ -958,7 +968,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() {
@@ -969,7 +979,7 @@ 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}
@@ -983,7 +993,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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.
@@ -996,7 +1006,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/**
* 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.
@@ -1010,7 +1020,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
*/

Back to the top