01: /*
02: * Created on Mar 6, 2005
03: *
04: * To change the template for this generated file go to
05: * Window - Preferences - Java - Code Generation - Code and Comments
06: */
07: package com.sun.portal.sra.admin.util;
08:
09: /**
10: * @author Sandeep Soni
11: *
12: * To change the template for this generated type comment go to Window -
13: * Preferences - Java - Code Generation - Code and Comments
14: */
15: public class SystemDefaults {
16: private static OSDefaults _osDefaults;
17:
18: public static OSDefaults getSystemDefaults() {
19: if (System.getProperty("os.name").equalsIgnoreCase("linux"))
20: _osDefaults = new LinuxSystemDefaults();
21: else if (System.getProperty("os.name")
22: .equalsIgnoreCase("hp-ux"))
23: _osDefaults = new HpuxSystemDefaults();
24: else if (System.getProperty("os.name")
25: .equalsIgnoreCase("sunos"))
26: _osDefaults = new SunSolarisSystemDefaults();
27: else if (System.getProperty("os.name").indexOf("indows") != -1)
28: _osDefaults = new WindowsDefaults();
29: else
30: _osDefaults = new SunSolarisSystemDefaults();
31:
32: return _osDefaults;
33: }
34:
35: public static void printAllSystemProperties() {
36: System.getProperties().list(System.out);
37: }
38:
39: public static void main(String[] args) {
40: SystemDefaults.printAllSystemProperties();
41:
42: OSDefaults defaults = SystemDefaults.getSystemDefaults();
43:
44: System.out.println("A = " + defaults.getValue("TEST_VALUE"));
45: System.out.println("A = "
46: + defaults.getValue("NON_EXISTENT_KEY"));
47: }
48: }
|