]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java
a9067a213c04e912985fb139651db012c4b3ff3b
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.osgi
.boot
;
19 public class OsgiBootUtils
{
21 public static void info(Object obj
) {
22 System
.out
.println("# OSGiBOOT # " + obj
);
25 public static void debug(Object obj
) {
26 System
.out
.println("# OSGiBOOT DBG # " + obj
);
29 public static void warn(Object obj
) {
30 System
.out
.println("# OSGiBOOT WARN # " + obj
);
31 // Because of a weird bug under Windows when starting it in a forked VM
32 // if (System.getProperty("os.name").contains("Windows"))
33 // System.out.println("# WARN " + obj);
35 // System.err.println("# WARN " + obj);
38 //FIXE: returns null when defaultValue is ""
39 public static String
getProperty(String name
, String defaultValue
) {
41 if (defaultValue
!= null)
42 value
= System
.getProperty(name
, defaultValue
);
44 value
= System
.getProperty(name
);
46 if (value
== null || value
.equals(""))
52 public static String
getProperty(String name
) {
53 return getProperty(name
, null);
56 public static String
getPropertyCompat(String name
, String oldName
) {
57 return getPropertyCompat(name
, oldName
, null);
60 public static String
getPropertyCompat(String name
, String oldName
,
61 String defaultValue
) {
64 if (defaultValue
!= null) {
65 res
= getProperty(name
, defaultValue
);
66 if (res
.equals(defaultValue
)) {
67 res
= getProperty(oldName
, defaultValue
);
68 if (!res
.equals(defaultValue
))
69 warnDeprecated(name
, oldName
);
72 res
= getProperty(name
, null);
74 res
= getProperty(oldName
, null);
76 warnDeprecated(name
, oldName
);
82 public static void warnDeprecated(String name
, String oldName
) {
83 warn("Property '" + oldName
84 + "' is deprecated and will be removed soon, use '" + name