001: /*
002: *
003: * Copyright (c) 2000-2001 Silvere Martin-Michiellot All Rights Reserved.
004: *
005: * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
006: * royalty free, license to use, modify but not to redistribute this
007: * software in source and binary code form,
008: * provided that i) this copyright notice and license appear on all copies of
009: * the software; and ii) Licensee does not utilize the software in a manner
010: * which is disparaging to Silvere Martin-Michiellot.
011: *
012: * This software is provided "AS IS," without a warranty of any kind. ALL
013: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
014: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
015: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
016: * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
017: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
018: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
019: * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
020: * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023: * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
024: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
025: *
026: * This software is not designed or intended for use in on-line control of
027: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028: * the design, construction, operation or maintenance of any nuclear
029: * facility. Licensee represents and warrants that it will not use or
030: * redistribute the Software for such purposes.
031: *
032: * @Author: Silvere Martin-Michiellot
033: *
034: */
035:
036: package com.db.version;
037:
038: import java.util.ResourceBundle;
039: import java.util.Properties;
040:
041: /**
042: * The SystemProperties class accesses general settings. It would be nice to access and control also the settings of the Virtual Machine, but as it is already launched, this sounds impossible. You therefore still have to use the -D parameter on the command line while launching Java.
043: */
044: public class SystemProperties extends Object {
045:
046: private static ResourceBundle bundle;
047:
048: /**
049: * Builds the system properties access.
050: * @see java.lang.System
051: */
052: public SystemProperties() {
053:
054: bundle = ResourceBundle
055: .getBundle("com.db.version.SystemPropertiesDescription");
056:
057: }
058:
059: /**
060: * Sets the system properties to the Properties argument.
061: */
062: public static void setProperties(Properties props) {
063:
064: System.setProperties(props);
065:
066: }
067:
068: /**
069: * Sets the system property indicated by the specified key.
070: */
071: public static String setProperty(String key, String value) {
072:
073: return System.setProperty(key, value);
074:
075: }
076:
077: /**
078: * Determines the current system properties.
079: */
080: public static Properties getProperties() {
081:
082: return System.getProperties();
083:
084: }
085:
086: /**
087: * Gets the system property indicated by the specified key.
088: */
089: public static String getProperty(String key) {
090:
091: return System.getProperty(key);
092:
093: }
094:
095: /**
096: * Gets the system property indicated by the specified key.
097: */
098: public static String getProperty(String key, String def) {
099:
100: return System.getProperty(key, def);
101:
102: }
103:
104: /**
105: * Gets the description corresponding to the system property indicated by the specified key.
106: */
107: public static String getPropertyDescription(String key) {
108:
109: return bundle.getString(key);
110:
111: }
112:
113: }
|