changeset 302:b365e9b369c1

Fix launcher to use OSGiRegistry bundle correctly reviewed-by: rkennke, omajid review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-May/001325.html PR 979
author Mario Torre <neugens.limasoftware@gmail.com>
date Mon, 14 May 2012 18:34:58 +0200
parents 3f0129a44803
children 5b10df3c7df9
files client/launcher/src/main/java/com/redhat/thermostat/client/osgi/Thermostat.java common/src/main/java/com/redhat/thermostat/osgi/OSGiRegistry.java common/src/test/java/com/redhat/thermostat/osgi/OSGiRegistryTest.java distribution/config/osgi-export.properties
diffstat 4 files changed, 28 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/client/launcher/src/main/java/com/redhat/thermostat/client/osgi/Thermostat.java	Mon May 14 16:34:08 2012 +0200
+++ b/client/launcher/src/main/java/com/redhat/thermostat/client/osgi/Thermostat.java	Mon May 14 18:34:58 2012 +0200
@@ -93,29 +93,12 @@
         Map<String, String> bundleConfigurations = new HashMap<String, String>();
         
         String publicPackages = OSGiRegistry.getOSGiPublicPackages();
-        publicPackages = publicPackages + ", com.redhat.thermostat.client.osgi.service, com.redhat.thermostat.common.dao";
         bundleConfigurations.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, publicPackages);
-        
+        bundleConfigurations.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, OSGiRegistry.getOSGiPublicPackages());
+ 
         bundleConfigurations.put(Constants.FRAMEWORK_STORAGE,
                                  thermostatBundleHome.getAbsolutePath());
-        bundleConfigurations.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "com.mongodb," +
-                                                                           "org.apache.commons.cli; version=1.2.0," +
-                                                                           "org.bson," +
-                                                                           "org.jfree.chart," +
-                                                                           "org.jfree.chart.axis," +
-                                                                           "org.jfree.chart.labels," +
-                                                                           "org.jfree.chart.plot," +
-                                                                           "org.jfree.chart.renderer.xy," +
-                                                                           "org.jfree.data.time," +
-                                                                           "org.jfree.data.xy," +
-                                                                           "com.redhat.thermostat.common.dao," +
-                                                                           "com.redhat.thermostat.common.storage," +
-                                                                           "com.redhat.thermostat.common," +
-                                                                           "com.redhat.thermostat.common.appctx," +
-                                                                           "com.redhat.thermostat.common.model," +
-                                                                           "com.redhat.thermostat.common.config," +
-                                                                           "com.redhat.thermostat.common.utils");
-        
+       
         Iterator<FrameworkFactory> factories = loader.iterator();
         if (factories.hasNext()) {
             
--- a/common/src/main/java/com/redhat/thermostat/osgi/OSGiRegistry.java	Mon May 14 16:34:08 2012 +0200
+++ b/common/src/main/java/com/redhat/thermostat/osgi/OSGiRegistry.java	Mon May 14 18:34:58 2012 +0200
@@ -71,7 +71,11 @@
                 publicPackages.append(",\n");
             }
             firstPackage = false;
-            publicPackages.append(bundle).append("; version=").append(bundles.get(bundle));
+            publicPackages.append(bundle);
+            String bundleVersion = (String) bundles.get(bundle);
+            if (!bundleVersion.isEmpty()) {
+                publicPackages.append("; version=").append(bundleVersion);
+            }
         }
                 
         return publicPackages.toString();
@@ -83,7 +87,6 @@
         Path thermostatHome = new File(home, "libs").toPath();
         OSGiBundlesVisitor visitor = new OSGiBundlesVisitor();
         Files.walkFileTree(thermostatHome, visitor);
-        System.err.println("loading JARs: " + visitor.jars);
         return visitor.jars;
     }
     
--- a/common/src/test/java/com/redhat/thermostat/osgi/OSGiRegistryTest.java	Mon May 14 16:34:08 2012 +0200
+++ b/common/src/test/java/com/redhat/thermostat/osgi/OSGiRegistryTest.java	Mon May 14 18:34:58 2012 +0200
@@ -91,6 +91,8 @@
 
         props.setProperty("this.is.a.fluff.package", "0.0.0");
         props.setProperty("this.is.even.more.a.fluff.package", "0.0.1");
+        props.setProperty("this.is.even.more.a.fluff.withoutVersion", "");
+        props.setProperty("this.is.even.more.a.fluff.package.2", "0.0.1");
 
         props.store(new FileOutputStream(tmpConfigs), "thermostat osgi public api test properties");
     }
--- a/distribution/config/osgi-export.properties	Mon May 14 16:34:08 2012 +0200
+++ b/distribution/config/osgi-export.properties	Mon May 14 18:34:58 2012 +0200
@@ -33,4 +33,21 @@
 # to do so, delete this exception statement from your version.
 
 # OSGi public API
-com.redhat.thermostat.service.process=1.0.0
\ No newline at end of file
+org.apache.commons.cli=1.2.0
+org.bson
+org.jfree.chart
+org.jfree.chart.axis
+org.jfree.chart.labels
+org.jfree.chart.plot
+org.jfree.chart.renderer.xy
+org.jfree.data.time
+org.jfree.data.xy
+
+com.redhat.thermostat.service.process=1.0.0
+com.redhat.thermostat.common.dao=1.0.0
+com.redhat.thermostat.common.storage=1.0.0
+com.redhat.thermostat.common=1.0.0
+com.redhat.thermostat.common.appctx=1.0.0
+com.redhat.thermostat.common.model=1.0.0
+com.redhat.thermostat.common.config=1.0.0
+com.redhat.thermostat.common.utils=1.0.0
\ No newline at end of file