|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlEnv
public final class UtlEnv
Utility class that loads and maintains runtime environment variables.
The environment maintained here is used by various platform components in 2 fashions. First and foremost it provides a way for overall global configuration values to be specified in the environment or system properties to augment configuration at runtime. Secondly, in the absence of higher level configuration mechanism being initialized, it provides a way for low level platform components to source configuration before higher level configuration mechanism have been initialized that can reinitialize or augment the environment dynamically for other configuration sources.
When higher level configuration mechanisms are used the initial environment loaded by this
class can be thought of as bootstrap environment until initialized. In support of this this
class provides an initialize(Properties)
method than can be used by applications to
indicate when the environment can be considered to have been full initialized,
UtlConstants.APP_PROPFILE_PROPNAME
if exists
and can be loaded. UtlConstants.APP_PROPFILE_DEFAULT
itself is resolved by first looking in System.getenv(String)
or in System.getProperty(String)
if not defined in the environment.
System.getenv()
are applied by taking them and replacing any instance of '_' with a '.'
This class MAY be used by end users, however its usage is not suppport unless one is directed to do so by Neeve Support.
Constructor Summary | |
---|---|
UtlEnv()
|
Method Summary | |
---|---|
static Properties |
getEnvProps()
Returns the environment properties. |
static Properties |
getEnvPropsNoWarn()
Returns the normalized environment properties. |
static String |
getLocalHostAddress()
Get the local host address This method returns the local host address using the following: - InetAddress.getLocalHost().getHostAddress . |
static String |
getLocalHostAddressForDisplay(String defaultValue)
Get the local host address for display purposes. |
static InetAddress |
getLocalHostInetAddress()
Get the InetAddress representing the local host IP + hostname. |
static String |
getLocalHostName()
Get the local host name This method returns the local host name using the following: - InetAddress.getLocalHost().getHostName . |
static String |
getLocalHostNameForDisplay(String defaultValue)
Get the local host name for display purposes. |
static String |
getPid()
Get the process pid This method returns the process id of the current process |
static String |
getValue(String name)
Get the value of a property from the environment props. |
static boolean |
getValue(String name,
boolean defValue)
Convenience method to return an environment property value as a boolean value |
static double |
getValue(String name,
double defValue)
Convenience method to return a property from the environment as a numeric value. |
static int |
getValue(String name,
int defValue)
Convenience method to return a property from the environment as an int value. |
static short |
getValue(String name,
short defValue)
Convenience method to return a property from the environment as an short value. |
static String |
getValue(String name,
String defValue)
Convenience method to return a property value as a String value from the environment |
static void |
initialize(Properties env)
Initializes the environment. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UtlEnv()
Method Detail |
---|
public static void initialize(Properties env)
env
- The environment to initialize.public static Properties getEnvPropsNoWarn()
public static Properties getEnvProps()
The caller should not modify the returned set of properties. All mutative operations on the environment should be done via calls to this class instead.
public static String getValue(String name)
name
- The property name
public static final boolean getValue(String name, boolean defValue)
name
- The property namedefValue
- The default property value to return in case the property
could not be found in the property table.
This method is a convenience method that returns a property value as a
boolean value. It uses getValue(java.lang.String)
to retrieve the property
value. The default value is returned in case the no property with the
provided name exists in the property table.
public static final double getValue(String name, double defValue)
name
- The property namedefValue
- The default property value to return in case the property
could not be found in the property table.
This method is a convenience method that returns a property value as a
numeric value. It uses getValue(java.lang.String)
to retrieve the property
value. The default value is returned in case the no property with the
provided name exists in the property table.
public static final int getValue(String name, int defValue)
name
- The property namedefValue
- The default property value to return in case the property
could not be found in the property table.
This method is a convenience method that returns a property value as an
int value. It uses getValue(String)
to retrieve the property
value. The default value is returned in case the no property with the
provided name exists in the property table.
public static final short getValue(String name, short defValue)
name
- The property namedefValue
- The default property value to return in case the property
could not be found in the property table.
This method is a convenience method that returns a property value as a
numeric value. It uses getValue(java.lang.String)
to retrieve the property
value. The default value is returned in case the no property with the
provided name exists in the property table.
public static String getValue(String name, String defValue)
name
- The property namedefValue
- The default property value to return in case the property
could not be found in the property table.
This method is a convenience method that returns a property value as a
string value. It uses getValue(java.lang.String)
to retrieve the property
value. The default value is returned in case the no property with the
provided name exists in the property table.
public static final String getPid()
This method returns the process id of the current process
public static final InetAddress getLocalHostInetAddress() throws UnknownHostException
InetAddress
representing the local host IP + hostname.
UnknownHostException
- Thrown if a local InetAddress could not
be determined.public static final String getLocalHostNameForDisplay(String defaultValue)
defaultValue
- The value to return if a local host name could not be
determined.
This method returns the name of the local host machine on which the X process is running. The defaultValue is returned if the local host name could not be determined for whatever reason
public static final String getLocalHostName() throws UnknownHostException
This method returns the local host name using the following:
- InetAddress.getLocalHost().getHostName
.
If a host name could not be determined, then this method throws
an UnknownHostException exception.
UnknownHostException
- Thrown if the local host name could not
be determined via InetAddress.getLocalHost().getHostName
public static final String getLocalHostAddressForDisplay(String defaultValue)
defaultValue
- The value to return if a local host address could not be
determined.
This method returns the address of the local host machine on which the X process
is running as returned by InetAddress.getLocalHost().getHostAddress
.
The defaultValue is returned if the local host address could not be determined
for whatever reason
public static final String getLocalHostAddress() throws UnknownHostException
This method returns the local host address using the following:
- InetAddress.getLocalHost().getHostAddress
.
If a host address could not be determined, then this method throws
an UnknownHostException exception.
UnknownHostException
- Thrown if the local host address could not
be determined via InetAddress.getLocalHost().getHostAddress
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |