Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-08-06 15:51:46 -0400
committerThomas Watson2010-08-06 15:51:46 -0400
commit72c5a6197b66a24fc473e8b05048fdce3fc49646 (patch)
treea1ff2f6cb8db33142b073b87a00878c58a30eba3
parent154696735e258051d2118a7150cf913bd62b5021 (diff)
downloadrt.equinox.framework-72c5a6197b66a24fc473e8b05048fdce3fc49646.tar.gz
rt.equinox.framework-72c5a6197b66a24fc473e8b05048fdce3fc49646.tar.xz
rt.equinox.framework-72c5a6197b66a24fc473e8b05048fdce3fc49646.zip
Bug 322007 - Update OSGi APIs to use genericsv20100806a-postGenerics
-rw-r--r--bundles/org.eclipse.osgi/.classpath4
-rw-r--r--bundles/org.eclipse.osgi/.classpath.osgisource21
-rw-r--r--bundles/org.eclipse.osgi/.cvsignore1
-rw-r--r--bundles/org.eclipse.osgi/.settings/.api_filters820
-rw-r--r--bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs29
-rw-r--r--bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.launching.prefs3
-rw-r--r--bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs4
-rw-r--r--bundles/org.eclipse.osgi/META-INF/MANIFEST.MF10
-rw-r--r--bundles/org.eclipse.osgi/bnd.bnd35
-rw-r--r--bundles/org.eclipse.osgi/build.properties18
-rw-r--r--bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java2
-rw-r--r--bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java4
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java93
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java148
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java29
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java72
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxLauncher.java25
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java4
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingFactory.java4
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingURLStreamHandler.java4
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java4
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java12
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java2
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceProperties.java28
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java16
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java74
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java358
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceUse.java41
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java39
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java16
-rw-r--r--bundles/org.eclipse.osgi/customBuildCallbacks.xml164
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorUtil.java8
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader.java4
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/DefaultStartupMonitor.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java195
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java38
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java575
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java34
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java760
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java16
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java32
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java20
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java127
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleReference.java12
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java443
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java78
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java16
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java24
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java395
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java20
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java170
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java20
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceException.java20
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java48
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java32
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java180
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java115
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java43
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java32
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java53
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java58
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/EventHook.java27
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/FindHook.java33
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java56
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java75
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java12
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java80
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java231
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java75
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java526
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java70
-rw-r--r--bundles/org.eclipse.osgi/osgi/src2/.cvsignore1
-rw-r--r--bundles/org.eclipse.osgi/osgi/src2/empty.txt1
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/Debug.java2
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java148
76 files changed, 3999 insertions, 3004 deletions
diff --git a/bundles/org.eclipse.osgi/.classpath b/bundles/org.eclipse.osgi/.classpath
index 0629761ab..5e737b490 100644
--- a/bundles/org.eclipse.osgi/.classpath
+++ b/bundles/org.eclipse.osgi/.classpath
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="osgi/exceptions.jar"/>
- <classpathentry kind="lib" path="osgi/xmlParserAPIs.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/OSGi%Minimum-1.2"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="osgi/src"/>
<classpathentry kind="src" path="supplement/src"/>
diff --git a/bundles/org.eclipse.osgi/.classpath.osgisource b/bundles/org.eclipse.osgi/.classpath.osgisource
new file mode 100644
index 000000000..f274aee0f
--- /dev/null
+++ b/bundles/org.eclipse.osgi/.classpath.osgisource
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.osgi.framework"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.osgi.util.tracker"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.osgi.service.composite"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.osgi.service.packageadmin"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.osgi.service.startlevel"/>
+ <classpathentry kind="src" path="osgi/src"/>
+ <classpathentry kind="src" path="supplement/src"/>
+ <classpathentry kind="src" path="core/adaptor"/>
+ <classpathentry kind="src" path="core/framework"/>
+ <classpathentry kind="src" path="core/composite"/>
+ <classpathentry kind="src" path="resolver/src"/>
+ <classpathentry kind="src" path="defaultAdaptor/src"/>
+ <classpathentry kind="src" path="eclipseAdaptor/src"/>
+ <classpathentry kind="src" path="security/src"/>
+ <classpathentry kind="src" path="console/src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.osgi/.cvsignore b/bundles/org.eclipse.osgi/.cvsignore
index cb7ca00bc..82e5cee02 100644
--- a/bundles/org.eclipse.osgi/.cvsignore
+++ b/bundles/org.eclipse.osgi/.cvsignore
@@ -6,3 +6,4 @@ core.jar
defaultAdaptor.jar
eclipseAdaptor.jar
resolver.jar
+generated
diff --git a/bundles/org.eclipse.osgi/.settings/.api_filters b/bundles/org.eclipse.osgi/.settings/.api_filters
index 008608453..7ff24da2d 100644
--- a/bundles/org.eclipse.osgi/.settings/.api_filters
+++ b/bundles/org.eclipse.osgi/.settings/.api_filters
@@ -1,673 +1,747 @@
<?xml version="1.0" encoding="UTF-8"?>
<component id="org.eclipse.osgi" version="2">
-<resource path="osgi/src/org/osgi/framework/Bundle.java" type="org.osgi.framework.Bundle">
-<filter id="403767336">
+<resource path="core/framework/org/eclipse/osgi/framework/internal/protocol/URLStreamHandlerFactoryProxyFor15.java" type="org.eclipse.osgi.framework.internal.protocol.URLStreamHandlerFactoryProxyFor15">
+<filter comment="We protect in code when Proxy is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Bundle"/>
-<message_argument value="SIGNERS_ALL"/>
+<message_argument value="org.eclipse.osgi.framework.internal.protocol.URLStreamHandlerFactoryProxyFor15.openConnection(URL, Proxy)"/>
+<message_argument value="Proxy"/>
+<message_argument value="J2SE-1.4"/>
</message_arguments>
</filter>
-<filter id="403767336">
+</resource>
+<resource path="core/framework/org/eclipse/osgi/launch/Equinox.java" type="org.eclipse.osgi.launch.Equinox">
+<filter id="1143996420">
<message_arguments>
-<message_argument value="org.osgi.framework.Bundle"/>
-<message_argument value="SIGNERS_TRUSTED"/>
+<message_argument value="adapt(Class&lt;A&gt;)"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1143996420">
<message_arguments>
-<message_argument value="org.osgi.framework.Bundle"/>
-<message_argument value="getSignerCertificates(int)"/>
+<message_argument value="compareTo(Bundle)"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1143996420">
<message_arguments>
-<message_argument value="org.osgi.framework.Bundle"/>
-<message_argument value="getVersion()"/>
+<message_argument value="getDataFile(String)"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+</resource>
+<resource path="eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java" type="org.eclipse.core.runtime.internal.adaptor.EclipseAdaptorHook$ParsingService">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="SIGNERS_ALL"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.EclipseAdaptorHook.ParsingService.createService()"/>
+<message_argument value="DocumentBuilderFactory"/>
+<message_argument value="newInstance()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="SIGNERS_TRUSTED"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.EclipseAdaptorHook.ParsingService.createService()"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="newInstance()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+</resource>
+<resource path="eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/PluginParser.java" type="org.eclipse.core.runtime.internal.adaptor.PluginParser">
+<filter comment="We protect in code when jaxp is not present." id="579862564">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="getSignerCertificates(int)"/>
+<message_argument value="PluginParser"/>
+<message_argument value="DefaultHandler"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="630194212">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="getVersion()"/>
+<message_argument value="PluginParser.locator"/>
+<message_argument value="Locator"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/BundleException.java" type="org.osgi.framework.BundleException">
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="ACTIVATOR_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.acquireXMLParsing(BundleContext)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="BundleException(String, int)"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.error(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="BundleException(String, int, Throwable)"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.fatalError(SAXParseException)"/>
+<message_argument value="SAXException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="DUPLICATE_BUNDLE_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.fatalError(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="INVALID_OPERATION"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleExtensionPointState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="MANIFEST_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleExtensionState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="NATIVECODE_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleInitialState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="RESOLVE_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleLibraryExportState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="SECURITY_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleLibraryState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="START_TRANSIENT_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handlePluginState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="STATECHANGE_ERROR"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleRequiresImportState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="UNSPECIFIED"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleRequiresState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="UNSUPPORTED_OPERATION"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleRuntimeState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="getType()"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.logStatus(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/BundleReference.java" type="org.osgi.framework.BundleReference">
-<filter id="1108344834">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="org.osgi.framework.BundleReference"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseFragmentAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/Constants.java" type="org.osgi.framework.Constants">
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BEGINNING_STARTLEVEL"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseLibraryAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_APP"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_BOOT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_EXT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginRequiresImport(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_FRAMEWORK"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseRequiresAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_EXECPERMISSION"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.processingInstruction(String, String)"/>
+<message_argument value="SAXException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_LIBRARY_EXTENSIONS"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.setDocumentLocator(Locator)"/>
+<message_argument value="Locator"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_SECURITY"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.startElement(String, String, String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="646971428">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_SECURITY_OSGI"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.warning(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647000098">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_STORAGE"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.PluginParser(FrameworkAdaptor, BundleContext, Version)"/>
+<message_argument value="DefaultHandler()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_STORAGE_CLEAN"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.acquireXMLParsing(BundleContext)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="newInstance()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.handleLibraryState(String, Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getValue(String, String)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_SYSTEMPACKAGES_EXTRA"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.logStatus(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="getColumnNumber()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_TRUST_REPOSITORIES"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.logStatus(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="getLineNumber()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="FRAMEWORK_WINDOWSYSTEM"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.logStatus(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="getMessage()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="org.osgi.framework.Constants"/>
-<message_argument value="SERVICE_TYPE"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.logStatus(SAXParseException)"/>
+<message_argument value="SAXParseException"/>
+<message_argument value="getSystemId()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BEGINNING_STARTLEVEL"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseFragmentAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getLength()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseFragmentAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getLocalName(int)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_APP"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseFragmentAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getValue(int)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_BOOT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parseLibraryAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getValue(String, String)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_EXT"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParser"/>
+<message_argument value="parse(InputStream, DefaultHandler)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_BUNDLE_PARENT_FRAMEWORK"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="newSAXParser()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_EXECPERMISSION"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="setFeature(String, boolean)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_LIBRARY_EXTENSIONS"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="setNamespaceAware(boolean)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_SECURITY"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePlugin(InputStream)"/>
+<message_argument value="SAXParserFactory"/>
+<message_argument value="setValidating(boolean)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_SECURITY_OSGI"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getLength()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_STORAGE"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getLocalName(int)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code when jaxp is not present." id="647004193">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_STORAGE_CLEAN"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginAttributes(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getValue(int)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
+</message_arguments>
+</filter>
+<filter comment="We protect in code when jaxp is not present." id="647004193">
+<message_arguments>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.PluginParser.parsePluginRequiresImport(Attributes)"/>
+<message_argument value="Attributes"/>
+<message_argument value="getValue(String, String)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
+</message_arguments>
+</filter>
+</resource>
+<resource path="osgi/src/org/osgi/framework/Bundle.java" type="org.osgi.framework.Bundle">
+<filter id="403804204">
+<message_arguments>
+<message_argument value="org.osgi.framework.Bundle"/>
+<message_argument value="adapt(Class&lt;A&gt;)"/>
+</message_arguments>
+</filter>
+<filter id="403804204">
+<message_arguments>
+<message_argument value="org.osgi.framework.Bundle"/>
+<message_argument value="getDataFile(String)"/>
+</message_arguments>
+</filter>
+<filter id="403984517">
+<message_arguments>
+<message_argument value="org.osgi.framework.Bundle"/>
+<message_argument value="java.lang.Comparable"/>
+<message_argument value="compareTo(T)"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="adapt(Class&lt;A&gt;)"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_SYSTEMPACKAGES_EXTRA"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="getDataFile(String)"/>
+</message_arguments>
+</filter>
+</resource>
+<resource path="osgi/src/org/osgi/framework/BundleContext.java" type="org.osgi.framework.BundleContext">
+<filter id="403804204">
+<message_arguments>
+<message_argument value="org.osgi.framework.BundleContext"/>
+<message_argument value="getServiceReference(Class&lt;S&gt;)"/>
+</message_arguments>
+</filter>
+<filter id="403804204">
+<message_arguments>
+<message_argument value="org.osgi.framework.BundleContext"/>
+<message_argument value="getServiceReferences(Class&lt;S&gt;, String)"/>
+</message_arguments>
+</filter>
+<filter id="403804204">
+<message_arguments>
+<message_argument value="org.osgi.framework.BundleContext"/>
+<message_argument value="registerService(Class&lt;S&gt;, S, Dictionary&lt;String,?&gt;)"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_TRUST_REPOSITORIES"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="getServiceReference(Class&lt;S&gt;)"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="FRAMEWORK_WINDOWSYSTEM"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="getServiceReferences(Class&lt;S&gt;, String)"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="SERVICE_TYPE"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="registerService(Class&lt;S&gt;, S, Dictionary&lt;String,?&gt;)"/>
</message_arguments>
</filter>
</resource>
-<resource path="osgi/src/org/osgi/framework/FrameworkEvent.java" type="org.osgi.framework.FrameworkEvent">
-<filter id="1141899266">
+<resource path="osgi/src/org/osgi/framework/Constants.java" type="org.osgi.framework.Constants">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="STOPPED"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_COMMAND_ABSPATH"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="STOPPED_BOOTCLASSPATH_MODIFIED"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_JARURLS"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="STOPPED_UPDATE"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_UUID"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="WAIT_TIMEDOUT"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="REMOTE_CONFIGS_SUPPORTED"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/FrameworkUtil.java" type="org.osgi.framework.FrameworkUtil">
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="getBundle(Class)"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="REMOTE_INTENTS_SUPPORTED"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="matchDistinguishedNameChain(String, List)"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_EXPORTED_CONFIGS"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/PackagePermission.java" type="org.osgi.framework.PackagePermission">
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="EXPORTONLY"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_EXPORTED_INTENTS"/>
</message_arguments>
</filter>
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="PackagePermission(String, Bundle, String)"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_EXPORTED_INTENTS_EXTRA"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/ServiceEvent.java" type="org.osgi.framework.ServiceEvent">
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="MODIFIED_ENDMATCH"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_EXPORTED_INTERFACES"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/ServiceException.java" type="org.osgi.framework.ServiceException">
-<filter id="1108344834">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="org.osgi.framework.ServiceException"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_IMPORTED"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/ServicePermission.java" type="org.osgi.framework.ServicePermission">
-<filter id="1141899266">
+<filter id="403767336">
<message_arguments>
-<message_argument value="1.5"/>
-<message_argument value="3.5"/>
-<message_argument value="ServicePermission(ServiceReference, String)"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_IMPORTED_CONFIGS"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/hooks/service/EventHook.java" type="org.osgi.framework.hooks.service.EventHook">
-<filter id="1110441988">
+<filter id="403767336">
<message_arguments>
-<message_argument value="org.osgi.framework.hooks.service.EventHook"/>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="SERVICE_INTENTS"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/hooks/service/FindHook.java" type="org.osgi.framework.hooks.service.FindHook">
-<filter id="1110441988">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.framework.hooks.service.FindHook"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="FRAMEWORK_COMMAND_ABSPATH"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/hooks/service/ListenerHook.java" type="org.osgi.framework.hooks.service.ListenerHook">
-<filter id="1110441988">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.framework.hooks.service.ListenerHook"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="FRAMEWORK_JARURLS"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/launch/Framework.java" type="org.osgi.framework.launch.Framework">
-<filter id="1110441988">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.framework.launch.Framework"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="FRAMEWORK_UUID"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/framework/launch/FrameworkFactory.java" type="org.osgi.framework.launch.FrameworkFactory">
-<filter id="1110441988">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.framework.launch.FrameworkFactory"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="REMOTE_CONFIGS_SUPPORTED"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java" type="org.osgi.service.condpermadmin.ConditionalPermissionAdmin">
-<filter id="403804204">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"/>
-<message_argument value="newConditionalPermissionInfo(String)"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="REMOTE_INTENTS_SUPPORTED"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"/>
-<message_argument value="newConditionalPermissionInfo(String, ConditionInfo[], PermissionInfo[], String)"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_EXPORTED_CONFIGS"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"/>
-<message_argument value="newConditionalPermissionUpdate()"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_EXPORTED_INTENTS"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="newConditionalPermissionInfo(String)"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_EXPORTED_INTENTS_EXTRA"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="newConditionalPermissionInfo(String, ConditionInfo[], PermissionInfo[], String)"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_EXPORTED_INTERFACES"/>
</message_arguments>
</filter>
<filter id="1209008130">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="newConditionalPermissionUpdate()"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_IMPORTED"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java" type="org.osgi.service.condpermadmin.ConditionalPermissionInfo">
-<filter id="403767336">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="ALLOW"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_IMPORTED_CONFIGS"/>
</message_arguments>
</filter>
-<filter id="403767336">
+<filter id="1209008130">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="DENY"/>
+<message_argument value="1.6"/>
+<message_argument value="3.7"/>
+<message_argument value="SERVICE_INTENTS"/>
</message_arguments>
</filter>
-<filter id="403804204">
+</resource>
+<resource path="osgi/src/org/osgi/framework/Version.java" type="org.osgi.framework.Version">
+<filter id="1143996420">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="equals(Object)"/>
+<message_argument value="compareTo(Version)"/>
</message_arguments>
</filter>
-<filter id="403804204">
+</resource>
+<resource path="osgi/src/org/osgi/framework/launch/Framework.java" type="org.osgi.framework.launch.Framework">
+<filter id="403984517">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="getAccessDecision()"/>
+<message_argument value="org.osgi.framework.launch.Framework"/>
+<message_argument value="java.lang.Comparable"/>
+<message_argument value="compareTo(T)"/>
</message_arguments>
</filter>
-<filter id="403804204">
+</resource>
+<resource path="osgi/src/org/osgi/util/tracker/BundleTracker.java" type="org.osgi.util.tracker.BundleTracker">
+<filter id="1141899266">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="getEncoded()"/>
+<message_argument value="1.5"/>
+<message_argument value="3.7"/>
+<message_argument value="getTracked()"/>
</message_arguments>
</filter>
-<filter id="403804204">
+</resource>
+<resource path="osgi/src/org/osgi/util/tracker/ServiceTracker.java" type="org.osgi.util.tracker.ServiceTracker">
+<filter id="1141899266">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="hashCode()"/>
+<message_argument value="1.5"/>
+<message_argument value="3.7"/>
+<message_argument value="getTracked()"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1143996420">
<message_arguments>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionInfo"/>
-<message_argument value="toString()"/>
+<message_argument value="ServiceTracker(BundleContext, Class&lt;S&gt;, ServiceTrackerCustomizer&lt;S,T&gt;)"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+</resource>
+<resource path="supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java" type="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio">
+<filter comment="We protect in code for when nio is not present." id="630194212">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="ALLOW"/>
+<message_argument value="Locker_JavaNio.fileLock"/>
+<message_argument value="FileLock"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="646971428">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="DENY"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.isLocked()"/>
+<message_argument value="FileLock"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="646971428">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="equals(Object)"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.isLocked()"/>
+<message_argument value="OverlappingFileLockException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="646971428">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="getAccessDecision()"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.lock()"/>
+<message_argument value="OverlappingFileLockException"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="getEncoded()"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.isLocked()"/>
+<message_argument value="FileChannel"/>
+<message_argument value="tryLock(long, long, boolean)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="hashCode()"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.isLocked()"/>
+<message_argument value="FileLock"/>
+<message_argument value="release()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="toString()"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.isLocked()"/>
+<message_argument value="RandomAccessFile"/>
+<message_argument value="getChannel()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionUpdate.java" type="org.osgi.service.condpermadmin.ConditionalPermissionUpdate">
-<filter id="1108344834">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.5"/>
-<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionUpdate"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.lock()"/>
+<message_argument value="FileChannel"/>
+<message_argument value="tryLock(long, long, boolean)"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/util/tracker/BundleTracker.java" type="org.osgi.util.tracker.BundleTracker">
-<filter id="1108344834">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.4"/>
-<message_argument value="3.5"/>
-<message_argument value="org.osgi.util.tracker.BundleTracker"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.lock()"/>
+<message_argument value="RandomAccessFile"/>
+<message_argument value="getChannel()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
-</resource>
-<resource path="osgi/src/org/osgi/util/tracker/BundleTrackerCustomizer.java" type="org.osgi.util.tracker.BundleTrackerCustomizer">
-<filter id="1108344834">
+<filter comment="We protect in code for when nio is not present." id="647004193">
<message_arguments>
-<message_argument value="1.4"/>
-<message_argument value="3.5"/>
-<message_argument value="org.osgi.util.tracker.BundleTrackerCustomizer"/>
+<message_argument value="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.release()"/>
+<message_argument value="FileLock"/>
+<message_argument value="release()"/>
+<message_argument value="CDC-1.1/Foundation-1.1"/>
</message_arguments>
</filter>
</resource>
diff --git a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs
index f14287e85..a93f9a214 100644
--- a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs
@@ -1,24 +1,23 @@
-#Fri Jul 16 15:14:09 CDT 2010
+#Fri Jul 16 15:45:06 CDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -27,7 +26,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -38,11 +37,8 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
@@ -50,7 +46,6 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
@@ -66,7 +61,7 @@ org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
@@ -75,7 +70,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
@@ -95,8 +90,8 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.launching.prefs
deleted file mode 100644
index 7754db21c..000000000
--- a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.launching.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon May 03 08:45:46 CDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
diff --git a/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs
index 7ae2079c5..5b3c8e014 100644
--- a/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs
+++ b/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,4 +1,4 @@
-#Wed Mar 11 14:32:26 CDT 2009
+#Thu Oct 08 09:47:30 CDT 2009
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
@@ -57,7 +57,7 @@ INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error
LEAK_EXTEND=Warning
LEAK_FIELD_DECL=Warning
LEAK_IMPLEMENT=Warning
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
index c11037fb0..db659b1b6 100644
--- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
@@ -17,7 +17,7 @@ Export-Package: org.eclipse.osgi.event;version="1.0",
org.eclipse.osgi.signedcontent; version="1.0",
org.eclipse.osgi.storagemanager;version="1.0",
org.eclipse.osgi.util;version="1.1",
- org.osgi.framework;version="1.5",
+ org.osgi.framework;version="1.6",
org.osgi.framework.launch; version="1.0",
org.osgi.framework.hooks.service; version="1.0",
org.osgi.service.condpermadmin;version="1.1",
@@ -26,8 +26,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.4.0",
- org.osgi.util.tracker;version="1.4.2",
+ org.osgi.util.tracker;version="1.5.0",
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",
@@ -68,12 +67,13 @@ Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundleActivator
Bundle-Description: %systemBundle
Bundle-Copyright: %copyright
Bundle-Vendor: %eclipse.org
-Bundle-Version: 3.6.100.qualifier
+Bundle-Version: 3.7.0.qualifier
Bundle-Localization: systembundle
Bundle-DocUrl: http://www.eclipse.org
Eclipse-ExtensibleAPI: true
Eclipse-SystemBundle: true
Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
- OSGi/Minimum-1.2
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Eclipse-BundleShape: jar
diff --git a/bundles/org.eclipse.osgi/bnd.bnd b/bundles/org.eclipse.osgi/bnd.bnd
new file mode 100644
index 000000000..43251fc93
--- /dev/null
+++ b/bundles/org.eclipse.osgi/bnd.bnd
@@ -0,0 +1,35 @@
+javac.source = 1.5
+javac.target = jsr14
+# We don't want bnd to make the manifest
+-nomanifest=true
+# We export packages which are not in this project
+-failok=true
+# We don't want bnd to put the source code in the jar
+-sources=false
+# We don't want bnd to try and figure out what classes to put in the jar
+-resourceonly
+# The following line prevents bnd from complaining about no folder named "src"
+src=osgi
+# The following line prevents bnd from complaining about no packages
+Private-Package: org.*
+# We tell bnd what resources to put in the jar. We rely upon Eclipse to populate the bin folder
+Include-Resource= bin, \
+ .options,\
+ META-INF=META-INF,\
+ systembundle.properties,\
+ JavaSE-1.7.profile,\
+ JavaSE-1.6.profile,\
+ J2SE-1.5.profile,\
+ J2SE-1.4.profile,\
+ J2SE-1.3.profile,\
+ J2SE-1.2.profile,\
+ JRE-1.1.profile,\
+ CDC-1.1_Foundation-1.1.profile,\
+ CDC-1.0_Foundation-1.0.profile,\
+ OSGi_Minimum-1.0.profile,\
+ OSGi_Minimum-1.1.profile,\
+ OSGi_Minimum-1.2.profile, \
+ profile.list,\
+ hookconfigurators.properties
+
+-runpath =
diff --git a/bundles/org.eclipse.osgi/build.properties b/bundles/org.eclipse.osgi/build.properties
index d21ae37ee..239ebb6f7 100644
--- a/bundles/org.eclipse.osgi/build.properties
+++ b/bundles/org.eclipse.osgi/build.properties
@@ -30,10 +30,18 @@ source.. = osgi/src,\
supplement/src/,\
security/src/
output.. = bin/
-jre.compilation.profile = CDC-1.1/Foundation-1.1
-bootClasspath=osgi/exceptions.jar;osgi/xmlParserAPIs.jar;${CDC-1.1/Foundation-1.1}
+jre.compilation.profile = J2SE-1.5
-javacSource=1.3
-javacTarget=1.2
+# jre.compilation.profile = CDC-1.1/Foundation-1.1
+# bootClasspath=osgi/exceptions.jar;osgi/xmlParserAPIs.jar;${CDC-1.1/Foundation-1.1}
-javacWarnings..=-deadCode \ No newline at end of file
+javacSource=1.5
+javacTarget=jsr14
+
+# To enable building the framework using projects from OSGi repo uncomment customBuildCallbacks
+# and add the following to the beginning of source..
+# osgi/src2,\
+# and use the .classpath.osgisource as the .classpath file.
+# customBuildCallbacks=customBuildCallbacks.xml
+
+javacWarnings..=-deadCode,-raw,-unchecked \ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
index 26d1737c7..76a808f64 100644
--- a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
+++ b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
@@ -277,7 +277,7 @@ public class FrameworkCommandInterpreter implements CommandInterpreter {
if (Modifier.isPublic(method.getModifiers()) && method.getName().startsWith("get") && throwable.isAssignableFrom(method.getReturnType()) && (method.getParameterTypes().length == 0)) { //$NON-NLS-1$
try {
- Throwable nested = (Throwable) method.invoke(t, null);
+ Throwable nested = (Throwable) method.invoke(t, (Object[]) null);
if ((nested != null) && (nested != t)) {
out.println(ConsoleMsg.CONSOLE_NESTED_EXCEPTION);
diff --git a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
index da34820de..a1e39e93d 100644
--- a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
+++ b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
@@ -498,7 +498,7 @@ public class FrameworkCommandProvider implements CommandProvider, SynchronousBun
intp.println(bundle.bundledata);
}
- ServiceReference[] services = context.getServiceReferences(null, null);
+ ServiceReference[] services = context.getServiceReferences((String) null, (String) null);
if (services != null) {
intp.println(ConsoleMsg.CONSOLE_REGISTERED_SERVICES_MESSAGE);
size = services.length;
@@ -536,7 +536,7 @@ public class FrameworkCommandProvider implements CommandProvider, SynchronousBun
filter = buf.toString();
}
- ServiceReference[] services = context.getServiceReferences(null, filter);
+ ServiceReference[] services = context.getServiceReferences((String) null, filter);
if (services != null) {
int size = services.length;
if (size > 0) {
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
index 053c6fc40..3268b3efc 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.osgi.framework.BundleException;
/**
* Headers classes. This class implements a Dictionary that has
- * the following behaviour:
+ * the following behavior:
* <ul>
* <li>put and remove clear throw UnsupportedOperationException.
* The Dictionary is thus read-only to others.
@@ -30,10 +30,10 @@ import org.osgi.framework.BundleException;
* </ul>
* @since 3.1
*/
-public class Headers extends Dictionary implements Map {
+public class Headers<K, V> extends Dictionary<K, V> implements Map<K, V> {
private boolean readOnly = false;
- private Object[] headers;
- private Object[] values;
+ private K[] headers;
+ private V[] values;
private int size = 0;
/**
@@ -43,8 +43,12 @@ public class Headers extends Dictionary implements Map {
*/
public Headers(int initialCapacity) {
super();
- headers = new Object[initialCapacity];
- values = new Object[initialCapacity];
+ @SuppressWarnings("unchecked")
+ K[] k = (K[]) new Object[initialCapacity];
+ headers = k;
+ @SuppressWarnings("unchecked")
+ V[] v = (V[]) new Object[initialCapacity];
+ values = v;
}
/**
@@ -54,12 +58,12 @@ public class Headers extends Dictionary implements Map {
* @exception IllegalArgumentException If a case-variant of the key is
* in the dictionary parameter.
*/
- public Headers(Dictionary values) {
+ public Headers(Dictionary<? extends K, ? extends V> values) {
this(values.size());
/* initialize the headers and values */
- Enumeration keys = values.keys();
+ Enumeration<? extends K> keys = values.keys();
while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
+ K key = keys.nextElement();
set(key, values.get(key));
}
}
@@ -67,15 +71,15 @@ public class Headers extends Dictionary implements Map {
/**
* Case-preserved keys.
*/
- public synchronized Enumeration keys() {
- return new ArrayEnumeration(headers, size);
+ public synchronized Enumeration<K> keys() {
+ return new ArrayEnumeration<K>(headers, size);
}
/**
* Values.
*/
- public synchronized Enumeration elements() {
- return new ArrayEnumeration(values, size);
+ public synchronized Enumeration<V> elements() {
+ return new ArrayEnumeration<V>(values, size);
}
private int getIndex(Object key) {
@@ -92,8 +96,8 @@ public class Headers extends Dictionary implements Map {
return -1;
}
- private Object remove(int remove) {
- Object removed = values[remove];
+ private V remove(int remove) {
+ V removed = values[remove];
for (int i = remove; i < size; i++) {
if (i == headers.length - 1) {
headers[i] = null;
@@ -108,11 +112,15 @@ public class Headers extends Dictionary implements Map {
return removed;
}
- private void add(Object header, Object value) {
+ private void add(K header, V value) {
if (size == headers.length) {
// grow the arrays
- Object[] newHeaders = new Object[headers.length + 10];
- Object[] newValues = new Object[values.length + 10];
+ @SuppressWarnings("unchecked")
+ K[] nh = (K[]) new Object[headers.length + 10];
+ K[] newHeaders = nh;
+ @SuppressWarnings("unchecked")
+ V[] nv = (V[]) new Object[values.length + 10];
+ V[] newValues = nv;
System.arraycopy(headers, 0, newHeaders, 0, headers.length);
System.arraycopy(values, 0, newValues, 0, values.length);
headers = newHeaders;
@@ -128,7 +136,7 @@ public class Headers extends Dictionary implements Map {
*
* @param key name.
*/
- public synchronized Object get(Object key) {
+ public synchronized V get(Object key) {
int i = -1;
if ((i = getIndex(key)) != -1)
return values[i];
@@ -151,11 +159,14 @@ public class Headers extends Dictionary implements Map {
* already present.
* @since 3.2
*/
- public synchronized Object set(Object key, Object value, boolean replace) {
+ public synchronized V set(K key, V value, boolean replace) {
if (readOnly)
throw new UnsupportedOperationException();
- if (key instanceof String)
- key = ((String) key).intern();
+ if (key instanceof String) {
+ @SuppressWarnings("unchecked")
+ K k = (K) ((String) key).intern();
+ key = k;
+ }
int i = getIndex(key);
if (value == null) { /* remove */
if (i != -1)
@@ -164,7 +175,7 @@ public class Headers extends Dictionary implements Map {
if (i != -1) { /* duplicate key */
if (!replace)
throw new IllegalArgumentException(NLS.bind(Msg.HEADER_DUPLICATE_KEY_EXCEPTION, key));
- Object oldVal = values[i];
+ V oldVal = values[i];
values[i] = value;
return oldVal;
}
@@ -184,7 +195,7 @@ public class Headers extends Dictionary implements Map {
* @exception IllegalArgumentException If a case-variant of the key is
* already present.
*/
- public synchronized Object set(Object key, Object value) {
+ public synchronized V set(K key, V value) {
return set(key, value, false);
}
@@ -220,7 +231,7 @@ public class Headers extends Dictionary implements Map {
* @param value header value.
* @throws UnsupportedOperationException
*/
- public synchronized Object put(Object key, Object value) {
+ public synchronized V put(K key, V value) {
if (readOnly)
throw new UnsupportedOperationException();
return set(key, value, true);
@@ -232,16 +243,16 @@ public class Headers extends Dictionary implements Map {
* @param key header name.
* @throws UnsupportedOperationException
*/
- public Object remove(Object key) {
+ public V remove(Object key) {
throw new UnsupportedOperationException();
}
public String toString() {
- return (values.toString());
+ return values.toString();
}
- public static Headers parseManifest(InputStream in) throws BundleException {
- Headers headers = new Headers(10);
+ public static Headers<String, String> parseManifest(InputStream in) throws BundleException {
+ Headers<String, String> headers = new Headers<String, String>(10);
try {
ManifestElement.parseBundleManifest(in, headers);
} catch (IOException e) {
@@ -251,12 +262,14 @@ public class Headers extends Dictionary implements Map {
return headers;
}
- class ArrayEnumeration implements Enumeration {
- private Object[] array;
+ private static class ArrayEnumeration<E> implements Enumeration<E> {
+ private E[] array;
int cur = 0;
- public ArrayEnumeration(Object[] array, int size) {
- this.array = new Object[size];
+ public ArrayEnumeration(E[] array, int size) {
+ @SuppressWarnings("unchecked")
+ E[] a = (E[]) new Object[size];
+ this.array = a;
System.arraycopy(array, 0, this.array, 0, this.array.length);
}
@@ -264,7 +277,7 @@ public class Headers extends Dictionary implements Map {
return cur < array.length;
}
- public Object nextElement() {
+ public E nextElement() {
return array[cur++];
}
}
@@ -278,23 +291,23 @@ public class Headers extends Dictionary implements Map {
return getIndex(key) >= 0;
}
- public boolean containsValue(Object var0) {
+ public boolean containsValue(Object value) {
throw new UnsupportedOperationException();
}
- public Set entrySet() {
+ public Set<Map.Entry<K, V>> entrySet() {
throw new UnsupportedOperationException();
}
- public Set keySet() {
+ public Set<K> keySet() {
throw new UnsupportedOperationException();
}
- public void putAll(Map var0) {
+ public void putAll(Map<? extends K, ? extends V> c) {
throw new UnsupportedOperationException();
}
- public Collection values() {
+ public Collection<V> values() {
throw new UnsupportedOperationException();
}
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
index 6345a3fce..89bccb1e2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,24 +23,25 @@ import java.util.*;
*
* @since 3.5
*/
-public class CopyOnWriteIdentityMap implements Map {
+public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
/**
* The empty array singleton instance.
*/
+ @SuppressWarnings("unchecked")
private static final Entry[] emptyArray = new Entry[0];
/**
* The array of entries. This field is volatile so it can be
* accessed from unsynchronized reader methods.
*/
- private volatile Entry[] entries;
+ private volatile Entry<K, V>[] entries;
/**
* Creates an empty map.
*
*/
public CopyOnWriteIdentityMap() {
- entries = emptyArray;
+ entries = empty();
}
/**
@@ -48,8 +49,10 @@ public class CopyOnWriteIdentityMap implements Map {
*
* @param source The CopyOnWriteMap to copy.
*/
- public CopyOnWriteIdentityMap(CopyOnWriteIdentityMap source) {
- this.entries = source.entries();
+ public CopyOnWriteIdentityMap(CopyOnWriteIdentityMap<? extends K, ? extends V> source) {
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] toCopy = (Entry<K, V>[]) source.entries();
+ this.entries = toCopy;
}
/* These methods modify the map and are synchronized. */
@@ -66,7 +69,7 @@ public class CopyOnWriteIdentityMap implements Map {
* Otherwise the previous value of the key.
* @throws IllegalArgumentException If key is null.
*/
- public synchronized Object put(Object key, Object value) {
+ public synchronized V put(K key, V value) {
if (key == null) {
throw new IllegalArgumentException();
}
@@ -74,23 +77,25 @@ public class CopyOnWriteIdentityMap implements Map {
int size = entries.length;
for (int i = 0; i < size; i++) {
if (entries[i].key == key) {
- Object v = entries[i].value;
+ V v = entries[i].value;
if (v == value) {
return v;
}
- Entry[] newEntries = new Entry[size];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] newEntries = new Entry[size];
System.arraycopy(entries, 0, newEntries, 0, size);
- newEntries[i] = new Entry(key, value);
+ newEntries[i] = new Entry<K, V>(key, value);
entries = newEntries;
return v;
}
}
- Entry[] newEntries = new Entry[size + 1];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] newEntries = new Entry[size + 1];
if (size > 0) {
System.arraycopy(entries, 0, newEntries, 0, size);
}
- newEntries[size] = new Entry(key, value);
+ newEntries[size] = new Entry<K, V>(key, value);
entries = newEntries;
return null;
}
@@ -100,21 +105,22 @@ public class CopyOnWriteIdentityMap implements Map {
*
* @param source The map whose entries are to be added to this map.
*/
- public void putAll(Map source) {
+ public void putAll(Map<? extends K, ? extends V> source) {
int sourceSize = source.size();
if (sourceSize == 0) {
return;
}
- if (source instanceof CopyOnWriteIdentityMap) {
- putAll(((CopyOnWriteIdentityMap) source).entries());
+ if (source instanceof CopyOnWriteIdentityMap<?, ?>) {
+ putAll(((CopyOnWriteIdentityMap<? extends K, ? extends V>) source).entries());
return;
}
- Entry[] toCopy = new Entry[sourceSize];
- Iterator iter = source.entrySet().iterator();
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] toCopy = new Entry[sourceSize];
+ Iterator<? extends Map.Entry<? extends K, ? extends V>> iter = source.entrySet().iterator();
for (int i = 0; i < sourceSize; i++) {
- Map.Entry mapEntry = (Map.Entry) iter.next();
- toCopy[i] = new Entry(mapEntry.getKey(), mapEntry.getValue());
+ Map.Entry<? extends K, ? extends V> mapEntry = iter.next();
+ toCopy[i] = new Entry<K, V>(mapEntry.getKey(), mapEntry.getValue());
}
putAll(toCopy);
}
@@ -125,14 +131,15 @@ public class CopyOnWriteIdentityMap implements Map {
*
* @param keys The array of keys to be added to this map.
*/
- public void putAll(Object[] keys) {
+ public <L extends K> void putAll(L[] keys) {
int sourceSize = keys.length;
if (sourceSize == 0) {
return;
}
- Entry[] toCopy = new Entry[sourceSize];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] toCopy = new Entry[sourceSize];
for (int i = 0; i < sourceSize; i++) {
- toCopy[i] = new Entry(keys[i], null);
+ toCopy[i] = new Entry<K, V>(keys[i], null);
}
putAll(toCopy);
}
@@ -142,13 +149,15 @@ public class CopyOnWriteIdentityMap implements Map {
*
* @param toCopy Array of entries to add to this map.
*/
- private synchronized void putAll(Entry[] toCopy) {
+ private synchronized void putAll(Entry<? extends K, ? extends V>[] toCopy) {
int sourceSize = toCopy.length;
int size = entries.length;
- Entry[] newEntries = new Entry[size + sourceSize];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] newEntries = new Entry[size + sourceSize];
System.arraycopy(entries, 0, newEntries, 0, size);
copy: for (int n = 0; n < sourceSize; n++) {
- Entry copy = toCopy[n];
+ @SuppressWarnings("unchecked")
+ Entry<K, V> copy = (Entry<K, V>) toCopy[n];
for (int i = 0; i < size; i++) {
if (newEntries[i].key == copy.key) {
newEntries[i] = copy;
@@ -162,7 +171,8 @@ public class CopyOnWriteIdentityMap implements Map {
entries = newEntries;
return;
}
- Entry[] e = new Entry[size];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] e = new Entry[size];
System.arraycopy(newEntries, 0, e, 0, size);
entries = e;
}
@@ -176,7 +186,7 @@ public class CopyOnWriteIdentityMap implements Map {
* Otherwise, the value associated with the key.
* @throws IllegalArgumentException If key is null.
*/
- public synchronized Object remove(Object key) {
+ public synchronized V remove(Object key) {
if (key == null) {
throw new IllegalArgumentException();
}
@@ -184,12 +194,13 @@ public class CopyOnWriteIdentityMap implements Map {
int size = entries.length;
for (int i = 0; i < size; i++) {
if (entries[i].key == key) {
- Object v = entries[i].value;
+ V v = entries[i].value;
if (size == 1) {
- entries = emptyArray;
+ entries = empty();
return v;
}
- Entry[] newEntries = new Entry[size - 1];
+ @SuppressWarnings("unchecked")
+ Entry<K, V>[] newEntries = new Entry[size - 1];
if (i > 0) {
System.arraycopy(entries, 0, newEntries, 0, i);
}
@@ -209,7 +220,7 @@ public class CopyOnWriteIdentityMap implements Map {
*
*/
public synchronized void clear() {
- entries = emptyArray;
+ entries = empty();
}
/* These methods only read the map and are not synchronized. */
@@ -219,11 +230,20 @@ public class CopyOnWriteIdentityMap implements Map {
* @return The array of entries. Callers to this method MUST NOT
* modify the returned array.
*/
- private Entry[] entries() {
+ private Entry<K, V>[] entries() {
return entries;
}
/**
+ * Return the static empty array generically type safe.
+ * @return The empty array of entries.
+ */
+ @SuppressWarnings("unchecked")
+ private static <K, V> Entry<K, V>[] empty() {
+ return emptyArray;
+ }
+
+ /**
* Is the map empty?
*
* @return <code>true</code> if the list is empty.
@@ -249,12 +269,12 @@ public class CopyOnWriteIdentityMap implements Map {
* @return The value object for the specified key.
* @throws IllegalArgumentException If key is null.
*/
- public Object get(Object key) {
+ public V get(Object key) {
if (key == null) {
throw new IllegalArgumentException();
}
- Entry[] e = entries();
+ Entry<K, V>[] e = entries();
for (int i = 0; i < e.length; i++) {
if (e[i].key == key) {
return e[i].value;
@@ -276,7 +296,7 @@ public class CopyOnWriteIdentityMap implements Map {
throw new IllegalArgumentException();
}
- Entry[] e = entries();
+ Entry<K, V>[] e = entries();
for (int i = 0; i < e.length; i++) {
if (e[i].key == key) {
return true;
@@ -293,7 +313,7 @@ public class CopyOnWriteIdentityMap implements Map {
* @return <code>true</code> if the specified value is in the map.
*/
public boolean containsValue(Object value) {
- Entry[] e = entries();
+ Entry<K, V>[] e = entries();
for (int i = 0; i < e.length; i++) {
if (e[i].value == value) {
return true;
@@ -309,8 +329,8 @@ public class CopyOnWriteIdentityMap implements Map {
* @return A Set of Map.Entry for each entry in this map.
* The set and the entries returned by the set cannot be modified.
*/
- public Set entrySet() {
- return new EntrySet(entries(), EntrySet.ENTRY);
+ public Set<Map.Entry<K, V>> entrySet() {
+ return new EntrySet<Map.Entry<K, V>>(entries(), EntrySet.ENTRY);
}
/**
@@ -320,8 +340,8 @@ public class CopyOnWriteIdentityMap implements Map {
* @return A Set of the key objects in this map
* The set cannot be modified.
*/
- public Set keySet() {
- return new EntrySet(entries(), EntrySet.KEY);
+ public Set<K> keySet() {
+ return new EntrySet<K>(entries(), EntrySet.KEY);
}
/**
@@ -331,44 +351,44 @@ public class CopyOnWriteIdentityMap implements Map {
* @return A Collection of the value objects in this map.
* The collection cannot be modified.
*/
- public Collection values() {
- return new EntrySet(entries(), EntrySet.VALUE);
+ public Collection<V> values() {
+ return new EntrySet<V>(entries(), EntrySet.VALUE);
}
/**
* This class represents the entry in this Map.
* Entry is immutable.
*/
- private static class Entry implements Map.Entry {
+ private static class Entry<K, V> implements Map.Entry<K, V> {
/**
* Key object.
*/
- final Object key;
+ final K key;
/**
* Value object.
*/
- final Object value;
+ final V value;
/**
* Constructor for map entry.
* @param key Key object in entry. Used for uniqueness.
* @param value Value object stored with key object.
*/
- Entry(final Object key, final Object value) {
+ Entry(final K key, final V value) {
this.key = key;
this.value = value;
}
- public Object getKey() {
+ public K getKey() {
return key;
}
- public Object getValue() {
+ public V getValue() {
return value;
}
- public Object setValue(Object value) {
+ public V setValue(V value) {
throw new UnsupportedOperationException(); // entries cannot be modified.
}
}
@@ -378,20 +398,20 @@ public class CopyOnWriteIdentityMap implements Map {
*
* This class is immutable.
*/
- private static class EntrySet extends AbstractSet {
- private final Entry[] entries;
+ private static class EntrySet<E> extends AbstractSet<E> {
+ private final Entry<?, ?>[] entries;
private final int returnType;
final static int ENTRY = 1;
final static int KEY = 2;
final static int VALUE = 3;
- EntrySet(Entry[] entries, int returnType) {
+ EntrySet(Entry<?, ?>[] entries, int returnType) {
this.entries = entries;
this.returnType = returnType;
}
- public Iterator iterator() {
- return new EntryIterator(entries, returnType);
+ public Iterator<E> iterator() {
+ return new EntryIterator<E>(entries, returnType);
}
public int size() {
@@ -403,12 +423,12 @@ public class CopyOnWriteIdentityMap implements Map {
* Iterator class used for entry and key sets and values collections.
*
*/
- private static class EntryIterator implements Iterator {
- private final Entry[] entries;
+ private static class EntryIterator<E> implements Iterator<E> {
+ private final Entry<?, ?>[] entries;
private final int returnType;
private int cursor = 0;
- EntryIterator(Entry[] entries, int returnType) {
+ EntryIterator(Entry<?, ?>[] entries, int returnType) {
this.entries = entries;
this.returnType = returnType;
}
@@ -417,17 +437,23 @@ public class CopyOnWriteIdentityMap implements Map {
return cursor < entries.length;
}
- public Object next() {
+ public E next() {
if (cursor == entries.length) {
throw new NoSuchElementException();
}
switch (returnType) {
case EntrySet.ENTRY :
- return entries[cursor++];
+ @SuppressWarnings("unchecked")
+ E entry = (E) entries[cursor++];
+ return entry;
case EntrySet.KEY :
- return entries[cursor++].key;
+ @SuppressWarnings("unchecked")
+ E key = (E) entries[cursor++].key;
+ return key;
case EntrySet.VALUE :
- return entries[cursor++].value;
+ @SuppressWarnings("unchecked")
+ E value = (E) entries[cursor++].value;
+ return value;
}
throw new InternalError();
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
index fab27980d..e8db941dd 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.security.*;
@@ -35,9 +34,9 @@ import org.osgi.framework.*;
* is destroyed when a bundle is uninstalled and reused if a bundle is updated.
* This class is abstract and is extended by BundleHost and BundleFragment.
*/
-public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement {
+public abstract class AbstractBundle implements Bundle, Comparable<Bundle>, KeyedElement {
/** The Framework this bundle is part of */
- protected Framework framework;
+ protected final Framework framework;
/** The state of the bundle. */
protected volatile int state;
/** A flag to denote whether a bundle state change is in progress */
@@ -45,7 +44,7 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement
/** Bundle's BundleData object */
protected BundleData bundledata;
/** Internal object used for state change synchronization */
- protected Object statechangeLock = new Object();
+ protected final Object statechangeLock = new Object();
/** ProtectionDomain for the bundle */
protected BundleProtectionDomain domain;
@@ -1138,7 +1137,7 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement
* if the argument can not be converted into something
* comparable with the receiver.
*/
- public int compareTo(Object obj) {
+ public int compareTo(Bundle obj) {
int slcomp = getStartLevel() - ((AbstractBundle) obj).getStartLevel();
if (slcomp != 0) {
return slcomp;
@@ -1532,4 +1531,22 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement
return Collections.EMPTY_MAP;
}
}
+
+ public <A> A adapt(Class<A> adapterType) {
+ if (adapterType.isInstance(this))
+ return (A) this;
+ if (BundleContext.class.equals(adapterType)) {
+ try {
+ return (A) getBundleContext();
+ } catch (SecurityException e) {
+ return null;
+ }
+ }
+ // TODO need to handle BundleWiring, BundlePackageAdmin
+ return null;
+ }
+
+ public File getDataFile(String filename) {
+ return framework.getDataFile(this, filename);
+ }
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
index cf6878109..15795d34e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
@@ -20,8 +20,7 @@ import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.eventmgr.CopyOnWriteIdentityMap;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;
import org.eclipse.osgi.internal.profile.Profile;
-import org.eclipse.osgi.internal.serviceregistry.ServiceReferenceImpl;
-import org.eclipse.osgi.internal.serviceregistry.ServiceRegistry;
+import org.eclipse.osgi.internal.serviceregistry.*;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
@@ -50,16 +49,16 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
/** Services that bundle is using. Key is ServiceRegistrationImpl,
Value is ServiceUse */
/* @GuardedBy("contextLock") */
- private HashMap/*<ServiceRegistrationImpl, ServiceUse>*/servicesInUse;
+ private HashMap<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse;
/** Listener list for bundle's BundleListeners */
- protected Map bundleEvent;
+ protected Map<BundleListener, BundleListener> bundleEvent;
/** Listener list for bundle's SynchronousBundleListeners */
- protected Map bundleEventSync;
+ protected Map<BundleListener, BundleListener> bundleEventSync;
/** Listener list for bundle's FrameworkListeners */
- protected Map frameworkEvent;
+ protected Map<FrameworkListener, FrameworkListener> frameworkEvent;
/** The current instantiation of the activator. */
protected BundleActivator activator;
@@ -315,7 +314,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
synchronized (framework.bundleEventSync) {
checkValid();
if (bundleEventSync == null) {
- bundleEventSync = new CopyOnWriteIdentityMap();
+ bundleEventSync = new CopyOnWriteIdentityMap<BundleListener, BundleListener>();
framework.bundleEventSync.put(this, this);
}
@@ -325,7 +324,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
synchronized (framework.bundleEvent) {
checkValid();
if (bundleEvent == null) {
- bundleEvent = new CopyOnWriteIdentityMap();
+ bundleEvent = new CopyOnWriteIdentityMap<BundleListener, BundleListener>();
framework.bundleEvent.put(this, this);
}
@@ -402,7 +401,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
synchronized (framework.frameworkEvent) {
checkValid();
if (frameworkEvent == null) {
- frameworkEvent = new CopyOnWriteIdentityMap();
+ frameworkEvent = new CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>();
framework.frameworkEvent.put(this, this);
}
@@ -502,9 +501,8 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* @see ServiceRegistration
* @see ServiceFactory
*/
- public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
+ public ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties) {
checkValid();
-
return framework.getServiceRegistry().registerService(this, clazzes, service, properties);
}
@@ -520,7 +518,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
*
* @see #registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
*/
- public ServiceRegistration registerService(String clazz, Object service, Dictionary properties) {
+ public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties) {
String[] clazzes = new String[] {clazz};
return registerService(clazzes, service, properties);
@@ -569,12 +567,12 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* @exception InvalidSyntaxException If <tt>filter</tt> contains
* an invalid filter string which cannot be parsed.
*/
- public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
+ public ServiceReference<?>[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
checkValid();
return framework.getServiceRegistry().getServiceReferences(this, clazz, filter, false);
}
- public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
+ public ServiceReference<?>[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
checkValid();
return framework.getServiceRegistry().getServiceReferences(this, clazz, filter, true);
}
@@ -599,7 +597,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* if no services are registered which implement the named class.
* @see #getServiceReferences
*/
- public ServiceReference getServiceReference(String clazz) {
+ public ServiceReference<?> getServiceReference(String clazz) {
checkValid();
return framework.getServiceRegistry().getServiceReference(this, clazz);
@@ -655,17 +653,19 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* @see #ungetService
* @see ServiceFactory
*/
- public Object getService(ServiceReference reference) {
+ public <S> S getService(ServiceReference<S> reference) {
checkValid();
if (reference == null)
throw new NullPointerException("A null service reference is not allowed."); //$NON-NLS-1$
synchronized (contextLock) {
if (servicesInUse == null)
// Cannot predict how many services a bundle will use, start with a small table.
- servicesInUse = new HashMap(10);
+ servicesInUse = new HashMap<ServiceRegistrationImpl<?>, ServiceUse<?>>(10);
}
- return framework.getServiceRegistry().getService(this, (ServiceReferenceImpl) reference);
+ @SuppressWarnings("unchecked")
+ S service = (S) framework.getServiceRegistry().getService(this, (ServiceReferenceImpl<S>) reference);
+ return service;
}
/**
@@ -703,10 +703,10 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* @see #getService
* @see ServiceFactory
*/
- public boolean ungetService(ServiceReference reference) {
+ public boolean ungetService(ServiceReference<?> reference) {
checkValid();
- return framework.getServiceRegistry().ungetService(this, (ServiceReferenceImpl) reference);
+ return framework.getServiceRegistry().ungetService(this, (ServiceReferenceImpl<?>) reference);
}
/**
@@ -772,7 +772,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
if (Profile.PROFILE && Profile.STARTUP)
Profile.logEnter("BundleContextImpl.startActivator()", null); //$NON-NLS-1$
try {
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
if (bundleActivator != null) {
if (Profile.PROFILE && Profile.STARTUP)
@@ -834,7 +834,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
*/
protected void stop() throws BundleException {
try {
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
if (activator != null) {
// make sure the context class loader is set correctly
@@ -873,7 +873,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
* @return A map of ServiceRegistrationImpl to ServiceUse for services in use by
* this context.
*/
- public Map getServicesInUseMap() {
+ public Map<ServiceRegistrationImpl<?>, ServiceUse<?>> getServicesInUseMap() {
synchronized (contextLock) {
return servicesInUse;
}
@@ -1017,4 +1017,30 @@ public class BundleContextImpl implements BundleContext, EventDispatcher {
public Framework getFramework() {
return framework;
}
+
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties) {
+ @SuppressWarnings("unchecked")
+ ServiceRegistration<S> registration = (ServiceRegistration<S>) registerService(clazz.getName(), service, properties);
+ return registration;
+ }
+
+ public <S> ServiceReference<S> getServiceReference(Class<S> clazz) {
+ @SuppressWarnings("unchecked")
+ ServiceReference<S> reference = (ServiceReference<S>) getServiceReference(clazz.getName());
+ return reference;
+ }
+
+ public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) throws InvalidSyntaxException {
+ @SuppressWarnings("unchecked")
+ ServiceReference<S>[] refs = (ServiceReference<S>[]) getServiceReferences(clazz.getName(), filter);
+ if (refs == null) {
+ return Collections.EMPTY_LIST;
+ }
+ List<ServiceReference<S>> result = new ArrayList<ServiceReference<S>>(refs.length);
+ for (ServiceReference<S> b : refs) {
+ result.add(b);
+ }
+ return result;
+ }
+
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxLauncher.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxLauncher.java
index 5b0d5e598..0441b0de9 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxLauncher.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxLauncher.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.URL;
import java.security.*;
import java.util.*;
@@ -327,7 +326,27 @@ public class EquinoxLauncher implements org.osgi.framework.launch.Framework {
public Version getVersion() {
Bundle current = systemBundle;
if (current != null)
- current.getVersion();
+ return current.getVersion();
return Version.emptyVersion;
}
+
+ public <A> A adapt(Class<A> adapterType) {
+ Bundle current = systemBundle;
+ if (current != null) {
+ return current.adapt(adapterType);
+ }
+ return null;
+ }
+
+ public int compareTo(Bundle o) {
+ // TODO need to implement
+ throw new UnsupportedOperationException("need to implement");
+ }
+
+ public File getDataFile(String filename) {
+ Bundle current = systemBundle;
+ if (current != null)
+ return current.getDataFile(filename);
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
index e26888914..3260d7771 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
@@ -1482,7 +1482,7 @@ public class Framework implements EventDispatcher, EventPublisher, Runnable {
if (factory != null) {
try {
- factory.getClass().getMethod("isMultiplexing", null); //$NON-NLS-1$
+ factory.getClass().getMethod("isMultiplexing", (Class[]) null); //$NON-NLS-1$
Method register = factory.getClass().getMethod("register", new Class[] {Object.class}); //$NON-NLS-1$
register.invoke(factory, new Object[] {chf});
} catch (NoSuchMethodException e) {
@@ -1570,7 +1570,7 @@ public class Framework implements EventDispatcher, EventPublisher, Runnable {
// because we failed to set the factory normally!!
if (factory != null) {
try {
- factory.getClass().getMethod("isMultiplexing", null); //$NON-NLS-1$
+ factory.getClass().getMethod("isMultiplexing", (Class[]) null); //$NON-NLS-1$
Method register = factory.getClass().getMethod("register", new Class[] {Object.class}); //$NON-NLS-1$
register.invoke(factory, new Object[] {shf});
} catch (NoSuchMethodException e) {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingFactory.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingFactory.java
index 1761141b2..33685262a 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingFactory.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingFactory.java
@@ -70,9 +70,9 @@ public abstract class MultiplexingFactory {
// close the service tracker
try {
// this is brittle; if class does not directly extend MultplexingFactory then this method will not exist, but we do not want a public method here
- Method closeTracker = factory.getClass().getSuperclass().getDeclaredMethod("closePackageAdminTracker", null); //$NON-NLS-1$
+ Method closeTracker = factory.getClass().getSuperclass().getDeclaredMethod("closePackageAdminTracker", (Class[]) null); //$NON-NLS-1$
closeTracker.setAccessible(true); // its a private method
- closeTracker.invoke(factory, null);
+ closeTracker.invoke(factory, (Object[]) null);
} catch (Exception e) {
adaptor.getFrameworkLog().log(new FrameworkLogEntry(MultiplexingFactory.class.getName(), FrameworkLogEntry.ERROR, 0, "unregister", FrameworkLogEntry.ERROR, e, null)); //$NON-NLS-1$
throw new RuntimeException(e.getMessage(), e);
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingURLStreamHandler.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingURLStreamHandler.java
index b7dadfcd5..f0eeba6b5 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingURLStreamHandler.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/MultiplexingURLStreamHandler.java
@@ -41,7 +41,7 @@ public class MultiplexingURLStreamHandler extends URLStreamHandler {
equalsMethod = URLStreamHandler.class.getDeclaredMethod("equals", new Class[] {URL.class, URL.class}); //$NON-NLS-1$
equalsMethod.setAccessible(true);
- getDefaultPortMethod = URLStreamHandler.class.getDeclaredMethod("getDefaultPort", null); //$NON-NLS-1$
+ getDefaultPortMethod = URLStreamHandler.class.getDeclaredMethod("getDefaultPort", (Class[]) null); //$NON-NLS-1$
getDefaultPortMethod.setAccessible(true);
getHostAddressMethod = URLStreamHandler.class.getDeclaredMethod("getHostAddress", new Class[] {URL.class}); //$NON-NLS-1$
@@ -122,7 +122,7 @@ public class MultiplexingURLStreamHandler extends URLStreamHandler {
URLStreamHandler handler = factory.findAuthorizedURLStreamHandler(protocol);
if (handler != null) {
try {
- return ((Integer) getDefaultPortMethod.invoke(handler, null)).intValue();
+ return ((Integer) getDefaultPortMethod.invoke(handler, (Object[]) null)).intValue();
} catch (InvocationTargetException e) {
throw (RuntimeException) e.getTargetException();
} catch (Exception e) {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
index cbea15e77..f15e6b525 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
@@ -66,7 +66,7 @@ public final class PermissionInfoCollection extends PermissionCollection {
try {
addPermissions(collection, permClass);
} catch (Exception e) {
- throw (SecurityException) new SecurityException("Exception creating permissions: " + e.getClass().getName() + ": " + e.getMessage()).initCause(e); //$NON-NLS-1$ //$NON-NLS-2$
+ throw (SecurityException) new SecurityException("Exception creating permissions: " + permClass + ": " + e.getMessage()).initCause(e); //$NON-NLS-1$ //$NON-NLS-2$
}
synchronized (cachedPermissionCollections) {
// check to see if another thread beat this thread at adding the collection
@@ -120,7 +120,7 @@ public final class PermissionInfoCollection extends PermissionCollection {
}
}
}
- collection.add((Permission) constructor.newInstance(args));
+ collection.add((Permission) constructor.newInstance((Object[]) args));
}
}
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
index 3d81df738..764324db8 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
@@ -629,6 +629,18 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
public void update(InputStream in) throws BundleException {
throw new IllegalStateException();
}
+
+ public int compareTo(Bundle o) {
+ return 0;
+ }
+
+ public <A> A adapt(Class<A> type) {
+ throw new IllegalStateException();
+ }
+
+ public File getDataFile(String filename) {
+ return null;
+ }
}
private static class MockX509Certificate extends X509Certificate {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
index 891f34685..b54b2c07d 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
@@ -69,7 +69,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
* @param event The <code>ServiceEvent</code> object.
*/
public void serviceChanged(ServiceEvent event) {
- ServiceReferenceImpl reference = (ServiceReferenceImpl) event.getServiceReference();
+ ServiceReferenceImpl<?> reference = (ServiceReferenceImpl<?>) event.getServiceReference();
// first check if we can short circuit the filter match if the required objectClass does not match the event
objectClassCheck: if (objectClass != null) {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceProperties.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceProperties.java
index d9dc6302e..a829d2697 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceProperties.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,20 +21,20 @@ import org.osgi.framework.Constants;
*
* Supports case-insensitive key lookup.
*/
-class ServiceProperties extends Headers {
+class ServiceProperties extends Headers<String, Object> {
/**
* Create a properties object for the service.
*
* @param props The properties for this service.
*/
- private ServiceProperties(int size, Dictionary props) {
+ private ServiceProperties(int size, Dictionary<String, ?> props) {
super(size);
if (props == null) {
return;
}
synchronized (props) {
- Enumeration keysEnum = props.keys();
+ Enumeration<?> keysEnum = props.keys();
while (keysEnum.hasMoreElements()) {
Object key = keysEnum.nextElement();
@@ -53,7 +53,7 @@ class ServiceProperties extends Headers {
*
* @param props The properties for this service.
*/
- ServiceProperties(Dictionary props) {
+ ServiceProperties(Dictionary<String, ?> props) {
this((props == null) ? 2 : props.size() + 2, props);
}
@@ -78,10 +78,10 @@ class ServiceProperties extends Headers {
String[] keynames = new String[size];
- Enumeration keysEnum = keys();
+ Enumeration<String> keysEnum = keys();
for (int i = 0; i < size; i++) {
- keynames[i] = (String) keysEnum.nextElement();
+ keynames[i] = keysEnum.nextElement();
}
return keynames;
@@ -120,10 +120,10 @@ class ServiceProperties extends Headers {
if (value instanceof Boolean) /* shortcut Boolean */
return value;
- Class clazz = value.getClass();
+ Class<?> clazz = value.getClass();
if (clazz.isArray()) {
// Do an array copy
- Class type = clazz.getComponentType();
+ Class<?> type = clazz.getComponentType();
int len = Array.getLength(value);
Object clonedArray = Array.newInstance(type, len);
System.arraycopy(value, 0, clonedArray, 0, len);
@@ -131,15 +131,15 @@ class ServiceProperties extends Headers {
}
// must use reflection because Object clone method is protected!!
try {
- return clazz.getMethod("clone", null).invoke(value, null); //$NON-NLS-1$
+ return clazz.getMethod("clone", (Class<?>[]) null).invoke(value, (Object[]) null); //$NON-NLS-1$
} catch (Exception e) {
/* clone is not a public method on value's class */
} catch (Error e) {
/* JCL does not support reflection; try some well known types */
- if (value instanceof Vector)
- return ((Vector) value).clone();
- if (value instanceof Hashtable)
- return ((Hashtable) value).clone();
+ if (value instanceof Vector<?>)
+ return ((Vector<?>) value).clone();
+ if (value instanceof Hashtable<?, ?>)
+ return ((Hashtable<?, ?>) value).clone();
}
return value;
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
index a89ef8087..e6784ca0a 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2009 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,15 +42,15 @@ import org.osgi.framework.*;
* @see BundleContext#getService
* @ThreadSafe
*/
-public class ServiceReferenceImpl implements ServiceReference, Comparable {
+public class ServiceReferenceImpl<S> implements ServiceReference<S> {
/** Registered Service object. */
- private final ServiceRegistrationImpl registration;
+ private final ServiceRegistrationImpl<S> registration;
/**
* Construct a reference.
*
*/
- ServiceReferenceImpl(ServiceRegistrationImpl registration) {
+ ServiceReferenceImpl(ServiceRegistrationImpl<S> registration) {
this.registration = registration;
/* We must not dereference registration in the constructor
* since it is "leaked" to us in the ServiceRegistrationImpl
@@ -195,7 +195,7 @@ public class ServiceReferenceImpl implements ServiceReference, Comparable {
* @since 1.4
*/
public int compareTo(Object object) {
- ServiceRegistrationImpl other = ((ServiceReferenceImpl) object).registration;
+ ServiceRegistrationImpl<?> other = ((ServiceReferenceImpl<?>) object).registration;
final int thisRanking = registration.getRanking();
final int otherRanking = other.getRanking();
@@ -237,11 +237,11 @@ public class ServiceReferenceImpl implements ServiceReference, Comparable {
return true;
}
- if (!(obj instanceof ServiceReferenceImpl)) {
+ if (!(obj instanceof ServiceReferenceImpl<?>)) {
return false;
}
- ServiceReferenceImpl other = (ServiceReferenceImpl) obj;
+ ServiceReferenceImpl<?> other = (ServiceReferenceImpl<?>) obj;
return registration == other.registration;
}
@@ -260,7 +260,7 @@ public class ServiceReferenceImpl implements ServiceReference, Comparable {
*
* @return The ServiceRegistrationImpl for this ServiceReferenceImpl.
*/
- public ServiceRegistrationImpl getRegistration() {
+ public ServiceRegistrationImpl<S> getRegistration() {
return registration;
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
index e507d1f2e..3821f9f53 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
@@ -34,7 +34,7 @@ import org.osgi.framework.Constants;
*
* @ThreadSafe
*/
-public class ServiceRegistrationImpl implements ServiceRegistration, Comparable {
+public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Comparable<ServiceRegistrationImpl<?>> {
/** Internal framework object. */
private final Framework framework;
@@ -50,17 +50,17 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
private final String[] clazzes;
/** service object for this registration. */
- private final Object service;
+ private final S service;
/** Reference to this registration. */
/* @GuardedBy("registrationLock") */
- private ServiceReferenceImpl reference;
+ private ServiceReferenceImpl<S> reference;
/** List of contexts using the service.
* List&lt;BundleContextImpl&gt;.
* */
/* @GuardedBy("registrationLock") */
- private final List contextsUsing;
+ private final List<BundleContextImpl> contextsUsing;
/** properties for this registration. */
/* @GuardedBy("registrationLock") */
@@ -88,7 +88,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* in the framework's service registry.
*
*/
- ServiceRegistrationImpl(ServiceRegistry registry, BundleContextImpl context, String[] clazzes, Object service) {
+ ServiceRegistrationImpl(ServiceRegistry registry, BundleContextImpl context, String[] clazzes, S service) {
this.registry = registry;
this.context = context;
this.bundle = context.getBundleImpl();
@@ -96,7 +96,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
this.clazzes = clazzes; /* must be set before calling createProperties. */
this.service = service;
this.serviceid = registry.getNextServiceId(); /* must be set before calling createProperties. */
- this.contextsUsing = new ArrayList(10);
+ this.contextsUsing = new ArrayList<BundleContextImpl>(10);
synchronized (registrationLock) {
this.state = REGISTERED;
@@ -105,15 +105,15 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* stores the value in a final field without
* otherwise using it.
*/
- this.reference = new ServiceReferenceImpl(this);
+ this.reference = new ServiceReferenceImpl<S>(this);
}
}
/**
* Call after constructing this object to complete the registration.
*/
- void register(Dictionary props) {
- final ServiceReferenceImpl ref;
+ void register(Dictionary<String, ?> props) {
+ final ServiceReferenceImpl<S> ref;
synchronized (registry) {
context.checkValid();
synchronized (registrationLock) {
@@ -152,8 +152,8 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* @exception IllegalArgumentException If the <tt>properties</tt>
* parameter contains case variants of the same key name.
*/
- public void setProperties(Dictionary props) {
- final ServiceReferenceImpl ref;
+ public void setProperties(Dictionary<String, ?> props) {
+ final ServiceReferenceImpl<S> ref;
final ServiceProperties previousProperties;
synchronized (registry) {
synchronized (registrationLock) {
@@ -202,7 +202,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* @see BundleContextImpl#ungetService
*/
public void unregister() {
- final ServiceReferenceImpl ref;
+ final ServiceReferenceImpl<S> ref;
synchronized (registry) {
synchronized (registrationLock) {
if (state != REGISTERED) { /* in the process of unregisterING */
@@ -236,7 +236,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
if (Debug.DEBUG_SERVICES) {
Debug.println("unregisterService: releasing users"); //$NON-NLS-1$
}
- users = (BundleContextImpl[]) contextsUsing.toArray(new BundleContextImpl[size]);
+ users = contextsUsing.toArray(new BundleContextImpl[size]);
}
}
@@ -262,11 +262,11 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* this ServiceRegistration has already been unregistered.
* @return A {@link ServiceReferenceImpl} object.
*/
- public ServiceReference getReference() {
+ public ServiceReference<S> getReference() {
return getReferenceImpl();
}
- ServiceReferenceImpl getReferenceImpl() {
+ ServiceReferenceImpl<S> getReferenceImpl() {
/* use reference instead of unregistered so that ServiceFactorys, called
* by releaseService after the registration is unregistered, can
* get the ServiceReference. Note this technically may violate the spec
@@ -289,7 +289,8 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* @return A Properties object for this ServiceRegistration.
*/
/* @GuardedBy("registrationLock") */
- private ServiceProperties createProperties(Dictionary p) {
+ private ServiceProperties createProperties(Dictionary<String, ?> p) {
+ assert Thread.holdsLock(registrationLock);
ServiceProperties props = new ServiceProperties(p);
props.set(Constants.OBJECTCLASS, clazzes, true);
@@ -368,7 +369,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
return clazzes;
}
- Object getServiceObject() {
+ S getServiceObject() {
return service;
}
@@ -391,6 +392,17 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
}
}
+ /**
+ * This method returns the bundle which registered the
+ * service regardless of the registration status of this
+ * service registration. This is not an OSGi specified
+ * method.
+ * @return The bundle which registered the service.
+ */
+ public Bundle getRegisteringBundle() {
+ return bundle;
+ }
+
Object getSafeService(BundleContextImpl user) {
try {
return getService(user);
@@ -416,22 +428,22 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
Debug.println("getService[" + user.getBundleImpl() + "](" + this + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- Map servicesInUse = user.getServicesInUseMap();
+ Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
if (servicesInUse == null) { /* user is closed */
user.checkValid(); /* throw exception */
}
/* Use a while loop to support retry if a call to a ServiceFactory fails */
while (true) {
- ServiceUse use;
+ ServiceUse<?> use;
boolean added = false;
/* Obtain the ServiceUse object for this service by bundle user */
synchronized (servicesInUse) {
user.checkValid();
- use = (ServiceUse) servicesInUse.get(this);
+ use = servicesInUse.get(this);
if (use == null) {
/* if this is the first use of the service
* optimistically record this service is being used. */
- use = new ServiceUse(user, this);
+ use = new ServiceUse<S>(user, this);
added = true;
synchronized (registrationLock) {
if (state == UNREGISTERED) { /* service unregistered */
@@ -489,14 +501,14 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
Debug.println("ungetService[" + user.getBundleImpl() + "](" + this + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- Map servicesInUse = user.getServicesInUseMap();
+ Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
if (servicesInUse == null) {
return false;
}
- ServiceUse use;
+ ServiceUse<?> use;
synchronized (servicesInUse) {
- use = (ServiceUse) servicesInUse.get(this);
+ use = servicesInUse.get(this);
if (use == null) {
return false;
}
@@ -532,14 +544,14 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
Debug.println("releaseService[" + user.getBundleImpl() + "](" + this + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- Map servicesInUse = user.getServicesInUseMap();
+ Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
if (servicesInUse == null) {
return;
}
- ServiceUse use;
+ ServiceUse<?> use;
synchronized (servicesInUse) {
synchronized (registrationLock) {
- use = (ServiceUse) servicesInUse.remove(this);
+ use = servicesInUse.remove(this);
if (use == null) {
return;
}
@@ -568,7 +580,7 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
/* Copy list of BundleContext into an array of Bundle. */
Bundle[] bundles = new Bundle[size];
for (int i = 0; i < size; i++)
- bundles[i] = ((BundleContextImpl) contextsUsing.get(i)).getBundleImpl();
+ bundles[i] = contextsUsing.get(i).getBundleImpl();
return bundles;
}
@@ -611,14 +623,12 @@ public class ServiceRegistrationImpl implements ServiceRegistration, Comparable
* We keep ServiceRegistationImpls in sorted lists such that the highest
* ranked service is at element 0 for quick retrieval.
*
- * @param object The <code>ServiceRegistrationImpl</code> to be compared.
+ * @param other The <code>ServiceRegistrationImpl</code> to be compared.
* @return Returns a negative integer, zero, or a positive integer if this
* <code>ServiceRegistrationImpl</code> is greater than, equal to, or
* less than the specified <code>ServiceRegistrationImpl</code>.
*/
- public int compareTo(Object object) {
- ServiceRegistrationImpl other = (ServiceRegistrationImpl) object;
-
+ public int compareTo(ServiceRegistrationImpl<?> other) {
final int thisRanking = this.getRanking();
final int otherRanking = other.getRanking();
if (thisRanking != otherRanking) {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
index 9f8f2b041..fb21961af 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
@@ -20,6 +20,7 @@ import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
import org.osgi.framework.Constants;
import org.osgi.framework.hooks.service.*;
+import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
/**
* The Service Registry. This class is the main control point for service
@@ -39,19 +40,19 @@ public class ServiceRegistry {
* The List&lt;ServiceRegistrationImpl&gt;s are sorted.
*/
/* @GuardedBy("this") */
- private final Map/*<String,List<ServiceRegistrationImpl>>*/publishedServicesByClass;
+ private final Map<String, List<ServiceRegistrationImpl<?>>> publishedServicesByClass;
/** All published services.
* List&lt;ServiceRegistrationImpl&gt;.
* The List&lt;ServiceRegistrationImpl&gt;s are sorted.
*/
/* @GuardedBy("this") */
- private final List/*<ServiceRegistrationImpl>*/allPublishedServices;
+ private final List<ServiceRegistrationImpl<?>> allPublishedServices;
/** Published services by BundleContextImpl.
* Map&lt;BundleContextImpl,List&lt;ServiceRegistrationImpl&gt;&gt;.
* The List&lt;ServiceRegistrationImpl&gt;s are NOT sorted.
*/
/* @GuardedBy("this") */
- private final Map/*<BundleContextImpl,List<ServiceRegistrationImpl>>*/publishedServicesByContext;
+ private final Map<BundleContextImpl, List<ServiceRegistrationImpl<?>>> publishedServicesByContext;
/** next free service id. */
/* @GuardedBy("this") */
private long serviceid;
@@ -59,7 +60,7 @@ public class ServiceRegistry {
* Map&lt;BundleContextImpl,CopyOnWriteIdentityMap&lt;ServiceListener,FilteredServiceListener&gt;&gt;.
*/
/* @GuardedBy("serviceEventListeners") */
- private final Map/*<BundleContextImpl,CopyOnWriteIdentityMap<ServiceListener,FilteredServiceListener>>*/serviceEventListeners;
+ private final Map<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>> serviceEventListeners;
/** initial capacity of the main data structure */
private static final int initialCapacity = 50;
@@ -75,10 +76,10 @@ public class ServiceRegistry {
public ServiceRegistry(Framework framework) {
this.framework = framework;
serviceid = 1;
- publishedServicesByClass = new HashMap(initialCapacity);
- publishedServicesByContext = new HashMap(initialCapacity);
- allPublishedServices = new ArrayList(initialCapacity);
- serviceEventListeners = new HashMap(initialCapacity);
+ publishedServicesByClass = new HashMap<String, List<ServiceRegistrationImpl<?>>>(initialCapacity);
+ publishedServicesByContext = new HashMap<BundleContextImpl, List<ServiceRegistrationImpl<?>>>(initialCapacity);
+ allPublishedServices = new ArrayList<ServiceRegistrationImpl<?>>(initialCapacity);
+ serviceEventListeners = new HashMap<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>>(initialCapacity);
}
/**
@@ -158,7 +159,7 @@ public class ServiceRegistry {
* @see ServiceRegistration
* @see ServiceFactory
*/
- public ServiceRegistrationImpl registerService(BundleContextImpl context, String[] clazzes, Object service, Dictionary properties) {
+ public ServiceRegistrationImpl<?> registerService(BundleContextImpl context, String[] clazzes, Object service, Dictionary<String, ?> properties) {
if (service == null) {
if (Debug.DEBUG_SERVICES) {
Debug.println("Service object is null"); //$NON-NLS-1$
@@ -178,7 +179,7 @@ public class ServiceRegistry {
}
/* copy the array so that changes to the original will not affect us. */
- List copy = new ArrayList(size);
+ List<String> copy = new ArrayList<String>(size);
// intern the strings and remove duplicates
for (int i = 0; i < size; i++) {
String clazz = clazzes[i].intern();
@@ -187,12 +188,12 @@ public class ServiceRegistry {
}
}
size = copy.size();
- clazzes = (String[]) copy.toArray(new String[size]);
+ clazzes = copy.toArray(new String[size]);
/* check for ServicePermissions. */
checkRegisterServicePermission(clazzes);
- if (!(service instanceof ServiceFactory)) {
+ if (!(service instanceof ServiceFactory<?>)) {
String invalidService = checkServiceClass(clazzes, service);
if (invalidService != null) {
if (Debug.DEBUG_SERVICES) {
@@ -202,7 +203,7 @@ public class ServiceRegistry {
}
}
- ServiceRegistrationImpl registration = new ServiceRegistrationImpl(this, context, clazzes, service);
+ ServiceRegistrationImpl<?> registration = new ServiceRegistrationImpl<Object>(this, context, clazzes, service);
registration.register(properties);
if (copy.contains(listenerHookName)) {
notifyNewListenerHook(registration);
@@ -282,33 +283,40 @@ public class ServiceRegistry {
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
*/
- public ServiceReferenceImpl[] getServiceReferences(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices) throws InvalidSyntaxException {
+ public ServiceReferenceImpl<?>[] getServiceReferences(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices) throws InvalidSyntaxException {
if (Debug.DEBUG_SERVICES) {
Debug.println((allservices ? "getAllServiceReferences(" : "getServiceReferences(") + clazz + ", \"" + filterstring + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
Filter filter = (filterstring == null) ? null : context.createFilter(filterstring);
- List references = changeRegistrationsToReferences(lookupServiceRegistrations(clazz, filter));
- for (Iterator iter = references.iterator(); iter.hasNext();) {
- ServiceReferenceImpl reference = (ServiceReferenceImpl) iter.next();
+ List<ServiceRegistrationImpl<?>> registrations = lookupServiceRegistrations(clazz, filter);
+ List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ for (ServiceRegistrationImpl<?> registration : registrations) {
+ ServiceReferenceImpl<?> reference;
+ try {
+ reference = registration.getReferenceImpl();
+ } catch (IllegalStateException e) {
+ continue; // got unregistered, don't return reference
+ }
if (allservices || isAssignableTo(context, reference)) {
try { /* test for permission to get the service */
checkGetServicePermission(reference);
} catch (SecurityException se) {
- iter.remove();
+ continue; // don't return reference
}
} else {
- iter.remove();
+ continue; // don't return reference
}
+ references.add(reference);
}
- final Collection shrinkable = new ShrinkableCollection(references);
+ final Collection<ServiceReference<?>> shrinkable = new ShrinkableCollection<ServiceReference<?>>(references);
notifyFindHooks(context, clazz, filterstring, allservices, shrinkable);
int size = references.size();
if (size == 0) {
return null;
}
- return (ServiceReferenceImpl[]) references.toArray(new ServiceReferenceImpl[size]);
+ return references.toArray(new ServiceReferenceImpl[size]);
}
/**
@@ -341,13 +349,13 @@ public class ServiceRegistry {
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
*/
- public ServiceReferenceImpl getServiceReference(BundleContextImpl context, String clazz) {
+ public ServiceReferenceImpl<?> getServiceReference(BundleContextImpl context, String clazz) {
if (Debug.DEBUG_SERVICES) {
Debug.println("getServiceReference(" + clazz + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
try {
- ServiceReferenceImpl[] references = getServiceReferences(context, clazz, null, false);
+ ServiceReferenceImpl<?>[] references = getServiceReferences(context, clazz, null, false);
if (references != null) {
// Since we maintain the registrations in a sorted List, the first element is always the
@@ -423,10 +431,9 @@ public class ServiceRegistry {
* @see #ungetService(BundleContextImpl, ServiceReferenceImpl)
* @see ServiceFactory
*/
- public Object getService(BundleContextImpl context, ServiceReferenceImpl reference) {
+ public Object getService(BundleContextImpl context, ServiceReferenceImpl<?> reference) {
/* test for permission to get the service */
checkGetServicePermission(reference);
-
return reference.getRegistration().getService(context);
}
@@ -467,8 +474,8 @@ public class ServiceRegistry {
* @see #getService
* @see ServiceFactory
*/
- public boolean ungetService(BundleContextImpl context, ServiceReferenceImpl reference) {
- ServiceRegistrationImpl registration = reference.getRegistration();
+ public boolean ungetService(BundleContextImpl context, ServiceReferenceImpl<?> reference) {
+ ServiceRegistrationImpl<?> registration = reference.getRegistration();
return registration.ungetService(context);
}
@@ -498,22 +505,30 @@ public class ServiceRegistry {
* @see ServiceReference
* @see ServicePermission
*/
- public ServiceReferenceImpl[] getRegisteredServices(BundleContextImpl context) {
- List references = changeRegistrationsToReferences(lookupServiceRegistrations(context));
- for (Iterator iter = references.iterator(); iter.hasNext();) {
- ServiceReferenceImpl reference = (ServiceReferenceImpl) iter.next();
- try { /* test for permission to get the service */
+ public ServiceReferenceImpl<?>[] getRegisteredServices(BundleContextImpl context) {
+ List<ServiceRegistrationImpl<?>> registrations = lookupServiceRegistrations(context);
+ List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ for (ServiceRegistrationImpl<?> registration : registrations) {
+ ServiceReferenceImpl<?> reference;
+ try {
+ reference = registration.getReferenceImpl();
+ } catch (IllegalStateException e) {
+ continue; // got unregistered, don't return reference
+ }
+ try {
+ /* test for permission to get the service */
checkGetServicePermission(reference);
} catch (SecurityException se) {
- iter.remove();
+ continue; // don't return reference
}
+ references.add(reference);
}
int size = references.size();
if (size == 0) {
return null;
}
- return (ServiceReferenceImpl[]) references.toArray(new ServiceReferenceImpl[size]);
+ return references.toArray(new ServiceReferenceImpl[size]);
}
/**
@@ -541,33 +556,41 @@ public class ServiceRegistry {
* @see ServiceReference
* @see ServicePermission
*/
- public ServiceReferenceImpl[] getServicesInUse(BundleContextImpl context) {
- Map servicesInUse = context.getServicesInUseMap();
+ public ServiceReferenceImpl<?>[] getServicesInUse(BundleContextImpl context) {
+ Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = context.getServicesInUseMap();
if (servicesInUse == null) {
return null;
}
- List references;
+ List<ServiceRegistrationImpl<?>> registrations;
synchronized (servicesInUse) {
- if (servicesInUse.size() == 0) {
+ if (servicesInUse.isEmpty()) {
return null;
}
- references = changeRegistrationsToReferences(new ArrayList(servicesInUse.keySet()));
+ registrations = new ArrayList<ServiceRegistrationImpl<?>>(servicesInUse.keySet());
}
- for (Iterator iter = references.iterator(); iter.hasNext();) {
- ServiceReferenceImpl reference = (ServiceReferenceImpl) iter.next();
- try { /* test for permission to get the service */
+ List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ for (ServiceRegistrationImpl<?> registration : registrations) {
+ ServiceReferenceImpl<?> reference;
+ try {
+ reference = registration.getReferenceImpl();
+ } catch (IllegalStateException e) {
+ continue; // got unregistered, don't return reference
+ }
+ try {
+ /* test for permission to get the service */
checkGetServicePermission(reference);
} catch (SecurityException se) {
- iter.remove();
+ continue; // don't return reference
}
+ references.add(reference);
}
int size = references.size();
if (size == 0) {
return null;
}
- return (ServiceReferenceImpl[]) references.toArray(new ServiceReferenceImpl[size]);
+ return references.toArray(new ServiceReferenceImpl[size]);
}
/**
@@ -577,9 +600,7 @@ public class ServiceRegistry {
* @param context The BundleContext of the closing bundle.
*/
public void unregisterServices(BundleContextImpl context) {
- List registrations = lookupServiceRegistrations(context);
- for (Iterator iter = registrations.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
+ for (ServiceRegistrationImpl<?> registration : lookupServiceRegistrations(context)) {
try {
registration.unregister();
} catch (IllegalStateException e) {
@@ -596,22 +617,21 @@ public class ServiceRegistry {
* @param context The BundleContext of the closing bundle.
*/
public void releaseServicesInUse(BundleContextImpl context) {
- Map servicesInUse = context.getServicesInUseMap();
+ Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = context.getServicesInUseMap();
if (servicesInUse == null) {
return;
}
- List registrations;
+ List<ServiceRegistrationImpl<?>> registrations;
synchronized (servicesInUse) {
- if (servicesInUse.size() == 0) {
+ if (servicesInUse.isEmpty()) {
return;
}
- registrations = new ArrayList(servicesInUse.keySet());
+ registrations = new ArrayList<ServiceRegistrationImpl<?>>(servicesInUse.keySet());
}
if (Debug.DEBUG_SERVICES) {
Debug.println("Releasing services"); //$NON-NLS-1$
}
- for (Iterator iter = registrations.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
+ for (ServiceRegistrationImpl<?> registration : registrations) {
registration.releaseService(context);
}
}
@@ -633,21 +653,21 @@ public class ServiceRegistry {
FilteredServiceListener filteredListener = new FilteredServiceListener(context, listener, filter);
FilteredServiceListener oldFilteredListener;
synchronized (serviceEventListeners) {
- Map listeners = (Map) serviceEventListeners.get(context);
+ CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners = serviceEventListeners.get(context);
if (listeners == null) {
- listeners = new CopyOnWriteIdentityMap();
+ listeners = new CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>();
serviceEventListeners.put(context, listeners);
}
- oldFilteredListener = (FilteredServiceListener) listeners.put(listener, filteredListener);
+ oldFilteredListener = listeners.put(listener, filteredListener);
}
if (oldFilteredListener != null) {
oldFilteredListener.markRemoved();
- Collection removedListeners = Collections.singletonList(oldFilteredListener);
+ Collection<ListenerInfo> removedListeners = Collections.<ListenerInfo> singletonList(oldFilteredListener);
notifyListenerHooks(removedListeners, false);
}
- Collection addedListeners = Collections.singletonList(filteredListener);
+ Collection<ListenerInfo> addedListeners = Collections.<ListenerInfo> singletonList(filteredListener);
notifyListenerHooks(addedListeners, true);
}
@@ -665,18 +685,18 @@ public class ServiceRegistry {
FilteredServiceListener oldFilteredListener;
synchronized (serviceEventListeners) {
- Map listeners = (Map) serviceEventListeners.get(context);
+ Map<ServiceListener, FilteredServiceListener> listeners = serviceEventListeners.get(context);
if (listeners == null) {
return; // this context has no listeners to begin with
}
- oldFilteredListener = (FilteredServiceListener) listeners.remove(listener);
+ oldFilteredListener = listeners.remove(listener);
}
if (oldFilteredListener == null) {
return;
}
oldFilteredListener.markRemoved();
- Collection removedListeners = Collections.singletonList(oldFilteredListener);
+ Collection<ListenerInfo> removedListeners = Collections.<ListenerInfo> singletonList(oldFilteredListener);
notifyListenerHooks(removedListeners, false);
}
@@ -686,19 +706,29 @@ public class ServiceRegistry {
* @param context Context of bundle removing all listeners.
*/
public void removeAllServiceListeners(BundleContextImpl context) {
- Map removedListenersMap;
+ Map<ServiceListener, FilteredServiceListener> removedListenersMap;
synchronized (serviceEventListeners) {
- removedListenersMap = (Map) serviceEventListeners.remove(context);
+ removedListenersMap = serviceEventListeners.remove(context);
}
- if ((removedListenersMap == null) || (removedListenersMap.size() == 0)) {
+ if ((removedListenersMap == null) || removedListenersMap.isEmpty()) {
return;
}
- Collection removedListeners = removedListenersMap.values();
- for (Iterator iter = removedListeners.iterator(); iter.hasNext();) {
- FilteredServiceListener oldFilteredListener = (FilteredServiceListener) iter.next();
+ Collection<FilteredServiceListener> removedListeners = removedListenersMap.values();
+ for (FilteredServiceListener oldFilteredListener : removedListeners) {
oldFilteredListener.markRemoved();
}
- notifyListenerHooks(removedListeners, false);
+ notifyListenerHooks(asListenerInfos(removedListeners), false);
+ }
+
+ /**
+ * Coerce the generic type of a collection from Collection<FilteredServiceListener>
+ * to Collection<ListenerInfo>
+ * @param c Collection to be coerced.
+ * @return c coerced to Collection<ListenerInfo>
+ */
+ @SuppressWarnings("unchecked")
+ private static Collection<ListenerInfo> asListenerInfos(Collection<? extends ListenerInfo> c) {
+ return (Collection<ListenerInfo>) c;
}
/**
@@ -706,11 +736,11 @@ public class ServiceRegistry {
*
* @param event The ServiceEvent to deliver.
*/
- void publishServiceEvent(final ServiceEvent event) {
+ public void publishServiceEvent(final ServiceEvent event) {
if (System.getSecurityManager() == null) {
publishServiceEventPrivileged(event);
} else {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
publishServiceEventPrivileged(event);
return null;
@@ -721,15 +751,13 @@ public class ServiceRegistry {
void publishServiceEventPrivileged(final ServiceEvent event) {
/* Build the listener snapshot */
- Map /*<BundleContextImpl,Set<Map.Entry<Object,Object>>>*/listenerSnapshot;
+ Map<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>> listenerSnapshot;
synchronized (serviceEventListeners) {
- listenerSnapshot = new HashMap(serviceEventListeners.size());
- for (Iterator iter = serviceEventListeners.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- BundleContextImpl context = (BundleContextImpl) entry.getKey();
- Map listeners = (Map) entry.getValue();
+ listenerSnapshot = new HashMap<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>>(serviceEventListeners.size());
+ for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>> entry : serviceEventListeners.entrySet()) {
+ CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners = entry.getValue();
if (!listeners.isEmpty()) {
- listenerSnapshot.put(context, listeners.entrySet());
+ listenerSnapshot.put(entry.getKey(), listeners.entrySet());
}
}
}
@@ -739,7 +767,7 @@ public class ServiceRegistry {
* removals from that collection will result in removals of the
* entry from the snapshot.
*/
- Collection/*<BundleContextImpl>*/shrinkable = listenerSnapshot.keySet();
+ Collection<BundleContext> shrinkable = asBundleContexts(listenerSnapshot.keySet());
notifyEventHooksPrivileged(event, shrinkable);
if (listenerSnapshot.isEmpty()) {
return;
@@ -747,23 +775,33 @@ public class ServiceRegistry {
/* deliver the event to the snapshot */
ListenerQueue queue = framework.newListenerQueue();
- for (Iterator iter = listenerSnapshot.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- EventDispatcher dispatcher = (BundleContextImpl) entry.getKey();
- Set listeners = (Set) entry.getValue();
+ for (Map.Entry<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>> entry : listenerSnapshot.entrySet()) {
+ EventDispatcher dispatcher = entry.getKey();
+ Set<Map.Entry<ServiceListener, FilteredServiceListener>> listeners = entry.getValue();
queue.queueListeners(listeners, dispatcher);
}
queue.dispatchEventSynchronous(SERVICEEVENT, event);
}
/**
+ * Coerce the generic type of a collection from Collection<BundleContextImpl>
+ * to Collection<BundleContext>
+ * @param c Collection to be coerced.
+ * @return c coerced to Collection<BundleContext>
+ */
+ @SuppressWarnings("unchecked")
+ private static Collection<BundleContext> asBundleContexts(Collection<? extends BundleContext> c) {
+ return (Collection<BundleContext>) c;
+ }
+
+ /**
* Return the next available service id.
*
* @return next service id.
*/
synchronized long getNextServiceId() {
long id = serviceid;
- serviceid++;
+ serviceid = id + 1;
return id;
}
@@ -774,11 +812,12 @@ public class ServiceRegistry {
* @param registration The new ServiceRegistration.
*/
/* @GuardedBy("this") */
- void addServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl registration) {
+ void addServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration) {
+ assert Thread.holdsLock(this);
// Add the ServiceRegistrationImpl to the list of Services published by BundleContextImpl.
- List contextServices = (List) publishedServicesByContext.get(context);
+ List<ServiceRegistrationImpl<?>> contextServices = publishedServicesByContext.get(context);
if (contextServices == null) {
- contextServices = new ArrayList(initialSubCapacity);
+ contextServices = new ArrayList<ServiceRegistrationImpl<?>>(initialSubCapacity);
publishedServicesByContext.put(context, contextServices);
}
// The list is NOT sorted, so we just add
@@ -790,10 +829,10 @@ public class ServiceRegistry {
for (int i = 0, size = clazzes.length; i < size; i++) {
String clazz = clazzes[i];
- List services = (List) publishedServicesByClass.get(clazz);
+ List<ServiceRegistrationImpl<?>> services = publishedServicesByClass.get(clazz);
if (services == null) {
- services = new ArrayList(initialSubCapacity);
+ services = new ArrayList<ServiceRegistrationImpl<?>>(initialSubCapacity);
publishedServicesByClass.put(clazz, services);
}
@@ -815,7 +854,8 @@ public class ServiceRegistry {
* @param registration The modified ServiceRegistration.
*/
/* @GuardedBy("this") */
- void modifyServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl registration) {
+ void modifyServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration) {
+ assert Thread.holdsLock(this);
// The list of Services published by BundleContextImpl is not sorted, so
// we do not need to modify it.
@@ -825,7 +865,7 @@ public class ServiceRegistry {
int insertIndex;
for (int i = 0, size = clazzes.length; i < size; i++) {
String clazz = clazzes[i];
- List services = (List) publishedServicesByClass.get(clazz);
+ List<ServiceRegistrationImpl<?>> services = publishedServicesByClass.get(clazz);
services.remove(registration);
// The list is sorted, so we must find the proper location to insert
insertIndex = -Collections.binarySearch(services, registration) - 1;
@@ -847,9 +887,10 @@ public class ServiceRegistry {
* @param registration The ServiceRegistration to remove.
*/
/* @GuardedBy("this") */
- void removeServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl registration) {
+ void removeServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration) {
+ assert Thread.holdsLock(this);
// Remove the ServiceRegistrationImpl from the list of Services published by BundleContextImpl.
- List contextServices = (List) publishedServicesByContext.get(context);
+ List<ServiceRegistrationImpl<?>> contextServices = publishedServicesByContext.get(context);
if (contextServices != null) {
contextServices.remove(registration);
}
@@ -858,7 +899,7 @@ public class ServiceRegistry {
String[] clazzes = registration.getClasses();
for (int i = 0, size = clazzes.length; i < size; i++) {
String clazz = clazzes[i];
- List services = (List) publishedServicesByClass.get(clazz);
+ List<ServiceRegistrationImpl<?>> services = publishedServicesByClass.get(clazz);
services.remove(registration);
if (services.isEmpty()) { // remove empty list
publishedServicesByClass.remove(clazz);
@@ -877,30 +918,32 @@ public class ServiceRegistry {
* @param filter The filter criteria.
* @return List<ServiceRegistrationImpl>
*/
- private List lookupServiceRegistrations(String clazz, Filter filter) {
- List result;
+ private List<ServiceRegistrationImpl<?>> lookupServiceRegistrations(String clazz, Filter filter) {
+ List<ServiceRegistrationImpl<?>> result;
synchronized (this) {
if (clazz == null) { /* all services */
result = allPublishedServices;
} else {
/* services registered under the class name */
- result = (List) publishedServicesByClass.get(clazz);
+ result = publishedServicesByClass.get(clazz);
}
- if ((result == null) || (result.size() == 0)) {
- return Collections.EMPTY_LIST;
+ if ((result == null) || result.isEmpty()) {
+ @SuppressWarnings("unchecked")
+ List<ServiceRegistrationImpl<?>> empty = Collections.EMPTY_LIST;
+ return empty;
}
- result = new ArrayList(result); /* make a new list since we don't want to change the real list */
+ result = new ArrayList<ServiceRegistrationImpl<?>>(result); /* make a new list since we don't want to change the real list */
}
if (filter == null) {
return result;
}
- for (Iterator iter = result.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
- ServiceReferenceImpl reference;
+ for (Iterator<ServiceRegistrationImpl<?>> iter = result.iterator(); iter.hasNext();) {
+ ServiceRegistrationImpl<?> registration = iter.next();
+ ServiceReferenceImpl<?> reference;
try {
reference = registration.getReferenceImpl();
} catch (IllegalStateException e) {
@@ -920,14 +963,16 @@ public class ServiceRegistry {
* @param context The BundleContext for which to return Service Registrations.
* @return List<ServiceRegistrationImpl>
*/
- private synchronized List lookupServiceRegistrations(BundleContextImpl context) {
- List result = (List) publishedServicesByContext.get(context);
+ private synchronized List<ServiceRegistrationImpl<?>> lookupServiceRegistrations(BundleContextImpl context) {
+ List<ServiceRegistrationImpl<?>> result = publishedServicesByContext.get(context);
- if ((result == null) || (result.size() == 0)) {
- return Collections.EMPTY_LIST;
+ if ((result == null) || result.isEmpty()) {
+ @SuppressWarnings("unchecked")
+ List<ServiceRegistrationImpl<?>> empty = Collections.EMPTY_LIST;
+ return empty;
}
- return new ArrayList(result); /* make a new list since we don't want to change the real list */
+ return new ArrayList<ServiceRegistrationImpl<?>>(result); /* make a new list since we don't want to change the real list */
}
/**
@@ -940,27 +985,6 @@ public class ServiceRegistry {
}
/**
- * Modify a List<ServiceRegistrationImpl> in place to a List<ServiceReferenceImpl>.
- *
- * @param result The input List<ServiceRegistrationImpl>.
- * @return result which has been changed to List<ServiceReferenceImpl>
- */
- private static List changeRegistrationsToReferences(List result) {
- for (ListIterator iter = result.listIterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
- ServiceReferenceImpl reference;
- try {
- reference = registration.getReferenceImpl();
- } catch (IllegalStateException e) {
- iter.remove(); /* service was unregistered after we were called */
- continue;
- }
- iter.set(reference); /* replace the registration with its reference */
- }
- return result;
- }
-
- /**
* Check for permission to register a service.
*
* The caller must have permission for ALL names.
@@ -978,7 +1002,7 @@ public class ServiceRegistry {
/**
* Check for permission to get a service.
*/
- private static void checkGetServicePermission(ServiceReference reference) {
+ private static void checkGetServicePermission(ServiceReference<?> reference) {
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
return;
@@ -1005,14 +1029,14 @@ public class ServiceRegistry {
* @return The name of the class that is not satisfied by the service object.
*/
static String checkServiceClass(final String[] clazzes, final Object serviceObject) {
- ClassLoader cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
return serviceObject.getClass().getClassLoader();
}
});
for (int i = 0, len = clazzes.length; i < len; i++) {
try {
- Class serviceClazz = cl == null ? Class.forName(clazzes[i]) : cl.loadClass(clazzes[i]);
+ Class<?> serviceClazz = cl == null ? Class.forName(clazzes[i]) : cl.loadClass(clazzes[i]);
if (!serviceClazz.isInstance(serviceObject))
return clazzes[i];
} catch (ClassNotFoundException e) {
@@ -1024,21 +1048,21 @@ public class ServiceRegistry {
return null;
}
- private static boolean extensiveCheckServiceClass(String clazz, Class serviceClazz) {
+ private static boolean extensiveCheckServiceClass(String clazz, Class<?> serviceClazz) {
if (clazz.equals(serviceClazz.getName()))
return false;
- Class[] interfaces = serviceClazz.getInterfaces();
+ Class<?>[] interfaces = serviceClazz.getInterfaces();
for (int i = 0, len = interfaces.length; i < len; i++)
if (!extensiveCheckServiceClass(clazz, interfaces[i]))
return false;
- Class superClazz = serviceClazz.getSuperclass();
+ Class<?> superClazz = serviceClazz.getSuperclass();
if (superClazz != null)
if (!extensiveCheckServiceClass(clazz, superClazz))
return false;
return true;
}
- static boolean isAssignableTo(BundleContextImpl context, ServiceReferenceImpl reference) {
+ static boolean isAssignableTo(BundleContextImpl context, ServiceReferenceImpl<?> reference) {
Bundle bundle = context.getBundleImpl();
String[] clazzes = reference.getClasses();
for (int i = 0, len = clazzes.length; i < len; i++)
@@ -1058,11 +1082,11 @@ public class ServiceRegistry {
* @param allservices True if getAllServiceReferences called.
* @param result The result to return to the caller which may have been shrunk by the FindHooks.
*/
- private void notifyFindHooks(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices, final Collection result) {
+ private void notifyFindHooks(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices, final Collection<ServiceReference<?>> result) {
if (System.getSecurityManager() == null) {
notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
} else {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
return null;
@@ -1071,7 +1095,7 @@ public class ServiceRegistry {
}
}
- void notifyFindHooksPrivileged(BundleContextImpl context, String clazz, String filterstring, boolean allservices, Collection result) {
+ void notifyFindHooksPrivileged(BundleContextImpl context, String clazz, String filterstring, boolean allservices, Collection<ServiceReference<?>> result) {
BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
if (systemBundleContext == null) { // if no system bundle context, we are done!
return;
@@ -1081,12 +1105,11 @@ public class ServiceRegistry {
Debug.println("notifyFindHooks(" + context.getBundleImpl() + "," + clazz + "," + filterstring + "," + allservices + "," + result + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
- List hooks = lookupServiceRegistrations(findHookName, null);
+ List<ServiceRegistrationImpl<?>> hooks = lookupServiceRegistrations(findHookName, null);
// Since the list is already sorted, we don't need to sort the list to call the hooks
// in the proper order.
- for (Iterator iter = hooks.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
+ for (ServiceRegistrationImpl<?> registration : hooks) {
Object findHook = registration.getSafeService(systemBundleContext);
if (findHook == null) { // if the hook is null
continue;
@@ -1118,7 +1141,7 @@ public class ServiceRegistry {
* @param event The service event to be delivered.
* @param result The result to return to the caller which may have been shrunk by the EventHooks.
*/
- private void notifyEventHooksPrivileged(ServiceEvent event, Collection result) {
+ private void notifyEventHooksPrivileged(ServiceEvent event, Collection<BundleContext> result) {
BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
if (systemBundleContext == null) { // if no system bundle context, we are done!
return;
@@ -1128,12 +1151,11 @@ public class ServiceRegistry {
Debug.println("notifyEventHooks(" + event.getType() + ":" + event.getServiceReference() + "," + result + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- List hooks = lookupServiceRegistrations(eventHookName, null);
+ List<ServiceRegistrationImpl<?>> hooks = lookupServiceRegistrations(eventHookName, null);
// Since the list is already sorted, we don't need to sort the list to call the hooks
// in the proper order.
- for (Iterator iter = hooks.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
+ for (ServiceRegistrationImpl<?> registration : hooks) {
Object eventHook = registration.getSafeService(systemBundleContext);
if (eventHook == null) { // if the hook is null
continue;
@@ -1163,11 +1185,11 @@ public class ServiceRegistry {
*
* @param registration The newly registered ListenerHook service.
*/
- private void notifyNewListenerHook(final ServiceRegistrationImpl registration) {
+ private void notifyNewListenerHook(final ServiceRegistrationImpl<?> registration) {
if (System.getSecurityManager() == null) {
notifyNewListenerHookPrivileged(registration);
} else {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
notifyNewListenerHookPrivileged(registration);
return null;
@@ -1177,7 +1199,7 @@ public class ServiceRegistry {
}
- void notifyNewListenerHookPrivileged(ServiceRegistrationImpl registration) {
+ void notifyNewListenerHookPrivileged(ServiceRegistrationImpl<?> registration) {
BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
if (systemBundleContext == null) { // if no system bundle context, we are done!
return;
@@ -1187,13 +1209,24 @@ public class ServiceRegistry {
Debug.println("notifyNewListenerHook(" + registration + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
- Collection addedListeners = new ArrayList(initialCapacity);
+ // snapshot the contexts with listeners
+ Map<BundleContextImpl, Collection<ListenerInfo>> snapshot;
+ int capacity = 0;
synchronized (serviceEventListeners) {
- for (Iterator iter = serviceEventListeners.values().iterator(); iter.hasNext();) {
- Map listeners = (Map) iter.next();
- if (!listeners.isEmpty()) {
- addedListeners.addAll(listeners.values());
- }
+ snapshot = new HashMap<BundleContextImpl, Collection<ListenerInfo>>(serviceEventListeners.size());
+ for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>> entry : serviceEventListeners.entrySet()) {
+ Collection<ListenerInfo> listeners = asListenerInfos(entry.getValue().values());
+ snapshot.put(entry.getKey(), listeners);
+ capacity += listeners.size();
+ }
+ }
+
+ // outside synchronized block, discard contexts which are not in scope
+ Collection<ListenerInfo> addedListeners = new ArrayList<ListenerInfo>(capacity);
+ for (Map.Entry<BundleContextImpl, Collection<ListenerInfo>> entry : snapshot.entrySet()) {
+ Collection<ListenerInfo> listeners = entry.getValue();
+ if (!listeners.isEmpty()) {
+ addedListeners.addAll(listeners);
}
}
addedListeners = Collections.unmodifiableCollection(addedListeners);
@@ -1225,15 +1258,16 @@ public class ServiceRegistry {
* The ListenerHook must be called in order: descending by service.ranking, then ascending by service.id.
* This is the natural order for ServiceReference.
*
- * @param listeners An unmodifiable collection of ListenerInfo objects.
+ * @param listeners A non-empty, unmodifiable collection of ListenerInfo objects.
+ * All elements in the list must be for the same bundle.
* @param added <code>true</code> if the specified listeners are being added. <code>false</code>
* if they are being removed.
*/
- private void notifyListenerHooks(final Collection listeners, final boolean added) {
+ private void notifyListenerHooks(final Collection<ListenerInfo> listeners, final boolean added) {
if (System.getSecurityManager() == null) {
notifyListenerHooksPrivileged(listeners, added);
} else {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
notifyListenerHooksPrivileged(listeners, added);
return null;
@@ -1243,7 +1277,8 @@ public class ServiceRegistry {
}
- void notifyListenerHooksPrivileged(Collection listeners, boolean added) {
+ void notifyListenerHooksPrivileged(Collection<ListenerInfo> listeners, boolean added) {
+ assert !listeners.isEmpty();
BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
if (systemBundleContext == null) { // if no system bundle context, we are done!
return;
@@ -1253,12 +1288,11 @@ public class ServiceRegistry {
Debug.println("notifyListenerHooks(" + listeners + "," + (added ? "added" : "removed") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
- List hooks = lookupServiceRegistrations(listenerHookName, null);
+ List<ServiceRegistrationImpl<?>> hooks = lookupServiceRegistrations(listenerHookName, null);
// Since the list is already sorted, we don't need to sort the list to call the hooks
// in the proper order.
- for (Iterator iter = hooks.iterator(); iter.hasNext();) {
- ServiceRegistrationImpl registration = (ServiceRegistrationImpl) iter.next();
+ for (ServiceRegistrationImpl<?> registration : hooks) {
Object listenerHook = registration.getSafeService(systemBundleContext);
if (listenerHook == null) { // if the hook is null
continue;
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceUse.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceUse.java
index 7fcc076be..e8b4988c2 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceUse.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceUse.java
@@ -27,19 +27,19 @@ import org.osgi.framework.*;
* @ThreadSafe
*/
-public class ServiceUse {
+public class ServiceUse<S> {
/** ServiceFactory object if the service instance represents a factory,
null otherwise */
- final ServiceFactory factory;
+ final ServiceFactory<S> factory;
/** BundleContext associated with this service use */
final BundleContextImpl context;
/** ServiceDescription of the registered service */
- final ServiceRegistrationImpl registration;
+ final ServiceRegistrationImpl<S> registration;
/** Service object either registered or that returned by
ServiceFactory.getService() */
/* @GuardedBy("this") */
- private Object cachedService;
+ private S cachedService;
/** bundle's use count for this service */
/* @GuardedBy("this") */
private int useCount;
@@ -54,11 +54,13 @@ public class ServiceUse {
* @param context bundle getting the service
* @param registration ServiceRegistration of the service
*/
- ServiceUse(BundleContextImpl context, ServiceRegistrationImpl registration) {
+ ServiceUse(BundleContextImpl context, ServiceRegistrationImpl<S> registration) {
this.useCount = 0;
- Object service = registration.getServiceObject();
- if (service instanceof ServiceFactory) {
- this.factory = (ServiceFactory) service;
+ S service = registration.getServiceObject();
+ if (service instanceof ServiceFactory<?>) {
+ @SuppressWarnings("unchecked")
+ ServiceFactory<S> f = (ServiceFactory<S>) service;
+ this.factory = f;
this.cachedService = null;
} else {
this.factory = null;
@@ -104,7 +106,8 @@ public class ServiceUse {
* reference.
*/
/* @GuardedBy("this") */
- Object getService() {
+ S getService() {
+ assert Thread.holdsLock(this);
if ((useCount > 0) || (factory == null)) {
useCount++;
return cachedService;
@@ -113,10 +116,10 @@ public class ServiceUse {
if (Debug.DEBUG_SERVICES) {
Debug.println("getService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
- final Object service;
+ final S service;
try {
- service = AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ service = AccessController.doPrivileged(new PrivilegedAction<S>() {
+ public S run() {
return factory.getService(context.getBundleImpl(), registration);
}
});
@@ -189,6 +192,7 @@ public class ServiceUse {
*/
/* @GuardedBy("this") */
boolean ungetService() {
+ assert Thread.holdsLock(this);
if (useCount == 0) {
return true;
}
@@ -202,15 +206,15 @@ public class ServiceUse {
return true;
}
- final Object service = cachedService;
+ final S service = cachedService;
cachedService = null;
if (Debug.DEBUG_SERVICES) {
Debug.println("ungetService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
try {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<S>() {
+ public S run() {
factory.ungetService(context.getBundleImpl(), registration, service);
return null;
}
@@ -239,10 +243,11 @@ public class ServiceUse {
*/
/* @GuardedBy("this") */
void releaseService() {
+ assert Thread.holdsLock(this);
if ((useCount == 0) || (factory == null)) {
return;
}
- final Object service = cachedService;
+ final S service = cachedService;
cachedService = null;
useCount = 0;
@@ -250,8 +255,8 @@ public class ServiceUse {
Debug.println("releaseService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
try {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<S>() {
+ public S run() {
factory.ungetService(context.getBundleImpl(), registration, service);
return null;
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
index cbc70ec7e..0ac9928d0 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,21 +26,21 @@ import java.util.Iterator;
*
*/
-public class ShrinkableCollection implements Collection {
- private final Collection collection;
+public class ShrinkableCollection<E> implements Collection<E> {
+ private final Collection<? extends E> collection;
- ShrinkableCollection(Collection c) {
+ ShrinkableCollection(Collection<? extends E> c) {
if (c == null) {
throw new NullPointerException();
}
collection = c;
}
- public boolean add(Object var0) {
+ public boolean add(E e) {
throw new UnsupportedOperationException();
}
- public boolean addAll(Collection var0) {
+ public boolean addAll(Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
@@ -48,32 +48,33 @@ public class ShrinkableCollection implements Collection {
collection.clear();
}
- public boolean contains(Object var0) {
- return collection.contains(var0);
+ public boolean contains(Object o) {
+ return collection.contains(o);
}
- public boolean containsAll(Collection var0) {
- return collection.containsAll(var0);
+ public boolean containsAll(Collection<?> c) {
+ return collection.containsAll(c);
}
public boolean isEmpty() {
return collection.isEmpty();
}
- public Iterator iterator() {
- return collection.iterator();
+ @SuppressWarnings("unchecked")
+ public Iterator<E> iterator() {
+ return (Iterator<E>) collection.iterator();
}
- public boolean remove(Object var0) {
- return collection.remove(var0);
+ public boolean remove(Object o) {
+ return collection.remove(o);
}
- public boolean removeAll(Collection var0) {
- return collection.removeAll(var0);
+ public boolean removeAll(Collection<?> c) {
+ return collection.removeAll(c);
}
- public boolean retainAll(Collection var0) {
- return collection.retainAll(var0);
+ public boolean retainAll(Collection<?> c) {
+ return collection.retainAll(c);
}
public int size() {
@@ -84,7 +85,7 @@ public class ShrinkableCollection implements Collection {
return collection.toArray();
}
- public Object[] toArray(Object[] var0) {
+ public <T> T[] toArray(T[] var0) {
return collection.toArray(var0);
}
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
index 3d6e280c0..1b194737f 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.launch;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.*;
@@ -283,4 +282,17 @@ public class Equinox implements Framework {
public Version getVersion() {
return getImpl().getVersion();
}
+
+ public <A> A adapt(Class<A> adapterType) {
+ return getImpl().adapt(adapterType);
+ }
+
+ public int compareTo(Bundle o) {
+ return getImpl().compareTo(o);
+ }
+
+ public File getDataFile(String filename) {
+ return getImpl().getDataFile(filename);
+ }
+
}
diff --git a/bundles/org.eclipse.osgi/customBuildCallbacks.xml b/bundles/org.eclipse.osgi/customBuildCallbacks.xml
new file mode 100644
index 000000000..c282787ca
--- /dev/null
+++ b/bundles/org.eclipse.osgi/customBuildCallbacks.xml
@@ -0,0 +1,164 @@
+<!-- ===================================================================== -->
+<!-- Custom targets called from a project's generated build.xml -->
+<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.-->
+<!-- ===================================================================== -->
+<project name="Build specific targets and properties" default="noDefault">
+
+ <!-- ===================================================================== -->
+ <!-- Default target -->
+ <!-- ===================================================================== -->
+ <target name="noDefault">
+ <echo message="This file must be called with explicit targets" />
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target build.jars -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder to contain the build results -->
+ <!-- ===================================================================== -->
+ <target name="pre.build.jars">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target build.jars -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder to contain the build results -->
+ <!-- ===================================================================== -->
+ <target name="post.build.jars">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target build.sources -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder to contain the build results -->
+ <!-- ===================================================================== -->
+ <target name="pre.build.sources">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target build.sources -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder to contain the build results -->
+ <!-- ===================================================================== -->
+ <target name="post.build.sources">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the compilation target <name> -->
+ <!-- Substitute "name" with the name of the compilation target, eg @dot -->
+ <!-- Available parameters : -->
+ <!-- source.foldern : n = 1 ... N, the source folders -->
+ <!-- target.folder : where the results of the compilation go -->
+ <!-- <name>.classpath : name = name of the compilation target. A -->
+ <!-- reference to the classpath structure. -->
+ <!-- ===================================================================== -->
+ <target name="pre.name">
+ </target>
+
+ <target name="pre.@dot">
+ <copydir dest="osgi/src2" src="../org.osgi.framework/src"></copydir>
+ <copydir dest="osgi/src2" src="../org.osgi.service.composite/src"></copydir>
+ <copydir dest="osgi/src2" src="../org.osgi.service.packageadmin/src"></copydir>
+ <copydir dest="osgi/src2" src="../org.osgi.service.startlevel/src"></copydir>
+ <copydir dest="osgi/src2" src="../org.osgi.util.tracker/src"></copydir>
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do during the compilation target <name>, after the compile -->
+ <!-- but before jaring. Substitute "name" with the name of the compilation-->
+ <!-- target, eg @dot -->
+ <!-- Available parameters : -->
+ <!-- source.foldern : n = 1 ... N, the source folders -->
+ <!-- target.folder : where the results of the compilation go -->
+ <!-- <name>.classpath : name = name of the compilation target. A -->
+ <!-- reference to the classpath structure. -->
+ <!-- ===================================================================== -->
+ <target name="post.compile.name">
+ </target>
+
+ <target name="post.compile.@dot">
+ <deltree dir="osgi/src2/org/"/>
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the compilation target <name> -->
+ <!-- Substitute "name" with the name of the compilation target, eg @dot -->
+ <!-- Available parameters : -->
+ <!-- jar.Location - the location of the compilation results -->
+ <!-- <name>.classpath : name = name of the compilation target. A -->
+ <!-- reference to the classpath structure. -->
+ <!-- ===================================================================== -->
+ <target name="post.name">
+ </target>
+
+ <target name="post.@dot">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target gather.bin.parts -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder containing the build results -->
+ <!-- target.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="pre.gather.bin.parts">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target gather.bin.parts -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder containing the build results -->
+ <!-- target.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="post.gather.bin.parts">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target gather.sources -->
+ <!-- Available parameters : -->
+ <!-- destination.temp.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="pre.gather.sources">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target gather.sources -->
+ <!-- Available parameters : -->
+ <!-- destination.temp.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="post.gather.sources">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target gather.logs -->
+ <!-- Available parameters : -->
+ <!-- destination.temp.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="pre.gather.logs">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target gather.logs -->
+ <!-- Available parameters : -->
+ <!-- destination.temp.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="post.gather.logs">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the target clean -->
+ <!-- Available parameters : -->
+ <!-- destination.temp.folder - destination folder -->
+ <!-- ===================================================================== -->
+ <target name="pre.clean">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the target clean -->
+ <!-- Available parameters : -->
+ <!-- plugin.destination - final destination of the build -->
+ <!-- build.result.folder - results of the compilation -->
+ <!-- temp.folder - temporary folder -->
+ <!-- ===================================================================== -->
+ <target name="post.clean">
+ </target>
+</project>
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorUtil.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorUtil.java
index 914ff65c1..44e5cbaee 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorUtil.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorUtil.java
@@ -218,10 +218,10 @@ public class AdaptorUtil {
public static URL encodeFileURL(File file) throws MalformedURLException {
try {
- Method toURI = File.class.getMethod("toURI", null); //$NON-NLS-1$
- Object uri = toURI.invoke(file, null);
- Method toURL = uri.getClass().getMethod("toURL", null); //$NON-NLS-1$
- return (URL) toURL.invoke(uri, null);
+ Method toURI = File.class.getMethod("toURI", (Class[]) null); //$NON-NLS-1$
+ Object uri = toURI.invoke(file, (Object[]) null);
+ Method toURL = uri.getClass().getMethod("toURL", (Class[]) null); //$NON-NLS-1$
+ return (URL) toURL.invoke(uri, (Object[]) null);
} catch (NoSuchMethodException e) {
// use toURL.
} catch (IllegalAccessException e) {
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader.java
index 2b6c864f2..c47c30515 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader.java
@@ -57,9 +57,9 @@ public class DefaultClassLoader extends ClassLoader implements ParallelClassLoad
boolean parallelCapable = false;
try {
if (typeParallel) {
- Method parallelCapableMetod = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", null); //$NON-NLS-1$
+ Method parallelCapableMetod = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", (Class[]) null); //$NON-NLS-1$
parallelCapableMetod.setAccessible(true);
- parallelCapable = ((Boolean) parallelCapableMetod.invoke(null, null)).booleanValue();
+ parallelCapable = ((Boolean) parallelCapableMetod.invoke(null, (Object[]) null)).booleanValue();
}
} catch (Throwable e) {
// must do everything to avoid failing in clinit
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/DefaultStartupMonitor.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/DefaultStartupMonitor.java
index 51ecaec74..9ac29d38d 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/DefaultStartupMonitor.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/DefaultStartupMonitor.java
@@ -32,7 +32,7 @@ public class DefaultStartupMonitor implements StartupMonitor {
this.splashHandler = splashHandler;
try {
- updateMethod = splashHandler.getClass().getMethod("updateSplash", null); //$NON-NLS-1$
+ updateMethod = splashHandler.getClass().getMethod("updateSplash", (Class[]) null); //$NON-NLS-1$
} catch (SecurityException e) {
throw (IllegalStateException) new IllegalStateException(e.getMessage()).initCause(e);
} catch (NoSuchMethodException e) {
@@ -47,7 +47,7 @@ public class DefaultStartupMonitor implements StartupMonitor {
public void update() {
if (updateMethod != null) {
try {
- updateMethod.invoke(splashHandler, null);
+ updateMethod.invoke(splashHandler, (Object[]) null);
} catch (Throwable e) {
// ignore, this is best effort
}
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 1811791d3..86052e822 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,6 +26,7 @@ import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
import java.security.PrivilegedAction;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
@@ -33,6 +34,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
/**
@@ -71,8 +73,8 @@ import java.util.Map;
*
* <p>
* The special action &quot;*&quot; will represent all actions. The
- * <code>resolve</code> action is implied by the <code>class</code>,
- * <code>execute</code> and <code>resource</code> actions.
+ * {@code resolve} action is implied by the {@code class},
+ * {@code execute} and {@code resource} actions.
* <p>
* The name of this permission is a filter expression. The filter gives access
* to the following attributes:
@@ -87,74 +89,74 @@ import java.util.Map;
* Filter attribute names are processed in a case sensitive manner.
*
* @ThreadSafe
- * @version $Revision: 7743 $
+ * @version $Id: 997d856b65726b4ed3c6a626300aa8797e89bc80 $
*/
public final class AdminPermission extends BasicPermission {
static final long serialVersionUID = 307051004521261705L;
/**
- * The action string <code>class</code>. The <code>class</code> action
- * implies the <code>resolve</code> action.
+ * The action string {@code class}. The {@code class} action
+ * implies the {@code resolve} action.
*
* @since 1.3
*/
public final static String CLASS = "class";
/**
- * The action string <code>execute</code>. The <code>execute</code> action
- * implies the <code>resolve</code> action.
+ * The action string {@code execute}. The {@code execute} action
+ * implies the {@code resolve} action.
*
* @since 1.3
*/
public final static String EXECUTE = "execute";
/**
- * The action string <code>extensionLifecycle</code>.
+ * The action string {@code extensionLifecycle}.
*
* @since 1.3
*/
public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
/**
- * The action string <code>lifecycle</code>.
+ * The action string {@code lifecycle}.
*
* @since 1.3
*/
public final static String LIFECYCLE = "lifecycle";
/**
- * The action string <code>listener</code>.
+ * The action string {@code listener}.
*
* @since 1.3
*/
public final static String LISTENER = "listener";
/**
- * The action string <code>metadata</code>.
+ * The action string {@code metadata}.
*
* @since 1.3
*/
public final static String METADATA = "metadata";
/**
- * The action string <code>resolve</code>. The <code>resolve</code> action
- * is implied by the <code>class</code>, <code>execute</code> and
- * <code>resource</code> 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";
/**
- * The action string <code>resource</code>. The <code>resource</code> action
- * implies the <code>resolve</code> action.
+ * The action string {@code resource}. The {@code resource} action
+ * implies the {@code resolve} action.
*
* @since 1.3
*/
public final static String RESOURCE = "resource";
/**
- * The action string <code>startlevel</code>.
+ * The action string {@code startlevel}.
*
* @since 1.3
*/
public final static String STARTLEVEL = "startlevel";
/**
- * The action string <code>context</code>.
+ * The action string {@code context}.
*
* @since 1.4
*/
@@ -210,16 +212,16 @@ public final class AdminPermission extends BasicPermission {
* filter in implies. This is not initialized until necessary, and then
* cached in this object.
*/
- private transient volatile Dictionary properties;
+ private transient volatile Dictionary<String, Object> properties;
/**
* ThreadLocal used to determine if we have recursively called
* getProperties.
*/
- private static final ThreadLocal recurse = new ThreadLocal();
+ private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
/**
- * Creates a new <code>AdminPermission</code> object that matches all
+ * Creates a new {@code AdminPermission} object that matches all
* bundles and has all actions. Equivalent to AdminPermission("*","*");
*/
public AdminPermission() {
@@ -247,14 +249,14 @@ public final class AdminPermission extends BasicPermission {
* Null arguments are equivalent to "*".
*
* @param filter A filter expression that can use signer, location, id, and
- * name keys. A value of &quot;*&quot; or <code>null</code> matches
+ * name keys. A value of &quot;*&quot; or {@code null} matches
* all bundle. Filter attribute names are processed in a case
* sensitive manner.
- * @param actions <code>class</code>, <code>execute</code>,
- * <code>extensionLifecycle</code>, <code>lifecycle</code>,
- * <code>listener</code>, <code>metadata</code>, <code>resolve</code>
- * , <code>resource</code>, <code>startlevel</code> or
- * <code>context</code>. A value of "*" or <code>null</code>
+ * @param actions {@code class}, {@code execute},
+ * {@code extensionLifecycle}, {@code lifecycle},
+ * {@code listener}, {@code metadata}, {@code resolve}
+ * , {@code resource}, {@code startlevel} or
+ * {@code context}. A value of "*" or {@code null}
* indicates all actions.
* @throws IllegalArgumentException If the filter has an invalid syntax.
*/
@@ -265,17 +267,17 @@ public final class AdminPermission extends BasicPermission {
}
/**
- * Creates a new requested <code>AdminPermission</code> object to be used by
- * the code that must perform <code>checkPermission</code>.
- * <code>AdminPermission</code> objects created with this constructor cannot
- * be added to an <code>AdminPermission</code> permission collection.
+ * Creates a new requested {@code AdminPermission} object to be used by
+ * the code that must perform {@code checkPermission}.
+ * {@code AdminPermission} objects created with this constructor cannot
+ * be added to an {@code AdminPermission} permission collection.
*
* @param bundle A bundle.
- * @param actions <code>class</code>, <code>execute</code>,
- * <code>extensionLifecycle</code>, <code>lifecycle</code>,
- * <code>listener</code>, <code>metadata</code>, <code>resolve</code>
- * , <code>resource</code>, <code>startlevel</code>,
- * <code>context</code>. A value of "*" or <code>null</code>
+ * @param actions {@code class}, {@code execute},
+ * {@code extensionLifecycle}, {@code lifecycle},
+ * {@code listener}, {@code metadata}, {@code resolve}
+ * , {@code resource}, {@code startlevel},
+ * {@code context}. A value of "*" or {@code null}
* indicates all actions.
* @since 1.3
*/
@@ -304,7 +306,7 @@ public final class AdminPermission extends BasicPermission {
/**
* Package private constructor used by AdminPermissionCollection.
*
- * @param filter name filter or <code>null</code> for wildcard.
+ * @param filter name filter or {@code null} for wildcard.
* @param mask action mask
*/
AdminPermission(Filter filter, int mask) {
@@ -316,7 +318,7 @@ public final class AdminPermission extends BasicPermission {
/**
* Called by constructors and when deserialized.
*
- * @param filter Permission's filter or <code>null</code> for wildcard.
+ * @param filter Permission's filter or {@code null} for wildcard.
* @param mask action mask
*/
private void setTransients(Filter filter, int mask) {
@@ -341,11 +343,7 @@ public final class AdminPermission extends BasicPermission {
boolean seencomma = false;
int mask = ACTION_NONE;
-
- if (actions == null) {
- return mask;
- }
-
+
char[] a = actions.toCharArray();
int i = a.length - 1;
@@ -559,7 +557,7 @@ 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</code> or equals "*", then <code>null</code> is
+ * {@code null} or equals "*", then {@code null} is
* returned to indicate a wildcard.
* @throws IllegalArgumentException If the filter syntax is invalid.
*/
@@ -589,7 +587,7 @@ public final class AdminPermission extends BasicPermission {
* constructed with a bundle.
*
* <p>
- * This method returns <code>true</code> if the specified permission is an
+ * This method returns {@code true} if the specified permission is an
* AdminPermission AND
* <ul>
* <li>this object's filter matches the specified permission's bundle ID,
@@ -601,13 +599,13 @@ public final class AdminPermission extends BasicPermission {
* actions.
* <p>
* Special case: if the specified permission was constructed with "*"
- * filter, then this method returns <code>true</code> if this object's
+ * 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</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
public boolean implies(Permission p) {
if (!(p instanceof AdminPermission)) {
@@ -632,8 +630,8 @@ public final class AdminPermission extends BasicPermission {
* validated as a proper argument. The requested AdminPermission must
* not have a filter expression.
* @param effective The effective actions with which to start.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
boolean implies0(AdminPermission requested, int effective) {
/* check actions first - much faster */
@@ -653,7 +651,8 @@ public final class AdminPermission extends BasicPermission {
if (requested.bundle == null) {
return false;
}
- Dictionary requestedProperties = requested.getProperties();
+ Dictionary<String, Object> requestedProperties = requested
+ .getProperties();
if (requestedProperties == null) {
/*
* If the requested properties are null, then we have detected a
@@ -668,17 +667,17 @@ public final class AdminPermission extends BasicPermission {
/**
* Returns the canonical string representation of the
- * <code>AdminPermission</code> actions.
+ * {@code AdminPermission} actions.
*
* <p>
- * Always returns present <code>AdminPermission</code> actions in the
- * following order: <code>class</code>, <code>execute</code>,
- * <code>extensionLifecycle</code>, <code>lifecycle</code>,
- * <code>listener</code>, <code>metadata</code>, <code>resolve</code>,
- * <code>resource</code>, <code>startlevel</code>, <code>context</code>.
+ * Always returns present {@code AdminPermission} actions in the
+ * following order: {@code class}, {@code execute},
+ * {@code extensionLifecycle}, {@code lifecycle},
+ * {@code listener}, {@code metadata}, {@code resolve},
+ * {@code resource}, {@code startlevel}, {@code context}.
*
* @return Canonical string representation of the
- * <code>AdminPermission</code> actions.
+ * {@code AdminPermission} actions.
*/
public String getActions() {
String result = actions;
@@ -747,21 +746,21 @@ public final class AdminPermission extends BasicPermission {
}
/**
- * Returns a new <code>PermissionCollection</code> object suitable for
- * storing <code>AdminPermission</code>s.
+ * Returns a new {@code PermissionCollection} object suitable for
+ * storing {@code AdminPermission}s.
*
- * @return A new <code>PermissionCollection</code> object.
+ * @return A new {@code PermissionCollection} object.
*/
public PermissionCollection newPermissionCollection() {
return new AdminPermissionCollection();
}
/**
- * Determines the equality of two <code>AdminPermission</code> objects.
+ * Determines the equality of two {@code AdminPermission} objects.
*
* @param obj The object being compared for equality with this object.
- * @return <code>true</code> if <code>obj</code> is equivalent to this
- * <code>AdminPermission</code>; <code>false</code> otherwise.
+ * @return {@code true} if {@code obj} is equivalent to this
+ * {@code AdminPermission}; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -824,7 +823,7 @@ public final class AdminPermission extends BasicPermission {
}
/**
- * Called by <code>implies0</code> on an AdminPermission which was
+ * Called by {@code implies0} on an AdminPermission which was
* constructed with a Bundle. This method loads a dictionary with the
* filter-matchable properties of this bundle. The dictionary is cached so
* this lookup only happens once.
@@ -834,8 +833,8 @@ public final class AdminPermission extends BasicPermission {
*
* @return a dictionary of properties for this bundle
*/
- private Dictionary getProperties() {
- Dictionary result = properties;
+ private Dictionary<String, Object> getProperties() {
+ Dictionary<String, Object> result = properties;
if (result != null) {
return result;
}
@@ -850,8 +849,9 @@ public final class AdminPermission extends BasicPermission {
}
recurse.set(bundle);
try {
- final Dictionary dict = new Hashtable(4);
- AccessController.doPrivileged(new PrivilegedAction() {
+ final Dictionary<String, Object> dict = new Hashtable<String, Object>(
+ 4);
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
dict.put("id", new Long(bundle.getBundleId()));
dict.put("location", bundle.getLocation());
@@ -875,7 +875,7 @@ public final class AdminPermission extends BasicPermission {
}
/**
- * Stores a collection of <code>AdminPermission</code>s.
+ * Stores a collection of {@code AdminPermission}s.
*/
final class AdminPermissionCollection extends PermissionCollection {
private static final long serialVersionUID = 3906372644575328048L;
@@ -884,7 +884,7 @@ final class AdminPermissionCollection extends PermissionCollection {
*
* @GuardedBy this
*/
- private transient Map permissions;
+ private transient Map<String, AdminPermission> permissions;
/**
* Boolean saying if "*" is in the collection.
@@ -899,17 +899,17 @@ final class AdminPermissionCollection extends PermissionCollection {
*
*/
public AdminPermissionCollection() {
- permissions = new HashMap();
+ permissions = new HashMap<String, AdminPermission>();
}
/**
* Adds a permission to this permission collection.
*
- * @param permission The <code>AdminPermission</code> object to add.
+ * @param permission The {@code AdminPermission} object to add.
* @throws IllegalArgumentException If the specified permission is not an
- * <code>AdminPermission</code> instance or was constructed with a
+ * {@code AdminPermission} instance or was constructed with a
* Bundle object.
- * @throws SecurityException If this <code>AdminPermissionCollection</code>
+ * @throws SecurityException If this {@code AdminPermissionCollection}
* object has been marked read-only.
*/
public void add(Permission permission) {
@@ -928,8 +928,8 @@ final class AdminPermissionCollection extends PermissionCollection {
}
final String name = ap.getName();
synchronized (this) {
- Map pc = permissions;
- AdminPermission existing = (AdminPermission) pc.get(name);
+ Map<String, AdminPermission> pc = permissions;
+ AdminPermission existing = pc.get(name);
if (existing != null) {
int oldMask = existing.action_mask;
int newMask = ap.action_mask;
@@ -952,13 +952,13 @@ final class AdminPermissionCollection extends PermissionCollection {
/**
* Determines if the specified permissions implies the permissions expressed
- * in <code>permission</code>.
+ * in {@code permission}.
*
* @param permission The Permission object to compare with the
- * <code>AdminPermission</code> objects in this collection.
- * @return <code>true</code> if <code>permission</code> is implied by an
- * <code>AdminPermission</code> in this collection,
- * <code>false</code> otherwise.
+ * {@code AdminPermission} objects in this collection.
+ * @return {@code true} if {@code permission} is implied by an
+ * {@code AdminPermission} in this collection,
+ * {@code false} otherwise.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof AdminPermission)) {
@@ -971,12 +971,12 @@ final class AdminPermissionCollection extends PermissionCollection {
return false;
}
int effective = AdminPermission.ACTION_NONE;
- Collection perms;
+ Collection<AdminPermission> perms;
synchronized (this) {
- Map pc = permissions;
+ Map<String, AdminPermission> pc = permissions;
// short circuit if the "*" Permission was added
if (all_allowed) {
- AdminPermission ap = (AdminPermission) pc.get("*");
+ AdminPermission ap = pc.get("*");
if (ap != null) {
effective |= ap.action_mask;
final int desired = requested.action_mask;
@@ -989,8 +989,8 @@ final class AdminPermissionCollection extends PermissionCollection {
}
// just iterate one by one
- for (Iterator iter = perms.iterator(); iter.hasNext();) {
- if (((AdminPermission) iter.next()).implies0(requested, effective)) {
+ for (Iterator<AdminPermission> iter = perms.iterator(); iter.hasNext();) {
+ if (iter.next().implies0(requested, effective)) {
return true;
}
}
@@ -998,13 +998,14 @@ final class AdminPermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all <code>AdminPermission</code> objects in the
+ * Returns an enumeration of all {@code AdminPermission} objects in the
* container.
*
- * @return Enumeration of all <code>AdminPermission</code> objects.
+ * @return Enumeration of all {@code AdminPermission} objects.
*/
- public synchronized Enumeration elements() {
- return Collections.enumeration(permissions.values());
+ public synchronized Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ return Collections.enumeration(all);
}
/* serialization logic */
@@ -1014,19 +1015,21 @@ final class AdminPermissionCollection extends PermissionCollection {
private synchronized void writeObject(ObjectOutputStream out)
throws IOException {
- Hashtable hashtable = new Hashtable(permissions);
+ 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)
+ private synchronized void readObject(java.io.ObjectInputStream in)
throws IOException,
ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
- permissions = new HashMap(hashtable);
+ 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 688f51e5f..9874a4b20 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2010). 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,35 +17,35 @@
package org.osgi.framework;
/**
- * A <code>ServiceEvent</code> listener that does not filter based upon
- * package wiring. <code>AllServiceListener</code> is a listener interface
+ * 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</code> is fired, it is synchronously delivered to an
- * <code>AllServiceListener</code>. The Framework may deliver
- * <code>ServiceEvent</code> objects to an <code>AllServiceListener</code>
+ * {@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</code>.
+ * {@code AllServiceListener}.
* <p>
- * An <code>AllServiceListener</code> object is registered with the Framework
- * using the <code>BundleContext.addServiceListener</code> method.
- * <code>AllServiceListener</code> objects are called with a
- * <code>ServiceEvent</code> object when a service is registered, modified, or
+ * 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</code> object delivery to
- * <code>AllServiceListener</code> objects is filtered by the filter specified
+ * {@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</code>
+ * 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</code>
+ * 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</code> objects,
- * <code>AllServiceListener</code> objects receive all
- * <code>ServiceEvent</code> objects regardless of whether the package source
+ * 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
@@ -55,7 +55,7 @@ package org.osgi.framework;
* @see ServicePermission
* @ThreadSafe
* @since 1.3
- * @version $Revision: 5673 $
+ * @version $Id: 35cee8a49e89b7b222aa3f85e1af0b4a4b550ce6 $
*/
public interface AllServiceListener extends ServiceListener {
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 692bc5eb8..a40bd55c6 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,23 +16,26 @@
package org.osgi.framework;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.cert.X509Certificate;
import java.util.Dictionary;
import java.util.Enumeration;
+import java.util.List;
import java.util.Map;
/**
* An installed bundle in the Framework.
*
* <p>
- * A <code>Bundle</code> object is the access point to define the lifecycle of
+ * 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</code> object.
+ * an associated {@code Bundle} object.
*
* <p>
- * A bundle must have a unique identity, a <code>long</code>, chosen by the
+ * 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.
@@ -54,53 +57,60 @@ import java.util.Map;
*
* <p>
* A bundle should only execute code when its state is one of
- * <code>STARTING</code>,<code>ACTIVE</code>, or <code>STOPPING</code>.
- * An <code>UNINSTALLED</code> bundle can not be set to another state; it is a
+ * {@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</code> objects, and these objects are only valid within the
+ * {@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
- * @version $Revision: 6906 $
+ * @version $Id: d361c5fbfa7af93a2a6a8c97eff4439a747b3a4f $
*/
-public interface Bundle {
+public interface Bundle extends Comparable<Bundle> {
/**
* The bundle is uninstalled and may not be used.
*
* <p>
- * The <code>UNINSTALLED</code> state is only visible after a bundle is
+ * The {@code UNINSTALLED} state is only visible after a bundle is
* uninstalled; the bundle is in an unusable state but references to the
- * <code>Bundle</code> object may still be available and used for
+ * {@code Bundle} object may still be available and used for
* introspection.
* <p>
- * The value of <code>UNINSTALLED</code> is 0x00000001.
+ * The value of {@code UNINSTALLED} is 0x00000001.
*/
- public static final int UNINSTALLED = 0x00000001;
+ int UNINSTALLED = 0x00000001;
/**
* The bundle is installed but not yet resolved.
*
* <p>
- * A bundle is in the <code>INSTALLED</code> state when it has been
+ * A bundle is in the {@code INSTALLED} state when it has been
* installed in the Framework but is not or cannot be resolved.
* <p>
* This state is visible if the bundle's code dependencies are not resolved.
- * The Framework may attempt to resolve an <code>INSTALLED</code> bundle's
- * code dependencies and move the bundle to the <code>RESOLVED</code>
+ * The Framework may attempt to resolve an {@code INSTALLED} bundle's
+ * code dependencies and move the bundle to the {@code RESOLVED}
* state.
* <p>
- * The value of <code>INSTALLED</code> is 0x00000002.
+ * The value of {@code INSTALLED} is 0x00000002.
*/
- public static final int INSTALLED = 0x00000002;
+ int INSTALLED = 0x00000002;
/**
* The bundle is resolved and is able to be started.
*
* <p>
- * A bundle is in the <code>RESOLVED</code> state when the Framework has
+ * A bundle is in the {@code RESOLVED} state when the Framework has
* successfully resolved the bundle's code dependencies. These dependencies
* include:
* <ul>
@@ -116,57 +126,57 @@ public interface Bundle {
* </ul>
* <p>
* Note that the bundle is not active yet. A bundle must be put in the
- * <code>RESOLVED</code> state before it can be started. The Framework may
+ * {@code RESOLVED} state before it can be started. The Framework may
* attempt to resolve a bundle at any time.
* <p>
- * The value of <code>RESOLVED</code> is 0x00000004.
+ * The value of {@code RESOLVED} is 0x00000004.
*/
- public static final int RESOLVED = 0x00000004;
+ int RESOLVED = 0x00000004;
/**
* The bundle is in the process of starting.
*
* <p>
- * A bundle is in the <code>STARTING</code> state when its
+ * 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 {@link BundleActivator#start} is called. If the
- * <code>BundleActivator.start</code> method completes without exception,
+ * {@code BundleActivator.start} method completes without exception,
* then the bundle has successfully started and must move to the
- * <code>ACTIVE</code> state.
+ * {@code ACTIVE} state.
* <p>
* If the bundle has a
* {@link Constants#ACTIVATION_LAZY lazy activation policy}, then the
* bundle may remain in this state for some time until the activation is
* triggered.
* <p>
- * The value of <code>STARTING</code> is 0x00000008.
+ * The value of {@code STARTING} is 0x00000008.
*/
- public static final int STARTING = 0x00000008;
+ int STARTING = 0x00000008;
/**
* The bundle is in the process of stopping.
*
* <p>
- * A bundle is in the <code>STOPPING</code> state when its
+ * 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 {@link BundleActivator#stop} method is called. When the
- * <code>BundleActivator.stop</code> method completes the bundle is
- * stopped and must move to the <code>RESOLVED</code> state.
+ * {@code BundleActivator.stop} method completes the bundle is
+ * stopped and must move to the {@code RESOLVED} state.
* <p>
- * The value of <code>STOPPING</code> is 0x00000010.
+ * The value of {@code STOPPING} is 0x00000010.
*/
- public static final int STOPPING = 0x00000010;
+ int STOPPING = 0x00000010;
/**
* The bundle is now running.
*
* <p>
- * A bundle is in the <code>ACTIVE</code> state when it has been
+ * A bundle is in the {@code ACTIVE} state when it has been
* successfully started and activated.
* <p>
- * The value of <code>ACTIVE</code> is 0x00000020.
+ * The value of {@code ACTIVE} is 0x00000020.
*/
- public static final int ACTIVE = 0x00000020;
+ int ACTIVE = 0x00000020;
/**
* The bundle start operation is transient and the persistent autostart
@@ -181,7 +191,7 @@ public interface Bundle {
* @since 1.4
* @see #start(int)
*/
- public static final int START_TRANSIENT = 0x00000001;
+ int START_TRANSIENT = 0x00000001;
/**
* The bundle start operation must activate the bundle according to the
@@ -197,7 +207,7 @@ public interface Bundle {
* @see Constants#BUNDLE_ACTIVATIONPOLICY
* @see #start(int)
*/
- public static final int START_ACTIVATION_POLICY = 0x00000002;
+ int START_ACTIVATION_POLICY = 0x00000002;
/**
* The bundle stop is transient and the persistent autostart setting of the
@@ -212,7 +222,7 @@ public interface Bundle {
* @since 1.4
* @see #stop(int)
*/
- public static final int STOP_TRANSIENT = 0x00000001;
+ int STOP_TRANSIENT = 0x00000001;
/**
* Request that all certificates used to sign the bundle be returned.
@@ -220,7 +230,7 @@ public interface Bundle {
* @since 1.5
* @see #getSignerCertificates(int)
*/
- public final static int SIGNERS_ALL = 1;
+ int SIGNERS_ALL = 1;
/**
* Request that only certificates used to sign the bundle that are trusted
@@ -229,7 +239,7 @@ public interface Bundle {
* @since 1.5
* @see #getSignerCertificates(int)
*/
- public final static int SIGNERS_TRUSTED = 2;
+ int SIGNERS_TRUSTED = 2;
/**
* Returns this bundle's current state.
@@ -237,24 +247,24 @@ public interface Bundle {
* <p>
* A bundle can be in only one state at any time.
*
- * @return An element of <code>UNINSTALLED</code>,<code>INSTALLED</code>,
- * <code>RESOLVED</code>,<code>STARTING</code>,
- * <code>STOPPING</code>,<code>ACTIVE</code>.
+ * @return An element of {@code UNINSTALLED},{@code INSTALLED},
+ * {@code RESOLVED},{@code STARTING},
+ * {@code STOPPING},{@code ACTIVE}.
*/
- public int getState();
+ int getState();
/**
* Starts this bundle.
*
* <p>
- * If this bundle's state is <code>UNINSTALLED</code> then an
- * <code>IllegalStateException</code> is thrown.
+ * If this bundle's state is {@code UNINSTALLED} then an
+ * {@code IllegalStateException} is thrown.
* <p>
* If the Framework implements the optional Start Level service and the
* current start level is less than this bundle's start level:
* <ul>
* <li>If the {@link #START_TRANSIENT} option is set, then a
- * <code>BundleException</code> is thrown indicating this bundle cannot be
+ * {@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
@@ -271,10 +281,10 @@ public interface Bundle {
* <li>If this bundle is in the process of being activated or deactivated
* then this method must wait for activation or deactivation to complete
* before continuing. If this does not occur in a reasonable time, a
- * <code>BundleException</code> is thrown to indicate this bundle was unable
+ * {@code BundleException} is thrown to indicate this bundle was unable
* to be started.
*
- * <li>If this bundle's state is <code>ACTIVE</code> then this method
+ * <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
@@ -284,71 +294,71 @@ public interface Bundle {
* 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</code>, an attempt is
+ * <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</code> is thrown.
+ * 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:
* <ul>
- * <li>If this bundle's state is <code>STARTING</code> then this method
+ * <li>If this bundle's state is {@code STARTING} then this method
* returns immediately.
- * <li>This bundle's state is set to <code>STARTING</code>.
+ * <li>This bundle's state is set to {@code STARTING}.
* <li>A bundle event of type {@link BundleEvent#LAZY_ACTIVATION} is fired.
* <li>This method returns immediately and the remaining steps will be
* followed when this bundle's activation is later triggered.
* </ul>
* <i></i>
- * <li>This bundle's state is set to <code>STARTING</code>.
+ * <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} method of this bundle's
- * <code>BundleActivator</code>, if one is specified, is called. If the
- * <code>BundleActivator</code> is invalid or throws an exception then:
+ * {@code BundleActivator}, if one is specified, is called. If the
+ * {@code BundleActivator} is invalid or throws an exception then:
* <ul>
- * <li>This bundle's state is set to <code>STOPPING</code>.
+ * <li>This bundle's state is set to {@code STOPPING}.
* <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
* <li>Any services registered by this bundle must be unregistered.
* <li>Any services used by this bundle must be released.
* <li>Any listeners registered by this bundle must be removed.
- * <li>This bundle's state is set to <code>RESOLVED</code>.
+ * <li>This bundle's state is set to {@code RESOLVED}.
* <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.
- * <li>A <code>BundleException</code> is then thrown.
+ * <li>A {@code BundleException} is then thrown.
* </ul>
* <i></i>
- * <li>If this bundle's state is <code>UNINSTALLED</code>, because this
- * bundle was uninstalled while the <code>BundleActivator.start</code>
- * method was running, a <code>BundleException</code> is thrown.
+ * <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</code>.
+ * <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()</code> in &#x007B; <code>INSTALLED</code>,
- * <code>RESOLVED</code> &#x007D; or &#x007B; <code>INSTALLED</code>,
- * <code>RESOLVED</code>, <code>STARTING</code> &#x007D; if this bundle has
+ * <li>{@code getState()} in &#x007B; {@code INSTALLED},
+ * {@code RESOLVED} &#x007D; or &#x007B; {@code INSTALLED},
+ * {@code RESOLVED}, {@code STARTING} &#x007D; if this bundle has
* a lazy activation policy.
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>Bundle autostart setting is modified unless the
* {@link #START_TRANSIENT} option was set.
- * <li><code>getState()</code> in &#x007B; <code>ACTIVE</code> &#x007D;
+ * <li>{@code getState()} in &#x007B; {@code ACTIVE} &#x007D;
* unless the lazy activation policy was used.
- * <li><code>BundleActivator.start()</code> has been called and did not
+ * <li>{@code BundleActivator.start()} has been called and did not
* throw an exception unless the lazy activation policy was used.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
* <li>Depending on when the exception occurred, bundle autostart setting is
* modified unless the {@link #START_TRANSIENT} option was set.
- * <li><code>getState()</code> not in &#x007B; <code>STARTING</code>,
- * <code>ACTIVE</code> &#x007D;.
+ * <li>{@code getState()} not in &#x007B; {@code STARTING},
+ * {@code ACTIVE} &#x007D;.
* </ul>
*
* @param options The options for starting this bundle. See
@@ -356,35 +366,35 @@ public interface Bundle {
* Framework must ignore unrecognized options.
* @throws BundleException If this bundle could not be started. This could
* be because a code dependency could not be resolved or the
- * specified <code>BundleActivator</code> could not be loaded or
+ * specified {@code BundleActivator} could not be loaded or
* threw an exception or this bundle is a fragment.
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @since 1.4
*/
- public void start(int options) throws BundleException;
+ void start(int options) throws BundleException;
/**
* Starts this bundle with no options.
*
* <p>
- * This method performs the same function as calling <code>start(0)</code>.
+ * This method performs the same function as calling {@code start(0)}.
*
* @throws BundleException If this bundle could not be started. This could
* be because a code dependency could not be resolved or the
- * specified <code>BundleActivator</code> could not be loaded or
+ * specified {@code BundleActivator} could not be loaded or
* threw an exception or this bundle is a fragment.
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #start(int)
*/
- public void start() throws BundleException;
+ void start() throws BundleException;
/**
* Stops this bundle.
@@ -392,57 +402,57 @@ public interface Bundle {
* <p>
* The following steps are required to stop a bundle:
* <ol>
- * <li>If this bundle's state is <code>UNINSTALLED</code> then an
- * <code>IllegalStateException</code> is thrown.
+ * <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
- * <code>BundleException</code> is thrown to indicate this bundle was unable
+ * {@code BundleException} is thrown to indicate this bundle was unable
* to be stopped.
* <li>If the {@link #STOP_TRANSIENT} option is not set then then set this
* bundle's persistent autostart setting to to <em>Stopped</em>. When the
* Framework is restarted and this bundle's autostart setting is
* <em>Stopped</em>, this bundle must not be automatically started.
*
- * <li>If this bundle's state is not <code>STARTING</code> or
- * <code>ACTIVE</code> then this method returns immediately.
+ * <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</code>.
+ * <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</code> prior to setting the
- * state to <code>STOPPING</code>, the {@link BundleActivator#stop} method
- * of this bundle's <code>BundleActivator</code>, if one is specified, is
+ * <li>If this bundle's state was {@code ACTIVE} prior to setting the
+ * state to {@code STOPPING}, the {@link BundleActivator#stop} 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</code> must be thrown after
+ * 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</code>, because this
- * bundle was uninstalled while the <code>BundleActivator.stop</code> method
- * was running, a <code>BundleException</code> must be thrown.
+ * <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</code>.
+ * <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()</code> in &#x007B; <code>ACTIVE</code> &#x007D;.
+ * <li>{@code getState()} in &#x007B; {@code ACTIVE} &#x007D;.
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
* <li>Bundle autostart setting is modified unless the
* {@link #STOP_TRANSIENT} option was set.
- * <li><code>getState()</code> not in &#x007B; <code>ACTIVE</code>,
- * <code>STOPPING</code> &#x007D;.
- * <li><code>BundleActivator.stop</code> has been called and did not throw
+ * <li>{@code getState()} not in &#x007B; {@code ACTIVE},
+ * {@code STOPPING} &#x007D;.
+ * <li>{@code BundleActivator.stop} has been called and did not throw
* an exception.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
@@ -451,108 +461,107 @@ public interface Bundle {
* {@link #STOP_TRANSIENT} option was set.
* </ul>
*
- * @param options The options for stoping this bundle. See
+ * @param options The options for stopping this bundle. See
* {@link #STOP_TRANSIENT}. The Framework must ignore unrecognized
* options.
- * @throws BundleException If this bundle's <code>BundleActivator</code>
+ * @throws BundleException If this bundle's {@code BundleActivator}
* threw an exception or this bundle is a fragment.
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @since 1.4
*/
- public void stop(int options) throws BundleException;
+ void stop(int options) throws BundleException;
/**
* Stops this bundle with no options.
*
* <p>
- * This method performs the same function as calling <code>stop(0)</code>.
+ * This method performs the same function as calling {@code stop(0)}.
*
- * @throws BundleException If this bundle's <code>BundleActivator</code>
+ * @throws BundleException If this bundle's {@code BundleActivator}
* threw an exception or this bundle is a fragment.
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #start(int)
*/
- public void stop() throws BundleException;
+ void stop() throws BundleException;
/**
- * Updates this bundle from an <code>InputStream</code>.
+ * Updates this bundle from an {@code InputStream}.
*
* <p>
- * If the specified <code>InputStream</code> is <code>null</code>, the
- * Framework must create the <code>InputStream</code> from which to read the
+ * 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</code>, it must be stopped before
+ * 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 not be updated. Instead, the previous package
- * version must remain exported until the
- * <code>PackageAdmin.refreshPackages</code> method has been has been called
+ * bundle, these packages must remain exported until the
+ * {@code PackageAdmin.refreshPackages} 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</code> then an
- * <code>IllegalStateException</code> is thrown.
+ * <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>, <code>STARTING</code>
- * or <code>STOPPING</code>, this bundle is stopped as described in the
- * <code>Bundle.stop</code> method. If <code>Bundle.stop</code> throws an
+ * <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</code> must be thrown after completion of the
+ * {@code BundleException} must be thrown after completion of the
* remaining steps.
*
- * <li>This bundle's state is set to <code>INSTALLED</code>.
+ * <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</code>, the
- * updated bundle is started as described in the <code>Bundle.start</code>
- * method. If <code>Bundle.start</code> throws an exception, a Framework
+ * <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()</code> not in &#x007B; <code>UNINSTALLED</code>
+ * <li>{@code getState()} not in &#x007B; {@code UNINSTALLED}
* &#x007D;.
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li><code>getState()</code> in &#x007B; <code>INSTALLED</code>,
- * <code>RESOLVED</code>, <code>ACTIVE</code> &#x007D;.
+ * <li>{@code getState()} in &#x007B; {@code INSTALLED},
+ * {@code RESOLVED}, {@code ACTIVE} &#x007D;.
* <li>This bundle has been updated.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li><code>getState()</code> in &#x007B; <code>INSTALLED</code>,
- * <code>RESOLVED</code>, <code>ACTIVE</code> &#x007D;.
+ * <li>{@code getState()} in &#x007B; {@code INSTALLED},
+ * {@code RESOLVED}, {@code ACTIVE} &#x007D;.
* <li>Original bundle is still used; no update occurred.
* </ul>
*
- * @param input The <code>InputStream</code> from which to read the new
- * bundle or <code>null</code> to indicate the Framework must create
+ * @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 Bundle-UpdateLocation}
* Manifest header, if present, or this bundle's original location.
@@ -563,31 +572,31 @@ public interface Bundle {
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code> for both the current
+ * {@code AdminPermission[this,LIFECYCLE]} for both the current
* bundle and the updated bundle, and the Java Runtime Environment
* supports permissions.
* @see #stop()
* @see #start()
*/
- public void update(InputStream input) throws BundleException;
+ void update(InputStream input) throws BundleException;
/**
* Updates this bundle.
*
* <p>
* This method performs the same function as calling
- * {@link #update(InputStream)} with a <code>null</code> InputStream.
+ * {@link #update(InputStream)} with a {@code null} InputStream.
*
* @throws BundleException If the update fails.
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code> for both the current
+ * {@code AdminPermission[this,LIFECYCLE]} for both the current
* bundle and the updated bundle, and the Java Runtime Environment
* supports permissions.
* @see #update(InputStream)
*/
- public void update() throws BundleException;
+ void update() throws BundleException;
/**
* Uninstalls this bundle.
@@ -595,28 +604,28 @@ public interface 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</code> state. The Framework must remove any resources
+ * {@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
- * <code>PackageAdmin.refreshPackages</code> method has been called or the
+ * {@code PackageAdmin.refreshPackages} 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</code> then an
- * <code>IllegalStateException</code> is thrown.
+ * <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>, <code>STARTING</code>
- * or <code>STOPPING</code>, this bundle is stopped as described in the
- * <code>Bundle.stop</code> method. If <code>Bundle.stop</code> throws an
+ * <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</code>.
+ * <li>This bundle's state is set to {@code UNINSTALLED}.
*
* <li>A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.
*
@@ -626,18 +635,18 @@ public interface Bundle {
*
* <b>Preconditions </b>
* <ul>
- * <li><code>getState()</code> not in &#x007B; <code>UNINSTALLED</code>
+ * <li>{@code getState()} not in &#x007B; {@code UNINSTALLED}
* &#x007D;.
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li><code>getState()</code> in &#x007B; <code>UNINSTALLED</code>
+ * <li>{@code getState()} in &#x007B; {@code UNINSTALLED}
* &#x007D;.
* <li>This bundle has been uninstalled.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li><code>getState()</code> not in &#x007B; <code>UNINSTALLED</code>
+ * <li>{@code getState()} not in &#x007B; {@code UNINSTALLED}
* &#x007D;.
* <li>This Bundle has not been uninstalled.
* </ul>
@@ -648,11 +657,11 @@ public interface Bundle {
* @throws IllegalStateException If this bundle has been uninstalled or this
* bundle tries to change its own state.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
* @see #stop()
*/
- public void uninstall() throws BundleException;
+ void uninstall() throws BundleException;
/**
* Returns this bundle's Manifest headers and values. This method returns
@@ -661,7 +670,7 @@ public interface Bundle {
*
* <p>
* Manifest header names are case-insensitive. The methods of the returned
- * <code>Dictionary</code> object must operate on header names in a
+ * {@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
@@ -684,16 +693,16 @@ public interface Bundle {
*
* <p>
* This method must continue to return Manifest header information while
- * this bundle is in the <code>UNINSTALLED</code> state.
+ * this bundle is in the {@code UNINSTALLED} state.
*
- * @return A <code>Dictionary</code> object containing this bundle's
+ * @return A {@code Dictionary} object containing this bundle's
* Manifest headers and values.
* @throws SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,METADATA]</code>, and
+ * appropriate {@code AdminPermission[this,METADATA]}, and
* the Java Runtime Environment supports permissions.
* @see Constants#BUNDLE_LOCALIZATION
*/
- public Dictionary/* <String,String> */getHeaders();
+ Dictionary<String, String> getHeaders();
/**
* Returns this bundle's unique identifier. This bundle is assigned a unique
@@ -704,7 +713,7 @@ public interface Bundle {
* A bundle's unique identifier has the following attributes:
* <ul>
* <li>Is unique and persistent.
- * <li>Is a <code>long</code>.
+ * <li>Is a {@code long}.
* <li>Its value is not reused for another bundle, even after a bundle is
* uninstalled.
* <li>Does not change while a bundle remains installed.
@@ -713,41 +722,41 @@ public interface Bundle {
*
* <p>
* This method must continue to return this bundle's unique identifier while
- * this bundle is in the <code>UNINSTALLED</code> state.
+ * this bundle is in the {@code UNINSTALLED} state.
*
* @return The unique identifier of this bundle.
*/
- public long getBundleId();
+ long getBundleId();
/**
* Returns this bundle's location identifier.
*
* <p>
* The location identifier is the location passed to
- * <code>BundleContext.installBundle</code> when a bundle is installed.
+ * {@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</code> state.
+ * 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]</code>, and
+ * appropriate {@code AdminPermission[this,METADATA]}, and
* the Java Runtime Environment supports permissions.
*/
- public String getLocation();
+ String getLocation();
/**
- * Returns this bundle's <code>ServiceReference</code> list for all
- * services it has registered or <code>null</code> if this bundle has no
+ * 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</code>
+ * 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</code> to get the service using at
+ * has the {@code ServicePermission} to get the service using at
* least one of the named classes the service was registered under.
*
* <p>
@@ -755,26 +764,26 @@ public interface Bundle {
* Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
*
- * @return An array of <code>ServiceReference</code> objects or
- * <code>null</code>.
+ * @return An array of {@code ServiceReference} objects or
+ * {@code null}.
* @throws IllegalStateException If this bundle has been
* uninstalled.
* @see ServiceRegistration
* @see ServiceReference
* @see ServicePermission
*/
- public ServiceReference[] getRegisteredServices();
+ ServiceReference< ? >[] getRegisteredServices();
/**
- * Returns this bundle's <code>ServiceReference</code> list for all
- * services it is using or returns <code>null</code> if this bundle is not
+ * 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</code> object to a service is included in the
- * returned list only if the caller has the <code>ServicePermission</code>
+ * {@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>
@@ -782,73 +791,73 @@ public interface Bundle {
* Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
*
- * @return An array of <code>ServiceReference</code> objects or
- * <code>null</code>.
+ * @return An array of {@code ServiceReference} objects or
+ * {@code null}.
* @throws IllegalStateException If this bundle has been
* uninstalled.
* @see ServiceReference
* @see ServicePermission
*/
- public 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</code>.
+ * always returns {@code true}.
* <p>
- * <code>permission</code> is of type <code>Object</code> to avoid
- * referencing the <code>java.security.Permission</code> class directly.
+ * {@code permission} is of type {@code Object} to avoid
+ * referencing the {@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</code>; that is, they must share
+ * {@code java.security.ProtectionDomain}; that is, they must share
* the same set of permissions.
*
* @param permission The permission to verify.
- * @return <code>true</code> if this bundle has the specified permission
+ * @return {@code true} if this bundle has the specified permission
* or the permissions possessed by this bundle imply the specified
- * permission; <code>false</code> if this bundle does not have the
- * specified permission or <code>permission</code> is not an
- * <code>instanceof</code> <code>java.security.Permission</code>.
+ * permission; {@code false} if this bundle does not have the
+ * specified permission or {@code permission} is not an
+ * {@code instanceof} {@code java.security.Permission}.
* @throws IllegalStateException If this bundle has been
* uninstalled.
*/
- public boolean hasPermission(Object permission);
+ 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</code>, this method
+ * resource. If this bundle's state is {@code INSTALLED}, this method
* must attempt to resolve this bundle before attempting to get the
* specified resource. If this bundle cannot be resolved, then only this
* bundle must be searched for the specified resource. Imported packages
* cannot be searched when this bundle has not been resolved. If this bundle
- * is a fragment bundle then <code>null</code> is returned.
+ * is a fragment bundle then {@code null} is returned.
* <p>
* 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</code> for a description of the
+ * {@code ClassLoader.getResource} for a description of the
* format of a resource name.
- * @return A URL to the named resource, or <code>null</code> if the resource
+ * @return A URL to the named resource, 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]</code>, and the Java Runtime
+ * {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
* Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
* @see #getEntry
* @see #findEntries
* @since 1.1
*/
- public URL getResource(String name);
+ URL getResource(String name);
/**
* Returns this bundle's Manifest headers and values localized to the
@@ -856,7 +865,7 @@ public interface Bundle {
*
* <p>
* This method performs the same function as
- * <code>Bundle.getHeaders()</code> except the manifest header values are
+ * {@code Bundle.getHeaders()} except the manifest header values are
* localized to the specified locale.
*
* <p>
@@ -875,13 +884,13 @@ public interface Bundle {
* bn
* </pre>
*
- * Where <code>bn</code> is this bundle's localization basename,
- * <code>Ls</code>, <code>Cs</code> and <code>Vs</code> are the
- * specified locale (language, country, variant) and <code>Ld</code>,
- * <code>Cd</code> and <code>Vd</code> are the default locale (language,
+ * 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</code> is specified as the locale string, the header
+ * 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
@@ -891,109 +900,109 @@ public interface Bundle {
*
* <p>
* This method must continue to return Manifest header information while
- * this bundle is in the <code>UNINSTALLED</code> state, however the
+ * 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</code> then the
- * locale returned by <code>java.util.Locale.getDefault</code> is
+ * localized. If the specified locale is {@code null} then the
+ * locale returned by {@code java.util.Locale.getDefault} is
* used. If the specified locale is the empty string, this method
* will return the raw (unlocalized) manifest headers including any
* leading &quot;%&quot;.
- * @return A <code>Dictionary</code> object containing this bundle's
+ * @return A {@code Dictionary} object containing this bundle's
* Manifest headers and values.
* @throws SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,METADATA]</code>, and
+ * appropriate {@code AdminPermission[this,METADATA]}, and
* the Java Runtime Environment supports permissions.
* @see #getHeaders()
* @see Constants#BUNDLE_LOCALIZATION
* @since 1.3
*/
- public Dictionary/* <String,String> */getHeaders(String locale);
+ Dictionary<String, String> getHeaders(String locale);
/**
* Returns the symbolic name of this bundle as specified by its
- * <code>Bundle-SymbolicName</code> manifest header. The bundle symbolic
+ * {@code Bundle-SymbolicName} manifest header. The bundle symbolic
* name together with a version must identify a unique bundle. 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</code> state.
+ * this bundle is in the {@code UNINSTALLED} state.
*
- * @return The symbolic name of this bundle or <code>null</code> if this
+ * @return The symbolic name of this bundle or {@code null} if this
* bundle does not have a symbolic name.
* @since 1.3
*/
- public String getSymbolicName();
+ String getSymbolicName();
/**
* 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</code>.
+ * {@code ClassNotFoundException}.
*
* <p>
- * If this bundle's state is <code>INSTALLED</code>, this method must
+ * 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</code> with details of the reason this bundle
+ * {@code BundleException} with details of the reason this bundle
* could not be resolved. This method must then throw a
- * <code>ClassNotFoundException</code>.
+ * {@code ClassNotFoundException}.
*
* <p>
- * If this bundle's state is <code>UNINSTALLED</code>, then an
- * <code>IllegalStateException</code> is thrown.
+ * 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 bundle is a fragment bundle or if the caller does not
- * have the appropriate <code>AdminPermission[this,CLASS]</code>,
+ * have the appropriate {@code AdminPermission[this,CLASS]},
* and the Java Runtime Environment supports permissions.
* @throws IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
*/
- public 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</code>, this method
+ * resources. If this bundle's state is {@code INSTALLED}, this method
* must attempt to resolve this bundle before attempting to get the
* specified resources. If this bundle cannot be resolved, then only this
* bundle must be searched for the specified resources. Imported packages
* cannot be searched when a bundle has not been resolved. If this bundle is
- * a fragment bundle then <code>null</code> is returned.
+ * a fragment bundle then {@code null} is returned.
* <p>
* 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</code> for a description of the
+ * {@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</code> if the resource could not be found or if this
+ * {@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]</code>, and 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
*/
- public Enumeration/* <URL> */getResources(String name) throws IOException;
+ Enumeration<URL> getResources(String name) throws IOException;
/**
- * Returns an Enumeration of all the paths (<code>String</code> objects)
+ * Returns an Enumeration of all the paths ({@code String} objects)
* to entries within this bundle whose longest sub-path matches the
* specified path. This bundle's class loader is not used to search for
* entries. Only the contents of this bundle are searched.
@@ -1011,16 +1020,16 @@ public interface Bundle {
* not contain directory entries.
*
* @param path The path name for which to return entry paths.
- * @return An Enumeration of the entry paths (<code>String</code>
- * objects) or <code>null</code> if no entry could be found or if
+ * @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 have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code> and the Java
+ * {@code AdminPermission[this,RESOURCE]} and the Java
* Runtime Environment supports permissions.
* @throws IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
*/
- public Enumeration/* <String> */getEntryPaths(String path);
+ Enumeration<String> getEntryPaths(String path);
/**
* Returns a URL to the entry at the specified path in this bundle. This
@@ -1036,15 +1045,15 @@ public interface Bundle {
* not contain directory entries.
*
* @param path The path name of the entry.
- * @return A URL to the entry, or <code>null</code> if no entry could be
+ * @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]</code> and the Java
+ * {@code AdminPermission[this,RESOURCE]} and the Java
* Runtime Environment supports permissions.
* @throws IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
*/
- public URL getEntry(String path);
+ URL getEntry(String path);
/**
* Returns the time when this bundle was last modified. A bundle is
@@ -1057,15 +1066,15 @@ public interface Bundle {
* @return The time when this bundle was last modified.
* @since 1.3
*/
- public long getLastModified();
+ long getLastModified();
/**
* Returns entries in this bundle and its attached fragments. This bundle's
* class loader is not used to search for entries. Only the contents of this
* bundle and its attached fragments are searched for the specified entries.
*
- * If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve this bundle before attempting to find entries.
+ * If this bundle's state is {@code INSTALLED}, this method must attempt to
+ * resolve this bundle before attempting to find entries.
*
* <p>
* This method is intended to be used to obtain configuration, setup,
@@ -1111,44 +1120,44 @@ public interface Bundle {
* using the wildcard character (&quot;*&quot;). If null is
* specified, this is equivalent to &quot;*&quot; and matches all
* files.
- * @param recurse If <code>true</code>, recurse into subdirectories.
- * Otherwise only return entries from the specified path.
+ * @param recurse If {@code true}, recurse into subdirectories. Otherwise
+ * only return entries from the specified path.
* @return An enumeration of URL objects for each matching entry, or
- * <code>null</code> if an entry could not be found or if the caller
- * does not have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code>, and the Java Runtime
+ * {@code null} if no matching entry could not be found or if the
+ * caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
* Environment supports permissions. The URLs are sorted such that
* entries from this bundle are returned first followed by the
- * entries from attached fragments in ascending bundle id order. If
- * this bundle is a fragment, then only matching entries in this
- * fragment are returned.
+ * entries from attached fragments in attachment order. If this
+ * bundle is a fragment, then only matching entries in this fragment
+ * are returned.
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
- public Enumeration/* <URL> */findEntries(String path, String filePattern,
+ Enumeration<URL> findEntries(String path, String filePattern,
boolean recurse);
/**
* Returns this bundle's {@link BundleContext}. The returned
- * <code>BundleContext</code> can be used by the caller to act on behalf
+ * {@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</code>. This method will
- * return <code>null</code> if this bundle has no valid
- * <code>BundleContext</code>.
+ * bundle has no valid {@code BundleContext}. This method will
+ * return {@code null} if this bundle has no valid
+ * {@code BundleContext}.
*
- * @return A <code>BundleContext</code> for this bundle or
- * <code>null</code> if this bundle has no valid
- * <code>BundleContext</code>.
+ * @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 <code>AdminPermission[this,CONTEXT]</code>, and
+ * appropriate {@code AdminPermission[this,CONTEXT]}, and
* the Java Runtime Environment supports permissions.
* @since 1.4
*/
- public BundleContext getBundleContext();
+ BundleContext getBundleContext();
/**
* Return the certificates for the signers of this bundle and the
@@ -1158,37 +1167,81 @@ public interface Bundle {
* on all signers of this bundle is returned. If
* {@link #SIGNERS_TRUSTED} is specified, then only information on
* the signers of this bundle trusted by the framework is returned.
- * @return The <code>X509Certificate</code>s for the signers of this bundle
- * and the <code>X509Certificate</code> chains for those signers.
- * The keys of the <code>Map</code> are the
- * <code>X509Certificate</code>s of the signers of this bundle. The
- * value for a key is a <code>List</code> containing the
- * <code>X509Certificate</code> chain for the signer. The first item
- * in the <code>List</code> is the signer's
- * <code>X509Certificate</code> which is then followed by the rest
- * of the <code>X509Certificate</code> chain. The returned
- * <code>Map</code> will be empty if there are no signers. The
- * returned <code>Map</code> is the property of the caller who is
+ * @return The {@code X509Certificate}s for the signers of this bundle
+ * and the {@code X509Certificate} chains for those signers.
+ * The keys of the {@code Map} are the
+ * {@code X509Certificate}s of the signers of this bundle. The
+ * value for a key is a {@code List} containing the
+ * {@code X509Certificate} chain for the signer. The first item
+ * in the {@code List} is the signer's
+ * {@code X509Certificate} which is then followed by the rest
+ * of the {@code X509Certificate} chain. The returned
+ * {@code Map} will be empty if there are no signers. The
+ * returned {@code Map} is the property of the caller who is
* free to modify it.
* @throws IllegalArgumentException If the specified
- * <code>signersType</code> is not {@link #SIGNERS_ALL} or
+ * {@code signersType} is not {@link #SIGNERS_ALL} or
* {@link #SIGNERS_TRUSTED}.
* @since 1.5
*/
- public Map/* <X509Certificate, List<X509Certificate>> */getSignerCertificates(
+ Map<X509Certificate, List<X509Certificate>> getSignerCertificates(
int signersType);
/**
* Returns the version of this bundle as specified by its
- * <code>Bundle-Version</code> manifest header. If this bundle does not have a
+ * {@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</code> state.
+ * this bundle is in the {@code UNINSTALLED} state.
*
* @return The version of this bundle.
* @since 1.5
*/
- public Version getVersion();
+ Version getVersion();
+
+ /**
+ * Adapt a bundle to the specifed type.
+ *
+ * <p>
+ * Adapting a bundle to the specified type may require certain checks,
+ * including security checks, to succeed. If a check does not succeed, then
+ * the bundle cannot be adapted and {@code null} is returned.
+ *
+ * @param <A> The type to which the bundle is to be adapted.
+ * @param type Class object for the type to which the bundle is to be
+ * adapted.
+ * @return The object, of the specified type, to which the bundle has been
+ * adapted or {@code null} if the bundle cannot be adapted to
+ * the specifed type.
+ * @since 1.6
+ */
+ <A> A adapt(Class<A> type);
+
+ /**
+ * Creates a {@code File} object for a file in the persistent storage area
+ * 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
+ * this bundle is a fragment bundle.
+ * @throws IllegalStateException If this bundle has been uninstalled.
+ * @since 1.6
+ */
+ File getDataFile(String filename);
}
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 56660b1b9..aefb0360a 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,33 @@ package org.osgi.framework;
/**
* Customizes the starting and stopping of a bundle.
* <p>
- * <code>BundleActivator</code> is an interface that may be implemented when a
+ * {@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</code> as required. If an instance's
- * <code>BundleActivator.start</code> method executes successfully, it is
- * guaranteed that the same instance's <code>BundleActivator.stop</code>
+ * 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</code> object.
+ * not concurrently call a {@code BundleActivator} object.
*
* <p>
- * <code>BundleActivator</code> is specified through the
- * <code>Bundle-Activator</code> Manifest header. A bundle can only specify a
- * single <code>BundleActivator</code> in the Manifest file. Fragment bundles
- * must not have a <code>BundleActivator</code>. The form of the Manifest
+ * {@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></code>
+ * {@code Bundle-Activator: <i>class-name</i>}
*
* <p>
- * where <code><i>class-name</i></code> is a fully qualified Java classname.
+ * where {@code <i>class-name</i>} is a fully qualified Java classname.
* <p>
- * The specified <code>BundleActivator</code> class must have a public
- * constructor that takes no parameters so that a <code>BundleActivator</code>
- * object can be created by <code>Class.newInstance()</code>.
+ * 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 $Revision: 6361 $
+ * @version $Id: 1b73057bd270ab07f0a16430dba16e5132eea24f $
*/
public interface BundleActivator {
@@ -69,7 +69,7 @@ public interface BundleActivator {
/**
* 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</code>
+ * 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.
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 44b38012e..1ba84da3a 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.osgi.framework;
import java.io.File;
import java.io.InputStream;
+import java.util.Collection;
import java.util.Dictionary;
/**
@@ -26,100 +27,103 @@ import java.util.Dictionary;
* Framework.
*
* <p>
- * <code>BundleContext</code> methods allow a bundle to:
+ * {@code BundleContext} methods allow a bundle to:
* <ul>
* <li>Subscribe to events published by the Framework.
* <li>Register service objects with the Framework service registry.
- * <li>Retrieve <code>ServiceReferences</code> from the Framework service
- * registry.
+ * <li>Retrieve {@code ServiceReferences} from the Framework service registry.
* <li>Get and release service objects for a referenced service.
* <li>Install new bundles in the Framework.
* <li>Get the list of bundles installed in the Framework.
* <li>Get the {@link Bundle} object for a bundle.
- * <li>Create <code>File</code> objects for files in a persistent storage
- * area provided for the bundle by the Framework.
+ * <li>Create {@code File} objects for files in a persistent storage area
+ * provided for the bundle by the Framework.
* </ul>
*
* <p>
- * A <code>BundleContext</code> object will be created and provided to the
- * bundle associated with this context when it is started using the
- * {@link BundleActivator#start} method. The same <code>BundleContext</code>
- * object will be passed to the bundle associated with this context when it is
- * stopped using the {@link BundleActivator#stop} method. A
- * <code>BundleContext</code> object is generally for the private use of its
- * associated bundle and is not meant to be shared with other bundles in the
- * OSGi environment.
+ * A {@code BundleContext} object will be created and provided to the bundle
+ * associated with this context when it is started using the
+ * {@link BundleActivator#start} method. The same {@code BundleContext} object
+ * will be passed to the bundle associated with this context when it is stopped
+ * using the {@link BundleActivator#stop} method. A {@code BundleContext} object
+ * is generally for the private use of its associated bundle and is not meant to
+ * be shared with other bundles in the OSGi environment.
*
* <p>
- * The <code>Bundle</code> object associated with a <code>BundleContext</code>
- * object is called the <em>context bundle</em>.
+ * The {@code Bundle} object associated with a {@code BundleContext} object is
+ * called the <em>context bundle</em>.
*
* <p>
- * The <code>BundleContext</code> object is only valid during the execution of
- * its context bundle; that is, during the period from when the context bundle
- * is in the <code>STARTING</code>, <code>STOPPING</code>, and
- * <code>ACTIVE</code> bundle states. If the <code>BundleContext</code>
- * object is used subsequently, an <code>IllegalStateException</code> must be
- * thrown. The <code>BundleContext</code> object must never be reused after
- * its context bundle is stopped.
+ * The {@code BundleContext} object is only valid during the execution of its
+ * context bundle; that is, during the period from when the context bundle is in
+ * the {@code STARTING}, {@code STOPPING}, and {@code ACTIVE} bundle states. If
+ * the {@code BundleContext} object is used subsequently, an
+ * {@code IllegalStateException} must be thrown. The {@code BundleContext}
+ * object must never be reused after its context bundle is stopped.
*
* <p>
- * The Framework is the only entity that can create <code>BundleContext</code>
+ * The Framework is the only entity that can create {@code BundleContext}
* objects and they are only valid within the Framework that created them.
*
+ * <p>
+ * A {@link Bundle} can be {@link Bundle#adapt(Class) adapted} to its
+ * {@code BundleContext}. In order for this to succeed, the caller must have the
+ * appropriate {@code AdminPermission[bundle,CONTEXT]} if the Java Runtime
+ * Environment supports permissions.
+ *
* @ThreadSafe
- * @version $Revision: 6781 $
+ * @version $Id: 6db49f97510449b2ed2203ef0565c003a6734fa5 $
*/
-public interface BundleContext {
+public interface BundleContext extends BundleReference {
+
/**
* Returns the value of the specified property. If the key is not found in
* the Framework properties, the system properties are then searched. The
- * method returns <code>null</code> if the property is not found.
+ * method returns {@code null} if the property is not found.
*
* <p>
* All bundles must have permission to read properties whose names start
* with &quot;org.osgi.&quot;.
*
* @param key The name of the requested property.
- * @return The value of the requested property, or <code>null</code> if the
+ * @return The value of the requested property, or {@code null} if the
* property is undefined.
* @throws SecurityException If the caller does not have the appropriate
- * <code>PropertyPermission</code> to read the property, and the
- * Java Runtime Environment supports permissions.
+ * {@code PropertyPermission} to read the property, and the Java
+ * Runtime Environment supports permissions.
*/
- public String getProperty(String key);
+ String getProperty(String key);
/**
- * Returns the <code>Bundle</code> object associated with this
- * <code>BundleContext</code>. This bundle is called the context bundle.
+ * Returns the {@code Bundle} object associated with this
+ * {@code BundleContext}. This bundle is called the context bundle.
*
- * @return The <code>Bundle</code> object associated with this
- * <code>BundleContext</code>.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return The {@code Bundle} object associated with this
+ * {@code BundleContext}.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public Bundle getBundle();
+ Bundle getBundle();
/**
- * Installs a bundle from the specified <code>InputStream</code> object.
+ * Installs a bundle from the specified {@code InputStream} object.
*
* <p>
- * If the specified <code>InputStream</code> is <code>null</code>, the
- * Framework must create the <code>InputStream</code> from which to read the
- * bundle by interpreting, in an implementation dependent manner, the
- * specified <code>location</code>.
+ * If the specified {@code InputStream} is {@code null}, the Framework must
+ * create the {@code InputStream} from which to read the bundle by
+ * interpreting, in an implementation dependent manner, the specified
+ * {@code location}.
*
* <p>
- * The specified <code>location</code> identifier will be used as the
- * identity of the bundle. Every installed bundle is uniquely identified by
- * its location identifier which is typically in the form of a URL.
+ * The specified {@code location} identifier will be used as the identity of
+ * the bundle. Every installed bundle is uniquely identified by its location
+ * identifier which is typically in the form of a URL.
*
* <p>
* The following steps are required to install a bundle:
* <ol>
* <li>If a bundle containing the same location identifier is already
- * installed, the <code>Bundle</code> object for that bundle is returned.
+ * installed, the {@code Bundle} object for that bundle is returned.
*
* <li>The bundle's content is read from the input stream. If this fails, a
* {@link BundleException} is thrown.
@@ -127,71 +131,73 @@ public interface BundleContext {
* <li>The bundle's associated resources are allocated. The associated
* resources minimally consist of a unique identifier and a persistent
* storage area if the platform has file system support. If this step fails,
- * a <code>BundleException</code> is thrown.
+ * a {@code BundleException} is thrown.
*
- * <li>The bundle's state is set to <code>INSTALLED</code>.
+ * <li>The bundle's state is set to {@code INSTALLED}.
*
* <li>A bundle event of type {@link BundleEvent#INSTALLED} is fired.
*
- * <li>The <code>Bundle</code> object for the newly or previously installed
+ * <li>The {@code Bundle} object for the newly or previously installed
* bundle is returned.
* </ol>
*
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li><code>getState()</code> in &#x007B; <code>INSTALLED</code>,
- * <code>RESOLVED</code> &#x007D;.
+ * <li>{@code getState()} in &#x007B; {@code INSTALLED}, {@code RESOLVED}
+ * &#x007D;.
* <li>Bundle has a unique ID.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li>Bundle is not installed and no trace of the bundle exists.
+ * <li>Bundle is not installed. If there was an existing bundle for the
+ * specified location, then that bundle must still be in the state it was
+ * prior to calling this method.</li>
* </ul>
*
* @param location The location identifier of the bundle to install.
- * @param input The <code>InputStream</code> object from which this bundle
- * will be read or <code>null</code> to indicate the Framework must
- * create the input stream from the specified location identifier.
- * The input stream must always be closed when this method completes,
- * even if an exception is thrown.
- * @return The <code>Bundle</code> object of the installed bundle.
+ * @param input The {@code InputStream} object from which this bundle will
+ * be read or {@code null} to indicate the Framework must create the
+ * input stream from the specified location identifier. The input
+ * stream must always be closed when this method completes, even if
+ * an exception is thrown.
+ * @return The {@code Bundle} object of the installed bundle.
* @throws BundleException If the input stream cannot be read or the
* installation failed.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * {@code AdminPermission[installed bundle,LIFECYCLE]}, and the Java
+ * Runtime Environment supports permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public Bundle installBundle(String location, InputStream input)
+ Bundle installBundle(String location, InputStream input)
throws BundleException;
/**
- * Installs a bundle from the specified <code>location</code> identifier.
+ * Installs a bundle from the specified {@code location} identifier.
*
* <p>
* This method performs the same function as calling
* {@link #installBundle(String,InputStream)} with the specified
- * <code>location</code> identifier and a <code>null</code> InputStream.
+ * {@code location} identifier and a {@code null} InputStream.
*
* @param location The location identifier of the bundle to install.
- * @return The <code>Bundle</code> object of the installed bundle.
+ * @return The {@code Bundle} object of the installed bundle.
* @throws BundleException If the installation failed.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * {@code AdminPermission[installed bundle,LIFECYCLE]}, and the Java
+ * Runtime Environment supports permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #installBundle(String, InputStream)
*/
- public Bundle installBundle(String location) throws BundleException;
+ Bundle installBundle(String location) throws BundleException;
/**
* Returns the bundle with the specified identifier.
*
* @param id The identifier of the bundle to retrieve.
- * @return A <code>Bundle</code> object or <code>null</code> if the
- * identifier does not match any installed bundle.
+ * @return A {@code Bundle} object or {@code null} if the identifier does
+ * not match any installed bundle.
*/
- public Bundle getBundle(long id);
+ Bundle getBundle(long id);
/**
* Returns a list of all installed bundles.
@@ -201,179 +207,164 @@ public interface BundleContext {
* Framework is a very dynamic environment, bundles can be installed or
* uninstalled at anytime.
*
- * @return An array of <code>Bundle</code> objects, one object per
- * installed bundle.
+ * @return An array of {@code Bundle} objects, one object per installed
+ * bundle.
*/
- public Bundle[] getBundles();
+ Bundle[] getBundles();
/**
- * Adds the specified <code>ServiceListener</code> object with the
- * specified <code>filter</code> to the context bundle's list of
- * listeners. See {@link Filter} for a description of the filter syntax.
- * <code>ServiceListener</code> objects are notified when a service has a
+ * Adds the specified {@code ServiceListener} object with the specified
+ * {@code filter} to the context bundle's list of listeners. See
+ * {@link Filter} for a description of the filter syntax.
+ * {@code ServiceListener} objects are notified when a service has a
* lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, then this
- * method replaces that listener's filter (which may be <code>null</code>)
- * with the specified one (which may be <code>null</code>).
+ * {@code l} such that {@code (l==listener)}, then this method replaces that
+ * listener's filter (which may be {@code null}) with the specified one
+ * (which may be {@code null}).
*
* <p>
* The listener is called if the filter criteria is met. To filter based
* upon the class of the service, the filter should reference the
- * {@link Constants#OBJECTCLASS} property. If <code>filter</code> is
- * <code>null</code>, all services are considered to match the filter.
+ * {@link Constants#OBJECTCLASS} property. If {@code filter} is {@code null}
+ * , all services are considered to match the filter.
*
* <p>
- * When using a <code>filter</code>, it is possible that the
- * <code>ServiceEvent</code>s for the complete lifecycle of a service
- * will not be delivered to the listener. For example, if the
- * <code>filter</code> only matches when the property <code>x</code> has
- * the value <code>1</code>, the listener will not be called if the
- * service is registered with the property <code>x</code> not set to the
- * value <code>1</code>. Subsequently, when the service is modified
- * setting property <code>x</code> to the value <code>1</code>, the
- * filter will match and the listener will be called with a
- * <code>ServiceEvent</code> of type <code>MODIFIED</code>. Thus, the
- * listener will not be called with a <code>ServiceEvent</code> of type
- * <code>REGISTERED</code>.
+ * When using a {@code filter}, it is possible that the {@code ServiceEvent}
+ * s for the complete lifecycle of a service will not be delivered to the
+ * listener. For example, if the {@code filter} only matches when the
+ * property {@code x} has the value {@code 1}, the listener will not be
+ * called if the service is registered with the property {@code x} not set
+ * to the value {@code 1}. Subsequently, when the service is modified
+ * setting property {@code x} to the value {@code 1}, the filter will match
+ * and the listener will be called with a {@code ServiceEvent} of type
+ * {@code MODIFIED}. Thus, the listener will not be called with a
+ * {@code ServiceEvent} of type {@code REGISTERED}.
*
* <p>
* If the Java Runtime Environment supports permissions, the
- * <code>ServiceListener</code> object will be notified of a service event
- * only if the bundle that is registering it has the
- * <code>ServicePermission</code> to get the service using at least one of
- * the named classes the service was registered under.
+ * {@code ServiceListener} object will be notified of a service event only
+ * if the bundle that is registering it has the {@code ServicePermission} to
+ * get the service using at least one of the named classes the service was
+ * registered under.
*
- * @param listener The <code>ServiceListener</code> object to be added.
+ * @param listener The {@code ServiceListener} object to be added.
* @param filter The filter criteria.
- * @throws InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws InvalidSyntaxException If {@code filter} contains an invalid
+ * filter string that cannot be parsed.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @see ServiceEvent
* @see ServiceListener
* @see ServicePermission
*/
- public void addServiceListener(ServiceListener listener, String filter)
+ void addServiceListener(ServiceListener listener, String filter)
throws InvalidSyntaxException;
/**
- * Adds the specified <code>ServiceListener</code> object to the context
- * bundle's list of listeners.
+ * Adds the specified {@code ServiceListener} object to the context bundle's
+ * list of listeners.
*
* <p>
* This method is the same as calling
- * <code>BundleContext.addServiceListener(ServiceListener listener,
- * String filter)</code>
- * with <code>filter</code> set to <code>null</code>.
+ * {@code BundleContext.addServiceListener(ServiceListener listener,
+ * String filter)} with {@code filter} set to {@code null}.
*
- * @param listener The <code>ServiceListener</code> object to be added.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code ServiceListener} object to be added.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @see #addServiceListener(ServiceListener, String)
*/
- public void addServiceListener(ServiceListener listener);
+ void addServiceListener(ServiceListener listener);
/**
- * Removes the specified <code>ServiceListener</code> object from the
- * context bundle's list of listeners.
+ * Removes the specified {@code ServiceListener} object from the context
+ * bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in this context bundle's list
- * of listeners, this method does nothing.
+ * If {@code listener} is not contained in this context bundle's list of
+ * listeners, this method does nothing.
*
- * @param listener The <code>ServiceListener</code> to be removed.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code ServiceListener} to be removed.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public void removeServiceListener(ServiceListener listener);
+ void removeServiceListener(ServiceListener listener);
/**
- * Adds the specified <code>BundleListener</code> object to the context
- * bundle's list of listeners if not already present. BundleListener objects
- * are notified when a bundle has a lifecycle state change.
+ * Adds the specified {@code BundleListener} object to the context bundle's
+ * list of listeners if not already present. BundleListener objects are
+ * notified when a bundle has a lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, this method
- * does nothing.
+ * {@code l} such that {@code (l==listener)}, this method does nothing.
*
- * @param listener The <code>BundleListener</code> to be added.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code BundleListener} to be added.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @throws SecurityException If listener is a
- * <code>SynchronousBundleListener</code> and the caller does not
- * have the appropriate
- * <code>AdminPermission[context bundle,LISTENER]</code>, and the
- * Java Runtime Environment supports permissions.
+ * {@code SynchronousBundleListener} and the caller does not have
+ * the appropriate {@code AdminPermission[context bundle,LISTENER]},
+ * and the Java Runtime Environment supports permissions.
* @see BundleEvent
* @see BundleListener
*/
- public void addBundleListener(BundleListener listener);
+ void addBundleListener(BundleListener listener);
/**
- * Removes the specified <code>BundleListener</code> object from the
- * context bundle's list of listeners.
+ * Removes the specified {@code BundleListener} object from the context
+ * bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in the context bundle's list
- * of listeners, this method does nothing.
+ * If {@code listener} is not contained in the context bundle's list of
+ * listeners, this method does nothing.
*
- * @param listener The <code>BundleListener</code> object to be removed.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code BundleListener} object to be removed.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @throws SecurityException If listener is a
- * <code>SynchronousBundleListener</code> and the caller does not
- * have the appropriate
- * <code>AdminPermission[context bundle,LISTENER]</code>, and the
- * Java Runtime Environment supports permissions.
+ * {@code SynchronousBundleListener} and the caller does not have
+ * the appropriate {@code AdminPermission[context bundle,LISTENER]},
+ * and the Java Runtime Environment supports permissions.
*/
- public void removeBundleListener(BundleListener listener);
+ void removeBundleListener(BundleListener listener);
/**
- * Adds the specified <code>FrameworkListener</code> object to the context
+ * Adds the specified {@code FrameworkListener} object to the context
* bundle's list of listeners if not already present. FrameworkListeners are
* notified of general Framework events.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, this method
- * does nothing.
+ * {@code l} such that {@code (l==listener)}, this method does nothing.
*
- * @param listener The <code>FrameworkListener</code> object to be added.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code FrameworkListener} object to be added.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @see FrameworkEvent
* @see FrameworkListener
*/
- public void addFrameworkListener(FrameworkListener listener);
+ void addFrameworkListener(FrameworkListener listener);
/**
- * Removes the specified <code>FrameworkListener</code> object from the
- * context bundle's list of listeners.
+ * Removes the specified {@code FrameworkListener} object from the context
+ * bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in the context bundle's list
- * of listeners, this method does nothing.
+ * If {@code listener} is not contained in the context bundle's list of
+ * listeners, this method does nothing.
*
- * @param listener The <code>FrameworkListener</code> object to be
- * removed.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The {@code FrameworkListener} object to be removed.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public void removeFrameworkListener(FrameworkListener listener);
+ void removeFrameworkListener(FrameworkListener listener);
/**
* Registers the specified service object with the specified properties
* under the specified class names into the Framework. A
- * <code>ServiceRegistration</code> object is returned. The
- * <code>ServiceRegistration</code> object is for the private use of the
- * bundle registering the service and should not be shared with other
- * bundles. The registering bundle is defined to be the context bundle.
- * Other bundles can locate the service by using either the
- * {@link #getServiceReferences} or {@link #getServiceReference} method.
+ * {@code ServiceRegistration} object is returned. The
+ * {@code ServiceRegistration} object is for the private use of the bundle
+ * registering the service and should not be shared with other bundles. The
+ * registering bundle is defined to be the context bundle. Other bundles can
+ * locate the service by using either the {@link #getServiceReferences} or
+ * {@link #getServiceReference} method.
*
* <p>
* A bundle can register a service object that implements the
@@ -383,59 +374,58 @@ public interface BundleContext {
* <p>
* The following steps are required to register a service:
* <ol>
- * <li>If <code>service</code> is not a <code>ServiceFactory</code>, an
- * <code>IllegalArgumentException</code> is thrown if <code>service</code>
- * is not an <code>instanceof</code> all the specified class names.
+ * <li>If {@code service} is not a {@code ServiceFactory}, an
+ * {@code IllegalArgumentException} is thrown if {@code service} is not an
+ * {@code instanceof} all the specified class names.
* <li>The Framework adds the following service properties to the service
- * properties from the specified <code>Dictionary</code> (which may be
- * <code>null</code>): <br/>
+ * properties from the specified {@code Dictionary} (which may be
+ * {@code null}): <br/>
* A property named {@link Constants#SERVICE_ID} identifying the
* registration number of the service <br/>
* A property named {@link Constants#OBJECTCLASS} containing all the
* specified classes. <br/>
- * Properties with these names in the specified <code>Dictionary</code> will
- * be ignored.
+ * Properties with these names in the specified {@code Dictionary} will be
+ * ignored.
* <li>The service is added to the Framework service registry and may now be
* used by other bundles.
* <li>A service event of type {@link ServiceEvent#REGISTERED} is fired.
- * <li>A <code>ServiceRegistration</code> object for this registration is
+ * <li>A {@code ServiceRegistration} object for this registration is
* returned.
* </ol>
*
* @param clazzes The class names under which the service can be located.
* The class names in this array will be stored in the service's
* properties under the key {@link Constants#OBJECTCLASS}.
- * @param service The service object or a <code>ServiceFactory</code>
- * object.
+ * @param service The service object or a {@code ServiceFactory} object.
* @param properties The properties for this service. The keys in the
- * properties object must all be <code>String</code> objects. See
+ * properties object must all be {@code String} objects. See
* {@link Constants} for a list of standard service property keys.
* Changes should not be made to this object after calling this
* method. To update the service's properties the
* {@link ServiceRegistration#setProperties} method must be called.
- * The set of properties may be <code>null</code> if the service has
- * no properties.
- * @return A <code>ServiceRegistration</code> object for use by the bundle
+ * The set of properties may be {@code null} if the service has no
+ * properties.
+ * @return A {@code ServiceRegistration} object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
* @throws IllegalArgumentException If one of the following is true:
* <ul>
- * <li><code>service</code> is <code>null</code>. <li><code>service
- * </code> is not a <code>ServiceFactory</code> object and is not an
- * instance of all the named classes in <code>clazzes</code>. <li>
- * <code>properties</code> contains case variants of the same key
- * name.
+ * <li>{@code service} is {@code null}. <li>{@code service
+ * } is not
+ * a {@code ServiceFactory} object and is not an instance of all the
+ * named classes in {@code clazzes}. <li> {@code properties}
+ * contains case variants of the same key name.
* </ul>
* @throws SecurityException If the caller does not have the
- * <code>ServicePermission</code> to register the service for all
- * the named classes and the Java Runtime Environment supports
+ * {@code ServicePermission} to register the service for all the
+ * named classes and the Java Runtime Environment supports
* permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see ServiceRegistration
* @see ServiceFactory
*/
- public ServiceRegistration registerService(String[] clazzes,
- Object service, Dictionary properties);
+ ServiceRegistration< ? > registerService(String[] clazzes, Object service,
+ Dictionary<String, ? > properties);
/**
* Registers the specified service object with the specified properties
@@ -444,28 +434,53 @@ public interface BundleContext {
* <p>
* This method is otherwise identical to
* {@link #registerService(String[], Object, Dictionary)} and is provided as
- * a convenience when <code>service</code> will only be registered under a
- * single class name. Note that even in this case the value of the service's
+ * a convenience when {@code service} will only be registered under a single
+ * class name. Note that even in this case the value of the service's
* {@link Constants#OBJECTCLASS} property will be an array of string, rather
* than just a single string.
*
* @param clazz The class name under which the service can be located.
- * @param service The service object or a <code>ServiceFactory</code>
- * object.
+ * @param service The service object or a {@code ServiceFactory} object.
* @param properties The properties for this service.
- * @return A <code>ServiceRegistration</code> object for use by the bundle
+ * @return A {@code ServiceRegistration} object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #registerService(String[], Object, Dictionary)
*/
- public ServiceRegistration registerService(String clazz, Object service,
- Dictionary properties);
+ ServiceRegistration< ? > registerService(String clazz, Object service,
+ Dictionary<String, ? > properties);
/**
- * Returns an array of <code>ServiceReference</code> objects. The returned
- * array of <code>ServiceReference</code> objects contains services that
- * were registered under the specified class, match the specified filter
+ * Registers the specified service object with the specified properties
+ * under the specified class name with the Framework.
+ *
+ * <p>
+ * This method is otherwise identical to
+ * {@link #registerService(String[], Object, Dictionary)} and is provided as
+ * a convenience when {@code service} will only be registered under a single
+ * class name. Note that even in this case the value of the service's
+ * {@link Constants#OBJECTCLASS} property will be an array of string, rather
+ * than just a single string.
+ *
+ * @param <S> Type of Service.
+ * @param clazz The class name under which the service can be located.
+ * @param service The service object or a {@code ServiceFactory} object.
+ * @param properties The properties for this service.
+ * @return A {@code ServiceRegistration} object for use by the bundle
+ * registering the service to update the service's properties or to
+ * unregister the service.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @see #registerService(String[], Object, Dictionary)
+ * @since 1.6
+ */
+ <S> ServiceRegistration<S> registerService(Class<S> clazz, S service,
+ Dictionary<String, ? > properties);
+
+ /**
+ * Returns an array of {@code ServiceReference} objects. The returned array
+ * of {@code ServiceReference} objects contains services that were
+ * registered under the specified class, match the specified filter
* expression, and the packages for the class names under which the services
* were registered match the context bundle's packages as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
@@ -476,53 +491,51 @@ public interface BundleContext {
* unregistered at any time.
*
* <p>
- * The specified <code>filter</code> expression is used to select the
- * registered services whose service properties contain keys and values
- * which satisfy the filter expression. See {@link Filter} for a description
- * of the filter syntax. If the specified <code>filter</code> is
- * <code>null</code>, all registered services are considered to match the
- * filter. If the specified <code>filter</code> expression cannot be parsed,
- * an {@link InvalidSyntaxException} will be thrown with a human readable
+ * The specified {@code filter} expression is used to select the registered
+ * services whose service properties contain keys and values which satisfy
+ * the filter expression. See {@link Filter} for a description of the filter
+ * syntax. If the specified {@code filter} is {@code null}, all registered
+ * services are considered to match the filter. If the specified
+ * {@code filter} expression cannot be parsed, an
+ * {@link InvalidSyntaxException} will be thrown with a human readable
* message where the filter became unparsable.
*
* <p>
- * The result is an array of <code>ServiceReference</code> objects for all
+ * The result is an array of {@code ServiceReference} objects for all
* services that meet all of the following conditions:
* <ul>
- * <li>If the specified class name, <code>clazz</code>, is not
- * <code>null</code>, the service must have been registered with the
- * specified class name. The complete list of class names with which a
- * service was registered is available from the service's
- * {@link Constants#OBJECTCLASS objectClass} property.
- * <li>If the specified <code>filter</code> is not <code>null</code>, the
- * filter expression must match the service.
+ * <li>If the specified class name, {@code clazz}, is not {@code null}, the
+ * service must have been registered with the specified class name. The
+ * complete list of class names with which a service was registered is
+ * available from the service's {@link Constants#OBJECTCLASS objectClass}
+ * property.
+ * <li>If the specified {@code filter} is not {@code null}, the filter
+ * expression must match the service.
* <li>If the Java Runtime Environment supports permissions, the caller must
- * have <code>ServicePermission</code> with the <code>GET</code> action for
- * at least one of the class names under which the service was registered.
+ * have {@code ServicePermission} with the {@code GET} action for at least
+ * one of the class names under which the service was registered.
* <li>For each class name with which the service was registered, calling
* {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
- * bundle and the class name on the service's <code>ServiceReference</code>
- * object must return <code>true</code>
+ * bundle and the class name on the service's {@code ServiceReference}
+ * object must return {@code true}
* </ul>
*
* @param clazz The class name with which the service was registered or
- * <code>null</code> for all services.
- * @param filter The filter expression or <code>null</code> for all
- * services.
- * @return An array of <code>ServiceReference</code> objects or
- * <code>null</code> if no services are registered which satisfy the
- * search.
- * @throws InvalidSyntaxException If the specified <code>filter</code>
- * contains an invalid filter expression that cannot be parsed.
+ * {@code null} for all services.
+ * @param filter The filter expression or {@code null} for all services.
+ * @return An array of {@code ServiceReference} objects or {@code null} if
+ * no services are registered which satisfy the search.
+ * @throws InvalidSyntaxException If the specified {@code filter} contains
+ * an invalid filter expression that cannot be parsed.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public ServiceReference[] getServiceReferences(String clazz, String filter)
+ ServiceReference< ? >[] getServiceReferences(String clazz, String filter)
throws InvalidSyntaxException;
/**
- * Returns an array of <code>ServiceReference</code> objects. The returned
- * array of <code>ServiceReference</code> objects contains services that
- * were registered under the specified class and match the specified filter
+ * Returns an array of {@code ServiceReference} objects. The returned array
+ * of {@code ServiceReference} objects contains services that were
+ * registered under the specified class and match the specified filter
* expression.
*
* <p>
@@ -531,61 +544,91 @@ public interface BundleContext {
* unregistered at any time.
*
* <p>
- * The specified <code>filter</code> expression is used to select the
- * registered services whose service properties contain keys and values
- * which satisfy the filter expression. See {@link Filter} for a description
- * of the filter syntax. If the specified <code>filter</code> is
- * <code>null</code>, all registered services are considered to match the
- * filter. If the specified <code>filter</code> expression cannot be parsed,
- * an {@link InvalidSyntaxException} will be thrown with a human readable
+ * The specified {@code filter} expression is used to select the registered
+ * services whose service properties contain keys and values which satisfy
+ * the filter expression. See {@link Filter} for a description of the filter
+ * syntax. If the specified {@code filter} is {@code null}, all registered
+ * services are considered to match the filter. If the specified
+ * {@code filter} expression cannot be parsed, an
+ * {@link InvalidSyntaxException} will be thrown with a human readable
* message where the filter became unparsable.
*
* <p>
- * The result is an array of <code>ServiceReference</code> objects for all
+ * The result is an array of {@code ServiceReference} objects for all
* services that meet all of the following conditions:
* <ul>
- * <li>If the specified class name, <code>clazz</code>, is not
- * <code>null</code>, the service must have been registered with the
- * specified class name. The complete list of class names with which a
- * service was registered is available from the service's
- * {@link Constants#OBJECTCLASS objectClass} property.
- * <li>If the specified <code>filter</code> is not <code>null</code>, the
- * filter expression must match the service.
+ * <li>If the specified class name, {@code clazz}, is not {@code null}, the
+ * service must have been registered with the specified class name. The
+ * complete list of class names with which a service was registered is
+ * available from the service's {@link Constants#OBJECTCLASS objectClass}
+ * property.
+ * <li>If the specified {@code filter} is not {@code null}, the filter
+ * expression must match the service.
* <li>If the Java Runtime Environment supports permissions, the caller must
- * have <code>ServicePermission</code> with the <code>GET</code> action for
- * at least one of the class names under which the service was registered.
+ * have {@code ServicePermission} with the {@code GET} action for at least
+ * one of the class names under which the service was registered.
* </ul>
*
* @param clazz The class name with which the service was registered or
- * <code>null</code> for all services.
- * @param filter The filter expression or <code>null</code> for all
- * services.
- * @return An array of <code>ServiceReference</code> objects or
- * <code>null</code> if no services are registered which satisfy the
- * search.
- * @throws InvalidSyntaxException If the specified <code>filter</code>
- * contains an invalid filter expression that cannot be parsed.
+ * {@code null} for all services.
+ * @param filter The filter expression or {@code null} for all services.
+ * @return An array of {@code ServiceReference} objects or {@code null} if
+ * no services are registered which satisfy the search.
+ * @throws InvalidSyntaxException If the specified {@code filter} contains
+ * an invalid filter expression that cannot be parsed.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @since 1.3
*/
- public ServiceReference[] getAllServiceReferences(String clazz,
- String filter) throws InvalidSyntaxException;
+ ServiceReference< ? >[] getAllServiceReferences(String clazz, String filter)
+ throws InvalidSyntaxException;
/**
- * Returns a <code>ServiceReference</code> object for a service that
- * implements and was registered under the specified class.
+ * Returns a {@code ServiceReference} object for a service that implements
+ * and was registered under the specified class.
*
* <p>
- * The returned <code>ServiceReference</code> object is valid at the time of
- * the call to this method. However as the Framework is a very dynamic
+ * The returned {@code ServiceReference} object 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 any time.
*
* <p>
* This method is the same as calling
- * {@link BundleContext#getServiceReferences(String, String)} with a
- * <code>null</code> filter expression. It is provided as a convenience for
- * when the caller is interested in any service that implements the
- * specified class.
+ * {@link #getServiceReferences(String, String)} with a {@code null} filter
+ * expression and then finding the reference with the highest priority. It
+ * is provided as a convenience for when the caller is interested in any
+ * service that implements the specified class.
+ * <p>
+ * If multiple such services exist, the service with the highest priority is
+ * selected. This priority is defined as the service reference with the
+ * highest ranking (as specified in its {@link Constants#SERVICE_RANKING}
+ * property) is returned.
+ * <p>
+ * If there is a tie in ranking, the service with the lowest service ID (as
+ * specified in its {@link Constants#SERVICE_ID} property); that is, the
+ * service that was registered first is returned.
+ *
+ * @param clazz The class name with which the service was registered.
+ * @return A {@code ServiceReference} object, or {@code null} if no services
+ * are registered which implement the named class.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @see #getServiceReferences(String, String)
+ */
+ ServiceReference< ? > getServiceReference(String clazz);
+
+ /**
+ * Returns a {@code ServiceReference} object for a service that implements
+ * and was registered under the specified class.
+ *
+ * <p>
+ * The returned {@code ServiceReference} object 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 any time.
+ *
+ * <p>
+ * This method is the same as calling
+ * {@link #getServiceReferences(Class, String)} with a {@code null} filter
+ * expression. It is provided as a convenience for when the caller is
+ * interested in any service that implements the specified class.
* <p>
* If multiple such services exist, the service with the highest ranking (as
* specified in its {@link Constants#SERVICE_RANKING} property) is returned.
@@ -594,17 +637,76 @@ public interface BundleContext {
* specified in its {@link Constants#SERVICE_ID} property); that is, the
* service that was registered first is returned.
*
+ * @param <S> Type of Service.
* @param clazz The class name with which the service was registered.
- * @return A <code>ServiceReference</code> object, or <code>null</code> if
- * no services are registered which implement the named class.
+ * @return A {@code ServiceReference} object, or {@code null} if no services
+ * are registered which implement the named class.
* @throws IllegalStateException If this BundleContext is no longer valid.
- * @see #getServiceReferences(String, String)
+ * @see #getServiceReferences(Class, String)
+ * @since 1.6
*/
- public ServiceReference getServiceReference(String clazz);
+ <S> ServiceReference<S> getServiceReference(Class<S> clazz);
+
+ /**
+ * Returns a collection of {@code ServiceReference} objects. The returned
+ * collection of {@code ServiceReference} objects contains services that
+ * were registered under the specified class, match the specified filter
+ * expression, and the packages for the class names under which the services
+ * were registered match the context bundle's packages as defined in
+ * {@link ServiceReference#isAssignableTo(Bundle, String)}.
+ *
+ * <p>
+ * The collection is valid at the time of the call to this method. However
+ * since the Framework is a very dynamic environment, services can be
+ * modified or unregistered at any time.
+ *
+ * <p>
+ * The specified {@code filter} expression is used to select the registered
+ * services whose service properties contain keys and values which satisfy
+ * the filter expression. See {@link Filter} for a description of the filter
+ * syntax. If the specified {@code filter} is {@code null}, all registered
+ * services are considered to match the filter. If the specified
+ * {@code filter} expression cannot be parsed, an
+ * {@link InvalidSyntaxException} will be thrown with a human readable
+ * message where the filter became unparsable.
+ *
+ * <p>
+ * The result is a collection of {@code ServiceReference} objects for all
+ * services that meet all of the following conditions:
+ * <ul>
+ * <li>If the specified class name, {@code clazz}, is not {@code null}, the
+ * service must have been registered with the specified class name. The
+ * complete list of class names with which a service was registered is
+ * available from the service's {@link Constants#OBJECTCLASS objectClass}
+ * property.
+ * <li>If the specified {@code filter} is not {@code null}, the filter
+ * expression must match the service.
+ * <li>If the Java Runtime Environment supports permissions, the caller must
+ * have {@code ServicePermission} with the {@code GET} action for at least
+ * one of the class names under which the service was registered.
+ * <li>For each class name with which the service was registered, calling
+ * {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
+ * bundle and the class name on the service's {@code ServiceReference}
+ * object must return {@code true}
+ * </ul>
+ *
+ * @param <S> Type of Service
+ * @param clazz The class name with which the service was registered. Must
+ * not be {@code null}.
+ * @param filter The filter expression or {@code null} for all services.
+ * @return A collection of {@code ServiceReference} objects. May be empty if
+ * no services are registered which satisfy the search.
+ * @throws InvalidSyntaxException If the specified {@code filter} contains
+ * an invalid filter expression that cannot be parsed.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @since 1.6
+ */
+ <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
+ String filter) throws InvalidSyntaxException;
/**
* Returns the service object referenced by the specified
- * <code>ServiceReference</code> object.
+ * {@code ServiceReference} object.
* <p>
* A bundle's use of a service is tracked by the bundle's use count of that
* service. Each time a service's service object is returned by
@@ -617,60 +719,59 @@ public interface BundleContext {
* no longer use that service.
*
* <p>
- * This method will always return <code>null</code> when the service
- * associated with this <code>reference</code> has been unregistered.
+ * This method will always return {@code null} when the service associated
+ * with this {@code reference} has been unregistered.
*
* <p>
* The following steps are required to get the service object:
* <ol>
- * <li>If the service has been unregistered, <code>null</code> is returned.
+ * <li>If the service has been unregistered, {@code null} is returned.
* <li>The context bundle's use count for this service is incremented by
* one.
* <li>If the context bundle's use count for the service is currently one
* and the service was registered with an object implementing the
- * <code>ServiceFactory</code> interface, the
+ * {@code ServiceFactory} interface, the
* {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
* called to create a service object for the context bundle. This service
* object is cached by the Framework. While the context bundle's use count
* for the service is greater than zero, subsequent calls to get the
* services's service object for the context bundle will return the cached
* service object. <br>
- * If the service object returned by the <code>ServiceFactory</code> object
- * is not an <code>instanceof</code> all the classes named when the service
- * was registered or the <code>ServiceFactory</code> object throws an
- * exception, <code>null</code> is returned and a Framework event of type
+ * If the service object returned by the {@code ServiceFactory} object is
+ * not an {@code instanceof} all the classes named when the service was
+ * registered or the {@code ServiceFactory} object throws an exception,
+ * {@code null} is returned and a Framework event of type
* {@link FrameworkEvent#ERROR} containing a {@link ServiceException}
* describing the error is fired.
* <li>The service object for the service is returned.
* </ol>
*
+ * @param <S> Type of Service.
* @param reference A reference to the service.
* @return A service object for the service associated with
- * <code>reference</code> or <code>null</code> if the service is not
+ * {@code reference} or {@code null} if the service is not
* registered, the service object returned by a
- * <code>ServiceFactory</code> does not implement the classes under
- * which it was registered or the <code>ServiceFactory</code> threw
- * an exception.
+ * {@code ServiceFactory} does not implement the classes under which
+ * it was registered or the {@code ServiceFactory} threw an
+ * exception.
* @throws SecurityException If the caller does not have the
- * <code>ServicePermission</code> to get the service using at least
- * one of the named classes the service was registered under and the
+ * {@code ServicePermission} to get the service using at least one
+ * of the named classes the service was registered under and the
* Java Runtime Environment supports permissions.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @throws IllegalArgumentException If the specified
- * <code>ServiceReference</code> was not created by the same
- * framework instance as this <code>BundleContext</code>.
+ * {@code ServiceReference} was not created by the same framework
+ * instance as this {@code BundleContext}.
* @see #ungetService(ServiceReference)
* @see ServiceFactory
*/
- public Object getService(ServiceReference reference);
+ <S> S getService(ServiceReference<S> reference);
/**
* Releases the service object referenced by the specified
- * <code>ServiceReference</code> object. If the context bundle's use count
- * for the service is zero, this method returns <code>false</code>.
- * Otherwise, the context bundle's use count for the service is decremented
- * by one.
+ * {@code ServiceReference} object. If the context bundle's use count for
+ * the service is zero, this method returns {@code false}. Otherwise, the
+ * context bundle's use count for the service is decremented by one.
*
* <p>
* The service's service object should no longer be used and all references
@@ -681,76 +782,71 @@ public interface BundleContext {
* The following steps are required to unget the service object:
* <ol>
* <li>If the context bundle's use count for the service is zero or the
- * service has been unregistered, <code>false</code> is returned.
+ * service has been unregistered, {@code false} is returned.
* <li>The context bundle's use count for this service is decremented by
* one.
* <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with a <code>ServiceFactory</code> object,
- * the
+ * and the service was registered with a {@code ServiceFactory} object, the
* {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
* method is called to release the service object for the context bundle.
- * <li><code>true</code> is returned.
+ * <li>{@code true} is returned.
* </ol>
*
* @param reference A reference to the service to be released.
- * @return <code>false</code> if the context bundle's use count for the
- * service is zero or if the service has been unregistered;
- * <code>true</code> otherwise.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return {@code false} if the context bundle's use count for the service
+ * is zero or if the service has been unregistered; {@code true}
+ * otherwise.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
* @throws IllegalArgumentException If the specified
- * <code>ServiceReference</code> was not created by the same
- * framework instance as this <code>BundleContext</code>.
+ * {@code ServiceReference} was not created by the same framework
+ * instance as this {@code BundleContext}.
* @see #getService
* @see ServiceFactory
*/
- public boolean ungetService(ServiceReference reference);
+ boolean ungetService(ServiceReference< ? > reference);
/**
- * Creates a <code>File</code> object for a file in the persistent storage
- * area provided for the bundle by the Framework. This method will return
- * <code>null</code> if the platform does not have file system support.
+ * Creates a {@code File} object for a file in the persistent storage area
+ * provided for the bundle by the Framework. This method will return
+ * {@code null} if the platform does not have file system support.
*
* <p>
- * A <code>File</code> object for the base directory of the persistent
- * storage area provided for the context bundle by the Framework can be
- * obtained by calling this method with an empty string as
- * <code>filename</code>.
+ * A {@code File} object for the base directory of the persistent storage
+ * area provided for the context 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 the bundle has the <code>java.io.FilePermission</code> with
- * actions <code>read</code>,<code>write</code>,<code>delete</code>
- * for all files (recursively) in the persistent storage area provided for
- * the context bundle.
+ * ensure that the 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 the context
+ * bundle.
*
* @param filename A relative name to the file to be accessed.
- * @return A <code>File</code> object that represents the requested file
- * or <code>null</code> if the platform does not have file system
- * support.
- * @throws IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return A {@code File} object that represents the requested file or
+ * {@code null} if the platform does not have file system support.
+ * @throws IllegalStateException If this BundleContext is no longer valid.
*/
- public File getDataFile(String filename);
+ File getDataFile(String filename);
/**
- * Creates a <code>Filter</code> object. This <code>Filter</code> object may
- * be used to match a <code>ServiceReference</code> object or a
- * <code>Dictionary</code> 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.
*
* @param filter The filter string.
- * @return A <code>Filter</code> object encapsulating the filter string.
- * @throws InvalidSyntaxException If <code>filter</code> contains an invalid
+ * @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</code> is null.
+ * @throws NullPointerException If {@code filter} is null.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see "Framework specification for a description of the filter string syntax."
* @see FrameworkUtil#createFilter(String)
* @since 1.1
*/
- public Filter createFilter(String filter) throws InvalidSyntaxException;
+ Filter createFilter(String filter) throws InvalidSyntaxException;
}
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 7a8fb8d3d..64f70bd48 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,8 @@ import java.util.EventObject;
/**
* An event from the Framework describing a bundle lifecycle change.
* <p>
- * <code>BundleEvent</code> objects are delivered to
- * <code>SynchronousBundleListener</code>s and <code>BundleListener</code>s
+ * {@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.
*
@@ -32,7 +32,7 @@ import java.util.EventObject;
* @Immutable
* @see BundleListener
* @see SynchronousBundleListener
- * @version $Revision: 6542 $
+ * @version $Id: ac96d1ab8c5b491539af238ad41071b5bb9aef95 $
*/
public class BundleEvent extends EventObject {
@@ -113,7 +113,7 @@ public class BundleEvent extends EventObject {
* {@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</code>s.
+ * delivered to {@code BundleListener}s.
*
* @see Bundle#start()
* @since 1.3
@@ -127,7 +127,7 @@ public class BundleEvent extends EventObject {
* {@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</code>s.
+ * delivered to {@code BundleListener}s.
*
* @see Bundle#stop()
* @since 1.3
@@ -140,9 +140,9 @@ public class BundleEvent extends EventObject {
* 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</code>. This event is only delivered to
+ * {@code BundleContext}. This event is only delivered to
* {@link SynchronousBundleListener}s. It is not delivered to
- * <code>BundleListener</code>s.
+ * {@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 500d14749..ede692773 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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;
* occurred.
*
* <p>
- * A <code>BundleException</code> object is created by the Framework to denote
+ * A {@code BundleException} object is created by the Framework to denote
* an exception condition in the lifecycle of a bundle.
- * <code>BundleException</code>s should not be created by bundle developers.
+ * {@code BundleException}s should not be created by bundle developers.
* A type code is used to identify the exception type for future extendability.
*
* <p>
@@ -32,7 +32,7 @@ package org.osgi.framework;
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Revision: 6083 $
+ * @version $Id: ad1058a00e2bcb6e6c39b1acc2c657eacc972f84 $
*/
public class BundleException extends Exception {
@@ -45,7 +45,7 @@ public class BundleException extends Exception {
private final int type;
/**
- * No exception type is unspecified.
+ * No exception type is specified.
*
* @since 1.5
*/
@@ -117,7 +117,7 @@ public class BundleException extends Exception {
public static final int START_TRANSIENT_ERROR = 10;
/**
- * Creates a <code>BundleException</code> with the specified message and
+ * Creates a {@code BundleException} with the specified message and
* exception cause.
*
* @param msg The associated message.
@@ -128,7 +128,7 @@ public class BundleException extends Exception {
}
/**
- * Creates a <code>BundleException</code> with the specified message.
+ * Creates a {@code BundleException} with the specified message.
*
* @param msg The message.
*/
@@ -137,7 +137,7 @@ public class BundleException extends Exception {
}
/**
- * Creates a <code>BundleException</code> with the specified message, type
+ * Creates a {@code BundleException} with the specified message, type
* and exception cause.
*
* @param msg The associated message.
@@ -151,7 +151,7 @@ public class BundleException extends Exception {
}
/**
- * Creates a <code>BundleException</code> with the specified message and
+ * Creates a {@code BundleException} with the specified message and
* type.
*
* @param msg The message.
@@ -164,29 +164,29 @@ public class BundleException extends Exception {
}
/**
- * Returns the cause of this exception or <code>null</code> if no cause was
+ * Returns the cause of this exception or {@code null} if no cause was
* specified when this exception was created.
*
* <p>
* This method predates the general purpose exception chaining mechanism.
- * The <code>getCause()</code> method is now the preferred means of
+ * The {@code getCause()} method is now the preferred means of
* obtaining this information.
*
- * @return The result of calling <code>getCause()</code>.
+ * @return The result of calling {@code getCause()}.
*/
public Throwable getNestedException() {
return getCause();
}
/**
- * Returns the cause of this exception or <code>null</code> if no cause was
+ * Returns the cause of this exception or {@code null} if no cause was
* set.
*
- * @return The cause of this exception or <code>null</code> if no cause was
+ * @return The cause of this exception or {@code null} if no cause was
* set.
* @since 1.3
*/
- public Throwable getCause() {
+ public Throwable getCause() {
return super.getCause();
}
@@ -206,7 +206,7 @@ public class BundleException extends Exception {
}
/**
- * Returns the type for this exception or <code>UNSPECIFIED</code> if the
+ * 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/BundleListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
index 9dd71516a..d9bb54cf8 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,29 +19,29 @@ package org.osgi.framework;
import java.util.EventListener;
/**
- * A <code>BundleEvent</code> listener. <code>BundleListener</code> is a
+ * A {@code BundleEvent} listener. {@code BundleListener} is a
* listener interface that may be implemented by a bundle developer. When a
- * <code>BundleEvent</code> is fired, it is asynchronously delivered to a
- * <code>BundleListener</code>. The Framework delivers
- * <code>BundleEvent</code> objects to a <code>BundleListener</code> in
- * order and must not concurrently call a <code>BundleListener</code>.
+ * {@code BundleEvent} is fired, it is asynchronously delivered to a
+ * {@code BundleListener}. The Framework delivers
+ * {@code BundleEvent} objects to a {@code BundleListener} in
+ * order and must not concurrently call a {@code BundleListener}.
* <p>
- * A <code>BundleListener</code> object is registered with the Framework using
+ * A {@code BundleListener} object is registered with the Framework using
* the {@link BundleContext#addBundleListener} method.
- * <code>BundleListener</code>s are called with a <code>BundleEvent</code>
+ * {@code BundleListener}s are called with a {@code BundleEvent}
* object when a bundle has been installed, resolved, started, stopped, updated,
* unresolved, or uninstalled.
*
* @see BundleEvent
* @NotThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: 77cdaebd3ac97c6798fc3043957abd1bd6d01ccb $
*/
public interface BundleListener extends EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
*
- * @param event The <code>BundleEvent</code>.
+ * @param event The {@code BundleEvent}.
*/
public void bundleChanged(BundleEvent event);
}
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 8677e6908..e6f9356ad 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2010). 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,10 +23,12 @@ import java.io.ObjectStreamField;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.List;
import java.util.Map;
/**
@@ -50,13 +52,13 @@ import java.util.Map;
* </pre>
*
* <p>
- * <code>BundlePermission</code> has four actions: <code>provide</code>,
- * <code>require</code>,<code>host</code>, and <code>fragment</code>. The
- * <code>provide</code> action implies the <code>require</code> 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
- * @version $Revision: 6860 $
+ * @version $Id: d30c9c987cc13007ed19d3a9fdd11b00739591c0 $
*/
public final class BundlePermission extends BasicPermission {
@@ -64,24 +66,24 @@ public final class BundlePermission extends BasicPermission {
private static final long serialVersionUID = 3257846601685873716L;
/**
- * The action string <code>provide</code>. The <code>provide</code> action
- * implies the <code>require</code> 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</code>. The <code>require</code> action
- * is implied by the <code>provide</code> action.
+ * The action string {@code require}. The {@code require} action
+ * is implied by the {@code provide} action.
*/
public final static String REQUIRE = "require";
/**
- * The action string <code>host</code>.
+ * The action string {@code host}.
*/
public final static String HOST = "host";
/**
- * The action string <code>fragment</code>.
+ * The action string {@code fragment}.
*/
public final static String FRAGMENT = "fragment";
@@ -113,14 +115,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</code> for the symbolic name; a bundle that
- * requires a bundle must have the appropriate <code>BundlePermssion</code>
+ * {@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</code> for that symbolic name.
+ * the appropriate {@code BundlePermission} for that symbolic name.
*
* @param symbolicName The bundle symbolic name.
- * @param actions <code>provide</code>,<code>require</code>,
- * <code>host</code>,<code>fragment</code> (canonical order).
+ * @param actions {@code provide},{@code require},
+ * {@code host},{@code fragment} (canonical order).
*/
public BundlePermission(String symbolicName, String actions) {
this(symbolicName, parseActions(actions));
@@ -278,9 +280,9 @@ public final class BundlePermission extends BasicPermission {
*
* <p>
* This method checks that the symbolic name of the target is implied by the
- * symbolic name of this object. The list of <code>BundlePermission</code>
+ * symbolic name of this object. The list of {@code BundlePermission}
* actions must either match or allow for the list of the target object to
- * imply the target <code>BundlePermission</code> action.
+ * imply the target {@code BundlePermission} action.
* <p>
* The permission to provide a bundle implies the permission to require the
* named symbolic name.
@@ -293,8 +295,8 @@ public final class BundlePermission extends BasicPermission {
* </pre>
*
* @param p The requested permission.
- * @return <code>true</code> if the specified <code>BundlePermission</code>
- * action is implied by this object; <code>false</code> 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)) {
@@ -310,15 +312,15 @@ public final class BundlePermission extends BasicPermission {
/**
* Returns the canonical string representation of the
- * <code>BundlePermission</code> actions.
+ * {@code BundlePermission} actions.
*
* <p>
- * Always returns present <code>BundlePermission</code> actions in the
- * following order: <code>provide</code>, <code>require</code>,
- * <code>host</code>, <code>fragment</code>.
+ * 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
- * </code> actions.
+ * @return Canonical string representation of the {@code BundlePermission
+ * } actions.
*/
public String getActions() {
String result = actions;
@@ -357,28 +359,28 @@ public final class BundlePermission extends BasicPermission {
}
/**
- * Returns a new <code>PermissionCollection</code> object suitable for
- * storing <code>BundlePermission</code> objects.
+ * Returns a new {@code PermissionCollection} object suitable for
+ * storing {@code BundlePermission} objects.
*
- * @return A new <code>PermissionCollection</code> object.
+ * @return A new {@code PermissionCollection} object.
*/
public PermissionCollection newPermissionCollection() {
return new BundlePermissionCollection();
}
/**
- * Determines the equality of two <code>BundlePermission</code> objects.
+ * Determines the equality of two {@code BundlePermission} objects.
*
* This method checks that specified bundle has the same bundle symbolic
- * name and <code>BundlePermission</code> actions as this
- * <code>BundlePermission</code> object.
+ * name and {@code BundlePermission} actions as this
+ * {@code BundlePermission} object.
*
* @param obj The object to test for equality with this
- * <code>BundlePermission</code> object.
- * @return <code>true</code> if <code>obj</code> is a
- * <code>BundlePermission</code>, and has the same bundle symbolic
- * name and actions as this <code>BundlePermission</code> object;
- * <code>false</code> otherwise.
+ * {@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.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -408,7 +410,7 @@ public final class BundlePermission extends BasicPermission {
/**
* WriteObject is called to save the state of the
- * <code>BundlePermission</code> object to a stream. The actions are
+ * {@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)
@@ -433,7 +435,7 @@ public final class BundlePermission extends BasicPermission {
}
/**
- * Stores a set of <code>BundlePermission</code> permissions.
+ * Stores a set of {@code BundlePermission} permissions.
*
* @see java.security.Permission
* @see java.security.Permissions
@@ -448,7 +450,7 @@ final class BundlePermissionCollection extends PermissionCollection {
*
* @GuardedBy this
*/
- private transient Map permissions;
+ private transient Map<String, BundlePermission> permissions;
/**
* Boolean saying if "*" is in the collection.
@@ -463,17 +465,17 @@ final class BundlePermissionCollection extends PermissionCollection {
*
*/
public BundlePermissionCollection() {
- permissions = new HashMap();
+ permissions = new HashMap<String, BundlePermission>();
all_allowed = false;
}
/**
* Add a permission to this permission collection.
*
- * @param permission The <code>BundlePermission</code> object to add.
+ * @param permission The {@code BundlePermission} object to add.
* @throws IllegalArgumentException If the permission is not a
- * <code>BundlePermission</code> instance.
- * @throws SecurityException If this <code>BundlePermissionCollection</code>
+ * {@code BundlePermission} instance.
+ * @throws SecurityException If this {@code BundlePermissionCollection}
* object has been marked read-only.
*/
public void add(final Permission permission) {
@@ -488,8 +490,8 @@ final class BundlePermissionCollection extends PermissionCollection {
final BundlePermission bp = (BundlePermission) permission;
final String name = bp.getName();
synchronized (this) {
- Map pc = permissions;
- BundlePermission existing = (BundlePermission) pc.get(name);
+ Map<String, BundlePermission> pc = permissions;
+ BundlePermission existing = pc.get(name);
if (existing != null) {
final int oldMask = existing.getActionsMask();
final int newMask = bp.getActionsMask();
@@ -512,12 +514,12 @@ final class BundlePermissionCollection extends PermissionCollection {
/**
* Determines if the specified permissions implies the permissions expressed
- * in <code>permission</code>.
+ * in {@code permission}.
*
* @param permission The Permission object to compare with this
- * <code>BundlePermission</code> object.
- * @return <code>true</code> if <code>permission</code> is a proper subset
- * of a permission in the set; <code>false</code> otherwise.
+ * {@code BundlePermission} object.
+ * @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)) {
@@ -530,10 +532,10 @@ final class BundlePermissionCollection extends PermissionCollection {
BundlePermission bp;
synchronized (this) {
- Map pc = permissions;
+ Map<String, BundlePermission> pc = permissions;
/* short circuit if the "*" Permission was added */
if (all_allowed) {
- bp = (BundlePermission) pc.get("*");
+ bp = pc.get("*");
if (bp != null) {
effective |= bp.getActionsMask();
if ((effective & desired) == desired) {
@@ -541,7 +543,7 @@ final class BundlePermissionCollection extends PermissionCollection {
}
}
}
- bp = (BundlePermission) pc.get(requestedName);
+ bp = pc.get(requestedName);
// strategy:
// Check for full match first. Then work our way up the
// name looking for matches on a.b.*
@@ -557,7 +559,7 @@ final class BundlePermissionCollection extends PermissionCollection {
int offset = requestedName.length() - 1;
while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
requestedName = requestedName.substring(0, last + 1) + "*";
- bp = (BundlePermission) pc.get(requestedName);
+ bp = pc.get(requestedName);
if (bp != null) {
effective |= bp.getActionsMask();
if ((effective & desired) == desired) {
@@ -573,13 +575,14 @@ final class BundlePermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all <code>BundlePermission</code> objects in
+ * Returns an enumeration of all {@code BundlePermission} objects in
* the container.
*
- * @return Enumeration of all <code>BundlePermission</code> objects.
+ * @return Enumeration of all {@code BundlePermission} objects.
*/
- public synchronized Enumeration elements() {
- return Collections.enumeration(permissions.values());
+ public synchronized Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ return Collections.enumeration(all);
}
/* serialization logic */
@@ -589,7 +592,8 @@ final class BundlePermissionCollection extends PermissionCollection {
private synchronized void writeObject(ObjectOutputStream out)
throws IOException {
- Hashtable hashtable = new Hashtable(permissions);
+ Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(
+ permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -599,8 +603,9 @@ final class BundlePermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
- permissions = new HashMap(hashtable);
+ 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/BundleReference.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleReference.java
index f9c418312..ca17bbdb5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleReference.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2010). 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,15 +21,15 @@ package org.osgi.framework;
*
* @since 1.5
* @ThreadSafe
- * @version $Revision: 6860 $
+ * @version $Id: adbba3dfc5ac9af0b534c3008ffab1b29984c4bb $
*/
public interface BundleReference {
/**
- * Returns the <code>Bundle</code> object associated with this
- * <code>BundleReference</code>.
+ * Returns the {@code Bundle} object associated with this
+ * {@code BundleReference}.
*
- * @return The <code>Bundle</code> object associated with this
- * <code>BundleReference</code>.
+ * @return The {@code Bundle} object associated with this
+ * {@code BundleReference}.
*/
public Bundle getBundle();
}
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 b30910ce8..d82da9b3f 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,20 +20,20 @@ package org.osgi.framework;
* Supports a configuration object.
*
* <p>
- * <code>Configurable</code> is an interface that should be used by a bundle
+ * {@code Configurable} is an interface that should be used by a bundle
* developer in support of a configurable service. Bundles that need to
* configure a service may test to determine if the service object is an
- * <code>instanceof Configurable</code>.
+ * {@code instanceof Configurable}.
*
* @deprecated As of 1.2. Please use Configuration Admin service.
- * @version $Revision: 6361 $
+ * @version $Id: 29705c0c238aa456cda1b1a13458079bf1542771 $
*/
public interface Configurable {
/**
* Returns this service's configuration object.
*
* <p>
- * Services implementing <code>Configurable</code> should take care when
+ * Services implementing {@code Configurable} should take care when
* returning a service configuration object since this object is probably
* sensitive.
* <p>
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
index 16a10d80b..8b12801e8 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,18 @@
package org.osgi.framework;
+import org.osgi.framework.launch.Framework;
+
/**
* Defines standard names for the OSGi environment system properties, service
* properties, and Manifest header attribute keys.
*
* <p>
- * The values associated with these keys are of type
- * <code>String</code>, unless otherwise indicated.
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
*
* @since 1.1
- * @version $Revision: 6552 $
+ * @version $Id: 6f6f34684262125c9feaefbaf534155572cb9524 $
*/
public interface Constants {
@@ -46,8 +48,8 @@ public interface Constants {
/**
* Manifest header identifying the bundle's category.
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_CATEGORY = "Bundle-Category";
@@ -56,16 +58,16 @@ public interface Constants {
* which are bundle resources used to extend the bundle's classpath.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_CLASSPATH = "Bundle-ClassPath";
/**
* Manifest header identifying the bundle's copyright information.
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_COPYRIGHT = "Bundle-Copyright";
@@ -73,16 +75,16 @@ public interface Constants {
* Manifest header containing a brief description of the bundle's
* functionality.
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_DESCRIPTION = "Bundle-Description";
/**
* Manifest header identifying the bundle's name.
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_NAME = "Bundle-Name";
@@ -92,8 +94,8 @@ public interface Constants {
* these environments.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_NATIVECODE = "Bundle-NativeCode";
@@ -102,8 +104,8 @@ public interface Constants {
* Framework for export.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String EXPORT_PACKAGE = "Export-Package";
@@ -113,8 +115,8 @@ public interface Constants {
* only).
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @deprecated As of 1.2.
*/
@@ -124,8 +126,8 @@ public interface Constants {
* Manifest header identifying the packages on which the bundle depends.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String IMPORT_PACKAGE = "Import-Package";
@@ -134,8 +136,8 @@ public interface Constants {
* import during execution.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.2
*/
@@ -146,8 +148,8 @@ public interface Constants {
* services that the bundle requires (used for informational purposes only).
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @deprecated As of 1.2.
*/
@@ -157,8 +159,8 @@ public interface Constants {
* Manifest header identifying the bundle's vendor.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_VENDOR = "Bundle-Vendor";
@@ -166,8 +168,8 @@ public interface Constants {
* Manifest header identifying the bundle's version.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_VERSION = "Bundle-Version";
@@ -176,8 +178,8 @@ public interface Constants {
* further information about the bundle may be obtained.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_DOCURL = "Bundle-DocURL";
@@ -186,8 +188,8 @@ public interface Constants {
* bundle may be reported; for example, an email address.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_CONTACTADDRESS = "Bundle-ContactAddress";
@@ -196,13 +198,13 @@ public interface Constants {
*
* <p>
* If present, this header specifies the name of the bundle resource class
- * that implements the <code>BundleActivator</code> interface and whose
- * <code>start</code> and <code>stop</code> methods are called by the
+ * that implements the {@code BundleActivator} interface and whose
+ * {@code start} and {@code stop} methods are called by the
* Framework when the bundle is started and stopped, respectively.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_ACTIVATOR = "Bundle-Activator";
@@ -211,8 +213,8 @@ public interface Constants {
* is obtained during a bundle update operation.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*/
public static final String BUNDLE_UPDATELOCATION = "Bundle-UpdateLocation";
@@ -296,8 +298,8 @@ public interface Constants {
* environments it implements.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.2
*/
@@ -307,8 +309,8 @@ public interface Constants {
* Manifest header identifying the bundle's symbolic name.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.3
*/
@@ -316,7 +318,7 @@ public interface Constants {
/**
* Manifest header directive identifying whether a bundle is a singleton.
- * The default value is <code>false</code>.
+ * The default value is {@code false}.
*
* <p>
* The directive value is encoded in the Bundle-SymbolicName manifest header
@@ -327,8 +329,8 @@ public interface Constants {
* </pre>
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @see #BUNDLE_SYMBOLICNAME
* @since 1.3
@@ -417,8 +419,8 @@ public interface Constants {
* entries.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @see #BUNDLE_LOCALIZATION_DEFAULT_BASENAME
* @since 1.3
@@ -426,7 +428,7 @@ public interface Constants {
public final static String BUNDLE_LOCALIZATION = "Bundle-Localization";
/**
- * Default value for the <code>Bundle-Localization</code> manifest header.
+ * Default value for the {@code Bundle-Localization} manifest header.
*
* @see #BUNDLE_LOCALIZATION
* @since 1.3
@@ -438,8 +440,8 @@ public interface Constants {
* by the bundle.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.3
*/
@@ -447,9 +449,9 @@ public interface Constants {
/**
* Manifest header attribute identifying a range of versions for a bundle
- * specified in the <code>Require-Bundle</code> or
- * <code>Fragment-Host</code> manifest headers. The default value is
- * <code>0.0.0</code>.
+ * specified in the {@code Require-Bundle} or
+ * {@code Fragment-Host} manifest headers. The default value is
+ * {@code 0.0.0}.
*
* <p>
* The attribute value is encoded in the Require-Bundle manifest header
@@ -476,8 +478,8 @@ public interface Constants {
* that the bundle is a fragment.
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.3
*/
@@ -509,8 +511,8 @@ public interface Constants {
* specifically, by version 1.3 of the OSGi Core Specification is "2".
*
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.3
*/
@@ -525,7 +527,7 @@ public interface Constants {
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; version=&quot;1.1&quot;
+ * Export-Package: org.osgi.framework; version=&quot;1.1&quot;
* </pre>
*
* @see #EXPORT_PACKAGE
@@ -822,8 +824,8 @@ public interface Constants {
/**
* Manifest header identifying the bundle's activation policy.
* <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
+ * The attribute value may be retrieved from the {@code Dictionary}
+ * object returned by the {@code Bundle.getHeaders} method.
*
* @since 1.4
* @see #ACTIVATION_LAZY
@@ -861,7 +863,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_VERSION = "org.osgi.framework.version";
@@ -871,7 +873,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_VENDOR = "org.osgi.framework.vendor";
@@ -881,7 +883,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_LANGUAGE = "org.osgi.framework.language";
@@ -891,7 +893,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_OS_NAME = "org.osgi.framework.os.name";
@@ -901,7 +903,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_OS_VERSION = "org.osgi.framework.os.version";
@@ -911,7 +913,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*/
public static final String FRAMEWORK_PROCESSOR = "org.osgi.framework.processor";
@@ -921,7 +923,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.2
*/
@@ -934,7 +936,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @see #FRAMEWORK_BUNDLE_PARENT
* @since 1.3
@@ -951,7 +953,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.3
*/
@@ -967,7 +969,7 @@ public interface Constants {
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @see #FRAMEWORK_SYSTEMPACKAGES
* @since 1.5
@@ -979,12 +981,12 @@ public interface Constants {
* framework extension bundles.
*
* <p>
- * As of version 1.4, the value of this property must be <code>true</code>.
+ * As of version 1.4, the value of this property must be {@code true}.
* The Framework must support framework extension bundles.
*
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.3
*/
@@ -995,12 +997,12 @@ public interface Constants {
* bootclasspath extension bundles.
*
* <p>
- * If the value of this property is <code>true</code>, then the Framework
+ * If the value of this property is {@code true}, then the Framework
* supports bootclasspath extension bundles. The default value is
- * <code>false</code>.
+ * {@code false}.
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.3
*/
@@ -1011,11 +1013,11 @@ public interface Constants {
* fragment bundles.
*
* <p>
- * As of version 1.4, the value of this property must be <code>true</code>.
+ * As of version 1.4, the value of this property must be {@code true}.
* The Framework must support fragment bundles.
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.3
*/
@@ -1026,12 +1028,12 @@ public interface Constants {
* the {@link #REQUIRE_BUNDLE Require-Bundle} manifest header.
*
* <p>
- * As of version 1.4, the value of this property must be <code>true</code>.
- * The Framework must support the <code>Require-Bundle</code> manifest
+ * As of version 1.4, the value of this property must be {@code true}.
+ * The Framework must support the {@code Require-Bundle} manifest
* header.
* <p>
* The value of this property may be retrieved by calling the
- * <code>BundleContext.getProperty</code> method.
+ * {@code BundleContext.getProperty} method.
*
* @since 1.3
*/
@@ -1053,7 +1055,7 @@ public interface Constants {
*
* <p>
* If this value is specified and there is a security manager already
- * installed, then a <code>SecurityException</code> must be thrown when the
+ * installed, then a {@code SecurityException} must be thrown when the
* Framework is initialized.
*
* @see #FRAMEWORK_SECURITY
@@ -1095,18 +1097,18 @@ public interface Constants {
*
* @since 1.5
*/
- public final static String FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT = "onFirstInit";
+ public final static String FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT = "onFirstInit";
/**
* Specifies a comma separated list of additional library file extensions
* that must be used when a bundle's class loader is searching for native
* libraries. If this property is not set, then only the library name
- * returned by <code>System.mapLibraryName(String)</code> will be used to
+ * returned by {@code System.mapLibraryName(String)} will be used to
* search. This is needed for certain operating systems which allow more
* than one extension for a library. For example, AIX allows library
- * extensions of <code>.a</code> and <code>.so</code>, but
- * <code>System.mapLibraryName(String)</code> will only return names with
- * the <code>.a</code> extension.
+ * extensions of {@code .a} and {@code .so}, but
+ * {@code System.mapLibraryName(String)} will only return names with
+ * the {@code .a} extension.
*
* @since 1.5
*/
@@ -1131,9 +1133,17 @@ public interface Constants {
public final static String FRAMEWORK_EXECPERMISSION = "org.osgi.framework.command.execpermission";
/**
+ * Specified the substitution string for the absolute path of a file.
+ *
+ * @see #FRAMEWORK_EXECPERMISSION
+ * @since 1.6
+ */
+ public final static String FRAMEWORK_COMMAND_ABSPATH = "abspath";
+
+ /**
* Specifies the trust repositories used by the framework. The value is a
- * <code>java.io.File.pathSeparator</code> separated list of valid file
- * paths to files that contain key stores of type <code>JKS</code>. The
+ * {@code java.io.File.pathSeparator} separated list of valid file
+ * paths to files that contain key stores of type {@code JKS}. The
* framework will use the key stores as trust repositories to authenticate
* certificates of trusted signers. The key stores are only used as
* read-only trust repositories to access public keys. No passwords are
@@ -1174,7 +1184,7 @@ public interface Constants {
* @see #FRAMEWORK_BUNDLE_PARENT_FRAMEWORK
* @since 1.5
*/
- public final static String FRAMEWORK_BUNDLE_PARENT = "org.osgi.framework.bundle.parent";
+ public final static String FRAMEWORK_BUNDLE_PARENT = "org.osgi.framework.bundle.parent";
/**
* Specifies to use of the boot class loader as the parent class loader for
@@ -1196,8 +1206,8 @@ public interface Constants {
/**
* Specifies to use the application class loader as the parent class loader
- * for all bundle class loaders. Depending on how the framework is
- * launched, this may refer to the same class loader as
+ * for all bundle class loaders. Depending on how the framework is launched,
+ * this may refer to the same class loader as
* {@link #FRAMEWORK_BUNDLE_PARENT_FRAMEWORK}.
*
* @since 1.5
@@ -1208,8 +1218,8 @@ public interface Constants {
/**
* Specifies to use the framework class loader as the parent class loader
* for all bundle class loaders. The framework class loader is the class
- * loader used to load the framework implementation. Depending on how the
- * framework is launched, this may refer to the same class loader as
+ * loader used to load the framework implementation. Depending on how the
+ * framework is launched, this may refer to the same class loader as
* {@link #FRAMEWORK_BUNDLE_PARENT_APP}.
*
* @since 1.5
@@ -1220,11 +1230,11 @@ public interface Constants {
/*
* Service properties.
*/
-
+
/**
* Service property identifying all of the class names under which a service
* was registered in the Framework. The value of this property must be of
- * type <code>String[]</code>.
+ * type {@code String[]}.
*
* <p>
* This property is set by the Framework when a service is registered.
@@ -1233,7 +1243,7 @@ public interface Constants {
/**
* Service property identifying a service's registration number. The value
- * of this property must be of type <code>Long</code>.
+ * of this property must be of type {@code Long}.
*
* <p>
* The value of this property is assigned by the Framework when a service is
@@ -1247,11 +1257,11 @@ public interface Constants {
* Service property identifying a service's persistent identifier.
*
* <p>
- * This property may be supplied in the <code>properties</code>
- * <code>Dictionary</code> object passed to the
- * <code>BundleContext.registerService</code> method. The value of this
- * property must be of type <code>String</code>, <code>String[]</code>, or
- * <code>Collection</code> of <code>String</code>.
+ * This property may be supplied in the {@code properties}
+ * {@code Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code String}, {@code String[]}, or
+ * {@code Collection} of {@code String}.
*
* <p>
* A service's persistent identifier uniquely identifies the service and
@@ -1269,25 +1279,25 @@ public interface Constants {
* Service property identifying a service's ranking number.
*
* <p>
- * This property may be supplied in the <code>properties
- * Dictionary</code> object passed to the
- * <code>BundleContext.registerService</code> method. The value of this
- * property must be of type <code>Integer</code>.
+ * This property may be supplied in the {@code properties
+ * Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code Integer}.
*
* <p>
* The service ranking is used by the Framework to determine the <i>natural
- * order</i> of services, see {@link ServiceReference#compareTo(Object)},
- * and the <i>default</i> service to be returned from a call to the
+ * order</i> of services, see {@link ServiceReference#compareTo}, and the
+ * <i>default</i> service to be returned from a call to the
* {@link BundleContext#getServiceReference} method.
*
* <p>
* The default ranking is zero (0). A service with a ranking of
- * <code>Integer.MAX_VALUE</code> is very likely to be returned as the
+ * {@code Integer.MAX_VALUE} is very likely to be returned as the
* default service, whereas a service with a ranking of
- * <code>Integer.MIN_VALUE</code> is very unlikely to be returned.
+ * {@code Integer.MIN_VALUE} is very unlikely to be returned.
*
* <p>
- * If the supplied property value is not of type <code>Integer</code>, it is
+ * If the supplied property value is not of type {@code Integer}, it is
* deemed to have a ranking value of zero.
*/
public static final String SERVICE_RANKING = "service.ranking";
@@ -1296,8 +1306,8 @@ public interface Constants {
* Service property identifying a service's vendor.
*
* <p>
- * This property may be supplied in the properties <code>Dictionary</code>
- * object passed to the <code>BundleContext.registerService</code> method.
+ * This property may be supplied in the properties {@code Dictionary}
+ * object passed to the {@code BundleContext.registerService} method.
*/
public static final String SERVICE_VENDOR = "service.vendor";
@@ -1305,8 +1315,207 @@ public interface Constants {
* Service property identifying a service's description.
*
* <p>
- * This property may be supplied in the properties <code>Dictionary</code>
- * object passed to the <code>BundleContext.registerService</code> method.
+ * This property may be supplied in the properties {@code Dictionary}
+ * object passed to the {@code BundleContext.registerService} method.
+ */
+ public static final String SERVICE_DESCRIPTION = "service.description";
+
+ /**
+ * Framework environment property identifying the Framework's universally
+ * unique identifier (UUID). A UUID represents a 128-bit value. A new UUID
+ * is generated by the {@link Framework#init()} method each time a framework
+ * is initialized. See the {@code toString} method of
+ * {@code java.util.UUID} for the format of this string.
+ *
+ * <p>
+ * The value of this property may be retrieved by calling the
+ * {@code BundleContext.getProperty} method.
+ *
+ * @since 1.6
+ */
+ public static final String FRAMEWORK_UUID = "org.osgi.framework.uuid";
+
+ /**
+ * Specifies that an returned URLs from bundle class loaders must be a jar:
+ * or file: URL if set to any value. This property must be set in the
+ * launching parameters of the framework. If a Framework cannot support this
+ * property it must throw an Illegal Argument Exception during its
+ * initialization. URLs obtained through the OSGi API do not have this
+ * guarantee, these URLs must follow the existing rules for resource URLs.
+ *
+ * @since 1.6
+ */
+ public final static String FRAMEWORK_JARURLS = "org.osgi.framework.jarurls";
+
+ /**
+ * Service property identifying the configuration types supported by a
+ * distribution provider. Registered by the distribution provider on one of
+ * its services to indicate the supported configuration types.
+ *
+ * <p>
+ * The value of this property must be of type {@code String},
+ * {@code String[]}, or {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String REMOTE_CONFIGS_SUPPORTED = "remote.configs.supported";
+
+ /**
+ * Service property identifying the intents supported by a distribution
+ * provider. Registered by the distribution provider on one of its services
+ * to indicate the vocabulary of implemented intents.
+ *
+ * <p>
+ * The value of this property must be of type {@code String},
+ * {@code String[]}, or {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String REMOTE_INTENTS_SUPPORTED = "remote.intents.supported";
+
+ /**
+ * Service property identifying the configuration types that should be used
+ * to export the service. Each configuration type represents the
+ * configuration parameters for an endpoint. A distribution provider should
+ * create an endpoint for each configuration type that it supports.
+ *
+ * <p>
+ * This property may be supplied in the {@code properties}
+ * {@code Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code String}, {@code String[]}, or
+ * {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String SERVICE_EXPORTED_CONFIGS = "service.exported.configs";
+
+ /**
+ * Service property identifying the intents that the distribution provider
+ * must implement to distribute the service. Intents listed in this property
+ * are reserved for intents that are critical for the code to function
+ * correctly, for example, ordering of messages. These intents should not be
+ * configurable.
+ *
+ * <p>
+ * This property may be supplied in the {@code properties}
+ * {@code Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code String}, {@code String[]}, or
+ * {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String SERVICE_EXPORTED_INTENTS = "service.exported.intents";
+
+ /**
+ * Service property identifying the extra intents that the distribution
+ * provider must implement to distribute the service. This property is
+ * merged with the {@code service.exported.intents} property before the
+ * distribution provider interprets the listed intents; it has therefore the
+ * same semantics but the property should be configurable so the
+ * administrator can choose the intents based on the topology. Bundles
+ * should therefore make this property configurable, for example through the
+ * Configuration Admin service.
+ *
+ * <p>
+ * This property may be supplied in the {@code properties}
+ * {@code Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code String}, {@code String[]}, or
+ * {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String SERVICE_EXPORTED_INTENTS_EXTRA = "service.exported.intents.extra";
+
+ /**
+ * Service property marking the service for export. It defines the
+ * interfaces under which this service can be exported. This list must be a
+ * subset of the types under which the service was registered. The single
+ * value of an asterisk (&quot;*&quot;, &#92;u002A) indicates all the
+ * interface types under which the service was registered excluding the
+ * non-interface types. It is strongly recommended to only export interface
+ * types and not concrete classes due to the complexity of creating proxies
+ * for some type of concrete classes.
+ *
+ * <p>
+ * This property may be supplied in the {@code properties}
+ * {@code Dictionary} object passed to the
+ * {@code BundleContext.registerService} method. The value of this
+ * property must be of type {@code String}, {@code String[]}, or
+ * {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String SERVICE_EXPORTED_INTERFACES = "service.exported.interfaces";
+
+ /**
+ * Service property identifying the service as imported. This service
+ * property must be set by a distribution provider to any value when it
+ * registers the endpoint proxy as an imported service. A bundle can use
+ * this property to filter out imported services.
+ *
+ * <p>
+ * The value of this property may be of any type.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ */
+ public static final String SERVICE_IMPORTED = "service.imported";
+
+ /**
+ * Service property identifying the configuration types used to import the
+ * service. Any associated properties for this configuration types must be
+ * properly mapped to the importing system. For example, a URL in these
+ * properties must point to a valid resource when used in the importing
+ * framework. If multiple configuration types are listed in this property,
+ * then they must be synonyms for exactly the same remote endpoint that is
+ * used to export this service.
+ *
+ * <p>
+ * The value of this property must be of type {@code String},
+ * {@code String[]}, or {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
+ * @see #SERVICE_EXPORTED_CONFIGS
+ */
+ public static final String SERVICE_IMPORTED_CONFIGS = "service.imported.configs";
+
+ /**
+ * Service property identifying the intents that this service implement.
+ * This property has a dual purpose:
+ * <ul>
+ * <li>A bundle can use this service property to notify the distribution
+ * provider that these intents are already implemented by the exported
+ * service object.</li>
+ * <li>A distribution provider must use this property to convey the combined
+ * intents of:</li>
+ * <ul>
+ * <li>The exporting service, and</li>
+ * <li>the intents that the exporting distribution provider adds, and</li>
+ * <li>the intents that the importing distribution provider adds.</li>
+ * </ul>
+ * <i></i>
+ *
+ * </ul>
+ * To export a service, a distribution provider must expand any qualified
+ * intents. Both the exporting and importing distribution providers must
+ * recognize all intents before a service can be distributed.
+ *
+ * <p>
+ * The value of this property must be of type {@code String},
+ * {@code String[]}, or {@code Collection} of {@code String}.
+ *
+ * @since 1.6
+ * @see "Remote Services Specification"
*/
- public static final String SERVICE_DESCRIPTION = "service.description";
+ public static final String SERVICE_INTENTS = "service.intents";
}
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 81c3e5b3e..7b29853d4 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,13 @@ import java.util.Dictionary;
/**
* An RFC 1960-based Filter.
* <p>
- * <code>Filter</code>s can be created by calling
+ * {@code Filter}s can be created by calling
* {@link BundleContext#createFilter} or {@link FrameworkUtil#createFilter} with
* a filter string.
* <p>
- * A <code>Filter</code> can be used numerous times to determine if the match
+ * A {@code Filter} can be used numerous times to determine if the match
* argument matches the filter string that was used to create the
- * <code>Filter</code>.
+ * {@code Filter}.
* <p>
* Some examples of LDAP filters are:
*
@@ -40,84 +40,84 @@ import java.util.Dictionary;
* @since 1.1
* @see "Core Specification, section 5.5, for a description of the filter string syntax."
* @ThreadSafe
- * @version $Revision: 6860 $
+ * @version $Id: 7d78403e84d093db71d5aeb9c2028f859b902c0b $
*/
public interface Filter {
/**
* Filter using a service's properties.
* <p>
- * This <code>Filter</code> is executed using the keys and values of the
+ * This {@code Filter} is executed using the keys and values of the
* referenced service's properties. The keys are case insensitively matched
- * with this <code>Filter</code>.
+ * with this {@code Filter}.
*
* @param reference The reference to the service whose properties are used
* in the match.
- * @return <code>true</code> if the service's properties match this
- * <code>Filter</code>; <code>false</code> otherwise.
+ * @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);
/**
- * Filter using a <code>Dictionary</code>. This <code>Filter</code> is
- * executed using the specified <code>Dictionary</code>'s keys and values.
- * The keys are case insensitively matched with this <code>Filter</code>.
+ * Filter using a {@code Dictionary}. This {@code Filter} is
+ * executed using the specified {@code Dictionary}'s keys and values.
+ * The keys are case insensitively matched with this {@code Filter}.
*
- * @param dictionary The <code>Dictionary</code> whose keys are used in the
+ * @param dictionary The {@code Dictionary} whose keys are used in the
* match.
- * @return <code>true</code> if the <code>Dictionary</code>'s keys and
- * values match this filter; <code>false</code> otherwise.
- * @throws IllegalArgumentException If <code>dictionary</code> contains case
+ * @return {@code true} if the {@code Dictionary}'s keys and
+ * values match this filter; {@code false} otherwise.
+ * @throws IllegalArgumentException If {@code dictionary} contains case
* variants of the same key name.
*/
- public boolean match(Dictionary dictionary);
+ public boolean match(Dictionary<String, ? > dictionary);
/**
- * Returns this <code>Filter</code>'s filter string.
+ * Returns this {@code Filter}'s filter string.
* <p>
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
*
- * @return This <code>Filter</code>'s filter string.
+ * @return This {@code Filter}'s filter string.
*/
public String toString();
/**
- * Compares this <code>Filter</code> to another <code>Filter</code>.
+ * Compares this {@code Filter} to another {@code Filter}.
*
* <p>
- * This method returns the result of calling
- * <code>this.toString().equals(obj.toString())</code>.
+ * This implementation returns the result of calling
+ * {@code this.toString().equals(obj.toString())}.
*
- * @param obj The object to compare against this <code>Filter</code>.
- * @return If the other object is a <code>Filter</code> object, then returns
+ * @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>;
- * <code>false</code> otherwise.
+ * {@code this.toString().equals(obj.toString())};
+ * {@code false} otherwise.
*/
public boolean equals(Object obj);
/**
- * Returns the hashCode for this <code>Filter</code>.
+ * Returns the hashCode for this {@code Filter}.
*
* <p>
- * This method returns the result of calling
- * <code>this.toString().hashCode()</code>.
+ * This implementation returns the result of calling
+ * {@code this.toString().hashCode()}.
*
- * @return The hashCode of this <code>Filter</code>.
+ * @return The hashCode of this {@code Filter}.
*/
public int hashCode();
/**
- * Filter with case sensitivity using a <code>Dictionary</code>. This
- * <code>Filter</code> is executed using the specified
- * <code>Dictionary</code>'s keys and values. The keys are case sensitively
- * matched with this <code>Filter</code>.
+ * Filter with case sensitivity using a {@code Dictionary}. This
+ * {@code Filter} is executed using the specified
+ * {@code Dictionary}'s keys and values. The keys are case sensitively
+ * matched with this {@code Filter}.
*
- * @param dictionary The <code>Dictionary</code> whose keys are used in the
+ * @param dictionary The {@code Dictionary} whose keys are used in the
* match.
- * @return <code>true</code> if the <code>Dictionary</code>'s keys and
- * values match this filter; <code>false</code> otherwise.
+ * @return {@code true} if the {@code Dictionary}'s keys and
+ * values match this filter; {@code false} otherwise.
* @since 1.3
*/
- public boolean matchCase(Dictionary dictionary);
+ public boolean matchCase(Dictionary<String, ? > dictionary);
}
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 747b24902..2cc72cfe9 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2010). 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,8 +22,8 @@ import java.util.EventObject;
* A general event from the Framework.
*
* <p>
- * <code>FrameworkEvent</code> objects are delivered to
- * <code>FrameworkListener</code>s when a general event occurs within the OSGi
+ * {@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.
*
@@ -32,7 +32,7 @@ import java.util.EventObject;
*
* @Immutable
* @see FrameworkListener
- * @version $Revision: 6542 $
+ * @version $Id: 897075a0bc075c0bb89e77d113f05ca84406a073 $
*/
public class FrameworkEvent extends EventObject {
@@ -82,7 +82,7 @@ public class FrameworkEvent extends EventObject {
* The source of this event is the System Bundle.
*
* @since 1.2
- * @see "<code>PackageAdmin.refreshPackages</code>"
+ * @see "{@code PackageAdmin.refreshPackages}"
*/
public final static int PACKAGES_REFRESHED = 0x00000004;
@@ -170,7 +170,7 @@ public class FrameworkEvent extends EventObject {
* Creates a Framework event.
*
* @param type The event type.
- * @param source The event source object. This may not be <code>null</code>.
+ * @param source The event source object. This may not be {@code null}.
* @deprecated As of 1.2. This constructor is deprecated in favor of using
* the other constructor with the System Bundle as the event
* source.
@@ -188,7 +188,7 @@ 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</code> if there is no related exception.
+ * {@code null} if there is no related exception.
*/
public FrameworkEvent(int type, Bundle bundle, Throwable throwable) {
super(bundle);
@@ -200,7 +200,7 @@ public class FrameworkEvent extends EventObject {
/**
* Returns the exception related to this event.
*
- * @return The related exception or <code>null</code> if none.
+ * @return The related exception or {@code null} if none.
*/
public Throwable getThrowable() {
return throwable;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
index c96c4904e..5d73fb904 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,31 +19,31 @@ package org.osgi.framework;
import java.util.EventListener;
/**
- * A <code>FrameworkEvent</code> listener. <code>FrameworkListener</code> is
+ * A {@code FrameworkEvent} listener. {@code FrameworkListener} is
* a listener interface that may be implemented by a bundle developer. When a
- * <code>FrameworkEvent</code> is fired, it is asynchronously delivered to a
- * <code>FrameworkListener</code>. The Framework delivers
- * <code>FrameworkEvent</code> objects to a <code>FrameworkListener</code>
- * in order and must not concurrently call a <code>FrameworkListener</code>.
+ * {@code FrameworkEvent} is fired, it is asynchronously delivered to a
+ * {@code FrameworkListener}. The Framework delivers
+ * {@code FrameworkEvent} objects to a {@code FrameworkListener}
+ * in order and must not concurrently call a {@code FrameworkListener}.
*
* <p>
- * A <code>FrameworkListener</code> object is registered with the Framework
+ * A {@code FrameworkListener} object is registered with the Framework
* using the {@link BundleContext#addFrameworkListener} method.
- * <code>FrameworkListener</code> objects are called with a
- * <code>FrameworkEvent</code> objects when the Framework starts and when
+ * {@code FrameworkListener} objects are called with a
+ * {@code FrameworkEvent} objects when the Framework starts and when
* asynchronous errors occur.
*
* @see FrameworkEvent
* @NotThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: a32e7599ea09d3510759d77e824cb8d9eff67f9d $
*/
public interface FrameworkListener extends EventListener {
/**
- * Receives notification of a general <code>FrameworkEvent</code> object.
+ * Receives notification of a general {@code FrameworkEvent} object.
*
- * @param event The <code>FrameworkEvent</code> object.
+ * @param event The {@code FrameworkEvent} object.
*/
public void frameworkEvent(FrameworkEvent event);
}
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 0b31ec855..1f0e9b7ed 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2010). 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.
@@ -39,7 +39,7 @@ import javax.security.auth.x500.X500Principal;
*
* @since 1.3
* @ThreadSafe
- * @version $Revision: 8080 $
+ * @version $Id: 8a1d1d4745abe4f3c6cd4272874260c356d45a0d $
*/
public class FrameworkUtil {
/**
@@ -50,9 +50,9 @@ public class FrameworkUtil {
}
/**
- * Creates a <code>Filter</code> object. This <code>Filter</code> object may
- * be used to match a <code>ServiceReference</code> object or a
- * <code>Dictionary</code> 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
@@ -64,10 +64,10 @@ public class FrameworkUtil {
* by {@link BundleContext#createFilter(String)}.
*
* @param filter The filter string.
- * @return A <code>Filter</code> object encapsulating the filter string.
- * @throws InvalidSyntaxException If <code>filter</code> contains an invalid
+ * @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</code> is null.
+ * @throws NullPointerException If {@code filter} is null.
*
* @see Filter
*/
@@ -102,8 +102,8 @@ public class FrameworkUtil {
* wildcard can also replace the first list of RDNs of a DN. The first RDNs
* are the least significant. Such lists of matched RDNs can be empty.
* <p>
- * For example, a match pattern with a wildcard that matches all all DNs
- * that end with RDNs of o=ACME and c=US would look like this:
+ * 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
@@ -176,34 +176,35 @@ public class FrameworkUtil {
*
* @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</code> and use
+ * element of the chain must be of type {@code String} and use
* the format defined in RFC 2253.
- * @return <code>true</code> If the pattern matches the DN chain; otherwise
- * <code>false</code> is returned.
+ * @return {@code true} If the pattern matches the DN chain; otherwise
+ * {@code false} is returned.
* @throws IllegalArgumentException If the specified match pattern or DN
* chain is invalid.
* @since 1.5
*/
public static boolean matchDistinguishedNameChain(String matchPattern,
- List /* <String> */dnChain) {
+ List<String> dnChain) {
return DNChainMatching.match(matchPattern, dnChain);
}
/**
- * Return a <code>Bundle</code> for the specified bundle class. The returned
- * <code>Bundle</code> is the bundle associated with the bundle class loader
+ * 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</code> for the specified bundle class or
- * <code>null</code> if the specified class was not defined by a
+ * @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 cl = AccessController
+ .doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return classFromBundle.getClassLoader();
}
@@ -256,16 +257,16 @@ public class FrameworkUtil {
* &lt;final&gt; ::= NULL | &lt;value&gt;
* </pre>
*
- * <code>&lt;attr&gt;</code> is a string representing an attribute, or key,
+ * {@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;</code> is a string representing the value, or part of
+ * {@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;</code> must contain one of the characters '
- * <code>*</code>' or '<code>(</code>' or '<code>)</code>', these characters
- * should be escaped by preceding them with the backslash '<code>\</code>'
- * character. Note that although both the <code>&lt;substring&gt;</code> and
- * <code>&lt;present&gt;</code> productions can produce the <code>'attr=*'</code>
+ * {@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>
@@ -279,7 +280,7 @@ public class FrameworkUtil {
* </pre>
*
* <p>
- * The approximate match (<code>~=</code>) is implementation specific but
+ * 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.
*
@@ -331,11 +332,11 @@ public class FrameworkUtil {
* d.put(&quot;cn&quot;, new String[] {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;});
* </pre>
*
- * d will match <code>(cn=a)</code> and also <code>(cn=b)</code>
+ * 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</code> .
+ * type will evaluate to {@code false} .
*/
private static class FilterImpl implements Filter {
/* filter operators */
@@ -369,7 +370,7 @@ public class FrameworkUtil {
* unparsable.
*
* @param filterString the filter string.
- * @exception InvalidSyntaxException If the filter parameter contains an
+ * @throws InvalidSyntaxException If the filter parameter contains an
* invalid filter string that cannot be parsed.
*/
static FilterImpl newInstance(String filterString)
@@ -386,59 +387,59 @@ public class FrameworkUtil {
/**
* Filter using a service's properties.
* <p>
- * This <code>Filter</code> is executed using the keys and values of the
+ * This {@code Filter} is executed using the keys and values of the
* referenced service's properties. The keys are case insensitively
- * matched with this <code>Filter</code>.
+ * matched with this {@code Filter}.
*
* @param reference The reference to the service whose properties are
* used in the match.
- * @return <code>true</code> if the service's properties match this
- * <code>Filter</code>; <code>false</code> otherwise.
+ * @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 match0(new ServiceReferenceDictionary(reference));
}
/**
- * Filter using a <code>Dictionary</code>. This <code>Filter</code> is
- * executed using the specified <code>Dictionary</code>'s keys and
+ * Filter using a {@code Dictionary}. This {@code Filter} is
+ * executed using the specified {@code Dictionary}'s keys and
* values. The keys are case insensitively matched with this
- * <code>Filter</code>.
+ * {@code Filter}.
*
- * @param dictionary The <code>Dictionary</code> whose keys are used in
+ * @param dictionary The {@code Dictionary} whose keys are used in
* the match.
- * @return <code>true</code> if the <code>Dictionary</code>'s keys and
- * values match this filter; <code>false</code> otherwise.
- * @throws IllegalArgumentException If <code>dictionary</code> contains
+ * @return {@code true} if the {@code Dictionary}'s keys and
+ * values match this filter; {@code false} otherwise.
+ * @throws IllegalArgumentException If {@code dictionary} contains
* case variants of the same key name.
*/
- public boolean match(Dictionary dictionary) {
+ public boolean match(Dictionary<String, ? > dictionary) {
return match0(new CaseInsensitiveDictionary(dictionary));
}
/**
- * Filter with case sensitivity using a <code>Dictionary</code>. This
- * <code>Filter</code> is executed using the specified
- * <code>Dictionary</code>'s keys and values. The keys are case
- * sensitively matched with this <code>Filter</code>.
+ * Filter with case sensitivity using a {@code Dictionary}. This
+ * {@code Filter} is executed using the specified
+ * {@code Dictionary}'s keys and values. The keys are case
+ * sensitively matched with this {@code Filter}.
*
- * @param dictionary The <code>Dictionary</code> whose keys are used in
+ * @param dictionary The {@code Dictionary} whose keys are used in
* the match.
- * @return <code>true</code> if the <code>Dictionary</code>'s keys and
- * values match this filter; <code>false</code> otherwise.
+ * @return {@code true} if the {@code Dictionary}'s keys and
+ * values match this filter; {@code false} otherwise.
* @since 1.3
*/
- public boolean matchCase(Dictionary dictionary) {
+ public boolean matchCase(Dictionary<String, ? > dictionary) {
return match0(dictionary);
}
/**
- * Returns this <code>Filter</code>'s filter string.
+ * Returns this {@code Filter}'s filter string.
* <p>
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
*
- * @return This <code>Filter</code>'s filter string.
+ * @return This {@code Filter}'s filter string.
*/
public String toString() {
String result = filterString;
@@ -449,12 +450,12 @@ public class FrameworkUtil {
}
/**
- * Returns this <code>Filter</code>'s normalized filter string.
+ * Returns this {@code Filter}'s normalized filter string.
* <p>
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
*
- * @return This <code>Filter</code>'s filter string.
+ * @return This {@code Filter}'s filter string.
*/
private String normalize() {
StringBuffer sb = new StringBuffer();
@@ -465,8 +466,8 @@ public class FrameworkUtil {
sb.append('&');
FilterImpl[] filters = (FilterImpl[]) value;
- for (int i = 0, size = filters.length; i < size; i++) {
- sb.append(filters[i].normalize());
+ for (FilterImpl f : filters) {
+ sb.append(f.normalize());
}
break;
@@ -476,8 +477,8 @@ public class FrameworkUtil {
sb.append('|');
FilterImpl[] filters = (FilterImpl[]) value;
- for (int i = 0, size = filters.length; i < size; i++) {
- sb.append(filters[i].normalize());
+ for (FilterImpl f : filters) {
+ sb.append(f.normalize());
}
break;
@@ -497,9 +498,7 @@ public class FrameworkUtil {
String[] substrings = (String[]) value;
- for (int i = 0, size = substrings.length; i < size; i++) {
- String substr = substrings[i];
-
+ for (String substr : substrings) {
if (substr == null) /* * */{
sb.append('*');
}
@@ -553,17 +552,17 @@ public class FrameworkUtil {
}
/**
- * Compares this <code>Filter</code> to another <code>Filter</code>.
+ * Compares this {@code Filter} to another {@code Filter}.
*
* <p>
* This implementation returns the result of calling
- * <code>this.toString().equals(obj.toString()</code>.
+ * {@code this.toString().equals(obj.toString()}.
*
- * @param obj The object to compare against this <code>Filter</code>.
- * @return If the other object is a <code>Filter</code> object, then
+ * @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>;
- * <code>false</code> otherwise.
+ * {@code this.toString().equals(obj.toString()};
+ * {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -578,13 +577,13 @@ public class FrameworkUtil {
}
/**
- * Returns the hashCode for this <code>Filter</code>.
+ * Returns the hashCode for this {@code Filter}.
*
* <p>
* This implementation returns the result of calling
- * <code>this.toString().hashCode()</code>.
+ * {@code this.toString().hashCode()}.
*
- * @return The hashCode of this <code>Filter</code>.
+ * @return The hashCode of this {@code Filter}.
*/
public int hashCode() {
return this.toString().hashCode();
@@ -596,14 +595,14 @@ public class FrameworkUtil {
*
* @param properties A dictionary whose keys are used in the match.
* @return If the Dictionary's keys match the filter, return
- * <code>true</code>. Otherwise, return <code>false</code>.
+ * {@code true}. Otherwise, return {@code false}.
*/
- private boolean match0(Dictionary properties) {
+ private boolean match0(Dictionary<String, ? > properties) {
switch (op) {
case AND : {
FilterImpl[] filters = (FilterImpl[]) value;
- for (int i = 0, size = filters.length; i < size; i++) {
- if (!filters[i].match0(properties)) {
+ for (FilterImpl f : filters) {
+ if (!f.match0(properties)) {
return false;
}
}
@@ -613,8 +612,8 @@ public class FrameworkUtil {
case OR : {
FilterImpl[] filters = (FilterImpl[]) value;
- for (int i = 0, size = filters.length; i < size; i++) {
- if (filters[i].match0(properties)) {
+ for (FilterImpl f : filters) {
+ if (f.match0(properties)) {
return true;
}
}
@@ -696,17 +695,17 @@ 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_ObjectArray(operation, (Object[]) value1, value2);
}
- if (value1 instanceof Collection) {
- return compare_Collection(operation, (Collection) value1,
+ if (value1 instanceof Collection< ? >) {
+ return compare_Collection(operation, (Collection< ? >) value1,
value2);
}
if (value1 instanceof Integer) {
@@ -741,17 +740,17 @@ public class FrameworkUtil {
return compare_Boolean(operation, ((Boolean) value1)
.booleanValue(), value2);
}
- if (value1 instanceof Comparable) {
- return compare_Comparable(operation, (Comparable) value1,
- value2);
+ if (value1 instanceof Comparable< ? >) {
+ Comparable<Object> comparable = (Comparable<Object>) value1;
+ return compare_Comparable(operation, comparable, value2);
}
- return compare_Unknown(operation, value1, value2); // RFC 59
+ return compare_Unknown(operation, value1, value2);
}
private boolean compare_Collection(int operation,
- Collection collection, Object value2) {
- for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
- if (compare(operation, iterator.next(), value2)) {
+ Collection< ? > collection, Object value2) {
+ for (Object value1 : collection) {
+ if (compare(operation, value1, value2)) {
return true;
}
}
@@ -760,20 +759,20 @@ public class FrameworkUtil {
private boolean compare_ObjectArray(int operation, Object[] array,
Object value2) {
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare(operation, array[i], value2)) {
+ for (Object value1 : array) {
+ if (compare(operation, value1, value2)) {
return true;
}
}
return false;
}
- private boolean compare_PrimitiveArray(int operation, Class type,
+ private boolean compare_PrimitiveArray(int operation, Class< ? > type,
Object primarray, Object value2) {
if (Integer.TYPE.isAssignableFrom(type)) {
int[] array = (int[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Integer(operation, array[i], value2)) {
+ for (int value1 : array) {
+ if (compare_Integer(operation, value1, value2)) {
return true;
}
}
@@ -781,8 +780,8 @@ public class FrameworkUtil {
}
if (Long.TYPE.isAssignableFrom(type)) {
long[] array = (long[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Long(operation, array[i], value2)) {
+ for (long value1 : array) {
+ if (compare_Long(operation, value1, value2)) {
return true;
}
}
@@ -790,8 +789,8 @@ public class FrameworkUtil {
}
if (Byte.TYPE.isAssignableFrom(type)) {
byte[] array = (byte[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Byte(operation, array[i], value2)) {
+ for (byte value1 : array) {
+ if (compare_Byte(operation, value1, value2)) {
return true;
}
}
@@ -799,8 +798,8 @@ public class FrameworkUtil {
}
if (Short.TYPE.isAssignableFrom(type)) {
short[] array = (short[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Short(operation, array[i], value2)) {
+ for (short value1 : array) {
+ if (compare_Short(operation, value1, value2)) {
return true;
}
}
@@ -808,8 +807,8 @@ public class FrameworkUtil {
}
if (Character.TYPE.isAssignableFrom(type)) {
char[] array = (char[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Character(operation, array[i], value2)) {
+ for (char value1 : array) {
+ if (compare_Character(operation, value1, value2)) {
return true;
}
}
@@ -817,8 +816,8 @@ public class FrameworkUtil {
}
if (Float.TYPE.isAssignableFrom(type)) {
float[] array = (float[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Float(operation, array[i], value2)) {
+ for (float value1 : array) {
+ if (compare_Float(operation, value1, value2)) {
return true;
}
}
@@ -826,8 +825,8 @@ public class FrameworkUtil {
}
if (Double.TYPE.isAssignableFrom(type)) {
double[] array = (double[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Double(operation, array[i], value2)) {
+ for (double value1 : array) {
+ if (compare_Double(operation, value1, value2)) {
return true;
}
}
@@ -835,8 +834,8 @@ public class FrameworkUtil {
}
if (Boolean.TYPE.isAssignableFrom(type)) {
boolean[] array = (boolean[]) primarray;
- for (int i = 0, size = array.length; i < size; i++) {
- if (compare_Boolean(operation, array[i], value2)) {
+ for (boolean value1 : array) {
+ if (compare_Boolean(operation, value1, value2)) {
return true;
}
}
@@ -1131,14 +1130,14 @@ public class FrameworkUtil {
return false;
}
- private static final Class[] constructorType = new Class[] {String.class};
+ private static final Class< ? >[] constructorType = new Class[] {String.class};
- private boolean compare_Comparable(int operation, Comparable value1,
- Object value2) {
+ private boolean compare_Comparable(int operation,
+ Comparable<Object> value1, Object value2) {
if (operation == SUBSTRING) {
return false;
}
- Constructor constructor;
+ Constructor< ? > constructor;
try {
constructor = value1.getClass().getConstructor(constructorType);
}
@@ -1162,18 +1161,24 @@ public class FrameworkUtil {
return false;
}
- switch (operation) {
- case APPROX :
- case EQUAL : {
- return value1.compareTo(value2) == 0;
- }
- case GREATER : {
- return value1.compareTo(value2) >= 0;
- }
- case LESS : {
- return value1.compareTo(value2) <= 0;
+ try {
+ switch (operation) {
+ case APPROX :
+ case EQUAL : {
+ return value1.compareTo(value2) == 0;
+ }
+ case GREATER : {
+ return value1.compareTo(value2) >= 0;
+ }
+ case LESS : {
+ return value1.compareTo(value2) <= 0;
+ }
}
}
+ catch (Exception e) {
+ // if the compareTo method throws an exception; return false
+ return false;
+ }
return false;
}
@@ -1182,7 +1187,7 @@ public class FrameworkUtil {
if (operation == SUBSTRING) {
return false;
}
- Constructor constructor;
+ Constructor< ? > constructor;
try {
constructor = value1.getClass().getConstructor(constructorType);
}
@@ -1206,14 +1211,20 @@ public class FrameworkUtil {
return false;
}
- switch (operation) {
- case APPROX :
- case EQUAL :
- case GREATER :
- case LESS : {
- return value1.equals(value2);
+ try {
+ switch (operation) {
+ case APPROX :
+ case EQUAL :
+ case GREATER :
+ case LESS : {
+ return value1.equals(value2);
+ }
}
}
+ catch (Exception e) {
+ // if the equals method throws an exception; return false
+ return false;
+ }
return false;
}
@@ -1230,9 +1241,7 @@ public class FrameworkUtil {
boolean changed = false;
char[] output = input.toCharArray();
int cursor = 0;
- for (int i = 0, length = output.length; i < length; i++) {
- char c = output[i];
-
+ for (char c : output) {
if (Character.isWhitespace(c)) {
changed = true;
continue;
@@ -1268,7 +1277,7 @@ public class FrameworkUtil {
}
catch (ArrayIndexOutOfBoundsException e) {
throw new InvalidSyntaxException("Filter ended abruptly",
- filterstring);
+ filterstring, e);
}
if (pos != filterChars.length) {
@@ -1337,7 +1346,7 @@ public class FrameworkUtil {
return parse_item();
}
- List operands = new ArrayList(10);
+ List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
while (filterChars[pos] == '(') {
FilterImpl child = parse_filter();
@@ -1357,7 +1366,7 @@ public class FrameworkUtil {
return parse_item();
}
- List operands = new ArrayList(10);
+ List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
while (filterChars[pos] == '(') {
FilterImpl child = parse_filter();
@@ -1510,7 +1519,7 @@ public class FrameworkUtil {
private Object parse_substring() throws InvalidSyntaxException {
StringBuffer sb = new StringBuffer(filterChars.length - pos);
- List operands = new ArrayList(10);
+ List<String> operands = new ArrayList<String>(10);
parseloop: while (true) {
char c = filterChars[pos];
@@ -1588,44 +1597,44 @@ public class FrameworkUtil {
* operation using a String key as no other operations are used by the
* Filter implementation.
*/
- private static class CaseInsensitiveDictionary extends Dictionary {
- private final Dictionary dictionary;
+ private static class CaseInsensitiveDictionary extends
+ Dictionary<String, Object> {
+ private final Dictionary<String, ? > dictionary;
private final String[] keys;
/**
* Create a case insensitive dictionary from the specified dictionary.
*
* @param dictionary
- * @throws IllegalArgumentException If <code>dictionary</code> contains
+ * @throws IllegalArgumentException If {@code dictionary} contains
* case variants of the same key name.
*/
- CaseInsensitiveDictionary(Dictionary dictionary) {
+ CaseInsensitiveDictionary(Dictionary<String, ? > dictionary) {
if (dictionary == null) {
this.dictionary = null;
this.keys = new String[0];
return;
}
this.dictionary = dictionary;
- List keyList = new ArrayList(dictionary.size());
- for (Enumeration e = dictionary.keys(); e.hasMoreElements();) {
+ List<String> keyList = new ArrayList<String>(dictionary.size());
+ for (Enumeration<?> e = dictionary.keys(); e.hasMoreElements();) {
Object k = e.nextElement();
if (k instanceof String) {
String key = (String) k;
- for (Iterator i = keyList.iterator(); i.hasNext();) {
- if (key.equalsIgnoreCase((String) i.next())) {
+ for (String i : keyList) {
+ if (key.equalsIgnoreCase(i)) {
throw new IllegalArgumentException();
}
}
keyList.add(key);
}
}
- this.keys = (String[]) keyList.toArray(new String[keyList.size()]);
+ this.keys = keyList.toArray(new String[keyList.size()]);
}
public Object get(Object o) {
String k = (String) o;
- for (int i = 0, length = keys.length; i < length; i++) {
- String key = keys[i];
+ for (String key : keys) {
if (key.equalsIgnoreCase(k)) {
return dictionary.get(key);
}
@@ -1637,15 +1646,15 @@ public class FrameworkUtil {
throw new UnsupportedOperationException();
}
- public Enumeration keys() {
+ public Enumeration<String> keys() {
throw new UnsupportedOperationException();
}
- public Enumeration elements() {
+ public Enumeration<Object> elements() {
throw new UnsupportedOperationException();
}
- public Object put(Object key, Object value) {
+ public Object put(String key, Object value) {
throw new UnsupportedOperationException();
}
@@ -1664,10 +1673,11 @@ public class FrameworkUtil {
* operation using a String key as no other operations are used by the
* Filter implementation.
*/
- private static class ServiceReferenceDictionary extends Dictionary {
- private final ServiceReference reference;
+ private static class ServiceReferenceDictionary extends
+ Dictionary<String, Object> {
+ private final ServiceReference< ? > reference;
- ServiceReferenceDictionary(ServiceReference reference) {
+ ServiceReferenceDictionary(ServiceReference< ? > reference) {
this.reference = reference;
}
@@ -1682,15 +1692,15 @@ public class FrameworkUtil {
throw new UnsupportedOperationException();
}
- public Enumeration keys() {
+ public Enumeration<String> keys() {
throw new UnsupportedOperationException();
}
- public Enumeration elements() {
+ public Enumeration<Object> elements() {
throw new UnsupportedOperationException();
}
- public Object put(Object key, Object value) {
+ public Object put(String key, Object value) {
throw new UnsupportedOperationException();
}
@@ -1703,7 +1713,8 @@ public class FrameworkUtil {
}
}
- private static class SetAccessibleAction implements PrivilegedAction {
+ private static class SetAccessibleAction implements
+ PrivilegedAction<Object> {
private final AccessibleObject accessible;
SetAccessibleAction(AccessibleObject accessible) {
@@ -1730,12 +1741,12 @@ public class FrameworkUtil {
* 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</code>
- * " and " <code>ou=Super CA,c=CA</code>
+ * 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</code>" and "<code>o=ACME</code>" and "
- * <code>c=us</code>". The first RDN has two name value pairs: "
- * <code>cn=ben</code>" and "<code>ou=research</code>".
+ * {@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
@@ -1758,7 +1769,7 @@ public class FrameworkUtil {
* @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;
}
@@ -1782,7 +1793,7 @@ public class FrameworkUtil {
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();
@@ -1809,7 +1820,8 @@ public class FrameworkUtil {
}
}
for (int i = 0; i < patLen; i++) {
- if (!rdnmatch((List) dn.get(i + dnStart), (List) dnPattern
+ if (!rdnmatch((List< ? >) dn.get(i + dnStart),
+ (List< ? >) dnPattern
.get(i + patStart))) {
return false;
}
@@ -1830,12 +1842,12 @@ public class FrameworkUtil {
* @return a list of DNs.
* @throws IllegalArgumentException
*/
- private static List parseDNchainPattern(String dnChain) {
+ private static List<Object> parseDNchainPattern(String dnChain) {
if (dnChain == null) {
throw new IllegalArgumentException(
"The DN chain must not be null.");
}
- List parsed = new ArrayList();
+ List<String> parsed = new ArrayList<String>();
int startIndex = 0;
startIndex = skipSpaces(dnChain, startIndex);
while (startIndex < dnChain.length()) {
@@ -1866,19 +1878,19 @@ public class FrameworkUtil {
return parseDNchain(parsed);
}
- private static List parseDNchain(List chain) {
+ private static List<Object> parseDNchain(List<String> chain) {
if (chain == null) {
throw new IllegalArgumentException("DN chain must not be null.");
}
- chain = new ArrayList(chain);
+ List<Object> result = new ArrayList<Object>(chain);
// Now we parse is a list of strings, lets make List of rdn out
// of them
- for (int i = 0; i < chain.size(); i++) {
- String dn = (String) chain.get(i);
+ for (int i = 0; i < result.size(); i++) {
+ String dn = (String) result.get(i);
if (dn.equals(STAR_WILDCARD) || dn.equals(MINUS_WILDCARD)) {
continue;
}
- List rdns = new ArrayList();
+ List<Object> rdns = new ArrayList<Object>();
if (dn.charAt(0) == '*') {
if (dn.charAt(1) != ',') {
throw new IllegalArgumentException(
@@ -1893,12 +1905,12 @@ public class FrameworkUtil {
}
// Now dn is a nice CANONICAL DN
parseDN(dn, rdns);
- chain.set(i, rdns);
+ result.set(i, rdns);
}
- if (chain.size() == 0) {
+ if (result.size() == 0) {
throw new IllegalArgumentException("empty DN chain");
}
- return chain;
+ return result;
}
/**
@@ -1921,10 +1933,10 @@ public class FrameworkUtil {
* @param rdn the list to fill in with RDNs extracted from the dn
* @throws IllegalArgumentException if a formatting error is found.
*/
- private static void parseDN(String dn, List rdn) {
+ private static void parseDN(String dn, List<Object> rdn) {
int startIndex = 0;
char c = '\0';
- List nameValues = new ArrayList();
+ List<String> nameValues = new ArrayList<String>();
while (startIndex < dn.length()) {
int endIndex;
for (endIndex = startIndex; endIndex < dn.length(); endIndex++) {
@@ -1944,7 +1956,7 @@ public class FrameworkUtil {
if (c != '+') {
rdn.add(nameValues);
if (endIndex != dn.length()) {
- nameValues = new ArrayList();
+ nameValues = new ArrayList<String>();
}
else {
nameValues = null;
@@ -1962,7 +1974,7 @@ 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 dnChainPattern,
+ private static int skipWildCards(List<Object> dnChainPattern,
int dnChainPatternIndex) {
int i;
for (i = dnChainPatternIndex; i < dnChainPattern.size(); i++) {
@@ -1976,7 +1988,7 @@ public class FrameworkUtil {
// otherwise continue skipping over wild cards
}
else {
- if (dnPattern instanceof List) {
+ if (dnPattern instanceof List< ? >) {
// if its a list then we have our 'non-wildcard' DN
break;
}
@@ -1997,8 +2009,9 @@ 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 dnChain, int dnChainIndex,
- List dnChainPattern, int dnChainPatternIndex)
+ private static boolean dnChainMatch(List<Object> dnChain,
+ int dnChainIndex, List<Object> dnChainPattern,
+ int dnChainPatternIndex)
throws IllegalArgumentException {
if (dnChainIndex >= dnChain.size()) {
return false;
@@ -2052,12 +2065,12 @@ public class FrameworkUtil {
// failure
}
else {
- if (dnPattern instanceof List) {
+ 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
@@ -2099,7 +2112,7 @@ public class FrameworkUtil {
dnChainPattern, dnChainPatternIndex);
}
else {
- if (!(dnPattern instanceof List)) {
+ if (!(dnPattern instanceof List< ? >)) {
throw new IllegalArgumentException(
"expected String or List in DN Pattern");
}
@@ -2152,9 +2165,9 @@ public class FrameworkUtil {
* @return true if dnChain matches the pattern.
* @throws IllegalArgumentException
*/
- static boolean match(String pattern, List/* <String> */dnChain) {
- List parsedDNChain;
- List parsedDNPattern;
+ static boolean match(String pattern, List<String> dnChain) {
+ List<Object> parsedDNChain;
+ List<Object> parsedDNPattern;
try {
parsedDNChain = parseDNchain(dnChain);
}
@@ -2176,12 +2189,12 @@ public class FrameworkUtil {
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 f67fd431c..46d6d20d7 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,14 +21,14 @@ package org.osgi.framework;
* syntax.
*
* <p>
- * An <code>InvalidSyntaxException</code> object indicates that a filter
+ * 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.
*
- * @version $Revision: 6083 $
+ * @version $Id: adb84e3bc0b82b842e4da84542057fdf53e2ca6a $
*/
public class InvalidSyntaxException extends Exception {
@@ -39,10 +39,10 @@ public class InvalidSyntaxException extends Exception {
private final String filter;
/**
- * Creates an exception of type <code>InvalidSyntaxException</code>.
+ * Creates an exception of type {@code InvalidSyntaxException}.
*
* <p>
- * This method creates an <code>InvalidSyntaxException</code> object with
+ * This method creates an {@code InvalidSyntaxException} object with
* the specified message and the filter string which generated the
* exception.
*
@@ -55,10 +55,10 @@ public class InvalidSyntaxException extends Exception {
}
/**
- * Creates an exception of type <code>InvalidSyntaxException</code>.
+ * Creates an exception of type {@code InvalidSyntaxException}.
*
* <p>
- * This method creates an <code>InvalidSyntaxException</code> object with
+ * This method creates an {@code InvalidSyntaxException} object with
* the specified message and the filter string which generated the
* exception.
*
@@ -74,7 +74,7 @@ public class InvalidSyntaxException extends Exception {
/**
* Returns the filter string that generated the
- * <code>InvalidSyntaxException</code> object.
+ * {@code InvalidSyntaxException} object.
*
* @return The invalid filter string.
* @see BundleContext#getServiceReferences
@@ -85,10 +85,10 @@ public class InvalidSyntaxException extends Exception {
}
/**
- * Returns the cause of this exception or <code>null</code> if no cause was
+ * Returns the cause of this exception or {@code null} if no cause was
* set.
*
- * @return The cause of this exception or <code>null</code> if no cause was
+ * @return The cause of this exception or {@code null} if no cause was
* set.
* @since 1.3
*/
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 da2f5406c..a94778d90 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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.
@@ -51,35 +51,35 @@ import java.util.Map;
* </pre>
*
* <p>
- * <code>PackagePermission</code> has three actions: <code>exportonly</code>,
- * <code>import</code> and <code>export</code>. The <code>export</code> action,
- * which is deprecated, implies the <code>import</code> action.
+ * {@code PackagePermission} has three actions: {@code exportonly},
+ * {@code import} and {@code export}. The {@code export} action,
+ * which is deprecated, implies the {@code import} action.
*
* @ThreadSafe
- * @version $Revision: 7189 $
+ * @version $Id: f0fd0a2d5340eb86d092ed2af6caacbc28205d81 $
*/
public final class PackagePermission extends BasicPermission {
static final long serialVersionUID = -5107705877071099135L;
/**
- * The action string <code>export</code>. The <code>export</code> action
- * implies the <code>import</code> action.
+ * The action string {@code export}. The {@code export} action
+ * implies the {@code import} action.
*
- * @deprecated Since 1.5. Use <code>exportonly</code> instead.
+ * @deprecated Since 1.5. Use {@code exportonly} instead.
*/
public final static String EXPORT = "export";
/**
- * The action string <code>exportonly</code>. The <code>exportonly</code>
- * action does not imply the <code>import</code> 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";
/**
- * The action string <code>import</code>.
+ * The action string {@code import}.
*/
public final static String IMPORT = "import";
@@ -117,10 +117,10 @@ public final class PackagePermission extends BasicPermission {
* filter in implies. This is not initialized until necessary, and then
* cached in this object.
*/
- private transient volatile Dictionary properties;
+ private transient volatile Dictionary<String, Object> properties;
/**
- * Creates a new <code>PackagePermission</code> object.
+ * Creates a new {@code PackagePermission} object.
*
* <p>
* The name is specified as a normal Java package name: a dot-separated
@@ -138,7 +138,7 @@ public final class PackagePermission extends BasicPermission {
* *
* </pre>
*
- * For the <code>import</code> action, the name can also be a filter
+ * 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
@@ -155,19 +155,19 @@ public final class PackagePermission extends BasicPermission {
* Package Permissions are granted over all possible versions of a package.
*
* A bundle that needs to export a package must have the appropriate
- * <code>PackagePermission</code> for that package; similarly, a bundle that
+ * {@code PackagePermission} for that package; similarly, a bundle that
* needs to import a package must have the appropriate
- * <code>PackagePermssion</code> for that package.
+ * {@code PackagePermssion} for that package.
* <p>
* Permission is granted for both classes and resources.
*
* @param name Package name or filter expression. A filter expression can
- * only be specified if the specified action is <code>import</code>.
- * @param actions <code>exportonly</code>,<code>import</code> (canonical
+ * only be specified if the specified action is {@code import}.
+ * @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</code> or the filter has an invalid syntax.
+ * {@code import} or the filter has an invalid syntax.
*/
public PackagePermission(String name, String actions) {
this(name, parseActions(actions));
@@ -179,17 +179,17 @@ public final class PackagePermission extends BasicPermission {
}
/**
- * Creates a new requested <code>PackagePermission</code> object to be used
- * by code that must perform <code>checkPermission</code> for the
- * <code>import</code> action. <code>PackagePermission</code> objects
+ * 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</code> permission collection.
+ * {@code PackagePermission} permission collection.
*
* @param name The name of the requested package to import.
* @param exportingBundle The bundle exporting the requested package.
- * @param actions The action <code>import</code>.
+ * @param actions The action {@code import}.
* @throws IllegalArgumentException If the specified action is not
- * <code>import</code> or the name is a filter expression.
+ * {@code import} or the name is a filter expression.
* @since 1.5
*/
public PackagePermission(String name, Bundle exportingBundle, String actions) {
@@ -345,7 +345,7 @@ public final class PackagePermission extends BasicPermission {
*
* @param filterString The filter string to parse.
* @return a Filter for this bundle. If the specified filterString is not a
- * filter expression, then <code>null</code> is returned.
+ * filter expression, then {@code null} is returned.
* @throws IllegalArgumentException If the filter syntax is invalid.
*/
private static Filter parseFilter(String filterString) {
@@ -370,9 +370,9 @@ public final class PackagePermission extends BasicPermission {
*
* <p>
* This method checks that the package name of the target is implied by the
- * package name of this object. The list of <code>PackagePermission</code>
+ * package name of this object. The list of {@code PackagePermission}
* actions must either match or allow for the list of the target object to
- * imply the target <code>PackagePermission</code> action.
+ * imply the target {@code PackagePermission} action.
* <p>
* The permission to export a package implies the permission to import the
* named package.
@@ -385,8 +385,8 @@ public final class PackagePermission extends BasicPermission {
* </pre>
*
* @param p The requested permission.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
public boolean implies(Permission p) {
if (!(p instanceof PackagePermission)) {
@@ -411,8 +411,8 @@ public final class PackagePermission extends BasicPermission {
* validated as a proper argument. The requested PackagePermission
* must not have a filter expression.
* @param effective The effective actions with which to start.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
boolean implies0(PackagePermission requested, int effective) {
/* check actions first - much faster */
@@ -431,14 +431,14 @@ public final class PackagePermission extends BasicPermission {
/**
* Returns the canonical string representation of the
- * <code>PackagePermission</code> actions.
+ * {@code PackagePermission} actions.
*
* <p>
- * Always returns present <code>PackagePermission</code> actions in the
- * following order: <code>EXPORTONLY</code>,<code>IMPORT</code>.
+ * Always returns present {@code PackagePermission} actions in the
+ * following order: {@code EXPORTONLY},{@code IMPORT}.
*
* @return Canonical string representation of the
- * <code>PackagePermission</code> actions.
+ * {@code PackagePermission} actions.
*/
public String getActions() {
String result = actions;
@@ -464,28 +464,28 @@ public final class PackagePermission extends BasicPermission {
}
/**
- * Returns a new <code>PermissionCollection</code> object suitable for
- * storing <code>PackagePermission</code> objects.
+ * Returns a new {@code PermissionCollection} object suitable for
+ * storing {@code PackagePermission} objects.
*
- * @return A new <code>PermissionCollection</code> object.
+ * @return A new {@code PermissionCollection} object.
*/
public PermissionCollection newPermissionCollection() {
return new PackagePermissionCollection();
}
/**
- * Determines the equality of two <code>PackagePermission</code> objects.
+ * Determines the equality of two {@code PackagePermission} objects.
*
* This method checks that specified package has the same package name and
- * <code>PackagePermission</code> actions as this
- * <code>PackagePermission</code> object.
+ * {@code PackagePermission} actions as this
+ * {@code PackagePermission} object.
*
* @param obj The object to test for equality with this
- * <code>PackagePermission</code> object.
- * @return <code>true</code> if <code>obj</code> is a
- * <code>PackagePermission</code>, and has the same package name and
- * actions as this <code>PackagePermission</code> object;
- * <code>false</code> otherwise.
+ * {@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.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -547,21 +547,21 @@ public final class PackagePermission extends BasicPermission {
}
/**
- * Called by <code><@link PackagePermission#implies(Permission)></code>.
+ * Called by {@code <@link PackagePermission#implies(Permission)>}.
*
* @return a dictionary of properties for this permission.
*/
- private Dictionary getProperties() {
- Dictionary result = properties;
+ private Dictionary<String, Object> getProperties() {
+ Dictionary<String, Object> result = properties;
if (result != null) {
return result;
}
- final Dictionary dict = new Hashtable(5);
+ final Dictionary<String, Object> dict = new Hashtable<String, Object>(5);
if (filter == null) {
dict.put("package.name", getName());
}
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
dict.put("id", new Long(bundle.getBundleId()));
dict.put("location", bundle.getLocation());
@@ -582,7 +582,7 @@ public final class PackagePermission extends BasicPermission {
}
/**
- * Stores a set of <code>PackagePermission</code> permissions.
+ * Stores a set of {@code PackagePermission} permissions.
*
* @see java.security.Permission
* @see java.security.Permissions
@@ -596,7 +596,7 @@ final class PackagePermissionCollection extends PermissionCollection {
*
* @GuardedBy this
*/
- private transient Map permissions;
+ private transient Map<String, PackagePermission> permissions;
/**
* Boolean saying if "*" is in the collection.
@@ -612,25 +612,25 @@ final class PackagePermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private Map filterPermissions;
+ private Map<String, PackagePermission> filterPermissions;
/**
* Create an empty PackagePermissions object.
*/
public PackagePermissionCollection() {
- permissions = new HashMap();
+ permissions = new HashMap<String, PackagePermission>();
all_allowed = false;
}
/**
* Adds a permission to this permission collection.
*
- * @param permission The <code>PackagePermission</code> object to add.
+ * @param permission The {@code PackagePermission} object to add.
* @throws IllegalArgumentException If the specified permission is not a
- * <code>PackagePermission</code> instance or was constructed with a
+ * {@code PackagePermission} instance or was constructed with a
* Bundle object.
* @throws SecurityException If this
- * <code>PackagePermissionCollection</code> object has been marked
+ * {@code PackagePermissionCollection} object has been marked
* read-only.
*/
public void add(final Permission permission) {
@@ -653,18 +653,18 @@ final class PackagePermissionCollection extends PermissionCollection {
final Filter f = pp.filter;
synchronized (this) {
/* select the bucket for the permission */
- Map pc;
+ Map<String, PackagePermission> pc;
if (f != null) {
pc = filterPermissions;
if (pc == null) {
- filterPermissions = pc = new HashMap();
+ filterPermissions = pc = new HashMap<String, PackagePermission>();
}
}
else {
pc = permissions;
}
- final PackagePermission existing = (PackagePermission) pc.get(name);
+ final PackagePermission existing = pc.get(name);
if (existing != null) {
final int oldMask = existing.action_mask;
final int newMask = pp.action_mask;
@@ -689,12 +689,12 @@ final class PackagePermissionCollection extends PermissionCollection {
/**
* Determines if the specified permissions implies the permissions expressed
- * in <code>permission</code>.
+ * in {@code permission}.
*
* @param permission The Permission object to compare with this
- * <code>PackagePermission</code> object.
- * @return <code>true</code> if <code>permission</code> is a proper subset
- * of a permission in the set; <code>false</code> otherwise.
+ * {@code PackagePermission} object.
+ * @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)) {
@@ -709,13 +709,13 @@ final class PackagePermissionCollection extends PermissionCollection {
final int desired = requested.action_mask;
int effective = PackagePermission.ACTION_NONE;
- Collection perms;
+ Collection<PackagePermission> perms;
synchronized (this) {
- Map pc = permissions;
+ Map<String, PackagePermission> pc = permissions;
PackagePermission pp;
/* short circuit if the "*" Permission was added */
if (all_allowed) {
- pp = (PackagePermission) pc.get("*");
+ pp = pc.get("*");
if (pp != null) {
effective |= pp.action_mask;
if ((effective & desired) == desired) {
@@ -727,7 +727,7 @@ final class PackagePermissionCollection extends PermissionCollection {
* strategy: Check for full match first. Then work our way up the
* name looking for matches on a.b.*
*/
- pp = (PackagePermission) pc.get(requestedName);
+ pp = pc.get(requestedName);
if (pp != null) {
/* we have a direct hit! */
effective |= pp.action_mask;
@@ -740,7 +740,7 @@ final class PackagePermissionCollection extends PermissionCollection {
int offset = requestedName.length() - 1;
while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
requestedName = requestedName.substring(0, last + 1) + "*";
- pp = (PackagePermission) pc.get(requestedName);
+ pp = pc.get(requestedName);
if (pp != null) {
effective |= pp.action_mask;
if ((effective & desired) == desired) {
@@ -760,9 +760,9 @@ final class PackagePermissionCollection extends PermissionCollection {
perms = pc.values();
}
/* iterate one by one over filteredPermissions */
- for (Iterator iter = perms.iterator(); iter.hasNext();) {
- if (((PackagePermission) iter.next())
- .implies0(requested, effective)) {
+ for (Iterator<PackagePermission> iter = perms.iterator(); iter
+ .hasNext();) {
+ if (iter.next().implies0(requested, effective)) {
return true;
}
}
@@ -770,14 +770,14 @@ final class PackagePermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all <code>PackagePermission</code> objects in
+ * Returns an enumeration of all {@code PackagePermission} objects in
* the container.
*
- * @return Enumeration of all <code>PackagePermission</code> objects.
+ * @return Enumeration of all {@code PackagePermission} objects.
*/
- public synchronized Enumeration elements() {
- List all = new ArrayList(permissions.values());
- Map pc = filterPermissions;
+ public synchronized Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ Map<String, PackagePermission> pc = filterPermissions;
if (pc != null) {
all.addAll(pc.values());
}
@@ -792,7 +792,8 @@ final class PackagePermissionCollection extends PermissionCollection {
private synchronized void writeObject(ObjectOutputStream out)
throws IOException {
- Hashtable hashtable = new Hashtable(permissions);
+ Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(
+ permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -803,9 +804,12 @@ final class PackagePermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
- permissions = new HashMap(hashtable);
+ Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields
+ .get("permissions", null);
+ permissions = new HashMap<String, PackagePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
- filterPermissions = (HashMap) 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 b7c9928dc..82ec899e7 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,8 +22,8 @@ import java.util.EventObject;
/**
* An event from the Framework describing a service lifecycle change.
* <p>
- * <code>ServiceEvent</code> objects are delivered to
- * <code>ServiceListener</code>s and <code>AllServiceListener</code>s when a
+ * {@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.
*
@@ -33,7 +33,7 @@ import java.util.EventObject;
* @Immutable
* @see ServiceListener
* @see AllServiceListener
- * @version $Revision: 6542 $
+ * @version $Id: 2b9458d90004411b6ca0cb4b361bc282b04c85eb $
*/
public class ServiceEvent extends EventObject {
@@ -41,7 +41,7 @@ public class ServiceEvent extends EventObject {
/**
* 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.
@@ -75,7 +75,7 @@ public class ServiceEvent extends EventObject {
* has completed unregistering.
*
* <p>
- * If a bundle is using a service that is <code>UNREGISTERING</code>, the
+ * If a bundle is using a service that is {@code UNREGISTERING}, the
* bundle should release its use of the service when it receives this event.
* If the bundle does not release its use of the service when it receives
* this event, the Framework will automatically release the bundle's use of
@@ -92,7 +92,7 @@ public class ServiceEvent extends EventObject {
* <p>
* This event is synchronously delivered <strong>after</strong> the service
* properties have been modified. This event is only delivered to listeners
- * which were added with a non-<code>null</code> filter where the filter
+ * which were added with a non-{@code null} filter where the filter
* matched the service properties prior to the modification but the filter
* does not match the modified service properties.
*
@@ -105,10 +105,10 @@ public class ServiceEvent extends EventObject {
* Creates a new service event object.
*
* @param type The event type.
- * @param reference A <code>ServiceReference</code> object to the service
+ * @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,7 +122,7 @@ public class ServiceEvent extends EventObject {
*
* @return Reference to the service that had a lifecycle change.
*/
- public ServiceReference getServiceReference() {
+ public ServiceReference< ? > getServiceReference() {
return reference;
}
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 4cf04a0f5..728db456d 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2010). 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,18 +20,18 @@ package org.osgi.framework;
* A service exception used to indicate that a service problem occurred.
*
* <p>
- * A <code>ServiceException</code> object is created by the Framework or
+ * 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</code>. When subclassing, the subclass should set
+ * {@code ServiceException}. When subclassing, the subclass should set
* the type to {@link #SUBCLASSED} to indicate that
- * <code>ServiceException</code> has been subclassed.
+ * {@code ServiceException} has been subclassed.
*
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Revision: 6518 $
+ * @version $Id: 7eb3f12f99fa32b5a28ea318cea9faece24df0b5 $
* @since 1.5
*/
@@ -70,7 +70,7 @@ public class ServiceException extends RuntimeException {
public static final int REMOTE = 5;
/**
- * Creates a <code>ServiceException</code> with the specified message and
+ * Creates a {@code ServiceException} with the specified message and
* exception cause.
*
* @param msg The associated message.
@@ -81,7 +81,7 @@ public class ServiceException extends RuntimeException {
}
/**
- * Creates a <code>ServiceException</code> with the specified message.
+ * Creates a {@code ServiceException} with the specified message.
*
* @param msg The message.
*/
@@ -90,7 +90,7 @@ public class ServiceException extends RuntimeException {
}
/**
- * Creates a <code>ServiceException</code> with the specified message,
+ * Creates a {@code ServiceException} with the specified message,
* type and exception cause.
*
* @param msg The associated message.
@@ -103,7 +103,7 @@ public class ServiceException extends RuntimeException {
}
/**
- * Creates a <code>ServiceException</code> with the specified message and
+ * Creates a {@code ServiceException} with the specified message and
* type.
*
* @param msg The message.
@@ -115,7 +115,7 @@ public class ServiceException extends RuntimeException {
}
/**
- * Returns the type for this exception or <code>UNSPECIFIED</code> if the
+ * 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 c8f6bf3d7..d2a521ff0 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,65 +21,65 @@ package org.osgi.framework;
* environment.
*
* <p>
- * When registering a service, a <code>ServiceFactory</code> object can be
- * used instead of a service object, so that the bundle developer can gain
- * control of the specific service object granted to a bundle that is using the
- * service.
+ * When registering a service, a {@code ServiceFactory} object can be used
+ * instead of a service object, so that the bundle developer can gain control of
+ * the specific service object granted to a bundle that is using the service.
*
* <p>
* When this happens, the
- * <code>BundleContext.getService(ServiceReference)</code> method calls the
- * <code>ServiceFactory.getService</code> method to create a service object
+ * {@code BundleContext.getService(ServiceReference)} method calls the
+ * {@code ServiceFactory.getService} method to create a service object
* specifically for the requesting bundle. The service object returned by the
- * <code>ServiceFactory</code> is cached by the Framework until the bundle
+ * {@code ServiceFactory} is cached by the Framework until the bundle
* releases its use of the service.
*
* <p>
* When the bundle's use count for the service equals zero (including the bundle
* stopping or the service being unregistered), the
- * <code>ServiceFactory.ungetService</code> method is called.
+ * {@code ServiceFactory.ungetService} method is called.
*
* <p>
- * <code>ServiceFactory</code> objects are only used by the Framework and are
+ * {@code ServiceFactory} objects are only used by the Framework and are
* not made available to other bundles in the OSGi environment. The Framework
- * may concurrently call a <code>ServiceFactory</code>.
+ * may concurrently call a {@code ServiceFactory}.
*
+ * @param <S> Type of Service
* @see BundleContext#getService
* @ThreadSafe
- * @version $Revision: 5967 $
+ * @version $Id: 6dad978a4354eedf8a4317b4aac37f2f2315d093 $
*/
-public interface ServiceFactory {
+public interface ServiceFactory<S> {
/**
* Creates a new service object.
*
* <p>
* The Framework invokes this method the first time the specified
- * <code>bundle</code> requests a service object using the
- * <code>BundleContext.getService(ServiceReference)</code> method. The
+ * {@code bundle} requests a service object using the
+ * {@code BundleContext.getService(ServiceReference)} method. The
* service factory can then return a specific service object for each
* bundle.
*
* <p>
- * The Framework caches the value returned (unless it is <code>null</code>),
+ * The Framework caches the value returned (unless it is {@code null}),
* and will return the same service object on any future call to
- * <code>BundleContext.getService</code> for the same bundle. This means the
+ * {@code BundleContext.getService} for the same bundle. This means the
* Framework must not allow this method to be concurrently called for the
* same bundle.
*
* <p>
* The Framework will check if the returned service object is an instance of
* all the classes named when the service was registered. If not, then
- * <code>null</code> is returned to the bundle.
+ * {@code null} is returned to the bundle.
*
* @param bundle The bundle using the service.
- * @param registration The <code>ServiceRegistration</code> object for the
+ * @param registration The {@code ServiceRegistration} object for the
* service.
* @return A service object that <strong>must</strong> be an instance of all
* the classes named when the service was registered.
* @see BundleContext#getService
*/
- public Object getService(Bundle bundle, ServiceRegistration registration);
+ public S getService(Bundle bundle, ServiceRegistration<S> registration);
/**
* Releases a service object.
@@ -89,12 +89,12 @@ public interface ServiceFactory {
* bundle. The service object may then be destroyed.
*
* @param bundle The bundle releasing the service.
- * @param registration The <code>ServiceRegistration</code> object for the
+ * @param registration The {@code ServiceRegistration} object for the
* service.
* @param service The service object returned by a previous call to the
- * <code>ServiceFactory.getService</code> method.
+ * {@code ServiceFactory.getService} method.
* @see BundleContext#ungetService
*/
- public void ungetService(Bundle bundle, ServiceRegistration registration,
- Object 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 ec0856029..dc6a159c2 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,46 +19,46 @@ package org.osgi.framework;
import java.util.EventListener;
/**
- * A <code>ServiceEvent</code> listener. <code>ServiceListener</code> is a
+ * A {@code ServiceEvent} listener. {@code ServiceListener} is a
* listener interface that may be implemented by a bundle developer. When a
- * <code>ServiceEvent</code> is fired, it is synchronously delivered to a
- * <code>ServiceListener</code>. The Framework may deliver
- * <code>ServiceEvent</code> objects to a <code>ServiceListener</code> out
+ * {@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>.
+ * {@code ServiceListener}.
*
* <p>
- * A <code>ServiceListener</code> object is registered with the Framework
- * using the <code>BundleContext.addServiceListener</code> method.
- * <code>ServiceListener</code> objects are called with a
- * <code>ServiceEvent</code> object when a service is registered, modified, or
+ * 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</code> object delivery to <code>ServiceListener</code>
+ * {@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</code> objects are only delivered to
+ * 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</code> to get the service using at
+ * appropriate {@code ServicePermission} to get the service using at
* least one of the named classes under which the service was registered.
*
* <p>
- * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
+ * {@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
* @see ServicePermission
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: d73f8e9b4babc8b53b5d1cbe7b17b732f54bb2a3 $
*/
public interface ServiceListener extends EventListener {
/**
* Receives notification that a service has had a lifecycle change.
*
- * @param event The <code>ServiceEvent</code> object.
+ * @param event The {@code ServiceEvent} object.
*/
public void serviceChanged(ServiceEvent event);
}
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 d2f3c3167..e6efbc451 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,28 +40,28 @@ import java.util.Map;
/**
* A bundle's authority to register or get a service.
* <ul>
- * <li>The <code>register</code> action allows a bundle to register a service on
+ * <li>The {@code register} action allows a bundle to register a service on
* the specified names.
- * <li>The <code>get</code> action allows a bundle to detect a service and get
+ * <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</code> to get the specific service.
+ * {@code ServicePermission} to get the specific service.
*
* @ThreadSafe
- * @version $Revision: 7189 $
+ * @version $Id: 84c2d426d6a1c82833102ce982f2134512f90075 $
*/
public final class ServicePermission extends BasicPermission {
static final long serialVersionUID = -7662148639076511574L;
/**
- * The action string <code>get</code>.
+ * The action string {@code get}.
*/
public final static String GET = "get";
/**
- * The action string <code>register</code>.
+ * The action string {@code register}.
*/
public final static String REGISTER = "register";
@@ -87,7 +87,7 @@ public final class ServicePermission extends BasicPermission {
* 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
@@ -106,7 +106,7 @@ public final class ServicePermission extends BasicPermission {
* filter in implies. This is not initialized until necessary, and then
* cached in this object.
*/
- private transient volatile Dictionary properties;
+ private transient volatile Dictionary<String, Object> properties;
/**
* True if constructed with a name and the name is "*" or ends with ".*".
@@ -138,7 +138,7 @@ public final class ServicePermission extends BasicPermission {
* *
* </pre>
*
- * For the <code>get</code> action, the name can also be a filter
+ * 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>
@@ -158,17 +158,17 @@ public final class ServicePermission extends BasicPermission {
* Service properties names are case insensitive.
*
* <p>
- * There are two possible actions: <code>get</code> and
- * <code>register</code>. The <code>get</code> permission allows the owner
+ * 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</code> permission allows the bundle to register a service
+ * {@code register} permission allows the bundle to register a service
* under that name.
*
* @param name The service class name
- * @param actions <code>get</code>,<code>register</code> (canonical order)
+ * @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</code> or the filter has an invalid syntax.
+ * {@code get} or the filter has an invalid syntax.
*/
public ServicePermission(String name, String actions) {
this(name, parseActions(actions));
@@ -180,19 +180,19 @@ public final class ServicePermission extends BasicPermission {
}
/**
- * Creates a new requested <code>ServicePermission</code> object to be used
- * by code that must perform <code>checkPermission</code> for the
- * <code>get</code> action. <code>ServicePermission</code> objects created
- * with this constructor cannot be added to a <code>ServicePermission</code>
+ * 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</code>.
+ * @param actions The action {@code get}.
* @throws IllegalArgumentException If the specified action is not
- * <code>get</code> or reference is <code>null</code>.
+ * {@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;
@@ -209,7 +209,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");
}
@@ -351,7 +351,7 @@ public final class ServicePermission extends BasicPermission {
*
* @param filterString The filter string to parse.
* @return a Filter for this bundle. If the specified filterString is not a
- * filter expression, then <code>null</code> is returned.
+ * filter expression, then {@code null} is returned.
* @throws IllegalArgumentException If the filter syntax is invalid.
*/
private static Filter parseFilter(String filterString) {
@@ -372,12 +372,12 @@ public final class ServicePermission extends BasicPermission {
}
/**
- * Determines if a <code>ServicePermission</code> object "implies" the
+ * Determines if a {@code ServicePermission} object "implies" the
* specified permission.
*
* @param p The target permission to check.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
public boolean implies(Permission p) {
if (!(p instanceof ServicePermission)) {
@@ -402,8 +402,8 @@ public final class ServicePermission extends BasicPermission {
* validated as a proper argument. The requested ServicePermission
* must not have a filter expression.
* @param effective The effective actions with which to start.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return {@code true} if the specified permission is implied by this
+ * object; {@code false} otherwise.
*/
boolean implies0(ServicePermission requested, int effective) {
/* check actions first - much faster */
@@ -450,8 +450,8 @@ public final class ServicePermission extends BasicPermission {
/**
* Returns the canonical string representation of the actions. Always
- * returns present actions in the following order: <code>get</code>,
- * <code>register</code>.
+ * returns present actions in the following order: {@code get},
+ * {@code register}.
*
* @return The canonical string representation of the actions.
*/
@@ -480,11 +480,11 @@ public final class ServicePermission extends BasicPermission {
}
/**
- * Returns a new <code>PermissionCollection</code> object for storing
- * <code>ServicePermission<code> objects.
- *
- * @return A new <code>PermissionCollection</code> object suitable for storing
- * <code>ServicePermission</code> objects.
+ * Returns a new {@code PermissionCollection} object for storing
+ * {@code ServicePermission} objects.
+ *
+ * @return A new {@code PermissionCollection} object suitable for storing
+ * {@code ServicePermission} objects.
*/
public PermissionCollection newPermissionCollection() {
return new ServicePermissionCollection();
@@ -494,12 +494,12 @@ public final class ServicePermission extends BasicPermission {
* Determines the equality of two ServicePermission objects.
*
* Checks that specified object has the same class name and action as this
- * <code>ServicePermission</code>.
+ * {@code ServicePermission}.
*
* @param obj The object to test for equality.
- * @return true if obj is a <code>ServicePermission</code>, and has the same
- * class name and actions as this <code>ServicePermission</code>
- * object; <code>false</code> otherwise.
+ * @return true if obj is a {@code ServicePermission}, and has the same
+ * class name and actions as this {@code ServicePermission}
+ * object; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -559,26 +559,26 @@ public final class ServicePermission extends BasicPermission {
setTransients(parseFilter(getName()), parseActions(actions));
}
/**
- * Called by <code><@link ServicePermission#implies(Permission)></code>.
+ * Called by {@code <@link ServicePermission#implies(Permission)>}.
*
* @return a dictionary of properties for this permission.
*/
- private Dictionary getProperties() {
- Dictionary result = properties;
+ private Dictionary<String, Object> getProperties() {
+ Dictionary<String, Object> result = properties;
if (result != null) {
return result;
}
if (service == null) {
- result = new Hashtable(1);
+ result = new Hashtable<String, Object>(1);
if (filter == null) {
result.put(Constants.OBJECTCLASS, new String[] {getName()});
}
return properties = result;
}
- final Map props = new HashMap(4);
+ final Map<String, Object> props = new HashMap<String, Object>(4);
final Bundle bundle = service.getBundle();
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
props.put("id", new Long(bundle.getBundleId()));
props.put("location", bundle.getLocation());
@@ -597,11 +597,11 @@ public final class ServicePermission extends BasicPermission {
return properties = new Properties(props, service);
}
- private static class Properties extends Dictionary {
- private final Map properties;
- private final ServiceReference service;
+ private static class Properties extends Dictionary<String, Object> {
+ private final Map<String, Object> properties;
+ private final ServiceReference< ? > service;
- Properties(Map properties, ServiceReference service) {
+ Properties(Map<String, Object> properties, ServiceReference< ? > service) {
this.properties = properties;
this.service = service;
}
@@ -630,16 +630,16 @@ public final class ServicePermission extends BasicPermission {
return false;
}
- public Enumeration keys() {
- Collection pk = properties.keySet();
+ public Enumeration<String> keys() {
+ Collection<String> pk = properties.keySet();
String spk[] = service.getPropertyKeys();
- List all = new ArrayList(pk.size() + spk.length);
+ List<String> all = new ArrayList<String>(pk.size() + spk.length);
all.addAll(pk);
add:
for (int i = 0, length = spk.length; i < length; i++) {
String key = spk[i];
- for (Iterator iter = pk.iterator(); iter.hasNext();) {
- if (key.equalsIgnoreCase((String) iter.next())) {
+ for (Iterator<String> iter = pk.iterator(); iter.hasNext();) {
+ if (key.equalsIgnoreCase(iter.next())) {
continue add;
}
}
@@ -648,16 +648,16 @@ public final class ServicePermission extends BasicPermission {
return Collections.enumeration(all);
}
- public Enumeration elements() {
- Collection pk = properties.keySet();
+ public Enumeration<Object> elements() {
+ Collection<String> pk = properties.keySet();
String spk[] = service.getPropertyKeys();
- List all = new ArrayList(pk.size() + spk.length);
+ List<Object> all = new ArrayList<Object>(pk.size() + spk.length);
all.addAll(properties.values());
add:
for (int i = 0, length = spk.length; i < length; i++) {
String key = spk[i];
- for (Iterator iter = pk.iterator(); iter.hasNext();) {
- if (key.equalsIgnoreCase((String) iter.next())) {
+ for (Iterator<String> iter = pk.iterator(); iter.hasNext();) {
+ if (key.equalsIgnoreCase(iter.next())) {
continue add;
}
}
@@ -666,7 +666,7 @@ public final class ServicePermission extends BasicPermission {
return Collections.enumeration(all);
}
- public Object put(Object key, Object value) {
+ public Object put(String key, Object value) {
throw new UnsupportedOperationException();
}
@@ -690,7 +690,7 @@ final class ServicePermissionCollection extends PermissionCollection {
*
* @GuardedBy this
*/
- private transient Map permissions;
+ private transient Map<String, ServicePermission> permissions;
/**
* Boolean saying if "*" is in the collection.
@@ -706,13 +706,13 @@ final class ServicePermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private Map filterPermissions;
+ private Map<String, ServicePermission> filterPermissions;
/**
* Creates an empty ServicePermissions object.
*/
public ServicePermissionCollection() {
- permissions = new HashMap();
+ permissions = new HashMap<String, ServicePermission>();
all_allowed = false;
}
@@ -723,7 +723,7 @@ final class ServicePermissionCollection extends PermissionCollection {
* @throws IllegalArgumentException If the specified permission is not a
* ServicePermission object.
* @throws SecurityException If this
- * <code>ServicePermissionCollection</code> object has been marked
+ * {@code ServicePermissionCollection} object has been marked
* read-only.
*/
public void add(final Permission permission) {
@@ -746,17 +746,17 @@ final class ServicePermissionCollection extends PermissionCollection {
final Filter f = sp.filter;
synchronized (this) {
/* select the bucket for the permission */
- Map pc;
+ Map<String, ServicePermission> pc;
if (f != null) {
pc = filterPermissions;
if (pc == null) {
- filterPermissions = pc = new HashMap();
+ filterPermissions = pc = new HashMap<String, ServicePermission>();
}
}
else {
pc = permissions;
}
- final ServicePermission existing = (ServicePermission) pc.get(name);
+ final ServicePermission existing = pc.get(name);
if (existing != null) {
final int oldMask = existing.action_mask;
@@ -781,11 +781,11 @@ final class ServicePermissionCollection extends PermissionCollection {
/**
* Determines if a set of permissions implies the permissions expressed in
- * <code>permission</code>.
+ * {@code permission}.
*
* @param permission The Permission object to compare.
- * @return <code>true</code> if <code>permission</code> is a proper
- * subset of a permission in the set; <code>false</code>
+ * @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) {
@@ -799,12 +799,12 @@ final class ServicePermissionCollection extends PermissionCollection {
}
int effective = ServicePermission.ACTION_NONE;
- Collection perms;
+ Collection<ServicePermission> perms;
synchronized (this) {
final int desired = requested.action_mask;
/* short circuit if the "*" Permission was added */
if (all_allowed) {
- ServicePermission sp = (ServicePermission) permissions.get("*");
+ ServicePermission sp = permissions.get("*");
if (sp != null) {
effective |= sp.action_mask;
if ((effective & desired) == desired) {
@@ -829,7 +829,7 @@ final class ServicePermissionCollection extends PermissionCollection {
}
}
}
- Map pc = filterPermissions;
+ Map<String, ServicePermission> pc = filterPermissions;
if (pc == null) {
return false;
}
@@ -837,9 +837,9 @@ final class ServicePermissionCollection extends PermissionCollection {
}
/* iterate one by one over filteredPermissions */
- for (Iterator iter = perms.iterator(); iter.hasNext();) {
- if (((ServicePermission) iter.next())
- .implies0(requested, effective)) {
+ for (Iterator<ServicePermission> iter = perms.iterator(); iter
+ .hasNext();) {
+ if (iter.next().implies0(requested, effective)) {
return true;
}
}
@@ -857,8 +857,8 @@ final class ServicePermissionCollection extends PermissionCollection {
*/
private int effective(String requestedName, final int desired,
int effective) {
- final Map pc = permissions;
- ServicePermission sp = (ServicePermission) pc.get(requestedName);
+ final Map<String, ServicePermission> pc = permissions;
+ ServicePermission sp = pc.get(requestedName);
// strategy:
// Check for full match first. Then work our way up the
// name looking for matches on a.b.*
@@ -874,7 +874,7 @@ final class ServicePermissionCollection extends PermissionCollection {
int offset = requestedName.length() - 1;
while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
requestedName = requestedName.substring(0, last + 1) + "*";
- sp = (ServicePermission) pc.get(requestedName);
+ sp = pc.get(requestedName);
if (sp != null) {
effective |= sp.action_mask;
if ((effective & desired) == desired) {
@@ -891,14 +891,14 @@ final class ServicePermissionCollection extends PermissionCollection {
}
/**
- * Returns an enumeration of all the <code>ServicePermission</code>
+ * Returns an enumeration of all the {@code ServicePermission}
* objects in the container.
*
* @return Enumeration of all the ServicePermission objects.
*/
- public synchronized Enumeration elements() {
- List all = new ArrayList(permissions.values());
- Map pc = filterPermissions;
+ public synchronized Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ Map<String, ServicePermission> pc = filterPermissions;
if (pc != null) {
all.addAll(pc.values());
}
@@ -913,7 +913,8 @@ final class ServicePermissionCollection extends PermissionCollection {
private synchronized void writeObject(ObjectOutputStream out)
throws IOException {
- Hashtable hashtable = new Hashtable(permissions);
+ Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(
+ permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -924,9 +925,12 @@ final class ServicePermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
- permissions = new HashMap(hashtable);
+ Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields
+ .get("permissions", null);
+ permissions = new HashMap<String, ServicePermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
- filterPermissions = (HashMap) 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 a6dd9bd65..69d31b8e3 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,39 @@ import java.util.Dictionary;
* A reference to a service.
*
* <p>
- * The Framework returns <code>ServiceReference</code> objects from the
- * <code>BundleContext.getServiceReference</code> and
- * <code>BundleContext.getServiceReferences</code> methods.
+ * The Framework returns {@code ServiceReference} objects from the
+ * {@code BundleContext.getServiceReference} and
+ * {@code BundleContext.getServiceReferences} methods.
* <p>
- * A <code>ServiceReference</code> object may be shared between bundles and
- * can be used to examine the properties of the service and to get the service
+ * A {@code ServiceReference} object may be shared between bundles and can
+ * be used to examine the properties of the service and to get the service
* object.
* <p>
* Every service registered in the Framework has a unique
- * <code>ServiceRegistration</code> object and may have multiple, distinct
- * <code>ServiceReference</code> objects referring to it.
- * <code>ServiceReference</code> objects associated with a
- * <code>ServiceRegistration</code> object have the same <code>hashCode</code>
- * and are considered equal (more specifically, their <code>equals()</code>
- * method will return <code>true</code> when compared).
+ * {@code ServiceRegistration} object and may have multiple, distinct
+ * {@code ServiceReference} objects referring to it.
+ * {@code ServiceReference} objects associated with a
+ * {@code ServiceRegistration} object have the same {@code hashCode}
+ * and are considered equal (more specifically, their {@code equals()}
+ * method will return {@code true} when compared).
* <p>
* If the same service object is registered multiple times,
- * <code>ServiceReference</code> objects associated with different
- * <code>ServiceRegistration</code> objects are not equal.
+ * {@code ServiceReference} objects associated with different
+ * {@code ServiceRegistration} objects are not equal.
*
+ * @param <S> Type of Service.
* @see BundleContext#getServiceReference
* @see BundleContext#getServiceReferences
* @see BundleContext#getService
* @ThreadSafe
- * @version $Revision: 6374 $
+ * @version $Id: 10e6b437fdf20dea9d8327f8135634a48a9dfd88 $
*/
-public interface ServiceReference extends Comparable {
+public interface ServiceReference<S> extends Comparable<Object> {
/**
* Returns the property value to which the specified property key is mapped
- * in the properties <code>Dictionary</code> object of the service
- * referenced by this <code>ServiceReference</code> object.
+ * in the properties {@code Dictionary} object of the service
+ * referenced by this {@code ServiceReference} object.
*
* <p>
* Property keys are case-insensitive.
@@ -61,30 +62,30 @@ public interface ServiceReference extends Comparable {
* <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</code> objects stored in the log) can
+ * 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</code>
+ * @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);
/**
- * Returns an array of the keys in the properties <code>Dictionary</code>
- * object of the service referenced by this <code>ServiceReference</code>
+ * Returns an array of the keys in the properties {@code Dictionary}
+ * object of the service referenced by this {@code ServiceReference}
* object.
*
* <p>
* This method will continue to return the keys after the service has been
* unregistered. This is so references to unregistered services (for
- * example, <code>ServiceReference</code> objects stored in the log) can
+ * example, {@code ServiceReference} objects stored in the log) can
* still be interrogated.
*
* <p>
* This method is <i>case-preserving </i>; this means that every key in the
* returned array must have the same case as the corresponding key in the
- * properties <code>Dictionary</code> that was passed to the
+ * properties {@code Dictionary} that was passed to the
* {@link BundleContext#registerService(String[],Object,Dictionary)} or
* {@link ServiceRegistration#setProperties} methods.
*
@@ -94,15 +95,15 @@ public interface ServiceReference extends Comparable {
/**
* Returns the bundle that registered the service referenced by this
- * <code>ServiceReference</code> object.
+ * {@code ServiceReference} object.
*
* <p>
- * This method must return <code>null</code> when the service has been
+ * This method must return {@code null} when the service has been
* unregistered. This can be used to determine if the service has been
* unregistered.
*
* @return The bundle that registered the service referenced by this
- * <code>ServiceReference</code> object; <code>null</code> if that
+ * {@code ServiceReference} object; {@code null} if that
* service has already been unregistered.
* @see BundleContext#registerService(String[],Object,Dictionary)
*/
@@ -110,12 +111,12 @@ public interface ServiceReference extends Comparable {
/**
* Returns the bundles that are using the service referenced by this
- * <code>ServiceReference</code> object. Specifically, this method returns
+ * {@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</code> object is greater than
- * zero; <code>null</code> if no bundles are currently using that
+ * by this {@code ServiceReference} object is greater than
+ * zero; {@code null} if no bundles are currently using that
* service.
*
* @since 1.1
@@ -124,60 +125,60 @@ public interface ServiceReference extends Comparable {
/**
* Tests if the bundle that registered the service referenced by this
- * <code>ServiceReference</code> and the specified bundle use the same
+ * {@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</code> (registrant bundle); find the source for
- * the package. If no source is found then return <code>true</code> if the
+ * {@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</code>.</li>
+ * {@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</code>;
- * otherwise return <code>false</code>.</li>
+ * package source of the specified bundle then return {@code true};
+ * otherwise return {@code false}.</li>
* </ol>
*
- * @param bundle The <code>Bundle</code> object to check.
+ * @param bundle The {@code Bundle} object to check.
* @param className The class name to check.
- * @return <code>true</code> if the bundle which registered the service
- * referenced by this <code>ServiceReference</code> and the
+ * @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</code> is returned.
- * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+ * 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</code>.
+ * {@code ServiceReference}.
* @since 1.3
*/
public boolean isAssignableTo(Bundle bundle, String className);
/**
- * Compares this <code>ServiceReference</code> with the specified
- * <code>ServiceReference</code> for order.
+ * Compares this {@code ServiceReference} with the specified
+ * {@code ServiceReference} for order.
*
* <p>
- * If this <code>ServiceReference</code> and the specified
- * <code>ServiceReference</code> have the same {@link Constants#SERVICE_ID
- * service id} they are equal. This <code>ServiceReference</code> is less
- * than the specified <code>ServiceReference</code> if it has a lower
+ * 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
* {@link Constants#SERVICE_RANKING service ranking} and greater if it has a
- * higher service ranking. Otherwise, if this <code>ServiceReference</code>
- * and the specified <code>ServiceReference</code> 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</code> is less than the specified
- * <code>ServiceReference</code> if it has a higher
+ * {@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.
*
- * @param reference The <code>ServiceReference</code> to be compared.
+ * @param reference The {@code ServiceReference} to be compared.
* @return Returns a negative integer, zero, or a positive integer if this
- * <code>ServiceReference</code> is less than, equal to, or greater
- * than the specified <code>ServiceReference</code>.
+ * {@code ServiceReference} is less than, equal to, or greater
+ * than the specified {@code ServiceReference}.
* @throws IllegalArgumentException If the specified
- * <code>ServiceReference</code> was not created by the same
- * framework instance as this <code>ServiceReference</code>.
+ * {@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 9186cf763..87175568a 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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,33 +22,34 @@ import java.util.Dictionary;
* A registered service.
*
* <p>
- * The Framework returns a <code>ServiceRegistration</code> object when a
- * <code>BundleContext.registerService</code> method invocation is successful.
- * The <code>ServiceRegistration</code> object is for the private use of the
+ * 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.
* <p>
- * The <code>ServiceRegistration</code> object may be used to update the
+ * 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)
* @ThreadSafe
- * @version $Revision: 6361 $
+ * @version $Id: 6487c568cab6629edb05feaf86d83caadf9acf4e $
*/
-public interface ServiceRegistration {
+public interface ServiceRegistration<S> {
/**
- * Returns a <code>ServiceReference</code> object for a service being
+ * Returns a {@code ServiceReference} object for a service being
* registered.
* <p>
- * The <code>ServiceReference</code> object may be shared with other
+ * The {@code ServiceReference} object may be shared with other
* bundles.
*
* @throws IllegalStateException If this
- * <code>ServiceRegistration</code> object has already been
+ * {@code ServiceRegistration} object has already been
* unregistered.
- * @return <code>ServiceReference</code> object.
+ * @return {@code ServiceReference} object.
*/
- public ServiceReference getReference();
+ public ServiceReference<S> getReference();
/**
* Updates the properties associated with a service.
@@ -70,17 +71,17 @@ public interface ServiceRegistration {
* 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</code>
+ * @throws IllegalStateException If this {@code ServiceRegistration}
* object has already been unregistered.
- * @throws IllegalArgumentException If <code>properties</code> contains
+ * @throws IllegalArgumentException If {@code properties} contains
* case variants of the same key name.
*/
- public void setProperties(Dictionary properties);
+ public void setProperties(Dictionary<String, ? > properties);
/**
- * Unregisters a service. Remove a <code>ServiceRegistration</code> object
- * from the Framework service registry. All <code>ServiceReference</code>
- * objects associated with this <code>ServiceRegistration</code> object
+ * Unregisters a service. Remove a {@code ServiceRegistration} object
+ * from the Framework service registry. All {@code ServiceReference}
+ * objects associated with this {@code ServiceRegistration} object
* can no longer be used to interact with the service once unregistration is
* complete.
*
@@ -92,18 +93,18 @@ public interface ServiceRegistration {
* <li>A service event of type {@link ServiceEvent#UNREGISTERING} is fired
* so that bundles using this service can release their use of the service.
* Once delivery of the service event is complete, the
- * <code>ServiceReference</code> objects for the service may no longer be
+ * {@code ServiceReference} objects for the service may no longer be
* used to get a service object for the service.
* <li>For each bundle whose use count for this service is greater than
* zero: <br>
* The bundle's use count for this service is set to zero. <br>
* If the service was registered with a {@link ServiceFactory} object, the
- * <code>ServiceFactory.ungetService</code> method is called to release
+ * {@code ServiceFactory.ungetService} method is called to release
* the service object for the bundle.
* </ol>
*
* @throws IllegalStateException If this
- * <code>ServiceRegistration</code> object has already been
+ * {@code ServiceRegistration} object has already been
* unregistered.
* @see BundleContext#ungetService
* @see ServiceFactory#ungetService
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 2ba0389a9..cf0e7178e 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). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2010). 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.
@@ -27,7 +27,7 @@ import java.util.Map;
* during filter expression evaluation in the permission implies method.
*
* @Immutable
- * @version $Revision: 6479 $
+ * @version $Id: 334caf9ffea9a1e22d7334271a1480f15d05b4e2 $
*/
class SignerProperty {
private final Bundle bundle;
@@ -71,19 +71,25 @@ 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
+ Map<X509Certificate, List<X509Certificate>> signers = matchBundle
.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
- for (Iterator iSigners = signers.values().iterator(); iSigners
- .hasNext();) {
- List/* <X509Certificate> */signerCerts = (List) iSigners.next();
- List/* <String> */dnChain = new ArrayList(signerCerts.size());
- for (Iterator iCerts = signerCerts.iterator(); iCerts.hasNext();) {
- dnChain.add(((X509Certificate) iCerts.next()).getSubjectDN()
+ for (Iterator<List<X509Certificate>> iSigners = signers.values()
+ .iterator(); iSigners.hasNext();) {
+ List<X509Certificate> signerCerts = iSigners.next();
+ List<String> dnChain = new ArrayList<String>(signerCerts.size());
+ for (Iterator<X509Certificate> iCerts = signerCerts.iterator(); iCerts
+ .hasNext();) {
+ dnChain.add(iCerts.next().getSubjectDN()
.getName());
}
- if (FrameworkUtil
- .matchDistinguishedNameChain(matchPattern, dnChain)) {
- return true;
+ try {
+ if (FrameworkUtil.matchDistinguishedNameChain(matchPattern,
+ dnChain)) {
+ return true;
+ }
+ }
+ catch (IllegalArgumentException e) {
+ continue; // bad pattern
}
}
return false;
@@ -106,7 +112,7 @@ class SignerProperty {
if (bundle == null) {
return false;
}
- Map/* <X509Certificate, List<X509Certificate>> */signers = bundle
+ 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/SynchronousBundleListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
index 9104f0490..227dc59cc 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2010). 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,35 +17,48 @@
package org.osgi.framework;
/**
- * A synchronous <code>BundleEvent</code> listener.
- * <code>SynchronousBundleListener</code> is a listener interface that may be
- * implemented by a bundle developer. When a <code>BundleEvent</code> is
- * fired, it is synchronously delivered to a
- * <code>SynchronousBundleListener</code>. The Framework may deliver
- * <code>BundleEvent</code> objects to a
- * <code>SynchronousBundleListener</code> out of order and may concurrently
- * call and/or reenter a <code>SynchronousBundleListener</code>.
+ * A synchronous {@code BundleEvent} listener.
+ * {@code SynchronousBundleListener} is a listener interface that may be
+ * implemented by a bundle developer. When a {@code BundleEvent} is fired,
+ * it is synchronously delivered to a {@code SynchronousBundleListener}.
+ * The Framework may deliver {@code BundleEvent} objects to a
+ * {@code SynchronousBundleListener} out of order and may concurrently call
+ * and/or reenter a {@code SynchronousBundleListener}.
+ *
+ * <p>
+ * For {@code BundleEvent} types {@link BundleEvent#STARTED STARTED} and
+ * {@link BundleEvent#LAZY_ACTIVATION LAZY_ACTIVATION}, the Framework must not
+ * hold the referenced bundle's &quot;state change&quot; lock when the
+ * {@code BundleEvent} is delivered to a
+ * {@code SynchronousBundleListener}. For the other
+ * {@code BundleEvent} types, the Framework must hold the referenced
+ * bundle's &quot;state change&quot; lock when the {@code BundleEvent} is
+ * delivered to a {@code SynchronousBundleListener}. A
+ * {@code SynchronousBundleListener} cannot directly call life cycle
+ * methods on the referenced bundle when the Framework is holding the referenced
+ * bundle's &quot;state change&quot; lock.
+ *
* <p>
- * A <code>SynchronousBundleListener</code> object is registered with the
+ * A {@code SynchronousBundleListener} object is registered with the
* Framework using the {@link BundleContext#addBundleListener} method.
- * <code>SynchronousBundleListener</code> objects are called with a
- * <code>BundleEvent</code> object when a bundle has been installed, resolved,
+ * {@code SynchronousBundleListener} objects are called with a
+ * {@code BundleEvent} object when a bundle has been installed, resolved,
* starting, started, stopping, stopped, updated, unresolved, or uninstalled.
* <p>
- * Unlike normal <code>BundleListener</code> objects,
- * <code>SynchronousBundleListener</code>s are synchronously called during
+ * Unlike normal {@code BundleListener} objects,
+ * {@code SynchronousBundleListener}s are synchronously called during
* bundle lifecycle processing. The bundle lifecycle processing will not proceed
- * until all <code>SynchronousBundleListener</code>s have completed.
- * <code>SynchronousBundleListener</code> objects will be called prior to
- * <code>BundleListener</code> objects.
+ * until all {@code SynchronousBundleListener}s have completed.
+ * {@code SynchronousBundleListener} objects will be called prior to
+ * {@code BundleListener} objects.
* <p>
- * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove
- * a <code>SynchronousBundleListener</code> object.
+ * {@code AdminPermission[bundle,LISTENER]} is required to add or remove a
+ * {@code SynchronousBundleListener} object.
*
* @since 1.1
* @see BundleEvent
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: b22484f48ebdcb2141da9bba9eb65f5c40e0f520 $
*/
public interface SynchronousBundleListener extends BundleListener {
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 73174959e..23f55ca0a 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2010). 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,19 +28,19 @@ import java.util.StringTokenizer;
* <li>Major version. A non-negative integer.</li>
* <li>Minor version. A non-negative integer.</li>
* <li>Micro version. A non-negative integer.</li>
- * <li>Qualifier. A text string. See <code>Version(String)</code> for the
+ * <li>Qualifier. A text string. See {@code Version(String)} for the
* format of the qualifier string.</li>
* </ol>
*
* <p>
- * <code>Version</code> objects are immutable.
+ * {@code Version} objects are immutable.
*
* @since 1.3
* @Immutable
- * @version $Revision: 6860 $
+ * @version $Id: 6b36c5c1ac6ff508fca81eedc6a25c20dfbf00ce $
*/
-public class Version implements Comparable {
+public class Version implements Comparable<Version> {
private final int major;
private final int minor;
private final int micro;
@@ -75,7 +75,7 @@ public class Version implements Comparable {
* @param minor Minor component of the version identifier.
* @param micro Micro component of the version identifier.
* @param qualifier Qualifier component of the version identifier. If
- * <code>null</code> is specified, then the qualifier will be set to
+ * {@code null} is specified, then the qualifier will be set to
* the empty string.
* @throws IllegalArgumentException If the numerical components are negative
* or the qualifier string is invalid.
@@ -111,7 +111,7 @@ public class Version implements Comparable {
* There must be no whitespace in version.
*
* @param version String representation of the version identifier.
- * @throws IllegalArgumentException If <code>version</code> is improperly
+ * @throws IllegalArgumentException If {@code version} is improperly
* formatted.
*/
public Version(String version) {
@@ -194,15 +194,15 @@ public class Version implements Comparable {
* Parses a version identifier from the specified string.
*
* <p>
- * See <code>Version(String)</code> for the format of the version string.
+ * 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</code> object representing the version
- * identifier. If <code>version</code> is <code>null</code> or
- * the empty string then <code>emptyVersion</code> will be
+ * @return A {@code Version} object representing the version
+ * identifier. If {@code version} is {@code null} or
+ * the empty string then {@code emptyVersion} will be
* returned.
- * @throws IllegalArgumentException If <code>version</code> is improperly
+ * @throws IllegalArgumentException If {@code version} is improperly
* formatted.
*/
public static Version parseVersion(String version) {
@@ -258,9 +258,9 @@ public class Version implements Comparable {
* Returns the string representation of this version identifier.
*
* <p>
- * The format of the version string will be <code>major.minor.micro</code>
+ * The format of the version string will be {@code major.minor.micro}
* if qualifier is the empty string or
- * <code>major.minor.micro.qualifier</code> otherwise.
+ * {@code major.minor.micro.qualifier} otherwise.
*
* @return The string representation of this version identifier.
*/
@@ -290,17 +290,17 @@ public class Version implements Comparable {
}
/**
- * Compares this <code>Version</code> object to another object.
+ * 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</code>).
+ * is equal (using {@code String.equals}).
*
- * @param object The <code>Version</code> object to be compared.
- * @return <code>true</code> if <code>object</code> is a
- * <code>Version</code> and is equal to this object;
- * <code>false</code> otherwise.
+ * @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.
*/
public boolean equals(Object object) {
if (object == this) { // quicktest
@@ -317,7 +317,7 @@ public class Version implements Comparable {
}
/**
- * Compares this <code>Version</code> object to another object.
+ * Compares this {@code Version} object to another object.
*
* <p>
* A version is considered to be <b>less than </b> another version if its
@@ -327,27 +327,25 @@ public class Version implements Comparable {
* and its micro component is less than the other version's micro component,
* 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</code>).
+ * {@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</code>).
+ * is equal (using {@code String.compareTo}).
*
- * @param object The <code>Version</code> object to be compared.
+ * @param other The {@code Version} object to be compared.
* @return A negative integer, zero, or a positive integer if this object is
* less than, equal to, or greater than the specified
- * <code>Version</code> object.
+ * {@code Version} object.
* @throws ClassCastException If the specified object is not a
- * <code>Version</code>.
+ * {@code Version}.
*/
- public int compareTo(Object object) {
- if (object == this) { // quicktest
+ public int compareTo(Version other) {
+ if (other == this) { // quicktest
return 0;
}
- Version other = (Version) object;
-
int result = major - other.major;
if (result != 0) {
return result;
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 1249493d6..f5a239a3f 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.osgi.framework.hooks.service;
import java.util.Collection;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
/**
@@ -28,7 +29,7 @@ import org.osgi.framework.ServiceEvent;
* (register, modify, and unregister service) operations.
*
* @ThreadSafe
- * @version $Revision: 6967 $
+ * @version $Id: 79aa00acbd7322819a783d7cce892a3b7fc52cf7 $
*/
public interface EventHook {
@@ -38,17 +39,15 @@ public interface EventHook {
* This method can filter the bundles which receive the event.
*
* @param event The service event to be delivered.
- * @param contexts A <code>Collection</code> of Bundle Contexts for bundles
- * which have listeners to which the specified event will be
- * delivered. The implementation of this method may remove bundle
- * contexts from the collection to prevent the event from being
- * delivered to the associated bundles. The collection supports all
- * the optional <code>Collection</code> operations except
- * <code>add</code> and <code>addAll</code>. Attempting to add to the
- * collection will result in an
- * <code>UnsupportedOperationException</code>. The collection is not
- * synchronized.
+ * @param contexts A collection of Bundle Contexts for bundles which have
+ * listeners to which the specified event will be delivered. The
+ * implementation of this method may remove bundle contexts from the
+ * 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.
*/
- void event(ServiceEvent event,
- Collection/* <BundleContext> */contexts);
+ void event(ServiceEvent event, Collection<BundleContext> contexts);
}
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 0de1f0bd8..cb334c531 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.osgi.framework.hooks.service;
import java.util.Collection;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* OSGi Framework Service Find Hook Service.
@@ -28,7 +29,7 @@ import org.osgi.framework.BundleContext;
* (get service references) operations.
*
* @ThreadSafe
- * @version $Revision: 6967 $
+ * @version $Id: 4a939200fa6634a563379b057e11bd1b5d174b9d $
*/
public interface FindHook {
@@ -39,25 +40,23 @@ 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</code>
+ * @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</code> for no filter criteria.
- * @param allServices <code>true</code> if the find operation is the result
+ * {@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 <code>Collection</code> of Service References to be
- * returned as a result of the find operation. The implementation of
- * this method may remove service references from the collection to
- * prevent the references from being returned to the bundle
- * performing the find operation. The collection supports all the
- * optional <code>Collection</code> operations except
- * <code>add</code> and <code>addAll</code>. Attempting to add to the
- * collection will result in an
- * <code>UnsupportedOperationException</code>. The collection is not
- * synchronized.
+ * @param references A collection of Service References to be returned as a
+ * result of the find operation. The implementation of this method
+ * may remove service references from the collection to prevent the
+ * 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.
*/
void find(BundleContext context, String name, String filter,
- boolean allServices,
- Collection/* <ServiceReference> */references);
+ 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 5934c0c81..48538686f 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). 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 $Revision: 6967 $
+ * @version $Id: c64053251939f402bb35b6a69fc3009888420872 $
*/
public interface ListenerHook {
@@ -40,13 +40,13 @@ public interface ListenerHook {
* method will be called to provide the current collection of service
* listeners which had been added prior to the hook being registered.
*
- * @param listeners A <code>Collection</code> 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</code>. The
- * collection is not synchronized.
+ * @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.
*/
- void added(Collection/* <ListenerInfo> */listeners);
+ void added(Collection<ListenerInfo> listeners);
/**
* Removed listeners hook method. This method is called to provide the hook
@@ -54,13 +54,13 @@ public interface ListenerHook {
* method will be called as service listeners are removed while this hook is
* registered.
*
- * @param listeners A <code>Collection</code> 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</code>. The
- * collection is not synchronized.
+ * @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.
*/
- void removed(Collection/* <ListenerInfo> */listeners);
+ void removed(Collection<ListenerInfo> listeners);
/**
* Information about a Service Listener. This interface describes the bundle
@@ -80,17 +80,17 @@ 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</code> if the listener was added without a
+ * 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</code>
+ * 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</code>.
+ * {@code true}.
*
* <p>
* There is an extremely rare case in which removed notification to
@@ -102,32 +102,32 @@ public interface ListenerHook {
* service listener. This method can be used to detect this rare
* occurrence.
*
- * @return <code>false</code> if the listener has not been been removed,
- * <code>true</code> otherwise.
+ * @return {@code false} if the listener has not been been removed,
+ * {@code true} otherwise.
*/
boolean isRemoved();
/**
- * Compares this <code>ListenerInfo</code> to another
- * <code>ListenerInfo</code>. Two <code>ListenerInfo</code>s are equals
+ * 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</code> which is not equal to this
- * <code>ListenerInfo</code>.
+ * different {@code ListenerInfo} which is not equal to this
+ * {@code ListenerInfo}.
*
* @param obj The object to compare against this
- * <code>ListenerInfo</code>.
- * @return <code>true</code> if the other object is a
- * <code>ListenerInfo</code> object and both objects refer to
+ * {@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);
/**
- * Returns the hash code for this <code>ListenerInfo</code>.
+ * Returns the hash code for this {@code ListenerInfo}.
*
- * @return The hash code of this <code>ListenerInfo</code>.
+ * @return The hash code of this {@code ListenerInfo}.
*/
int hashCode();
}
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 f7618aa4d..182e52a0a 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, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@
package org.osgi.framework.launch;
import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -32,7 +34,7 @@ import org.osgi.framework.FrameworkEvent;
* instance.
*
* @ThreadSafe
- * @version $Revision: 6542 $
+ * @version $Id: 48f87dc5fbb8157a0bf2e9c4504917b62ca9fe66 $
*/
public interface Framework extends Bundle {
@@ -40,14 +42,16 @@ public interface Framework extends Bundle {
* Initialize this Framework. After calling this method, this Framework
* must:
* <ul>
+ * <li>Have generated a new {@link Constants#FRAMEWORK_UUID framework UUID}.
+ * </li>
* <li>Be in the {@link #STARTING} state.</li>
* <li>Have a valid Bundle Context.</li>
* <li>Be at start level 0.</li>
* <li>Have event handling enabled.</li>
* <li>Have reified Bundle objects for all installed bundles.</li>
* <li>Have registered any framework services. For example,
- * <code>PackageAdmin</code>, <code>ConditionalPermissionAdmin</code>,
- * <code>StartLevel</code>.</li>
+ * {@code PackageAdmin}, {@code ConditionalPermissionAdmin},
+ * {@code StartLevel}.</li>
* </ul>
*
* <p>
@@ -61,7 +65,7 @@ public interface Framework extends Bundle {
* @throws BundleException If this Framework could not be initialized.
* @throws SecurityException If the Java Runtime Environment supports
* permissions and the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code> or if there is a
+ * {@code AdminPermission[this,EXECUTE]} or if there is a
* security manager already installed and the
* {@link Constants#FRAMEWORK_SECURITY} configuration property is
* set.
@@ -70,8 +74,8 @@ public interface Framework extends Bundle {
void init() throws BundleException;
/**
- * Wait until this Framework has completely stopped. The <code>stop</code>
- * and <code>update</code> methods on a Framework performs an asynchronous
+ * 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},
@@ -84,7 +88,7 @@ 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</code> types may be returned by
+ * following {@code FrameworkEvent} types may be returned by
* this method.
* <ul>
* <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
@@ -144,7 +148,7 @@ public interface Framework extends Bundle {
*
* @throws BundleException If this Framework could not be started.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see "Start Level Service Specification"
*/
@@ -160,7 +164,7 @@ public interface Framework extends Bundle {
* @param options Ignored. There are no start options for the Framework.
* @throws BundleException If this Framework could not be started.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #start()
*/
@@ -196,7 +200,7 @@ public interface Framework extends Bundle {
* @throws BundleException If stopping this Framework could not be
* initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see "Start Level Service Specification"
*/
@@ -213,7 +217,7 @@ public interface Framework extends Bundle {
* @throws BundleException If stopping this Framework could not be
* initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #stop()
*/
@@ -227,7 +231,7 @@ 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]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void uninstall() throws BundleException;
@@ -248,7 +252,7 @@ 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]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void update() throws BundleException;
@@ -265,7 +269,7 @@ 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]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void update(InputStream in) throws BundleException;
@@ -281,12 +285,12 @@ public interface Framework extends Bundle {
/**
* Returns the Framework location identifier. This Framework is assigned the
- * unique location &quot;<code>System Bundle</code>&quot; since this
+ * unique location &quot;{@code System Bundle}&quot; since this
* Framework is also a System Bundle.
*
- * @return The string &quot;<code>System Bundle</code>&quot;.
+ * @return The string &quot;{@code System Bundle}&quot;.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,METADATA]</code>, and the Java Runtime
+ * {@code AdminPermission[this,METADATA]}, and the Java Runtime
* Environment supports permissions.
* @see Bundle#getLocation()
* @see Constants#SYSTEM_BUNDLE_LOCATION
@@ -296,7 +300,7 @@ 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</code>&quot; must be recognized as an alias to
+ * &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.
*
@@ -305,4 +309,37 @@ public interface Framework extends Bundle {
* @see Constants#SYSTEM_BUNDLE_SYMBOLICNAME
*/
String getSymbolicName();
+
+ /**
+ * 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.
+ */
+ Enumeration<String> getEntryPaths(String path);
+
+ /**
+ * 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.
+ */
+ URL getEntry(String path);
+
+ /**
+ * Returns {@code null} as a framework implementation does not have a
+ * proper bundle from which to return entries.
+ *
+ * @param path Ignored.
+ * @param filePattern Ignored.
+ * @param recurse Ignored.
+ * @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);
}
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 bcb6da3b8..3058c2396 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). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2010). 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 @@ 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</code> class which can create a FrameworkFactory instance
+ * {@code ServiceLoader} class which can create a FrameworkFactory instance
* from the resource.
*
* @ThreadSafe
- * @version $Revision: 6888 $
+ * @version $Id: 16707fdb1206f8f8c75283ebb49d467223e06c41 $
*/
public interface FrameworkFactory {
@@ -58,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</code>. The 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</code>, and the Java Runtime Environment
+ * {@code AllPermission}, and the Java Runtime Environment
* supports permissions.
*/
- Framework newFramework(Map configuration);
+ Framework newFramework(Map<String, String> configuration);
}
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 681148fa3..8e0f443a7 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,11 +30,14 @@ import java.util.Map;
* tracked items. This is not a public class. It is only for use by the
* implementation of the Tracker class.
*
+ * @param <S> The tracked item. It is the key.
+ * @param <T> The value mapped to the tracked item.
+ * @param <R> The reason the tracked item is being tracked or untracked.
* @ThreadSafe
- * @version $Revision: 5871 $
+ * @version $Id: 0fd2229640d82d225e72144f87490b3e9d650254 $
* @since 1.4
*/
-abstract class AbstractTracked {
+abstract class AbstractTracked<S, T, R> {
/* set this to true to compile in debug messages */
static final boolean DEBUG = false;
@@ -43,7 +46,7 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final Map tracked;
+ private final Map<S, T> tracked;
/**
* Modification count. This field is initialized to zero and incremented by
@@ -67,7 +70,7 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final List adding;
+ private final List<S> adding;
/**
* true if the tracked object is closed.
@@ -94,16 +97,16 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final LinkedList initial;
+ private final LinkedList<S> initial;
/**
* AbstractTracked constructor.
*/
AbstractTracked() {
- tracked = new HashMap();
+ tracked = new HashMap<S, T>();
trackingCount = 0;
- adding = new ArrayList(6);
- initial = new LinkedList();
+ adding = new ArrayList<S>(6);
+ initial = new LinkedList<S>();
closed = false;
}
@@ -114,17 +117,15 @@ abstract class AbstractTracked {
* 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</code>
+ * @param list The initial list of items to be tracked. {@code null}
* entries in the list are ignored.
* @GuardedBy this
*/
- void setInitial(Object[] list) {
+ void setInitial(S[] list) {
if (list == null) {
return;
}
- int size = list.length;
- for (int i = 0; i < size; i++) {
- Object item = list[i];
+ for (S item : list) {
if (item == null) {
continue;
}
@@ -145,7 +146,7 @@ abstract class AbstractTracked {
*/
void trackInitial() {
while (true) {
- Object item;
+ S item;
synchronized (this) {
if (closed || (initial.size() == 0)) {
/*
@@ -202,8 +203,8 @@ abstract class AbstractTracked {
* @param item Item to be tracked.
* @param related Action related object.
*/
- void track(final Object item, final Object related) {
- final Object object;
+ void track(final S item, final R related) {
+ final T object;
synchronized (this) {
if (closed) {
return;
@@ -250,11 +251,11 @@ abstract class AbstractTracked {
* @param item Item to be tracked.
* @param related Action related object.
*/
- private void trackAdding(final Object item, final Object related) {
+ private void trackAdding(final S item, final R related) {
if (DEBUG) {
System.out.println("AbstractTracked.trackAdding: " + item); //$NON-NLS-1$
}
- Object object = null;
+ T object = null;
boolean becameUntracked = false;
/* Call customizer outside of synchronized region */
try {
@@ -305,8 +306,8 @@ abstract class AbstractTracked {
* @param item Item to be untracked.
* @param related Action related object.
*/
- void untrack(final Object item, final Object related) {
- final Object object;
+ void untrack(final S item, final R related) {
+ final T object;
synchronized (this) {
if (initial.remove(item)) { /*
* if this item is already in the list
@@ -374,19 +375,19 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- Object getCustomizedObject(final Object item) {
+ T getCustomizedObject(final S item) {
return tracked.get(item);
}
/**
- * Return the list of tracked items.
+ * Copy the tracked items into an array.
*
* @param list An array to contain the tracked items.
* @return The specified list if it is large enough to hold the tracked
* items or a new array large enough to hold the tracked items.
* @GuardedBy this
*/
- Object[] getTracked(final Object[] list) {
+ S[] copyKeys(final S[] list) {
return tracked.keySet().toArray(list);
}
@@ -401,7 +402,7 @@ abstract class AbstractTracked {
}
/**
- * Returns the tracking count for this <code>ServiceTracker</code> object.
+ * Returns the tracking count for this {@code ServiceTracker} object.
*
* The tracking count is initialized to 0 when this object is opened. Every
* time an item is added, modified or removed from this object the tracking
@@ -415,15 +416,32 @@ abstract class AbstractTracked {
}
/**
+ * 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 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.
+ * @return The specified map.
+ * @GuardedBy this
+ * @since 1.5
+ */
+ <M extends Map< ? super S, ? super T>> M copyEntries(final M map) {
+ map.putAll(tracked);
+ return map;
+ }
+
+ /**
* 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</code> if
+ * @return Customized object for the tracked item or {@code null} if
* the item is not to be tracked.
*/
- abstract Object customizerAdding(final Object item, final Object related);
+ abstract T customizerAdding(final S item, final R related);
/**
* Call the specific customizer modified method. This method must not be
@@ -433,8 +451,8 @@ abstract class AbstractTracked {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerModified(final Object item, final Object related,
- final Object object);
+ abstract void customizerModified(final S item, final R related,
+ final T object);
/**
* Call the specific customizer removed method. This method must not be
@@ -444,6 +462,6 @@ abstract class AbstractTracked {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerRemoved(final Object item, final Object related,
- final Object 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 8791d98d3..b9b608de4 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,55 +16,59 @@
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</code> class simplifies tracking bundles much like
- * the <code>ServiceTracker</code> simplifies tracking services.
+ * The {@code BundleTracker} class simplifies tracking bundles much like
+ * the {@code ServiceTracker} simplifies tracking services.
* <p>
- * A <code>BundleTracker</code> is constructed with state criteria and a
- * <code>BundleTrackerCustomizer</code> object. A <code>BundleTracker</code> can
- * use the <code>BundleTrackerCustomizer</code> to select which bundles are
+ * 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</code> can then be opened to begin tracking all bundles
+ * {@code BundleTracker} can then be opened to begin tracking all bundles
* whose state matches the specified state criteria.
* <p>
- * The <code>getBundles</code> method can be called to get the
- * <code>Bundle</code> objects of the bundles being tracked. The
- * <code>getObject</code> method can be called to get the customized object for
+ * 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</code> class is thread-safe. It does not call a
- * <code>BundleTrackerCustomizer</code> while holding any locks.
- * <code>BundleTrackerCustomizer</code> implementations must also be
+ * 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.
*
+ * @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Revision: 5894 $
+ * @version $Id: 4f1410cfefaf6b9fb6060090d605324e5d9254ac $
* @since 1.4
*/
-public class BundleTracker implements BundleTrackerCustomizer {
+public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
/* set this to true to compile in debug messages */
- static final boolean DEBUG = false;
+ static final boolean DEBUG = false;
/**
- * The Bundle Context used by this <code>BundleTracker</code>.
+ * The Bundle Context used by this {@code BundleTracker}.
*/
- protected final BundleContext context;
+ protected final BundleContext context;
/**
- * The <code>BundleTrackerCustomizer</code> object for this tracker.
+ * The {@code BundleTrackerCustomizer} object for this tracker.
*/
- final BundleTrackerCustomizer customizer;
+ final BundleTrackerCustomizer<T> customizer;
/**
- * Tracked bundles: <code>Bundle</code> object -> customized Object and
- * <code>BundleListener</code> object
+ * Tracked bundles: {@code Bundle} object -> customized Object and
+ * {@code BundleListener} object
*/
- private volatile Tracked tracked;
+ private volatile Tracked tracked;
/**
* Accessor method for the current Tracked object. This method is only
@@ -81,50 +85,50 @@ public class BundleTracker implements BundleTrackerCustomizer {
* State mask for bundles being tracked. This field contains the ORed values
* of the bundle states being tracked.
*/
- final int mask;
+ final int mask;
/**
- * Create a <code>BundleTracker</code> for bundles whose state is present in
+ * 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</code>.
+ * tracked by this {@code BundleTracker}.
*
- * @param context The <code>BundleContext</code> against which the tracking
+ * @param context The {@code BundleContext} against which the tracking
* is done.
- * @param stateMask The bit mask of the <code>OR</code>ing of the bundle
+ * @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</code>. If
- * customizer is <code>null</code>, then this
- * <code>BundleTracker</code> will be used as the
- * <code>BundleTrackerCustomizer</code> and this
- * <code>BundleTracker</code> will call the
- * <code>BundleTrackerCustomizer</code> 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 customizer) {
+ BundleTrackerCustomizer<T> customizer) {
this.context = context;
this.mask = stateMask;
this.customizer = (customizer == null) ? this : customizer;
}
/**
- * Open this <code>BundleTracker</code> and begin tracking bundles.
+ * Open this {@code BundleTracker} and begin tracking bundles.
*
* <p>
* Bundle which match the state criteria specified when this
- * <code>BundleTracker</code> was created are now tracked by this
- * <code>BundleTracker</code>.
+ * {@code BundleTracker} was created are now tracked by this
+ * {@code BundleTracker}.
*
- * @throws java.lang.IllegalStateException If the <code>BundleContext</code>
- * with which this <code>BundleTracker</code> was created is no
+ * @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]</code>, and the
+ * {@code AdminPermission[context bundle,LISTENER]}, and the
* Java Runtime Environment supports permissions.
*/
public void open() {
@@ -150,7 +154,7 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
}
/* set tracked with the initial bundles */
- t.setInitial(bundles);
+ t.setInitial(bundles);
}
}
tracked = t;
@@ -160,10 +164,10 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
/**
- * Close this <code>BundleTracker</code>.
+ * Close this {@code BundleTracker}.
*
* <p>
- * This method should be called when this <code>BundleTracker</code> should
+ * This method should be called when this {@code BundleTracker} should
* end the tracking of bundles.
*
* <p>
@@ -200,80 +204,81 @@ public class BundleTracker implements BundleTrackerCustomizer {
/**
* Default implementation of the
- * <code>BundleTrackerCustomizer.addingBundle</code> method.
+ * {@code BundleTrackerCustomizer.addingBundle} method.
*
* <p>
- * This method is only called when this <code>BundleTracker</code> has been
- * constructed with a <code>null BundleTrackerCustomizer</code> argument.
+ * This method is only called when this {@code BundleTracker} has been
+ * constructed with a {@code null BundleTrackerCustomizer} argument.
*
* <p>
- * This implementation simply returns the specified <code>Bundle</code>.
+ * This implementation simply returns the specified {@code Bundle}.
*
* <p>
* This method can be overridden in a subclass to customize the object to be
* tracked for the bundle being added.
*
- * @param bundle The <code>Bundle</code> being added to this
- * <code>BundleTracker</code> object.
+ * @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</code> if there is no bundle event associated
+ * 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)
*/
- public Object addingBundle(Bundle bundle, BundleEvent event) {
- return bundle;
+ public T addingBundle(Bundle bundle, BundleEvent event) {
+ T result = (T) bundle;
+ return result;
}
/**
* Default implementation of the
- * <code>BundleTrackerCustomizer.modifiedBundle</code> method.
+ * {@code BundleTrackerCustomizer.modifiedBundle} method.
*
* <p>
- * This method is only called when this <code>BundleTracker</code> has been
- * constructed with a <code>null BundleTrackerCustomizer</code> argument.
+ * This method is only called when this {@code BundleTracker} has been
+ * constructed with a {@code null BundleTrackerCustomizer} argument.
*
* <p>
* This implementation does nothing.
*
- * @param bundle The <code>Bundle</code> whose state has been modified.
+ * @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</code> if there is no bundle event associated
+ * 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)
*/
- public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) {
+ public void modifiedBundle(Bundle bundle, BundleEvent event, T object) {
/* do nothing */
}
/**
* Default implementation of the
- * <code>BundleTrackerCustomizer.removedBundle</code> method.
+ * {@code BundleTrackerCustomizer.removedBundle} method.
*
* <p>
- * This method is only called when this <code>BundleTracker</code> has been
- * constructed with a <code>null BundleTrackerCustomizer</code> argument.
+ * This method is only called when this {@code BundleTracker} has been
+ * constructed with a {@code null BundleTrackerCustomizer} argument.
*
* <p>
* This implementation does nothing.
*
- * @param bundle The <code>Bundle</code> being removed.
+ * @param bundle The {@code Bundle} being removed.
* @param event The bundle event which caused this customizer method to be
- * called or <code>null</code> if there is no bundle event associated
+ * 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)
*/
- public void removedBundle(Bundle bundle, BundleEvent event, Object object) {
+ public void removedBundle(Bundle bundle, BundleEvent event, T object) {
/* do nothing */
}
/**
- * Return an array of <code>Bundle</code>s for all bundles being tracked by
- * this <code>BundleTracker</code>.
+ * Return an array of {@code Bundle}s for all bundles being tracked by
+ * this {@code BundleTracker}.
*
- * @return An array of <code>Bundle</code>s or <code>null</code> if no
+ * @return An array of {@code Bundle}s or {@code null} if no
* bundles are being tracked.
*/
public Bundle[] getBundles() {
@@ -286,20 +291,20 @@ public class BundleTracker implements BundleTrackerCustomizer {
if (length == 0) {
return null;
}
- return (Bundle[]) t.getTracked(new Bundle[length]);
+ return t.copyKeys(new Bundle[length]);
}
}
/**
- * Returns the customized object for the specified <code>Bundle</code> if
- * the specified bundle is being tracked by this <code>BundleTracker</code>.
+ * 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</code> being tracked.
- * @return The customized object for the specified <code>Bundle</code> or
- * <code>null</code> if the specified <code>Bundle</code> is not
+ * @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.
*/
- public Object getObject(Bundle bundle) {
+ public T getObject(Bundle bundle) {
final Tracked t = tracked();
if (t == null) { /* if BundleTracker is not open */
return null;
@@ -310,14 +315,14 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
/**
- * Remove a bundle from this <code>BundleTracker</code>.
+ * Remove a bundle from this {@code BundleTracker}.
*
- * The specified bundle will be removed from this <code>BundleTracker</code>
+ * The specified bundle will be removed from this {@code BundleTracker}
* . If the specified bundle was being tracked then the
- * <code>BundleTrackerCustomizer.removedBundle</code> method will be called
+ * {@code BundleTrackerCustomizer.removedBundle} method will be called
* for that bundle.
*
- * @param bundle The <code>Bundle</code> to be removed.
+ * @param bundle The {@code Bundle} to be removed.
*/
public void remove(Bundle bundle) {
final Tracked t = tracked();
@@ -329,7 +334,7 @@ public class BundleTracker implements BundleTrackerCustomizer {
/**
* Return the number of bundles being tracked by this
- * <code>BundleTracker</code>.
+ * {@code BundleTracker}.
*
* @return The number of bundles being tracked.
*/
@@ -344,23 +349,23 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
/**
- * Returns the tracking count for this <code>BundleTracker</code>.
+ * Returns the tracking count for this {@code BundleTracker}.
*
* The tracking count is initialized to 0 when this
- * <code>BundleTracker</code> is opened. Every time a bundle is added,
- * modified or removed from this <code>BundleTracker</code> the tracking
+ * {@code BundleTracker} is opened. Every time a bundle is added,
+ * modified or removed from this {@code BundleTracker} the tracking
* count is incremented.
*
* <p>
* The tracking count can be used to determine if this
- * <code>BundleTracker</code> has added, modified or removed a bundle by
+ * {@code BundleTracker} has added, modified or removed a bundle by
* comparing a tracking count value previously collected with the current
* tracking count value. If the value has not changed, then no bundle has
- * been added, modified or removed from this <code>BundleTracker</code>
+ * been added, modified or removed from this {@code BundleTracker}
* since the previous tracking count was collected.
*
- * @return The tracking count for this <code>BundleTracker</code> or -1 if
- * this <code>BundleTracker</code> is not open.
+ * @return The tracking count for this {@code BundleTracker} or -1 if
+ * this {@code BundleTracker} is not open.
*/
public int getTrackingCount() {
final Tracked t = tracked();
@@ -373,13 +378,35 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
/**
+ * 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.
+ * @since 1.5
+ */
+ public Map<Bundle, T> getTracked() {
+ Map<Bundle, T> map = new HashMap<Bundle, T>();
+ final Tracked t = tracked();
+ if (t == null) { /* if BundleTracker is not open */
+ return map;
+ }
+ synchronized (t) {
+ return t.copyEntries(map);
+ }
+ }
+
+ /**
* Inner class which subclasses AbstractTracked. This class is the
- * <code>SynchronousBundleListener</code> object for the tracker.
+ * {@code SynchronousBundleListener} object for the tracker.
*
* @ThreadSafe
* @since 1.4
*/
- class Tracked extends AbstractTracked implements SynchronousBundleListener {
+ class Tracked extends AbstractTracked<Bundle, T, BundleEvent> implements
+ SynchronousBundleListener {
/**
* Tracked constructor.
*/
@@ -388,11 +415,11 @@ public class BundleTracker implements BundleTrackerCustomizer {
}
/**
- * <code>BundleListener</code> method for the <code>BundleTracker</code>
+ * {@code BundleListener} method for the {@code BundleTracker}
* class. This method must NOT be synchronized to avoid deadlock
* potential.
*
- * @param event <code>BundleEvent</code> object from the framework.
+ * @param event {@code BundleEvent} object from the framework.
*/
public void bundleChanged(final BundleEvent event) {
/*
@@ -431,13 +458,11 @@ public class BundleTracker implements BundleTrackerCustomizer {
*
* @param item Item to be tracked.
* @param related Action related object.
- * @return Customized object for the tracked item or <code>null</code>
+ * @return Customized object for the tracked item or {@code null}
* if the item is not to be tracked.
*/
- Object customizerAdding(final Object item,
- final Object related) {
- return customizer
- .addingBundle((Bundle) item, (BundleEvent) related);
+ T customizerAdding(final Bundle item, final BundleEvent related) {
+ return customizer.addingBundle(item, related);
}
/**
@@ -448,10 +473,9 @@ public class BundleTracker implements BundleTrackerCustomizer {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- void customizerModified(final Object item,
- final Object related, final Object object) {
- customizer.modifiedBundle((Bundle) item, (BundleEvent) related,
- object);
+ void customizerModified(final Bundle item, final BundleEvent related,
+ final T object) {
+ customizer.modifiedBundle(item, related, object);
}
/**
@@ -462,10 +486,9 @@ public class BundleTracker implements BundleTrackerCustomizer {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- void customizerRemoved(final Object item,
- final Object related, final Object object) {
- customizer.removedBundle((Bundle) item, (BundleEvent) related,
- 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 100c6b4ea..a7c9a2353 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, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2010). 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,85 +20,86 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
/**
- * The <code>BundleTrackerCustomizer</code> interface allows a
- * <code>BundleTracker</code> to customize the <code>Bundle</code>s that are
- * tracked. A <code>BundleTrackerCustomizer</code> is called when a bundle is
- * being added to a <code>BundleTracker</code>. The
- * <code>BundleTrackerCustomizer</code> can then return an object for the
- * tracked bundle. A <code>BundleTrackerCustomizer</code> is also called when 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</code>.
+ * {@code BundleTracker}.
*
* <p>
* The methods in this interface may be called as the result of a
- * <code>BundleEvent</code> being received by a <code>BundleTracker</code>.
- * Since <code>BundleEvent</code>s are received synchronously by the
- * <code>BundleTracker</code>, it is highly recommended that implementations of
+ * {@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</code> class is thread-safe. It does not call a
- * <code>BundleTrackerCustomizer</code> while holding any locks.
- * <code>BundleTrackerCustomizer</code> implementations must also be
+ * 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.
*
+ * @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Revision: 5874 $
+ * @version $Id: 0e80f2555530b217faef57726a5938f0087a45c5 $
* @since 1.4
*/
-public interface BundleTrackerCustomizer {
+public interface BundleTrackerCustomizer<T> {
/**
- * A bundle is being added to the <code>BundleTracker</code>.
+ * A bundle is being added to the {@code BundleTracker}.
*
* <p>
* This method is called before a bundle which matched the search parameters
- * of the <code>BundleTracker</code> is added to the
- * <code>BundleTracker</code>. This method should return the object to be
- * tracked for the specified <code>Bundle</code>. The returned object is
- * stored in the <code>BundleTracker</code> 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</code> being added to the
- * <code>BundleTracker</code>.
+ * @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</code> if there is no bundle event associated
+ * 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</code>
- * object or <code>null</code> if the specified <code>Bundle</code>
+ * @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 Object addingBundle(Bundle bundle, BundleEvent event);
+ public T addingBundle(Bundle bundle, BundleEvent event);
/**
- * A bundle tracked by the <code>BundleTracker</code> has been modified.
+ * A bundle tracked by the {@code BundleTracker} has been modified.
*
* <p>
* This method is called when a bundle being tracked by the
- * <code>BundleTracker</code> has had its state modified.
+ * {@code BundleTracker} has had its state modified.
*
- * @param bundle The <code>Bundle</code> whose state has been modified.
+ * @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</code> if there is no bundle event associated
+ * 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,
- Object object);
+ T object);
/**
- * A bundle tracked by the <code>BundleTracker</code> has been removed.
+ * A bundle tracked by the {@code BundleTracker} has been removed.
*
* <p>
* This method is called after a bundle is no longer being tracked by the
- * <code>BundleTracker</code>.
+ * {@code BundleTracker}.
*
- * @param bundle The <code>Bundle</code> that has been removed.
+ * @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</code> if there is no bundle event associated
+ * 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,
- Object object);
+ 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 b4e373b29..bc546e673 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,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,9 @@
package org.osgi.util.tracker;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleContext;
@@ -27,73 +28,74 @@ import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
/**
- * The <code>ServiceTracker</code> class simplifies using services from the
+ * The {@code ServiceTracker} class simplifies using services from the
* Framework's service registry.
* <p>
- * A <code>ServiceTracker</code> object is constructed with search criteria and
- * a <code>ServiceTrackerCustomizer</code> object. A <code>ServiceTracker</code>
- * can use a <code>ServiceTrackerCustomizer</code> to customize the service
- * objects to be tracked. The <code>ServiceTracker</code> can then be opened to
+ * 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</code> correctly
- * handles all of the details of listening to <code>ServiceEvent</code>s and
+ * 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</code> method can be called to get references
- * to the services being tracked. The <code>getService</code> and
- * <code>getServices</code> methods can be called to get the service objects for
+ * 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</code> class is thread-safe. It does not call a
- * <code>ServiceTrackerCustomizer</code> while holding any locks.
- * <code>ServiceTrackerCustomizer</code> implementations must also be
+ * 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.
*
+ * @param <S> The type of the service being tracked.
+ * @param <T> The type of the tracked object.
* @ThreadSafe
- * @version $Revision: 6386 $
+ * @version $Id: b375e1b7075486696b42fc55546375f0546b0d58 $
*/
-public class ServiceTracker implements ServiceTrackerCustomizer {
+public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
/* set this to true to compile in debug messages */
- static final boolean DEBUG = false;
+ static final boolean DEBUG = false;
/**
- * The Bundle Context used by this <code>ServiceTracker</code>.
+ * The Bundle Context used by this {@code ServiceTracker}.
*/
- protected final BundleContext context;
+ protected final BundleContext context;
/**
- * The Filter used by this <code>ServiceTracker</code> which specifies the
+ * The Filter used by this {@code ServiceTracker} which specifies the
* search criteria for the services to track.
*
* @since 1.1
*/
- protected final Filter filter;
+ protected final Filter filter;
/**
- * The <code>ServiceTrackerCustomizer</code> for this tracker.
+ * The {@code ServiceTrackerCustomizer} for this tracker.
*/
- final ServiceTrackerCustomizer customizer;
+ final ServiceTrackerCustomizer<S, T> customizer;
/**
* Filter string for use when adding the ServiceListener. If this field is
* set, then certain optimizations can be taken since we don't have a user
* supplied filter.
*/
- final String listenerFilter;
+ final String listenerFilter;
/**
* Class name to be tracked. If this field is set, then we are tracking by
* class name.
*/
- private final String trackClass;
+ private final String trackClass;
/**
* Reference to be tracked. If this field is set, then we are tracking a
* single ServiceReference.
*/
- private final ServiceReference trackReference;
+ private final ServiceReference<S> trackReference;
/**
- * Tracked services: <code>ServiceReference</code> -> customized Object and
- * <code>ServiceListener</code> object
+ * Tracked services: {@code ServiceReference} -> customized Object and
+ * {@code ServiceListener} object
*/
- private volatile Tracked tracked;
+ private volatile Tracked tracked;
/**
* Accessor method for the current Tracked object. This method is only
@@ -111,49 +113,43 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
*
* This field is volatile since it is accessed by multiple threads.
*/
- private volatile ServiceReference cachedReference;
+ private volatile ServiceReference<S> cachedReference;
/**
* Cached service object for getService.
*
* This field is volatile since it is accessed by multiple threads.
*/
- private volatile Object cachedService;
+ private volatile T cachedService;
/**
- * org.osgi.framework package version which introduced
- * {@link ServiceEvent#MODIFIED_ENDMATCH}
- */
- private static final Version endMatchVersion = new Version(1, 5, 0);
-
- /**
- * Create a <code>ServiceTracker</code> on the specified
- * <code>ServiceReference</code>.
+ * Create a {@code ServiceTracker} on the specified
+ * {@code ServiceReference}.
*
* <p>
- * The service referenced by the specified <code>ServiceReference</code>
- * will be tracked by this <code>ServiceTracker</code>.
+ * The service referenced by the specified {@code ServiceReference}
+ * will be tracked by this {@code ServiceTracker}.
*
- * @param context The <code>BundleContext</code> against which the tracking
+ * @param context The {@code BundleContext} against which the tracking
* is done.
- * @param reference The <code>ServiceReference</code> for the service to be
+ * @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</code>. If
- * customizer is <code>null</code>, then this
- * <code>ServiceTracker</code> will be used as the
- * <code>ServiceTrackerCustomizer</code> and this
- * <code>ServiceTracker</code> will call the
- * <code>ServiceTrackerCustomizer</code> methods on itself.
+ * 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 reference,
- final ServiceTrackerCustomizer customizer) {
+ 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() + ")";
+ + reference.getProperty(Constants.SERVICE_ID).toString() + ")";
try {
this.filter = context.createFilter(listenerFilter);
}
@@ -170,32 +166,32 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
/**
- * Create a <code>ServiceTracker</code> on the specified class name.
+ * Create a {@code ServiceTracker} on the specified class name.
*
* <p>
* Services registered under the specified class name will be tracked by
- * this <code>ServiceTracker</code>.
+ * this {@code ServiceTracker}.
*
- * @param context The <code>BundleContext</code> against which the tracking
+ * @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</code>. If
- * customizer is <code>null</code>, then this
- * <code>ServiceTracker</code> will be used as the
- * <code>ServiceTrackerCustomizer</code> and this
- * <code>ServiceTracker</code> will call the
- * <code>ServiceTrackerCustomizer</code> methods on itself.
+ * 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 customizer) {
+ 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() + ")";
+ + clazz.toString() + ")";
try {
this.filter = context.createFilter(listenerFilter);
}
@@ -212,42 +208,31 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
/**
- * Create a <code>ServiceTracker</code> on the specified <code>Filter</code>
+ * Create a {@code ServiceTracker} on the specified {@code Filter}
* object.
*
* <p>
- * Services which match the specified <code>Filter</code> object will be
- * tracked by this <code>ServiceTracker</code>.
+ * Services which match the specified {@code Filter} object will be
+ * tracked by this {@code ServiceTracker}.
*
- * @param context The <code>BundleContext</code> against which the tracking
+ * @param context The {@code BundleContext} against which the tracking
* is done.
- * @param filter The <code>Filter</code> to select the services to be
+ * @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</code>. If
- * customizer is null, then this <code>ServiceTracker</code> will be
- * used as the <code>ServiceTrackerCustomizer</code> and this
- * <code>ServiceTracker</code> will call the
- * <code>ServiceTrackerCustomizer</code> 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 customizer) {
+ final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = null;
this.trackClass = null;
- final Version frameworkVersion = (Version) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
- String version = context
- .getProperty(Constants.FRAMEWORK_VERSION);
- return (version == null) ? Version.emptyVersion
- : new Version(version);
- }
- });
- final boolean endMatchSupported = (frameworkVersion
- .compareTo(endMatchVersion) >= 0);
- this.listenerFilter = endMatchSupported ? filter.toString() : null;
+ this.listenerFilter = filter.toString();
this.filter = filter;
this.customizer = (customizer == null) ? this : customizer;
if ((context == null) || (filter == null)) {
@@ -259,13 +244,37 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
/**
- * Open this <code>ServiceTracker</code> and begin tracking services.
+ * Create a {@code ServiceTracker} on the specified class.
*
* <p>
- * This implementation calls <code>open(false)</code>.
+ * Services registered under the name of the specified class will be tracked
+ * by this {@code ServiceTracker}.
*
- * @throws java.lang.IllegalStateException If the <code>BundleContext</code>
- * with which this <code>ServiceTracker</code> was created is no
+ * @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
+ * {@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) {
+ 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.
* @see #open(boolean)
*/
@@ -274,22 +283,22 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
/**
- * Open this <code>ServiceTracker</code> and begin tracking services.
+ * Open this {@code ServiceTracker} and begin tracking services.
*
* <p>
* Services which match the search criteria specified when this
- * <code>ServiceTracker</code> was created are now tracked by this
- * <code>ServiceTracker</code>.
+ * {@code ServiceTracker} was created are now tracked by this
+ * {@code ServiceTracker}.
*
- * @param trackAllServices If <code>true</code>, then this
- * <code>ServiceTracker</code> will track all matching services
- * regardless of class loader accessibility. If <code>false</code>,
- * then this <code>ServiceTracker</code> will only track matching
+ * @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</code> is used by this
- * <code>ServiceTracker</code>.
- * @throws java.lang.IllegalStateException If the <code>BundleContext</code>
- * with which this <code>ServiceTracker</code> was created is no
+ * {@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
*/
@@ -300,13 +309,13 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
return;
}
if (DEBUG) {
- System.out.println("ServiceTracker.open: " + filter);
+ System.out.println("ServiceTracker.open: " + filter);
}
t = trackAllServices ? new AllTracked() : new Tracked();
synchronized (t) {
try {
context.addServiceListener(t, listenerFilter);
- ServiceReference[] references = null;
+ ServiceReference<S>[] references = null;
if (trackClass != null) {
references = getInitialReferences(trackAllServices,
trackClass, null);
@@ -314,23 +323,22 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
else {
if (trackReference != null) {
if (trackReference.getBundle() != null) {
- references = new ServiceReference[] {trackReference};
+ ServiceReference<S>[] single = new ServiceReference[] {trackReference};
+ references = single;
}
}
else { /* user supplied filter */
references = getInitialReferences(trackAllServices,
- null,
- (listenerFilter != null) ? listenerFilter
- : filter.toString());
+ null, listenerFilter);
}
}
/* set tracked with the initial references */
- t.setInitial(references);
+ t.setInitial(references);
}
catch (InvalidSyntaxException e) {
throw new RuntimeException(
"unexpected InvalidSyntaxException: "
- + e.getMessage(), e);
+ + e.getMessage(), e);
}
}
tracked = t;
@@ -340,33 +348,33 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
/**
- * Returns the list of initial <code>ServiceReference</code>s that will be
- * tracked by this <code>ServiceTracker</code>.
+ * Returns the list of initial {@code ServiceReference}s that will be
+ * tracked by this {@code ServiceTracker}.
*
- * @param trackAllServices If <code>true</code>, use
- * <code>getAllServiceReferences</code>.
+ * @param trackAllServices If {@code true}, use
+ * {@code getAllServiceReferences}.
* @param className The class name with which the service was registered, or
- * <code>null</code> for all services.
- * @param filterString The filter criteria or <code>null</code> for all
+ * {@code null} for all services.
+ * @param filterString The filter criteria or {@code null} for all
* services.
- * @return The list of initial <code>ServiceReference</code>s.
+ * @return The list of initial {@code ServiceReference}s.
* @throws InvalidSyntaxException If the specified filterString has an
* invalid syntax.
*/
- private ServiceReference[] getInitialReferences(boolean trackAllServices,
- String className, String filterString)
+ private ServiceReference<S>[] getInitialReferences(
+ boolean trackAllServices, String className, String filterString)
throws InvalidSyntaxException {
- if (trackAllServices) {
- return context.getAllServiceReferences(className, filterString);
- }
- return context.getServiceReferences(className, filterString);
+ ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context
+ .getAllServiceReferences(className, filterString)
+ : context.getServiceReferences(className, filterString));
+ return result;
}
/**
- * Close this <code>ServiceTracker</code>.
+ * Close this {@code ServiceTracker}.
*
* <p>
- * This method should be called when this <code>ServiceTracker</code> should
+ * This method should be called when this {@code ServiceTracker} should
* end the tracking of services.
*
* <p>
@@ -375,14 +383,14 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
*/
public void close() {
final Tracked outgoing;
- final ServiceReference[] references;
+ final ServiceReference<S>[] references;
synchronized (this) {
outgoing = tracked;
if (outgoing == null) {
return;
}
if (DEBUG) {
- System.out.println("ServiceTracker.close: " + filter);
+ System.out.println("ServiceTracker.close: " + filter);
}
outgoing.close();
references = getServiceReferences();
@@ -405,26 +413,25 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
}
if (DEBUG) {
if ((cachedReference == null) && (cachedService == null)) {
- System.out
- .println("ServiceTracker.close[cached cleared]: "
- + filter);
+ System.out.println("ServiceTracker.close[cached cleared]: "
+ + filter);
}
}
}
/**
* Default implementation of the
- * <code>ServiceTrackerCustomizer.addingService</code> method.
+ * {@code ServiceTrackerCustomizer.addingService} method.
*
* <p>
- * This method is only called when this <code>ServiceTracker</code> has been
- * constructed with a <code>null ServiceTrackerCustomizer</code> argument.
+ * 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</code>
- * on the <code>BundleContext</code> with which this
- * <code>ServiceTracker</code> was created passing the specified
- * <code>ServiceReference</code>.
+ * 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
@@ -433,22 +440,23 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
* the service.
*
* @param reference The reference to the service being added to this
- * <code>ServiceTracker</code>.
+ * {@code ServiceTracker}.
* @return The service object to be tracked for the service added to this
- * <code>ServiceTracker</code>.
+ * {@code ServiceTracker}.
* @see ServiceTrackerCustomizer#addingService(ServiceReference)
*/
- public Object addingService(ServiceReference reference) {
- return context.getService(reference);
+ public T addingService(ServiceReference<S> reference) {
+ T result = (T) context.getService(reference);
+ return result;
}
/**
* Default implementation of the
- * <code>ServiceTrackerCustomizer.modifiedService</code> method.
+ * {@code ServiceTrackerCustomizer.modifiedService} method.
*
* <p>
- * This method is only called when this <code>ServiceTracker</code> has been
- * constructed with a <code>null ServiceTrackerCustomizer</code> argument.
+ * This method is only called when this {@code ServiceTracker} has been
+ * constructed with a {@code null ServiceTrackerCustomizer} argument.
*
* <p>
* This implementation does nothing.
@@ -457,22 +465,22 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
* @param service The service object for the modified service.
* @see ServiceTrackerCustomizer#modifiedService(ServiceReference, Object)
*/
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<S> reference, T service) {
/* do nothing */
}
/**
* Default implementation of the
- * <code>ServiceTrackerCustomizer.removedService</code> method.
+ * {@code ServiceTrackerCustomizer.removedService} method.
*
* <p>
- * This method is only called when this <code>ServiceTracker</code> has been
- * constructed with a <code>null ServiceTrackerCustomizer</code> argument.
+ * This method is only called when this {@code ServiceTracker} has been
+ * constructed with a {@code null ServiceTrackerCustomizer} argument.
*
* <p>
- * This implementation calls <code>ungetService</code>, on the
- * <code>BundleContext</code> with which this <code>ServiceTracker</code>
- * was created, passing the specified <code>ServiceReference</code>.
+ * This implementation calls {@code ungetService}, 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. If the default
* implementation of {@link #addingService(ServiceReference) addingService}
@@ -482,19 +490,19 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
* @param service The service object for the removed service.
* @see ServiceTrackerCustomizer#removedService(ServiceReference, Object)
*/
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<S> reference, T service) {
context.ungetService(reference);
}
/**
* Wait for at least one service to be tracked by this
- * <code>ServiceTracker</code>. This method will also return when this
- * <code>ServiceTracker</code> is closed.
+ * {@code ServiceTracker}. This method will also return when this
+ * {@code ServiceTracker} is closed.
*
* <p>
- * It is strongly recommended that <code>waitForService</code> is not used
- * during the calling of the <code>BundleActivator</code> methods.
- * <code>BundleActivator</code> methods are expected to complete in a short
+ * 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>
@@ -508,11 +516,11 @@ public class ServiceTracker implements ServiceTrackerCustomizer {
* current thread.
* @throws IllegalArgumentException If the value of timeout is negative.
*/
- public Object waitForService(long time