]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - OsgiBootUtils.java
2d1f0b4d7ae3f04cdc13ec443ccbb053c754db72
1 package org
.argeo
.slc
.osgiboot
;
3 public class OsgiBootUtils
{
5 public static void info(Object obj
) {
6 System
.out
.println("# OSGiBOOT # " + obj
);
9 public static void debug(Object obj
) {
10 System
.out
.println("# OSGiBOOT DBG # " + obj
);
13 public static void warn(Object obj
) {
14 System
.out
.println("# OSGiBOOT WARN # " + obj
);
15 // Because of a weird bug under Windows when starting it in a forked VM
16 // if (System.getProperty("os.name").contains("Windows"))
17 // System.out.println("# WARN " + obj);
19 // System.err.println("# WARN " + obj);
22 //FIXE: returns null when defaultValue is ""
23 public static String
getProperty(String name
, String defaultValue
) {
25 if (defaultValue
!= null)
26 value
= System
.getProperty(name
, defaultValue
);
28 value
= System
.getProperty(name
);
30 if (value
== null || value
.equals(""))
36 public static String
getProperty(String name
) {
37 return getProperty(name
, null);
40 public static String
getPropertyCompat(String name
, String oldName
) {
41 return getPropertyCompat(name
, oldName
, null);
44 public static String
getPropertyCompat(String name
, String oldName
,
45 String defaultValue
) {
48 if (defaultValue
!= null) {
49 res
= getProperty(name
, defaultValue
);
50 if (res
.equals(defaultValue
)) {
51 res
= getProperty(oldName
, defaultValue
);
52 if (!res
.equals(defaultValue
))
53 warnDeprecated(name
, oldName
);
56 res
= getProperty(name
, null);
58 res
= getProperty(oldName
, null);
60 warnDeprecated(name
, oldName
);
66 public static void warnDeprecated(String name
, String oldName
) {
67 warn("Property '" + oldName
68 + "' is deprecated and will be removed soon, use '" + name