]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/slc/osgiboot/Launcher.java
Add license headers
[lgpl/argeo-commons.git] / osgi / runtime / org.argeo.osgi.boot / src / main / java / org / argeo / slc / osgiboot / Launcher.java
index 75925165553efaba4c1b4e7ef4080274d88f527e..cd7b723b87459c4d4ee146a5163f1dc8a3962d55 100644 (file)
@@ -1,10 +1,25 @@
+/*
+ * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.argeo.slc.osgiboot;
 
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.List;
-import java.util.Properties;
 import java.util.Vector;
 
 import org.eclipse.core.runtime.adaptor.EclipseStarter;
@@ -14,8 +29,9 @@ public class Launcher {
 
        public static void main(String[] args) {
                // Try to load system properties
-               String systemPropertiesFilePath = System
-                               .getProperty(OsgiBoot.PROP_SLC_OSGIBOOT_SYSTEM_PROPERTIES_FILE);
+               String systemPropertiesFilePath = OsgiBootUtils.getPropertyCompat(
+                               OsgiBoot.PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE,
+                               OsgiBoot.PROP_SLC_OSGIBOOT_SYSTEM_PROPERTIES_FILE);
                if (systemPropertiesFilePath != null) {
                        FileInputStream in;
                        try {
@@ -52,13 +68,23 @@ public class Launcher {
        }
 
        protected static void startMainClass() {
-               Properties config = System.getProperties();
-               String className = config.getProperty("slc.osgiboot.appclass");
+               // Properties config = System.getProperties();
+               // String className = config.getProperty("slc.osgiboot.appclass");
+               String className = OsgiBootUtils.getPropertyCompat(
+                               OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS,
+                               OsgiBoot.PROP_SLC_OSGIBOOT_APPCLASS);
                if (className == null)
                        return;
 
-               String[] uiArgs = readArgumentsFromLine(config.getProperty(
-                               "slc.osgiboot.appargs", ""));
+               // should use OsgiBootUtils.getPropertyCompat(), but it does not 
+               // work for "" as default value
+               // so no warning displayed if PROP_SLC_OSGIBOOT_APPARGS is used
+               // FIXME: change OsgiBootUtils.getPropertyCompat()
+               String line = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPARGS, 
+                               System.getProperty(OsgiBoot.PROP_SLC_OSGIBOOT_APPARGS, ""));            
+               
+               String[] uiArgs = readArgumentsFromLine(line);
+               
                try {
                        // Launch main method using reflection
                        Class clss = Class.forName(className);