[jboss-osgi-commits] JBoss-OSGI SVN: r89615 - in projects/jboss-osgi/trunk: runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework and 1 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Mon Jun 1 13:39:33 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-06-01 13:39:32 -0400 (Mon, 01 Jun 2009)
New Revision: 89615

Modified:
   projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java
Log:
Add equinox, knopflerfish data directory

Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java	2009-06-01 17:29:43 UTC (rev 89614)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java	2009-06-01 17:39:32 UTC (rev 89615)
@@ -23,6 +23,9 @@
 
 //$Id$
 
+import static org.eclipse.core.runtime.adaptor.LocationManager.PROP_INSTALL_AREA;
+import static org.jboss.osgi.spi.Constants.OSGI_SERVER_HOME;
+
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -30,7 +33,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.core.runtime.adaptor.LocationManager;
 import org.eclipse.osgi.framework.internal.core.Framework;
 import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
 import org.jboss.logging.Logger;
@@ -118,10 +120,13 @@
       }
 
       // Prevent a NPE when the config area is not set
-      if (FrameworkProperties.getProperty(LocationManager.PROP_INSTALL_AREA) == null)
+      if (FrameworkProperties.getProperty(PROP_INSTALL_AREA) == null)
       {
-         String userHome = FrameworkProperties.getProperty("user.home");
-         FrameworkProperties.setProperty(LocationManager.PROP_INSTALL_AREA, userHome + "/equinox");
+         String osgiServerHome = FrameworkProperties.getProperty(OSGI_SERVER_HOME);
+         if (osgiServerHome == null)
+            throw new IllegalStateException("Cannot find value for property '" + PROP_INSTALL_AREA + "' nor for '" + OSGI_SERVER_HOME + "'");
+         
+         FrameworkProperties.setProperty(PROP_INSTALL_AREA, osgiServerHome + "/data/equinox");
       }
       
       // Init the Framework

Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java	2009-06-01 17:29:43 UTC (rev 89614)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java	2009-06-01 17:39:32 UTC (rev 89615)
@@ -23,6 +23,8 @@
 
 //$Id$
 
+import static org.jboss.osgi.spi.Constants.OSGI_SERVER_HOME;
+
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.net.URL;
@@ -49,6 +51,8 @@
  */
 public class KnopflerfishIntegration implements OSGiFramework
 {
+   private static final String ORG_OSGI_FRAMEWORK_DIR = "org.osgi.framework.dir";
+
    // Provide logging
    final Logger log = Logger.getLogger(KnopflerfishIntegration.class);
 
@@ -130,10 +134,13 @@
       }
       
       // Prevent a NPE when the config area is not set
-      if (Framework.getProperty("org.osgi.framework.dir") == null)
+      if (Framework.getProperty(ORG_OSGI_FRAMEWORK_DIR) == null)
       {
-         String userHome = Framework.getProperty("user.home");
-         Framework.setProperty("org.osgi.framework.dir", userHome + "/knopflerfish");
+         String osgiServerHome = Framework.getProperty(OSGI_SERVER_HOME);
+         if (osgiServerHome == null)
+            throw new IllegalStateException("Cannot find value for property '" + ORG_OSGI_FRAMEWORK_DIR + "' nor for '" + OSGI_SERVER_HOME + "'");
+         
+         Framework.setProperty(ORG_OSGI_FRAMEWORK_DIR, osgiServerHome + "/data/knopflerfish");
       }
 
       // Cannot disable REGISTERSERVICEURLHANDLER

Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java	2009-06-01 17:29:43 UTC (rev 89614)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java	2009-06-01 17:39:32 UTC (rev 89615)
@@ -23,7 +23,6 @@
 
 //$Id$
 
-
 /**
  * JBossOSGi Constants
  * 
@@ -42,4 +41,14 @@
     * The default is 'true' 
     */
    String PROPERTY_DEFERRED_START = "org.jboss.osgi.deferred.start";
+
+   /**
+    * The JBossOSGi runtime system property that denotes the path to the runtime
+    */
+   String OSGI_HOME = "osgi.home";
+
+   /**
+    * The JBossOSGi runtime system property that denotes the path to the active server
+    */
+   String OSGI_SERVER_HOME = "osgi.server.home";
 }




More information about the jboss-osgi-commits mailing list