01: package hero.util;
02:
03: /*
04: *
05: * Bonita
06: * Copyright (C) 1999 Bull S.A.
07: * Bull 68 route de versailles 78434 Louveciennes Cedex France
08: * Further information: bonita@objectweb.org
09: *
10: * This library is free software; you can redistribute it and/or
11: * modify it under the terms of the GNU Lesser General Public
12: * License as published by the Free Software Foundation; either
13: * version 2.1 of the License, or any later version.
14: *
15: * This library is distributed in the hope that it will be useful,
16: * but WITHOUT ANY WARRANTY; without even the implied warranty of
17: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18: * Lesser General Public License for more details.
19: *
20: * You should have received a copy of the GNU Lesser General Public
21: * License along with this library; if not, write to the Free Software
22: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23: * USA
24: *
25: *
26: --------------------------------------------------------------------------
27: * $Id$
28: *
29: --------------------------------------------------------------------------
30: */
31:
32: /**
33: * This class works on the server and provides method to retrieve information
34: * specific to the server type, ie JOnAS, JBoss.
35: */
36:
37: public class ServerType {
38: private static final String jonasDir = (String) System
39: .getProperties().get("jonas.base");
40: private static final String jbossDir = (String) System
41: .getProperties().get("jboss.home.dir");
42:
43: public static boolean isJonas() {
44: return jonasDir != null;
45: }
46:
47: public static boolean isJBoss() {
48: return jbossDir != null;
49: }
50:
51: public static String getServerBase() {
52: if (isJonas()) {
53: return jonasDir;
54: } else if (isJBoss()) {
55: return jbossDir;
56: }
57:
58: throw new RuntimeException("The server base is not found.");
59: }
60: }
|