Package com.verisign.epp.util
Class Environment
- java.lang.Object
-
- com.verisign.epp.util.Environment
-
- Direct Known Subclasses:
EPPEnv
public abstract class Environment extends java.lang.ObjectThis class loads properties from a properties configuration file with one of theenvInitializemethods. After the properties have been loaded, the values can be retrieved by using one of thegetmethods.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.PropertiespropertiesProperties loaded from the configuration file
-
Constructor Summary
Constructors Constructor Description Environment()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenvInitialize(java.lang.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(java.lang.String aConfigFile, java.lang.ClassLoader aClassLoader)Loads configuration file properties into aPropertiesattribute using a customClassLoader.:static java.lang.StringgetEnv(java.lang.String aProperty)This Method gets the given value from properties.static java.lang.StringgetOption(java.lang.String aProperty)This Method gets a property value, but will not throw an exception if it does not exist.static java.lang.StringgetProperty(java.lang.String aProperty)Gets a property loaded from the EPP configuration file.static java.lang.StringgetProperty(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 voidsetProperties(java.util.Properties aProperties)Sets theEnvironmentproperties using a clientPropertiesobject.static voidsetProperty(java.lang.String aProperty, java.lang.String aValue)Sets an individual property.
-
-
-
Method Detail
-
envInitialize
public void envInitialize(java.lang.String aConfigFile) throws EnvExceptionLoads 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
public void envInitialize(java.lang.String aConfigFile, java.lang.ClassLoader aClassLoader) throws EnvExceptionLoads 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
public static java.lang.String getEnv(java.lang.String aProperty) throws EnvExceptionThis 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
public 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.- Parameters:
aProperty- Property name- Returns:
- Trimmed property value if defined;
nullotherwise
-
getProperty
public static java.lang.String getProperty(java.lang.String aProperty)
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
public 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).- Parameters:
aProperty- Property nameaDefaultValue- Default value if property is not found- Returns:
- Property value if defined;
aDefaultValueotherwise
-
setProperties
public static void setProperties(java.util.Properties aProperties)
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
public static void setProperty(java.lang.String aProperty, java.lang.String aValue)Sets an individual property. IfaValueisnullthan the property will be removed.- Parameters:
aProperty- Name of propertyaValue- Property value
-
-