Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2010-10-11 11:39:13 +0000
committermkuppe2010-10-11 11:39:13 +0000
commitb105030fae32f4b7b7fe697693c39adf9cfd7924 (patch)
treef0efcd60a7ccf5a9290c02708e49fe7c489a71f1 /providers/bundles
parentd50c7ea7dfa67b45d6c5fd2cdf131cedb850adfa (diff)
downloadorg.eclipse.ecf-b105030fae32f4b7b7fe697693c39adf9cfd7924.tar.gz
org.eclipse.ecf-b105030fae32f4b7b7fe697693c39adf9cfd7924.tar.xz
org.eclipse.ecf-b105030fae32f4b7b7fe697693c39adf9cfd7924.zip
REOPENED - bug 325950: ClassNotFoundException with r-osgi and ECF (not with r-osgi only)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=325950
Diffstat (limited to 'providers/bundles')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF3
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java22
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java31
3 files changed, 16 insertions, 40 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
index ff52933f9..c0bdfafaf 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
@@ -6,11 +6,10 @@ Bundle-Version: 3.1.0.qualifier
Import-Package: org.eclipse.ecf.core.util.reflection,
org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework;version="1.3.0",
- org.osgi.service.packageadmin;version="1.2.0",
org.osgi.util.tracker;version="1.3.3"
Require-Bundle: org.eclipse.ecf;bundle-version="3.1.0",
org.eclipse.ecf.provider,
- org.eclipse.ecf.remoteservice,
+ org.eclipse.ecf.remoteservice;bundle-version="5.0.0",
org.eclipse.equinox.common,
ch.ethz.iks.r_osgi.remote
Bundle-Activator: org.eclipse.ecf.internal.provider.r_osgi.Activator
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
index d76fdcd41..8c2650bb1 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
@@ -14,7 +14,6 @@ package org.eclipse.ecf.internal.provider.r_osgi;
import ch.ethz.iks.r_osgi.RemoteOSGiService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -36,9 +35,6 @@ public final class Activator implements BundleActivator {
// The service tracker for the R-OSGi remote service
private ServiceTracker r_osgi_tracker;
- // The package admin service tracker
- private ServiceTracker pkg_admin_tracker;
-
/**
* The constructor.
*/
@@ -57,9 +53,6 @@ public final class Activator implements BundleActivator {
this.context = bc;
r_osgi_tracker = new ServiceTracker(context, RemoteOSGiService.class.getName(), null);
r_osgi_tracker.open();
-
- pkg_admin_tracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
- pkg_admin_tracker.open();
}
/**
@@ -72,8 +65,6 @@ public final class Activator implements BundleActivator {
public void stop(final BundleContext bc) throws Exception {
r_osgi_tracker.close();
r_osgi_tracker = null;
- pkg_admin_tracker.close();
- pkg_admin_tracker = null;
this.context = null;
plugin = null;
}
@@ -110,17 +101,4 @@ public final class Activator implements BundleActivator {
}
return plugin;
}
-
- /**
- * get the PackageAdmin service instance.
- *
- * @return the PackageAdmin service instance or null, if there is none.
- */
- public PackageAdmin getPackageAdmin() {
- if (pkg_admin_tracker == null) {
- return null;
- }
- return (PackageAdmin) pkg_admin_tracker.getService();
- }
-
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java
index 08de7fbdb..7bfcc159b 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java
@@ -27,7 +27,6 @@ import org.eclipse.ecf.remoteservice.events.IRemoteServiceUnregisteredEvent;
import org.eclipse.equinox.concurrent.future.*;
import org.osgi.framework.*;
import org.osgi.framework.Constants;
-import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
@@ -37,7 +36,7 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
*
* @author Jan S. Rellermeyer, ETH Zurich
*/
-final class R_OSGiRemoteServiceContainer implements IRemoteServiceContainerAdapter, IContainer, RemoteServiceListener {
+final class R_OSGiRemoteServiceContainer implements IOSGiRemoteServiceContainerAdapter, IRemoteServiceContainerAdapter, IContainer, RemoteServiceListener {
// the bundle context.
private BundleContext context;
@@ -389,6 +388,19 @@ final class R_OSGiRemoteServiceContainer implements IRemoteServiceContainerAdapt
* java.lang.Object, java.util.Dictionary)
*/
public IRemoteServiceRegistration registerRemoteService(final String[] clazzes, final Object service, final Dictionary properties) {
+ return registerRemoteService(clazzes, service, properties, context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.remoteservice.IOSGiRemoteServiceContainerAdapter#registerRemoteService(java.lang.String[], org.osgi.framework.ServiceReference, java.util.Dictionary)
+ */
+ public IRemoteServiceRegistration registerRemoteService(final String[] clazzes, final ServiceReference aServiceReference, final Dictionary properties) {
+ final Object service = context.getService(aServiceReference);
+ final BundleContext bundleContext = aServiceReference.getBundle().getBundleContext();
+ return registerRemoteService(clazzes, service, properties, bundleContext);
+ }
+
+ private IRemoteServiceRegistration registerRemoteService(final String[] clazzes, final Object service, final Dictionary properties, final BundleContext aContext) {
if (containerID == null) {
throw new IllegalStateException("Container is not connected"); //$NON-NLS-1$
}
@@ -411,20 +423,7 @@ final class R_OSGiRemoteServiceContainer implements IRemoteServiceContainerAdapt
serviceRanking = (serviceRanking == null) ? new Integer(0) : serviceRanking;
props.put(org.eclipse.ecf.remoteservice.Constants.SERVICE_RANKING, serviceRanking);
- // register the service with the local framework but use the original BundleContext
- // http://bugs.eclipse.org/325950
- final PackageAdmin pkgAdmin = Activator.getDefault().getPackageAdmin();
- final Bundle bundle = pkgAdmin.getBundle(service.getClass());
- BundleContext bundleContext = bundle.getBundleContext();
-
- //TODO replace with a fix for 325950 comment #17
- // if pkgadmin does not return a context (in cases where a third bundle registered
- // the service) fall back to our own bundle context
- if (bundleContext == null) {
- bundleContext = context;
- }
-
- final ServiceRegistration reg = bundleContext.registerService(clazzes, service, props);
+ final ServiceRegistration reg = aContext.registerService(clazzes, service, props);
// Set ECF remote service id property based upon local service property
reg.setProperties(prepareProperties(reg.getReference()));

Back to the top