01: /**
02: * $Id: MAConfigProperties.java,v 1.2 2005/06/14 11:05:50 ak118254 Exp $
03: * Copyright 2004 Sun Microsystems, Inc. Allrights reserved. Use of
04: * this product is subjectto license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users Subject to Standard License
06: * Terms and Conditions.
07: *
08: * Sun, Sun Microsystems, the Sun logo, and Sun ONE are trademarks or
09: * registered trademarks of Sun Microsystems,Inc. in the United States
10: * and other countries.
11: */package com.sun.portal.wireless.util;
12:
13: import java.util.Map;
14: import java.util.Properties;
15: import java.io.FileInputStream;
16:
17: public class MAConfigProperties {
18: private static Properties props = null;
19:
20: private static String MAP_CONFIG_PROPERTIES = "/etc/opt/SUNWportal/MAConfig.properties";
21:
22: static {
23: try {
24: props = new Properties();
25: props.load(new FileInputStream(MAP_CONFIG_PROPERTIES));
26: } catch (Exception e) {
27: e.printStackTrace();
28: }
29: }
30:
31: /**
32: * Get the value for "key"
33: */
34: public static String get(String key) {
35: return ((String) props.get(key));
36: }
37:
38: /**
39: * Get the value for "key". If not found, return defaultValue
40: */
41: public static String get(String key, String defaultValue) {
42: String value = (String) props.get(key);
43: if (value == null) {
44: value = defaultValue;
45: }
46:
47: return value;
48: }
49:
50: /**
51: * Return the Map of keys & properties
52: */
53: public static Map getAll() {
54: return ((Map) props.clone());
55: }
56: }
|