felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r812879 - in /felix/trunk/karaf: assembly/src/main/filtered-resources/bin/ gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/ gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/ gshell/gs...
Date Wed, 09 Sep 2009 10:52:30 GMT
Author: gnodet
Date: Wed Sep  9 10:52:29 2009
New Revision: 812879

URL: http://svn.apache.org/viewvc?rev=812879&view=rev
Log:
FELIX-1574: Some Karaf instances never reach the 'started' state

Modified:
    felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin
    felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin.bat
    felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java
    felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/Execute.java
    felix/trunk/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml

Modified: felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin?rev=812879&r1=812878&r2=812879&view=diff
==============================================================================
--- felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin (original)
+++ felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin Wed Sep  9 10:52:29 2009
@@ -200,7 +200,7 @@
 }
 
 setupDefaults() {
-    DEFAULT_JAVA_OPTS="-Dstorage.file=${KARAF_HOME}/etc/instances.properties -Xms$JAVA_MIN_MEM
-Xmx$JAVA_MAX_MEM "
+    DEFAULT_JAVA_OPTS="-Dstorage.location=${KARAF_HOME}/instances -Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM
"
 
     #Set the JVM_VENDOR specific JVM flags
     if [ "$JVM_VENDOR" = "SUN" ]; then

Modified: felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin.bat
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin.bat?rev=812879&r1=812878&r2=812879&view=diff
==============================================================================
--- felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin.bat (original)
+++ felix/trunk/karaf/assembly/src/main/filtered-resources/bin/admin.bat Wed Sep  9 10:52:29
2009
@@ -54,7 +54,7 @@
   set KARAF_BASE=%KARAF_HOME%
 )
 
-set DEFAULT_JAVA_OPTS=-Dstorage.file="%KARAF_HOME%\etc\instances.properties"
+set DEFAULT_JAVA_OPTS=-Dstorage.location="%KARAF_HOME%\instances"
 set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
 
 rem Support for loading native libraries

Modified: felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java?rev=812879&r1=812878&r2=812879&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java
(original)
+++ felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java
Wed Sep  9 10:52:29 2009
@@ -37,6 +37,8 @@
 
 public class AdminServiceImpl implements AdminService {
 
+    public static final String STORAGE_FILE = "instance.properties";
+
     private static final Logger LOGGER = LoggerFactory.getLogger(AdminServiceImpl.class);
 
     private Map<String, Instance> instances = new HashMap<String, Instance>();
@@ -81,13 +83,14 @@
 
     public synchronized void init() throws Exception {
         try {
-            if (!storageLocation.isFile()) {
-                if (storageLocation.exists()) {
-                    LOGGER.error("Instances storage location should be a file: " + storageLocation);
+            File storageFile = new File(storageLocation, STORAGE_FILE);
+            if (!storageFile.isFile()) {
+                if (storageFile.exists()) {
+                    LOGGER.error("Instances storage location should be a file: " + storageFile);
                 }
                 return;
             }
-            Properties storage = loadStorage(storageLocation);
+            Properties storage = loadStorage(storageFile);
             int count = Integer.parseInt(storage.getProperty("count", "0"));
             defaultPortStart = Integer.parseInt(storage.getProperty("port", Integer.toString(defaultPortStart)));
             Map<String, Instance> newInstances = new HashMap<String, Instance>();
@@ -117,7 +120,11 @@
         if (instances.get(name) != null) {
             throw new IllegalArgumentException("Instance '" + name + "' already exists");
         }
-        File serviceMixBase = new File(location != null ? location : ("instances/" + name)).getCanonicalFile();
+        String loc = location != null ? location : name;
+        File serviceMixBase = new File(loc);
+        if (!serviceMixBase.isAbsolute()) {
+            serviceMixBase = new File(storageLocation, loc);
+        }
         int sshPort = port;
         if (sshPort <= 0) {
             sshPort = ++defaultPortStart;
@@ -184,7 +191,7 @@
             storage.setProperty("item." + i + ".loc", data[i].getLocation());
             storage.setProperty("item." + i + ".pid", Integer.toString(data[i].getPid()));
         }
-        saveStorage(storage, storageLocation);
+        saveStorage(storage, new File(storageLocation, STORAGE_FILE));
     }
 
     private void copyResourceToDir(File target, String resource, boolean text) throws Exception
{

Modified: felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/Execute.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/Execute.java?rev=812879&r1=812878&r2=812879&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/Execute.java
(original)
+++ felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/main/Execute.java
Wed Sep  9 10:52:29 2009
@@ -73,7 +73,7 @@
             exit(-1);
         }
 
-        String storage = System.getProperty("storage.file");
+        String storage = System.getProperty("storage.location");
         if (storage == null) {
             System.err.println("System property 'storage.file' is not set. \n" +
         		"This property needs to be set to the full path of the instance.properties file.");

Modified: felix/trunk/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml?rev=812879&r1=812878&r2=812879&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml
(original)
+++ felix/trunk/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml
Wed Sep  9 10:52:29 2009
@@ -80,7 +80,7 @@
     </command-bundle>
 
     <bean id="adminService" class="org.apache.felix.karaf.gshell.admin.internal.AdminServiceImpl"
init-method="init">
-        <property name="storageLocation" value="${karaf.home}/etc/instances.properties"
/>
+        <property name="storageLocation" value="${karaf.home}/instances" />
     </bean>
 
     <bean id="instanceCompleter" class="org.apache.felix.karaf.gshell.admin.internal.completers.InstanceCompleter">



Mime
View raw message