[jboss-osgi-commits] JBoss-OSGI SVN: r100535 - in projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi: serviceloader/internal and 1 other directory.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Feb 5 11:13:03 EST 2010
Author: thomas.diesler at jboss.com
Date: 2010-02-05 11:13:02 -0500 (Fri, 05 Feb 2010)
New Revision: 100535
Removed:
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/common/
Modified:
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
Log:
Fix ServiceFactory
Modified: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java 2010-02-05 16:12:20 UTC (rev 100534)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java 2010-02-05 16:13:02 UTC (rev 100535)
@@ -58,14 +58,15 @@
if (state == Bundle.STARTING)
{
Bundle bundle = context.getBundle();
- if (bundle.getEntry("META-INF/services") == null)
+ if (bundle.getEntry("META-INF/services/") == null)
return;
- Enumeration<String> entryPaths = bundle.getEntryPaths("META-INF/services");
+ Enumeration<String> entryPaths = bundle.getEntryPaths("META-INF/services/");
while (entryPaths.hasMoreElements())
{
String entryPath = entryPaths.nextElement();
- processServicesEntryPath(context, entryPath);
+ if (entryPath.endsWith("/") == false)
+ processServicesEntryPath(context, entryPath);
}
}
}
@@ -108,9 +109,9 @@
props.put(Constants.VERSION_ATTRIBUTE, bundle.getVersion().toString());
String vendor = (String)bundle.getHeaders().get(Constants.BUNDLE_VENDOR);
props.put(Constants.SERVICE_VENDOR, (vendor != null ? vendor : "anonymous"));
-
- // Register the service factory
- MetaInfServiceFactory factory = new MetaInfServiceFactory(serviceClass);
+
+ // Register the service factory on behalf of the intercepted bundle
+ MetaInfServiceFactory factory = new MetaInfServiceFactory(implClass);
BundleContext bundleContext = bundle.getBundleContext();
bundleContext.registerService(serviceName, factory, props);
}
@@ -128,11 +129,11 @@
log.error("Cannot process: " + entryPath, ex);
}
}
-
+
static class MetaInfServiceFactory implements ServiceFactory
{
private Class<?> serviceClass;
-
+
public MetaInfServiceFactory(Class<?> serviceClass)
{
this.serviceClass = serviceClass;
More information about the jboss-osgi-commits
mailing list