IMC Epclient 5.0.3

at.spardat.enterprise.util
Class Props

java.lang.Object
  extended byat.spardat.enterprise.util.Props

public class Props
extends java.lang.Object

This class is used by non-application-classes that want to access system-properties, but do not want to define them using -Dkey=value on the command line. Instead they may just specify the define

 -Denterprise.propertyFile=c:/javadev/myproject/config/ep.properties
 
In this case, the properties are loaded from the filesystem. Alternatively, you may specify a path to load the file from the application-jar-file
 -Denterprise.propertyFile=/at/spardat/someProj/ep.properties
 
by specifying a property-file that is loadable from the applications classloader. That classloader must be the same classloader the enterprise-classes are loaded from.

Either way, all properties found in the file are inserted as system-properties before the getProperty-methods of this class are called.

Author:
YSD, 28.09.2003

Constructor Summary
Props()
           
 
Method Summary
static java.lang.String getProperty(java.lang.String key)
          Returns a system-property for a given key or null if there is no such property set.
static java.lang.String getProperty(java.lang.String key, java.lang.String def)
          Returns the system-property for a given key.
static java.lang.String getPropertySafe(java.lang.String key)
          Returns a system-property for a given key and throws a RuntimeException if the property is not set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Props

public Props()
Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String key)
Returns a system-property for a given key or null if there is no such property set.

Parameters:
key - the key for the requested property
Returns:
the value of the property

getPropertySafe

public static java.lang.String getPropertySafe(java.lang.String key)
Returns a system-property for a given key and throws a RuntimeException if the property is not set.

Parameters:
key - the key for the requested property
Returns:
the value of the property
Throws:
SysException - if no property found

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String def)
Returns the system-property for a given key. If there is no such property, a provided default-value is returned.

Parameters:
key - the property-key
def - the default-value that should be returned if the property with key is not found.
Returns:
value for the property.

IMC Epclient 5.0.3