public class SystemProperties extends Object
The system properties can be set in couple of ways: programmatically by
calling the initializeProperties
method, or can be statically
loaded at startup from a file named:
AMConfig.[class,properties]
.
Setting the properties through the API takes precedence and will replace the
properties loaded via file. For statically loading the properties via a file,
this class tries to first find a class, AMConfig.class
, and
then a file, AMConfig.properties
in the CLASSPATH accessible
to this code. The AMConfig.class
takes precedence over the
flat file AMConfig.properties
.
If multiple servers are running, each may have their own configuration file.
The naming convention for such scenarios is
AMConfig-<serverName>
.
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_FILE_NAME
Default name of the configuration file.
|
static String |
CONFIG_PATH
Runtime flag to be set, in order to override the path of the
configuration file.
|
static String |
NEWCONFDIR |
static String |
PROPERTIES
New configuration file extension
|
Constructor and Description |
---|
SystemProperties() |
Modifier and Type | Method and Description |
---|---|
static String |
get(String key)
This method lets you query for a system property whose value is same as
String key. |
static String |
get(String key,
String def)
This method lets you query for a system property whose value is same as
String key. |
static Properties |
getAll()
This method lets you get all the properties defined and their values.
|
static boolean |
getAsBoolean(String key)
Returns the property value as a boolean
|
static boolean |
getAsBoolean(String key,
boolean defaultValue)
Returns the property value as a boolean
|
static Map |
getAttributeMap()
Returns the property name to service attribute schema name mapping.
|
static String |
getInitializationError()
Returns error messages during initialization, else
null . |
static Properties |
getPlatform()
Deprecated.
use
getAll() |
static Properties |
getProperties()
Returns all the properties defined and their values.
|
static String |
getSecondaryInitializationError()
Returns error messages during initialization using the single war
deployment, else
null . |
static String |
getServerInstanceName()
Returns the server instance name of which properties are retrieved
to initialized this object.
|
static void |
initializeProperties(Properties properties) |
static void |
initializeProperties(Properties properties,
boolean reset)
Initializes the properties to be used by OpenSSO.
|
static void |
initializeProperties(Properties properties,
boolean reset,
boolean withDefaults)
Initializes the properties to be used by OpenSSO.
|
static void |
initializeProperties(String file)
Initializes properties bundle from the
file |
static void |
initializeProperties(String propertyName,
String propertyValue)
Initializes the property to be used by OpenSSO.
|
static boolean |
isServerMode()
Returns
true if instance is running in server mode. |
static long |
lastModified()
Returns a counter for last modification.
|
static void |
setServerInstanceName(String name)
Sets the server instance name of which properties are retrieved
to initialized this object.
|
public static final String CONFIG_PATH
public static final String CONFIG_FILE_NAME
public static final String PROPERTIES
public static final String NEWCONFDIR
public SystemProperties()
public static String get(String key)
String
key. The method first tries to read the property
from java.lang.System followed by a lookup in the config file.key
- type String
, the key whose value one is
looking for.null
public static String get(String key, String def)
String
key.key
- the key whose value one is looking for.def
- the default value if the key does not exist.public static boolean getAsBoolean(String key)
key
- the key whose value one is looking for.public static boolean getAsBoolean(String key, boolean defaultValue)
key
- defaultValue
- value if key is not found.public static Properties getProperties()
public static Properties getAll()
public static Properties getPlatform()
getAll()
public static void initializeProperties(String file)
file
passed.
file
- type String
, file name for the resource bundleMissingResourceException
public static void initializeProperties(Properties properties)
public static void initializeProperties(Properties properties, boolean reset)
properties
- properties for OpenSSOreset
- true
to reset existing properties.public static void initializeProperties(Properties properties, boolean reset, boolean withDefaults)
properties
- properties for OpenSSO.reset
- true
to reset existing properties.withDefaults
- true
to include default properties.public static void initializeProperties(String propertyName, String propertyValue)
propertyName
- property name.propertyValue
- property value.public static long lastModified()
initializeProperties
. This is a convenience methods for
applications to track changes to OpenSSO properties.public static String getInitializationError()
null
.public static String getSecondaryInitializationError()
null
.public static void setServerInstanceName(String name)
name
- Server instance name.public static String getServerInstanceName()
public static boolean isServerMode()
true
if instance is running in server mode.true
if instance is running in server mode.public static Map getAttributeMap()
Copyright © 2010-2013, ForgeRock All Rights Reserved.