Class SystemConfigurationUtil

  • All Implemented Interfaces:
    ConfigurationListener

    public final class SystemConfigurationUtil
    extends Object
    implements ConfigurationListener
    The SystemConfigurationUtil class provides methods to get attributes defined in "systemConfig" configuration. It also has a method getProperty to get properties in "FederationConfig.properties".
    • Method Detail

      • 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.
      • isServerMode

        public static boolean isServerMode()
        Returns true 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 interface ConfigurationListener
        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.