public abstract class Environment
extends java.lang.Object
envInitialize
methods. After the properties have been
loaded, the values can be retrieved by using one of the get
methods.Modifier and Type | Field and Description |
---|---|
protected static java.util.Properties |
properties
Properties loaded from the configuration file
|
Constructor and Description |
---|
Environment() |
Modifier and Type | Method and Description |
---|---|
void |
envInitialize(java.lang.String aConfigFile)
Loads configuration file properties into a
Properties
attribute in the following search order:File system System classpath Environment class ClassLoader
If the configuration file can not be located, an EnvException
is thrown. |
void |
envInitialize(java.lang.String aConfigFile,
java.lang.ClassLoader aClassLoader)
Loads configuration file properties into a
Properties
attribute using a custom ClassLoader .: |
static java.lang.String |
getEnv(java.lang.String aProperty)
This Method gets the given value from properties.
|
static java.lang.String |
getOption(java.lang.String aProperty)
This Method gets a property value, but will not throw an exception if it
does not exist.
|
static java.lang.String |
getProperty(java.lang.String aProperty)
Gets a property loaded from the EPP configuration file.
|
static java.lang.String |
getProperty(java.lang.String aProperty,
java.lang.String aDefaultValue)
Gets a property loaded from the EPP configuration file and if it doesn't
exist, will return the passed default value (
aDefaultValue ). |
static void |
setProperties(java.util.Properties aProperties)
Sets the
Environment properties using a client
Properties object. |
static void |
setProperty(java.lang.String aProperty,
java.lang.String aValue)
Sets an individual property.
|
protected static java.util.Properties properties
public void envInitialize(java.lang.String aConfigFile) throws EnvException
Properties
attribute in the following search order:Environment
class ClassLoader
EnvException
is thrown.aConfigFile
- - File name of configuration fileEnvException
- Error finding or loading configuration filepublic void envInitialize(java.lang.String aConfigFile, java.lang.ClassLoader aClassLoader) throws EnvException
Properties
attribute using a custom ClassLoader
.:aConfigFile
- File name of configuration fileaClassLoader
- Java ClassLoader
to load the configuration file from.EnvException
- Error finding or loading configuration filepublic static java.lang.String getEnv(java.lang.String aProperty) throws EnvException
aProperty
- - this String contains property name.EnvException
- Property is not definedpublic static java.lang.String getOption(java.lang.String aProperty)
aProperty
- Property namenull
otherwisepublic static java.lang.String getProperty(java.lang.String aProperty)
aProperty
- Property namenull
otherwisepublic static java.lang.String getProperty(java.lang.String aProperty, java.lang.String aDefaultValue)
aDefaultValue
).aProperty
- Property nameaDefaultValue
- Default value if property is not foundaDefaultValue
otherwisepublic static void setProperties(java.util.Properties aProperties)
Environment
properties using a client
Properties
object. This is an option to using a configuration
file with one of the envInitialize
methods.aProperties
- A set of EPP configuration propertiespublic static void setProperty(java.lang.String aProperty, java.lang.String aValue)
aValue
is null
than the property will be removed.aProperty
- Name of propertyaValue
- Property value