Package com.verisign.epp.util
Class Environment
java.lang.Object
com.verisign.epp.util.Environment
- Direct Known Subclasses:
EPPEnv
This class loads properties from a properties configuration file with one of
the
envInitialize methods. After the properties have been
loaded, the values can be retrieved by using one of the get
methods.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static PropertiesProperties loaded from the configuration file -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenvInitialize(String aConfigFile) Loads configuration file properties into aPropertiesattribute in the following search order:
File system System classpathEnvironmentclass ClassLoader
If the configuration file can not be located, anEnvExceptionis thrown.voidenvInitialize(String aConfigFile, ClassLoader aClassLoader) Loads configuration file properties into aPropertiesattribute using a customClassLoader.:static StringThis Method gets the given value from properties.static StringThis Method gets a property value, but will not throw an exception if it does not exist.static StringgetProperty(String aProperty) Gets a property loaded from the EPP configuration file.static StringgetProperty(String aProperty, 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 voidsetProperties(Properties aProperties) Sets theEnvironmentproperties using a clientPropertiesobject.static voidsetProperty(String aProperty, String aValue) Sets an individual property.
-
Field Details
-
properties
Properties loaded from the configuration file
-
-
Constructor Details
-
Environment
public Environment()
-
-
Method Details
-
envInitialize
Loads configuration file properties into aPropertiesattribute in the following search order:
- File system
- System classpath
Environmentclass ClassLoader
If the configuration file can not be located, anEnvExceptionis thrown.- Parameters:
aConfigFile- - File name of configuration file- Throws:
EnvException- Error finding or loading configuration file
-
envInitialize
Loads configuration file properties into aPropertiesattribute using a customClassLoader.:- Parameters:
aConfigFile- File name of configuration fileaClassLoader- JavaClassLoaderto load the configuration file from.- Throws:
EnvException- Error finding or loading configuration file
-
getEnv
This Method gets the given value from properties. It is to provide the higher layers easy access to properties- Parameters:
aProperty- - this String contains property name.- Returns:
- Trimmed property value
- Throws:
EnvException- Property is not defined
-
getOption
This Method gets a property value, but will not throw an exception if it does not exist.- Parameters:
aProperty- Property name- Returns:
- Trimmed property value if defined;
nullotherwise
-
getProperty
Gets a property loaded from the EPP configuration file. This method simply returns the raw property value with no trimming.- Parameters:
aProperty- Property name- Returns:
- Property value if defined;
nullotherwise
-
getProperty
Gets a property loaded from the EPP configuration file and if it doesn't exist, will return the passed default value (aDefaultValue).- Parameters:
aProperty- Property nameaDefaultValue- Default value if property is not found- Returns:
- Property value if defined;
aDefaultValueotherwise
-
setProperties
Sets theEnvironmentproperties using a clientPropertiesobject. This is an option to using a configuration file with one of theenvInitializemethods.- Parameters:
aProperties- A set of EPP configuration properties
-
setProperty
Sets an individual property. IfaValueisnullthan the property will be removed.- Parameters:
aProperty- Name of propertyaValue- Property value
-