Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-27 04:16:10 -0500
committerAlexander Kurtakov2015-03-23 05:36:24 -0400
commit09155e9ddb667a364a0be35f73cb6da662154a33 (patch)
treeb63bf87fc4870884cc0b0d475074915f7fc4c16c
parent97cbe376383b753aa4b568950e803bef71fbdb27 (diff)
downloadrt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.gz
rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.xz
rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.zip
Bug 460967 - Use type safe service retrieving
Instead of retrieving services based on their String class name there is newer implementation that takes the class directly and returns the correct class preventing casts. Change-Id: I817c47b702001b739a07a54f4fd8dd72ae9750aa Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java7
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java8
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java6
-rw-r--r--bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java12
14 files changed, 61 insertions, 53 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
index 74df5887b..97f044a48 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.frameworkadmin.equinox;
@@ -165,8 +166,8 @@ public class EquinoxBundlesState implements BundlesState {
Properties platformProperties = new Properties();
// set default value
- ServiceReference<?> environmentRef = context.getServiceReference(EnvironmentInfo.class);
- EnvironmentInfo environment = environmentRef == null ? null : (EnvironmentInfo) context.getService(environmentRef);
+ ServiceReference<EnvironmentInfo> environmentRef = context.getServiceReference(EnvironmentInfo.class);
+ EnvironmentInfo environment = environmentRef == null ? null : context.getService(environmentRef);
if (environment != null) {
try {
String nl = Locale.getDefault().toString();
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
index c8e646fbf..f850c7c09 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 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
@@ -7,7 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Red Hat, Inc - bug 305712
+ * Red Hat, Inc - bug 305712, bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.frameworkadmin.equinox;
@@ -283,8 +283,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
// 2. Create a Manipulator object fully initialized to the current running fw.
- ServiceReference<?> reference = context.getServiceReference(StartLevel.class.getName());
- StartLevel startLevel = (StartLevel) context.getService(reference);
+ ServiceReference<StartLevel> reference = context.getServiceReference(StartLevel.class);
+ StartLevel startLevel = context.getService(reference);
Bundle[] bundles = context.getBundles();
BundleInfo[] bInfos = new BundleInfo[bundles.length];
for (int i = 0; i < bundles.length; i++) {
diff --git a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java
index ac9b6d3c5..1691d7427 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.frameworkadmin.utils;
@@ -40,10 +41,10 @@ public class Activator implements BundleActivator {
public static PluginConverter acquirePluginConverter() {
if (bundleContext == null)
return null;
- ServiceReference<?> reference = bundleContext.getServiceReference(PluginConverter.class.getName());
+ ServiceReference<PluginConverter> reference = bundleContext.getServiceReference(PluginConverter.class);
if (reference == null)
return null;
- PluginConverter result = (PluginConverter) bundleContext.getService(reference);
+ PluginConverter result = bundleContext.getService(reference);
bundleContext.ungetService(reference);
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
index c6e58dd77..10ddb70f9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
@@ -33,8 +34,8 @@ public class ProvisioningAgentTest extends AbstractProvisioningTest {
URI p2location = getTempFolder().toURI();
String PROFILE_ID = "testMultipleAgents";
- ServiceReference providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class.getName());
- IProvisioningAgentProvider provider = (IProvisioningAgentProvider) TestActivator.context.getService(providerRef);
+ ServiceReference<IProvisioningAgentProvider> providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class);
+ IProvisioningAgentProvider provider = TestActivator.context.getService(providerRef);
IProvisioningAgent firstAgent = provider.createAgent(p2location);
IProfileRegistry firstProfileRegistry = (IProfileRegistry) firstAgent.getService(IProfileRegistry.SERVICE_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
index c658bc457..e2cdc0399 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
@@ -47,8 +47,8 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
private IProvisioningAgent end2endAgent = null;
protected void setUp() throws Exception {
- ServiceReference sr = TestActivator.context.getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
- IProvisioningAgentProvider agentFactory = (IProvisioningAgentProvider) TestActivator.context.getService(sr);
+ ServiceReference<IProvisioningAgentProvider> sr = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class);
+ IProvisioningAgentProvider agentFactory = TestActivator.context.getService(sr);
end2endAgent = agentFactory.createAgent(getTempFolder().toURI());
metadataRepoManager = (IMetadataRepositoryManager) end2endAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
artifactRepoManager = (IArtifactRepositoryManager) end2endAgent.getService(IArtifactRepositoryManager.SERVICE_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
index 8c1c17870..24a8ed409 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
@@ -37,11 +37,11 @@ import org.osgi.framework.ServiceReference;
public class DirectorTest extends AbstractProvisioningTest {
public void testInstallIU() {
- ServiceReference sr = TestActivator.context.getServiceReference(IDirector.SERVICE_NAME);
+ ServiceReference<IDirector> sr = TestActivator.context.getServiceReference(IDirector.class);
if (sr == null) {
throw new RuntimeException("Director service not available");
}
- IDirector director = (IDirector) TestActivator.context.getService(sr);
+ IDirector director = TestActivator.context.getService(sr);
if (director == null) {
throw new RuntimeException("Director could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java
index 9e0e58fd7..24c0f0dd8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Cloudsmith Inc. and others.
+ * Copyright (c) 2009, 2015 Cloudsmith Inc. 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Cloudsmith Inc - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -33,7 +34,7 @@ public class AllServerTests extends TestCase {
static UIServices hookedAuthDialog;
private static ServiceRegistration certificateUIRegistration;
private static int setUpCounter = 0;
- private static ServiceReference packageAdminRef;
+ private static ServiceReference<PackageAdmin> packageAdminRef;
public static Test suite() throws Exception {
final TestSuite suite = new TestSuite("AllServerBasedTestSuite");
@@ -102,8 +103,8 @@ public class AllServerTests extends TestCase {
public static void oneTimeSetUp() throws Exception {
BundleContext context = TestActivator.getContext();
- packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
- PackageAdmin pkgAdmin = (PackageAdmin) context.getService(packageAdminRef);
+ packageAdminRef = context.getServiceReference(PackageAdmin.class);
+ PackageAdmin pkgAdmin = context.getService(packageAdminRef);
// Make sure these are not running
stopTransient(pkgAdmin, BUNDLE_EQUINOX_HTTP);
@@ -130,7 +131,7 @@ public class AllServerTests extends TestCase {
public static void oneTimeTearDown() throws Exception {
BundleContext context = TestActivator.getContext();
certificateUIRegistration.unregister();
- PackageAdmin pkgAdmin = (PackageAdmin) context.getService(packageAdminRef);
+ PackageAdmin pkgAdmin = context.getService(packageAdminRef);
stopTransient(pkgAdmin, BUNDLE_TESTSERVER);
stopTransient(pkgAdmin, BUNDLE_EQUINOX_HTTP);
context.ungetService(packageAdminRef);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
index 41918d3d2..dfbe37940 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Sonatype, Inc. and others.
+ * Copyright (c) 2011, 2015 Sonatype, Inc. 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
@@ -8,6 +8,7 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
* IBM Corporation - Ongoing development
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
@@ -34,8 +35,8 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest {
//Directly test the operation
public void testSyncOperation() throws ProvisionException {
- ServiceReference providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class.getName());
- IProvisioningAgentProvider provider = (IProvisioningAgentProvider) TestActivator.context.getService(providerRef);
+ ServiceReference<IProvisioningAgentProvider> providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class);
+ IProvisioningAgentProvider provider = TestActivator.context.getService(providerRef);
URI p2location = getTestData("p2 location", "testData/synchronizeOperation/p2").toURI();
URI repoLocation = getTestData("p2 location", "testData/synchronizeOperation/repo").toURI();
@@ -54,8 +55,8 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest {
//Test a copy of the helper code
public void testCopyOfHelper() throws ProvisionException {
- ServiceReference providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class.getName());
- IProvisioningAgentProvider provider = (IProvisioningAgentProvider) TestActivator.context.getService(providerRef);
+ ServiceReference<IProvisioningAgentProvider> providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class);
+ IProvisioningAgentProvider provider = TestActivator.context.getService(providerRef);
URI p2location = getTestData("p2 location", "testData/synchronizeOperation/p2").toURI();
URI repoLocation = getTestData("p2 location", "testData/synchronizeOperation/repo").toURI();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java
index 2e1a9e0e5..f42d57420 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Cloudsmith and others.
+ * Copyright (c) 2009, 2015 Cloudsmith 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Cloudsmith - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.testserver.helper;
@@ -34,7 +35,7 @@ public class TestServerController {
static UIServices hookedAuthDialog;
private static ServiceRegistration certificateUIRegistration;
private static int setUpCounter = 0;
- private static ServiceReference packageAdminRef;
+ private static ServiceReference<PackageAdmin> packageAdminRef;
private static Bundle getBundle(PackageAdmin packageAdmin, String symbolicName) {
Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
@@ -75,8 +76,8 @@ public class TestServerController {
public static void oneTimeSetUp() throws Exception {
BundleContext context = TestActivator.getContext();
- packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
- PackageAdmin pkgAdmin = (PackageAdmin) context.getService(packageAdminRef);
+ packageAdminRef = context.getServiceReference(PackageAdmin.class);
+ PackageAdmin pkgAdmin = context.getService(packageAdminRef);
// Make sure these are not running
stopTransient(pkgAdmin, BUNDLE_EQUINOX_HTTP);
@@ -102,7 +103,7 @@ public class TestServerController {
public static void oneTimeTearDown() throws Exception {
BundleContext context = TestActivator.getContext();
certificateUIRegistration.unregister();
- PackageAdmin pkgAdmin = (PackageAdmin) context.getService(packageAdminRef);
+ PackageAdmin pkgAdmin = context.getService(packageAdminRef);
stopTransient(pkgAdmin, BUNDLE_TESTSERVER);
stopTransient(pkgAdmin, BUNDLE_EQUINOX_HTTP);
context.ungetService(packageAdminRef);
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
index 7cca4956a..f42534de8 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
@@ -123,10 +123,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public IProvisioningEventBus getProvisioningEventBus() {
- ServiceReference<?> busReference = context.getServiceReference(IProvisioningEventBus.SERVICE_NAME);
+ ServiceReference<IProvisioningEventBus> busReference = context.getServiceReference(IProvisioningEventBus.class);
if (busReference == null)
return null;
- return (IProvisioningEventBus) context.getService(busReference);
+ return context.getService(busReference);
}
/*
@@ -146,10 +146,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public IAgentLocation getAgentLocation() {
- ServiceReference<?> ref = getContext().getServiceReference(IAgentLocation.SERVICE_NAME);
+ ServiceReference<IAgentLocation> ref = getContext().getServiceReference(IAgentLocation.class);
if (ref == null)
return null;
- IAgentLocation location = (IAgentLocation) getContext().getService(ref);
+ IAgentLocation location = getContext().getService(ref);
getContext().ungetService(ref);
return location;
}
@@ -184,10 +184,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public IProvisioningAgentProvider getAgentProvider() {
- ServiceReference<?> ref = getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
+ ServiceReference<IProvisioningAgentProvider> ref = getContext().getServiceReference(IProvisioningAgentProvider.class);
if (ref == null)
return null;
- IProvisioningAgentProvider agentProvider = (IProvisioningAgentProvider) getContext().getService(ref);
+ IProvisioningAgentProvider agentProvider = getContext().getService(ref);
getContext().ungetService(ref);
return agentProvider;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java
index c6d6acd79..f6cc655ac 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB (Hamdan Msheik) - Bug 396420 - Control Install dialog through preference customization
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.sdk;
@@ -158,10 +159,10 @@ public class ProvSDKUIActivator extends AbstractUIPlugin {
}
private IAgentLocation getAgentLocation() {
- ServiceReference<?> ref = getContext().getServiceReference(IAgentLocation.SERVICE_NAME);
+ ServiceReference<IAgentLocation> ref = getContext().getServiceReference(IAgentLocation.class);
if (ref == null)
return null;
- IAgentLocation location = (IAgentLocation) getContext().getService(ref);
+ IAgentLocation location = getContext().getService(ref);
getContext().ungetService(ref);
return location;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java
index bf3177f7a..151579b36 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB (Hamdan Msheik) - Bug 396420 - Control Install dialog through preference customization
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.sdk.prefs;
@@ -63,10 +64,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
}
private static IAgentLocation getDefaultAgentLocation() {
- ServiceReference<?> reference = ProvSDKUIActivator.getContext().getServiceReference(IAgentLocation.SERVICE_NAME);
+ ServiceReference<IAgentLocation> reference = ProvSDKUIActivator.getContext().getServiceReference(IAgentLocation.class);
if (reference == null)
return null;
- IAgentLocation result = (IAgentLocation) ProvSDKUIActivator.getContext().getService(reference);
+ IAgentLocation result = ProvSDKUIActivator.getContext().getService(reference);
ProvSDKUIActivator.getContext().ungetService(reference);
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
index 948122271..9ec5570d8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
@@ -34,7 +34,7 @@ import org.osgi.service.packageadmin.PackageAdmin;
public class ProvUIActivator extends AbstractUIPlugin {
private static BundleContext context;
private static PackageAdmin packageAdmin = null;
- private static ServiceReference<?> packageAdminRef = null;
+ private static ServiceReference<PackageAdmin> packageAdminRef = null;
private static ProvUIActivator plugin;
public static final String PLUGIN_ID = "org.eclipse.equinox.p2.ui"; //$NON-NLS-1$
@@ -83,8 +83,8 @@ public class ProvUIActivator extends AbstractUIPlugin {
plugin = this;
ProvUIActivator.context = bundleContext;
- packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
+ packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class);
+ packageAdmin = bundleContext.getService(packageAdminRef);
}
public void stop(BundleContext bundleContext) throws Exception {
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java
index f4061f188..4a3a25745 100644
--- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java
+++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2015 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
@@ -7,7 +7,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Red Hat, Inc (Krzysztof Daniel) - Bug 421935: Extend simpleconfigurator to
- * read .info files from many locations
+ * read .info files from many locations, Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.simpleconfigurator;
@@ -44,15 +44,15 @@ class ConfigApplier {
inDevMode = manipulatingContext.getProperty(PROP_DEVMODE) != null;
baseLocation = runningOnEquinox ? EquinoxUtils.getInstallLocationURI(context) : null;
- ServiceReference<?> packageAdminRef = manipulatingContext.getServiceReference(PackageAdmin.class.getName());
+ ServiceReference<PackageAdmin> packageAdminRef = manipulatingContext.getServiceReference(PackageAdmin.class);
if (packageAdminRef == null)
throw new IllegalStateException("No PackageAdmin service is available."); //$NON-NLS-1$
- packageAdminService = (PackageAdmin) manipulatingContext.getService(packageAdminRef);
+ packageAdminService = manipulatingContext.getService(packageAdminRef);
- ServiceReference<?> startLevelRef = manipulatingContext.getServiceReference(StartLevel.class.getName());
+ ServiceReference<StartLevel> startLevelRef = manipulatingContext.getServiceReference(StartLevel.class);
if (startLevelRef == null)
throw new IllegalStateException("No StartLevelService service is available."); //$NON-NLS-1$
- startLevelService = (StartLevel) manipulatingContext.getService(startLevelRef);
+ startLevelService = manipulatingContext.getService(startLevelRef);
frameworkWiring = (FrameworkWiring) manipulatingContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class);
}

Back to the top