Package org.jboss.msc.value
Class EnvironmentPropertyValue
- java.lang.Object
-
- org.jboss.msc.value.EnvironmentPropertyValue
-
- All Implemented Interfaces:
java.security.PrivilegedAction<java.lang.String>
,Value<java.lang.String>
public final class EnvironmentPropertyValue extends java.lang.Object implements Value<java.lang.String>, java.security.PrivilegedAction<java.lang.String>
A value which comes from an environment property.- See Also:
System.getenv(String)
-
-
Field Summary
Fields Modifier and Type Field Description private java.security.AccessControlContext
accessControlContext
private Value<?>
defaultValue
private java.lang.String
propertyName
-
Constructor Summary
Constructors Constructor Description EnvironmentPropertyValue(java.lang.String propertyName)
Construct a new instance.EnvironmentPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext)
Construct a new instance.EnvironmentPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext, Value<?> defaultValue)
Construct a new instance.EnvironmentPropertyValue(java.lang.String propertyName, Value<?> defaultValue)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getValue()
Get the actual value.java.lang.String
run()
Fetch the property in an unprivileged context.
-
-
-
Field Detail
-
propertyName
private final java.lang.String propertyName
-
accessControlContext
private final java.security.AccessControlContext accessControlContext
-
defaultValue
private final Value<?> defaultValue
-
-
Constructor Detail
-
EnvironmentPropertyValue
public EnvironmentPropertyValue(java.lang.String propertyName)
Construct a new instance.- Parameters:
propertyName
- the property name to read
-
EnvironmentPropertyValue
public EnvironmentPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext)
Construct a new instance.- Parameters:
propertyName
- the property name to readaccessControlContext
- the access control context in which to fetch the property value
-
EnvironmentPropertyValue
public EnvironmentPropertyValue(java.lang.String propertyName, Value<?> defaultValue)
Construct a new instance.- Parameters:
propertyName
- the property name to readdefaultValue
- the value to use if the property is unset
-
EnvironmentPropertyValue
public EnvironmentPropertyValue(java.lang.String propertyName, java.security.AccessControlContext accessControlContext, Value<?> defaultValue)
Construct a new instance.- Parameters:
propertyName
- the property name to readaccessControlContext
- the access control context in which to fetch the property valuedefaultValue
- the value to use if the property is unset
-
-
Method Detail
-
getValue
public java.lang.String getValue() throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Get the actual value.
-
run
public java.lang.String run()
Fetch the property in an unprivileged context.- Specified by:
run
in interfacejava.security.PrivilegedAction<java.lang.String>
- Returns:
- the property value
-
-