Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2010-09-28 08:39:48 +0000
committermkuppe2010-09-28 08:39:48 +0000
commit5e97d5f708924d0bde9ae2d3a47597aa06d199c9 (patch)
tree20c8b1ec965223e503680b88e85eb5df68d047ae /providers
parentcb6a263384c9cdd027d7c73861a8b772d0717cb9 (diff)
downloadorg.eclipse.ecf-5e97d5f708924d0bde9ae2d3a47597aa06d199c9.tar.gz
org.eclipse.ecf-5e97d5f708924d0bde9ae2d3a47597aa06d199c9.tar.xz
org.eclipse.ecf-5e97d5f708924d0bde9ae2d3a47597aa06d199c9.zip
RESOLVED - 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')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF1
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java19
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiRemoteServiceContainer.java10
3 files changed, 28 insertions, 2 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 85355b6f5..ee1707de4 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
@@ -5,6 +5,7 @@ Bundle-SymbolicName: org.eclipse.ecf.provider.r_osgi;singleton:=true
Bundle-Version: 3.1.0.qualifier
Import-Package: 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,
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 43743acb1..29083b956 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,6 +14,7 @@ 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;
/**
@@ -35,6 +36,9 @@ 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.
*/
@@ -53,6 +57,9 @@ 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();
}
/**
@@ -102,4 +109,16 @@ 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 1770ec9cb..f2bc6ed3e 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,6 +27,7 @@ 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;
@@ -398,8 +399,13 @@ 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
- final ServiceRegistration reg = context.registerService(clazzes, service, props);
+ // 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());
+ final BundleContext bundleContext = bundle.getBundleContext();
+
+ final ServiceRegistration reg = bundleContext.registerService(clazzes, service, props);
// Set ECF remote service id property based upon local service property
reg.setProperties(prepareProperties(reg.getReference()));

Back to the top