X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fboot%2FLauncher.java;h=7fd3e76093767b6259bbc7cdfb829997a2afc6ed;hb=25eec0a9cc31c67740ba4131ed40951a028a7669;hp=b13e066b815cd64e8d2365956782d5f7d22a83ec;hpb=d28ceea9dd8b82f6808cf93d088f5e43423949a1;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/Launcher.java b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/Launcher.java index b13e066b8..7fd3e7609 100644 --- a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/Launcher.java +++ b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/Launcher.java @@ -29,17 +29,14 @@ public class Launcher { public static void main(String[] args) { // Try to load system properties - String systemPropertiesFilePath = OsgiBootUtils - .getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE); + String systemPropertiesFilePath = getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE); if (systemPropertiesFilePath != null) { FileInputStream in; try { in = new FileInputStream(systemPropertiesFilePath); System.getProperties().load(in); } catch (IOException e1) { - throw new RuntimeException( - "Cannot load system properties from " - + systemPropertiesFilePath, e1); + throw new RuntimeException("Cannot load system properties from " + systemPropertiesFilePath, e1); } if (in != null) { try { @@ -67,13 +64,11 @@ public class Launcher { } protected static void startMainClass() { - String className = OsgiBootUtils - .getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS); + String className = getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS); if (className == null) return; - String line = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPARGS, - ""); + String line = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPARGS, ""); String[] uiArgs = readArgumentsFromLine(line); @@ -133,4 +128,21 @@ public class Launcher { return res; } + public static String getProperty(String name, String defaultValue) { + final String value; + if (defaultValue != null) + value = System.getProperty(name, defaultValue); + else + value = System.getProperty(name); + + if (value == null || value.equals("")) + return null; + else + return value; + } + + public static String getProperty(String name) { + return getProperty(name, null); + } + }