[302487] WST server discovery service lookup problem
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
index 5da95c4..2582d3c 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
@@ -14,6 +14,7 @@
import java.net.URL;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -240,11 +241,16 @@
public static Object getService(BundleContext context, String name) {
if (context == null)
return null;
- ServiceReference reference = context.getServiceReference(name);
+ ServiceReference reference = context.getServiceReference(IProvisioningAgent.SERVICE_NAME);
if (reference == null)
return null;
- Object result = context.getService(reference);
- context.ungetService(reference);
- return result;
+ IProvisioningAgent result = (IProvisioningAgent) context.getService(reference);
+ if (result == null)
+ return null;
+ try {
+ return result.getService(name);
+ } finally {
+ context.ungetService(reference);
+ }
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
index 4f87a62..12232fc 100644
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
+++ b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
@@ -13,10 +13,10 @@
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.server.discovery.internal.Activator;
import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
@@ -92,8 +92,8 @@
IProfileRegistry profileRegistry = (IProfileRegistry) ExtensionUtility.getService(bundleContext, IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
- ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
- pcr.addInstallableUnits(new IInstallableUnit[] { iu } );
+ IProfileChangeRequest pcr = planner.createChangeRequest(profile);
+ pcr.add(iu);
provContext = new ProvisioningContext(new URI[] { uri });
provContext.setArtifactRepositories(new URI[] { uri });
if (!explain)