Package com.sun.identity.common
Class SystemConfigurationUtil
- java.lang.Object
-
- com.sun.identity.common.SystemConfigurationUtil
-
- All Implemented Interfaces:
ConfigurationListener
public final class SystemConfigurationUtil extends Object implements ConfigurationListener
TheSystemConfigurationUtil
class provides methods to get attributes defined in "systemConfig" configuration. It also has a method getProperty to get properties in "FederationConfig.properties".
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROP_SERVER_MODE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configChanged(ConfigurationActionEvent event)
This method will be invoked when a component's configuration data has been changed.static String
getAuthenticationURL()
Returns authentication URL.static Set<String>
getCookieDomainsForRequest(jakarta.servlet.http.HttpServletRequest request)
Returns list of cookie domains.static String
getProperty(String propertyName)
Returns property value corresponding to the property name.static String
getProperty(String propertyName, String defaultValue)
Returns property value corresponding to the property name.static String
getServerFromID(String id)
Returns the server instance corresponding to the server id.static String
getServerID(String protocol, String hostname, int port, String uri)
Returns the server id corresponding to a server instance.static List
getServerList()
Returns all the instances in the server cluster this instance belongs to.static Collection
getServiceAllURLs(String serviceName)
Returns all service urls.static URL
getServiceURL(String serviceName, String protocol, String hostname, int port, String uri)
Returns the URL of the specified service on the specified host.static List
getSiteList()
Returns all the sites instance.static void
initializeProperties(String propertyName, String propertyValue)
Initializes the properties map.static void
initializeProperties(Properties properties)
Initializes the properties map.static boolean
isServerMode()
Returnstrue
if this is running on server mode.static boolean
isSiteId(String siteID)
Check whether the given id is a siteId.static boolean
isValidServerId(String serverID)
Checks whether the given serverID is a really existing serverid in the current configuration.
-
-
-
Field Detail
-
PROP_SERVER_MODE
public static final String PROP_SERVER_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAuthenticationURL
public static String getAuthenticationURL() throws SystemConfigurationException
Returns authentication URL.- Returns:
- authentication URL, return null if the authentication URL could not be found.
- Throws:
SystemConfigurationException
-
getCookieDomainsForRequest
public static Set<String> getCookieDomainsForRequest(jakarta.servlet.http.HttpServletRequest request)
Returns list of cookie domains.- Returns:
- list of cookie domains, return empty list if no cookie domain is defined.
-
getServerList
public static List getServerList() throws SystemConfigurationException
Returns all the instances in the server cluster this instance belongs to.- Returns:
- list of server names.
- Throws:
SystemConfigurationException
- if unable to get the server list.
-
getServiceAllURLs
public static Collection getServiceAllURLs(String serviceName) throws SystemConfigurationException
Returns all service urls.- Returns:
- list of server names.
- Throws:
SystemConfigurationException
- if unable to get the server list.
-
getSiteList
public static List getSiteList() throws SystemConfigurationException
Returns all the sites instance.- Returns:
- list of site names.
- Throws:
SystemConfigurationException
- if unable to get the server list.
-
isServerMode
public static boolean isServerMode()
Returnstrue
if this is running on server mode.- Returns:
true
if this is running on server mode.
-
getServiceURL
public static URL getServiceURL(String serviceName, String protocol, String hostname, int port, String uri) throws SystemConfigurationException
Returns the URL of the specified service on the specified host.- Parameters:
serviceName
- The name of the service.protocol
- The service protocol.hostname
- The service host name.port
- The service listening port.uri
- The service URI.- Returns:
- The URL of the specified service on the specified host.
- Throws:
SystemConfigurationException
- if the URL could not be found.
-
getServerID
public static String getServerID(String protocol, String hostname, int port, String uri) throws SystemConfigurationException
Returns the server id corresponding to a server instance. There is a one-to-one mapping between the server id and the instance.- Parameters:
protocol
- The service protocol of the server instance.hostname
- The service host name of the server instance.port
- The service listening port of the server instance.uri
- The service URI of the server instance.- Returns:
- the server id corresponding to the server instance
- Throws:
SystemConfigurationException
- if the server id corresponding to the server instance could not be found.
-
getServerFromID
public static String getServerFromID(String id) throws SystemConfigurationException
Returns the server instance corresponding to the server id.- Parameters:
id
- server id- Returns:
- server instance name, e.g. "http://abc.sun.com:58080".
- Throws:
SystemConfigurationException
- if the server name corresponding to the server id does not exist.
-
isSiteId
public static boolean isSiteId(String siteID)
Check whether the given id is a siteId.- Parameters:
siteID
- The site id to check.- Returns:
- true, if the given siteID is an existing site id.
-
initializeProperties
public static void initializeProperties(Properties properties)
Initializes the properties map.- Parameters:
properties
- Map of new properties.
-
initializeProperties
public static void initializeProperties(String propertyName, String propertyValue)
Initializes the properties map.- Parameters:
propertyName
- Name of properties.propertyValue
- Value of properties.
-
getProperty
public static String getProperty(String propertyName)
Returns property value corresponding to the property name.- Parameters:
propertyName
- name of the property whose value to be returned.- Returns:
- the value of the property, returns null if the property does not exist.
-
getProperty
public static String getProperty(String propertyName, String defaultValue)
Returns property value corresponding to the property name. If the property is not found, the default value is returned.- Parameters:
propertyName
- name of the property whose value to be returned.defaultValue
- the default value.- Returns:
- the value of the property, returns null if the property does not exist.
-
configChanged
public void configChanged(ConfigurationActionEvent event)
This method will be invoked when a component's configuration data has been changed. The parameters componentName, realm and configName denotes the component name, organization and configuration instance name that are changed respectively.- Specified by:
configChanged
in interfaceConfigurationListener
- Parameters:
event
- Configuration action event, like ADDED, DELETED, MODIFIED etc.
-
isValidServerId
public static boolean isValidServerId(String serverID)
Checks whether the given serverID is a really existing serverid in the current configuration. It returns false if the given id is a siteID!- Parameters:
serverID
- true if the given serverID is a valid serverID.
-
-