]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBootUtils.java
Pass JCR context to the user menu
[lgpl/argeo-commons.git] / org.argeo.osgi.boot / src / org / argeo / osgi / boot / OsgiBootUtils.java
index f1105d3bcdbd9f3b3bacac5c7342057f2f54f5ca..da142cfe9b79c0a7327021e737209c93596f85ff 100644 (file)
@@ -27,45 +27,26 @@ import org.osgi.framework.Bundle;
 /** Utilities, mostly related to logging. */\r
 public class OsgiBootUtils {\r
        /** ISO8601 (as per log4j) and difference to UTC */\r
-       private static DateFormat dateFormat = new SimpleDateFormat(\r
-                       "yyyy-MM-dd HH:mm:ss,SSS Z");\r
+       private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS Z");\r
 \r
        public static void info(Object obj) {\r
-               System.out.println("# OSGiBOOT      # " + dateFormat.format(new Date())\r
-                               + " # " + obj);\r
+               System.out.println("# OSGiBOOT      # " + dateFormat.format(new Date()) + " # " + obj);\r
        }\r
 \r
        public static void debug(Object obj) {\r
-               System.out.println("# OSGiBOOT DBG  # " + dateFormat.format(new Date())\r
-                               + " # " + obj);\r
+               System.out.println("# OSGiBOOT DBG  # " + dateFormat.format(new Date()) + " # " + obj);\r
        }\r
 \r
        public static void warn(Object obj) {\r
-               System.out.println("# OSGiBOOT WARN # " + dateFormat.format(new Date())\r
-                               + " # " + obj);\r
+               System.out.println("# OSGiBOOT WARN # " + dateFormat.format(new Date()) + " # " + obj);\r
        }\r
 \r
-       /**\r
-        * Gets a property value\r
-        * \r
-        * @return null when defaultValue is ""\r
-        */\r
-       public static String getProperty(String name, String defaultValue) {\r
-               final String value;\r
-               if (defaultValue != null)\r
-                       value = System.getProperty(name, defaultValue);\r
-               else\r
-                       value = System.getProperty(name);\r
-\r
-               if (value == null || value.equals(""))\r
-                       return null;\r
-               else\r
-                       return value;\r
+       public static void error(Object obj, Throwable e) {\r
+               System.err.println("# OSGiBOOT ERR  # " + dateFormat.format(new Date()) + " # " + obj);\r
+               if (e != null)\r
+                       e.printStackTrace();\r
        }\r
 \r
-       public static String getProperty(String name) {\r
-               return getProperty(name, null);\r
-       }\r
 \r
        public static String stateAsString(int state) {\r
                switch (state) {\r
@@ -90,8 +71,7 @@ public class OsgiBootUtils {
         * @return ==0: versions are identical, <0: tested version is newer, >0:\r
         *         currentVersion is newer.\r
         */\r
-       public static int compareVersions(String currentVersion,\r
-                       String testedVersion) {\r
+       public static int compareVersions(String currentVersion, String testedVersion) {\r
                List<String> cToks = new ArrayList<String>();\r
                StringTokenizer cSt = new StringTokenizer(currentVersion, ".");\r
                while (cSt.hasMoreTokens())\r