Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2010-10-04 16:59:44 +0000
committerJohn Arthorne2010-10-04 16:59:44 +0000
commitfdfa6363a847d135212385970259283890243fd0 (patch)
tree36b2417d822242d54d84a3c63c36b010900b0f4d
parent66d60f2ea0d94f246c00f8dd827d6c64bb7b0a88 (diff)
downloadrt.equinox.p2-fdfa6363a847d135212385970259283890243fd0.tar.gz
rt.equinox.p2-fdfa6363a847d135212385970259283890243fd0.tar.xz
rt.equinox.p2-fdfa6363a847d135212385970259283890243fd0.zip
Fixed compiler warnings related to genericsv20101004
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/ServiceHelper.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Activator.java14
8 files changed, 39 insertions, 40 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
index 10304f9de..54bc79f44 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008, 2009, IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This
* 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
@@ -16,15 +16,15 @@ import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
-public class Activator implements BundleActivator, ServiceTrackerCustomizer {
+public class Activator implements BundleActivator, ServiceTrackerCustomizer<IProvisioningAgent, IProvisioningAgent> {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.equinox.p2.console"; //$NON-NLS-1$
private static final String PROVIDER_NAME = "org.eclipse.osgi.framework.console.CommandProvider"; //$NON-NLS-1$
private static BundleContext context;
- private ServiceTracker agentTracker;
+ private ServiceTracker<IProvisioningAgent, IProvisioningAgent> agentTracker;
private ProvCommandProvider provider;
- private ServiceRegistration providerRegistration = null;
+ private ServiceRegistration<?> providerRegistration = null;
public static BundleContext getContext() {
return context;
@@ -44,7 +44,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
}
if (registerCommands) {
- agentTracker = new ServiceTracker(context, IProvisioningAgent.SERVICE_NAME, this);
+ agentTracker = new ServiceTracker<IProvisioningAgent, IProvisioningAgent>(context, IProvisioningAgent.class, this);
agentTracker.open();
}
}
@@ -57,19 +57,19 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
Activator.context = null;
}
- public Object addingService(ServiceReference reference) {
+ public IProvisioningAgent addingService(ServiceReference<IProvisioningAgent> reference) {
BundleContext ctxt = Activator.getContext();
- IProvisioningAgent agent = (IProvisioningAgent) ctxt.getService(reference);
+ IProvisioningAgent agent = ctxt.getService(reference);
provider = new ProvCommandProvider(ctxt.getProperty("eclipse.p2.profile"), agent); //$NON-NLS-1$
providerRegistration = ctxt.registerService(PROVIDER_NAME, provider, null);
return agent;
}
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<IProvisioningAgent> reference, IProvisioningAgent service) {
// nothing
}
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<IProvisioningAgent> reference, IProvisioningAgent service) {
if (providerRegistration != null)
providerRegistration.unregister();
providerRegistration = null;
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/ServiceHelper.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/ServiceHelper.java
index e09fb6695..762029592 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/ServiceHelper.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/ServiceHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 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 http://www.eclipse.org/legal/epl-v10.html
@@ -23,7 +23,7 @@ public class ServiceHelper {
public static Object getService(BundleContext context, String name) {
if (context == null)
return null;
- ServiceReference reference = context.getServiceReference(name);
+ ServiceReference<?> reference = context.getServiceReference(name);
if (reference == null)
return null;
Object result = context.getService(reference);
@@ -32,7 +32,7 @@ public class ServiceHelper {
}
public static Object getService(BundleContext context, String name, String filter) {
- ServiceReference[] references;
+ ServiceReference<?>[] references;
try {
references = context.getServiceReferences(name, filter);
} catch (InvalidSyntaxException e) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
index ea3831bbd..dceeffa69 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
@@ -142,16 +142,16 @@ public class ProfilePreferences extends EclipsePreferences {
* Returns a reference to the agent service corresponding to the given encoded
* agent location. Never returns null; throws an exception if the agent could not be found.
*/
- private ServiceReference getAgent(String segment) throws BackingStoreException {
+ private ServiceReference<IProvisioningAgent> getAgent(String segment) throws BackingStoreException {
String locationString = EncodingUtils.decodeSlashes(segment);
Exception failure = null;
try {
String filter = "(locationURI=" + encodeForFilter(locationString) + ')'; //$NON-NLS-1$
final BundleContext context = EngineActivator.getContext();
if (context != null) {
- ServiceReference[] refs = context.getServiceReferences(IProvisioningAgent.SERVICE_NAME, filter);
- if (refs != null && refs.length > 0)
- return refs[0];
+ Collection<ServiceReference<IProvisioningAgent>> refs = context.getServiceReferences(IProvisioningAgent.class, filter);
+ if (!refs.isEmpty())
+ return refs.iterator().next();
}
} catch (InvalidSyntaxException e) {
failure = e;
@@ -237,8 +237,8 @@ public class ProfilePreferences extends EclipsePreferences {
*/
protected void load() throws BackingStoreException {
synchronized (((ProfilePreferences) parent).profileLock) {
- ServiceReference agentRef = getAgent(getSegment(absolutePath(), 1));
- IProvisioningAgent agent = (IProvisioningAgent) EngineActivator.getContext().getService(agentRef);
+ ServiceReference<IProvisioningAgent> agentRef = getAgent(getSegment(absolutePath(), 1));
+ IProvisioningAgent agent = EngineActivator.getContext().getService(agentRef);
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
try {
String profileId = getSegment(absolutePath(), 2);
@@ -277,8 +277,8 @@ public class ProfilePreferences extends EclipsePreferences {
*/
protected synchronized void save() throws BackingStoreException {
try {
- ServiceReference agentRef = getAgent(getSegment(absolutePath(), 1));
- IProvisioningAgent agent = (IProvisioningAgent) EngineActivator.getContext().getService(agentRef);
+ ServiceReference<IProvisioningAgent> agentRef = getAgent(getSegment(absolutePath(), 1));
+ IProvisioningAgent agent = EngineActivator.getContext().getService(agentRef);
if (saveJob == null || saveJob.agent != agent)
saveJob = new SaveJob(agent);
EngineActivator.getContext().ungetService(agentRef);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index 57aabb9e5..9d16c83ba 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -84,10 +84,10 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
final BundleContext context = EngineActivator.getContext();
if (context == null)
return;
- ServiceReference ref = context.getServiceReference(IAgentLocation.SERVICE_NAME);
+ ServiceReference<IAgentLocation> ref = context.getServiceReference(IAgentLocation.class);
if (ref == null)
return;
- IAgentLocation location = (IAgentLocation) context.getService(ref);
+ IAgentLocation location = context.getService(ref);
if (location == null)
return;
if (store.equals(getDefaultRegistryDirectory(location))) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
index 6607b5cf2..397cd6da9 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
@@ -43,8 +43,8 @@ public class CertificateChecker {
public IStatus start() {
final BundleContext context = EngineActivator.getContext();
- ServiceReference contentFactoryRef = context.getServiceReference(SignedContentFactory.class.getName());
- SignedContentFactory verifierFactory = (SignedContentFactory) context.getService(contentFactoryRef);
+ ServiceReference<SignedContentFactory> contentFactoryRef = context.getServiceReference(SignedContentFactory.class);
+ SignedContentFactory verifierFactory = context.getService(contentFactoryRef);
try {
return checkCertificates(verifierFactory);
} finally {
@@ -146,7 +146,7 @@ public class CertificateChecker {
if (trustedCertificates == null)
// I'm pretty sure this would be a bug; trustedCertificates should never be null here.
return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected);
- ServiceTracker trustEngineTracker = new ServiceTracker(EngineActivator.getContext(), TrustEngine.class.getName(), null);
+ ServiceTracker<TrustEngine, TrustEngine> trustEngineTracker = new ServiceTracker<TrustEngine, TrustEngine>(EngineActivator.getContext(), TrustEngine.class, null);
trustEngineTracker.open();
Object[] trustEngines = trustEngineTracker.getServices();
try {
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
index c05ff6868..ac780a867 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
@@ -69,10 +69,10 @@ public class Activator implements BundleActivator {
}
public static IProvisioningAgent getCurrentAgent() {
- ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
+ ServiceReference<IProvisioningAgent> reference = bundleContext.getServiceReference(IProvisioningAgent.class);
if (reference == null)
return null;
- return (IProvisioningAgent) bundleContext.getService(reference);
+ return bundleContext.getService(reference);
}
public static IFileArtifactRepository getBundlePoolRepository() {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
index 6f4e4448d..bdb23985f 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.persistence;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.metadata.VersionRange;
-
import java.net.*;
import java.util.List;
import java.util.StringTokenizer;
@@ -22,6 +19,8 @@ import org.eclipse.equinox.internal.p2.core.Activator;
import org.eclipse.equinox.internal.p2.core.StringPool;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
@@ -48,7 +47,7 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants {
protected StringPool stringPool = new StringPool();//used to eliminate string duplication
private IProgressMonitor monitor;
- private static ServiceTracker xmlTracker = null;
+ private static ServiceTracker<SAXParserFactory, SAXParserFactory> xmlTracker = null;
public XMLParser(BundleContext context, String pluginId) {
super();
@@ -77,10 +76,10 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants {
private synchronized static SAXParserFactory acquireXMLParsing(BundleContext context) {
if (xmlTracker == null) {
- xmlTracker = new ServiceTracker(context, SAXParserFactory.class.getName(), null);
+ xmlTracker = new ServiceTracker<SAXParserFactory, SAXParserFactory>(context, SAXParserFactory.class, null);
xmlTracker.open();
}
- return (SAXParserFactory) xmlTracker.getService();
+ return xmlTracker.getService();
}
protected synchronized static void releaseXMLParsing() {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Activator.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Activator.java
index 695e2874d..f4cc4713d 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Activator.java
@@ -32,10 +32,10 @@ public class Activator implements BundleActivator {
private static BundleContext context;
// tracker for ECF service
- private ServiceTracker retrievalFactoryTracker;
+ private ServiceTracker<IRetrieveFileTransferFactory, IRetrieveFileTransferFactory> retrievalFactoryTracker;
// tracker for protocolToFactoryMapperTracker
- private ServiceTracker protocolToFactoryMapperTracker = null;
+ private ServiceTracker<IFileTransferProtocolToFactoryMapper, IFileTransferProtocolToFactoryMapper> protocolToFactoryMapperTracker = null;
// The shared instance
private static Activator plugin;
@@ -79,7 +79,7 @@ public class Activator implements BundleActivator {
* @return a factory, or null, if configuration is incorrect
*/
public IRetrieveFileTransferFactory getRetrieveFileTransferFactory() {
- return (IRetrieveFileTransferFactory) getFileTransferServiceTracker().getService();
+ return getFileTransferServiceTracker().getService();
}
public synchronized void useJREHttpClient() {
@@ -126,9 +126,9 @@ public class Activator implements BundleActivator {
* "org.eclipse.ecf.provider.filetransfer" on first call.
* @return ServiceTracker
*/
- private synchronized ServiceTracker getFileTransferServiceTracker() {
+ private synchronized ServiceTracker<IRetrieveFileTransferFactory, IRetrieveFileTransferFactory> getFileTransferServiceTracker() {
if (retrievalFactoryTracker == null) {
- retrievalFactoryTracker = new ServiceTracker(Activator.getContext(), IRetrieveFileTransferFactory.class.getName(), null);
+ retrievalFactoryTracker = new ServiceTracker<IRetrieveFileTransferFactory, IRetrieveFileTransferFactory>(Activator.getContext(), IRetrieveFileTransferFactory.class, null);
retrievalFactoryTracker.open();
startBundle("org.eclipse.ecf"); //$NON-NLS-1$
startBundle("org.eclipse.ecf.provider.filetransfer"); //$NON-NLS-1$
@@ -138,10 +138,10 @@ public class Activator implements BundleActivator {
private IFileTransferProtocolToFactoryMapper getProtocolToFactoryMapper() {
if (protocolToFactoryMapperTracker == null) {
- protocolToFactoryMapperTracker = new ServiceTracker(context, IFileTransferProtocolToFactoryMapper.class.getName(), null);
+ protocolToFactoryMapperTracker = new ServiceTracker<IFileTransferProtocolToFactoryMapper, IFileTransferProtocolToFactoryMapper>(context, IFileTransferProtocolToFactoryMapper.class, null);
protocolToFactoryMapperTracker.open();
}
- return (IFileTransferProtocolToFactoryMapper) protocolToFactoryMapperTracker.getService();
+ return protocolToFactoryMapperTracker.getService();
}
private boolean startBundle(String bundleId) {

Back to the top