Interface ServerConfigurationService


  • public interface ServerConfigurationService

    ServerConfigurationService provides information about how the server is configured.

    • Method Detail

      • getServerId

        String getServerId()
        Access the unique (to the cluster) id of the server.
        Returns:
        The unique (to the cluster) id of the server.
      • getServerInstance

        String getServerInstance()
        Access the unique (to the cluster) instance id of the server.
        Returns:
        The unique (to the cluster) instance id of the server.
      • getServerIdInstance

        String getServerIdInstance()
        Access the combined server / instance id.
        Returns:
        The combined server / instance id.
      • getServerName

        String getServerName()
        Access the server DNS name.
        Returns:
        The server DNS name.
      • getServerNameAliases

        Collection<String> getServerNameAliases()
        Access alternative names
        Returns:
        The server alternative names (doesn't contain the server name) or an empty collection if there is no alternative name
      • getServerUrl

        String getServerUrl()
        Access the URL to the root of the server - append any additional path to the end.
        Returns:
        The URL to the root of the server.
      • getHelpUrl

        String getHelpUrl​(String helpContext)
        Access the URL to the help service on the server - append in the path the tool well known id for context sensitive help.
        Parameters:
        helpContext - The context string.
        Returns:
        The URL to the help service on the server.
      • getAccessUrl

        String getAccessUrl()
        Access the URL to the access service on the server - append any additional path to the end.
        Returns:
        The URL to the access service on the server.
      • getAccessPath

        String getAccessPath()
        Access the path to the access service on the server relative to the base URL for the server.
        Returns:
        The path to the access service on the server.
      • getPortalUrl

        String getPortalUrl()
        Access the URL to the portal service on the server - append any additional path to the end.
        Returns:
        The URL to the portal service on the server.
      • getToolUrl

        String getToolUrl()
        Access the URL to the tool dispatcher service on the server - append any additional path to the end.
        Returns:
        The URL to the tool dispatcher service on the server.
      • getGatewaySiteId

        String getGatewaySiteId()
        Access the site id for the gateway (public) site.
        Returns:
        The site id for the gateway (public) site.
      • getLoggedOutUrl

        String getLoggedOutUrl()
        Access the URL to use as a redirect when the user has logged out.
        Returns:
        The URL to use as a redirect when the user has logged out.
      • getUserHomeUrl

        String getUserHomeUrl()
        Access the URL to the user's "home" (My Workspace) in the service.
        Returns:
        The URL to the user's "home" (My Workspace) in the service.
      • getSakaiHomePath

        String getSakaiHomePath()
        Access the file path to the "sakai home" on the app server.
        Returns:
        The file path to the "sakai home" on the app server.
      • getString

        String getString​(String name)
        Access some named configuration value as a string. 1) IF "name=value" THEN this will return "value" 2) IF "name=" THEN this will return null 3) IF name is not defined in the config THEN this will return "" (empty string)
        Parameters:
        name - The configuration value name (or key).
        Returns:
        The configuration value for this name OR null if defined as 'blank' OR "" (empty string) if not defined.
      • getString

        String getString​(String name,
                         String dflt)
        Access some named configuration value as a string. 1) IF "name=value" THEN this will return "value" 2) IF "name=" THEN this will return null 3) IF name is not defined in the config THEN this will return the provided default value
        Parameters:
        name - The configuration value name (or key).
        dflt - The value to return if not found in the config.
        Returns:
        The configuration value for this name OR null if defined as 'blank' OR default value if not defined.
      • getStrings

        String[] getStrings​(String name)
        Access some named configuration values as an array of strings. There are 2 ways this is indicated in the system: 1) The name is the base name. name + ".count" must be defined to be a positive integer - how many are defined. name + "." + i (1..count) must be defined to be the values. 2) A comma delimited list of values: name=val1,val2,val3 If count is 0 or the value is empty then an empty string array is the resulting return value. Null is returned ONLY in the case the value cannot be found at all.
        Parameters:
        name - The configuration value name base.
        Returns:
        The configuration value with this name, empty array if no values or count=0, OR null if config name is not found.
      • getLong

        long getLong​(String name,
                     long dflt)
        Access some named configuration value as a long
        Parameters:
        name - The configuration value name.
        dflt - The value to return if not found.
        Returns:
        The configuration value with this name, or the default value if not found.
      • getInt

        int getInt​(String name,
                   int dflt)
        Access some named configuration value as an int.
        Parameters:
        name - The configuration value name.
        dflt - The value to return if not found.
        Returns:
        The configuration value with this name, or the default value if not found.
      • getBoolean

        boolean getBoolean​(String name,
                           boolean dflt)
        Access some named configuration value as a boolean.
        Parameters:
        name - The configuration value name.
        dflt - The value to return if not found.
        Returns:
        The configuration value with this name, or the default value if not found.
      • getStringList

        List<String> getStringList​(String name,
                                   List<String> dflt)
        Access some named configuration value as a List. The value must be a comma separated set of values.
        Parameters:
        name - The configuration value name.
        dflt - The value to return if not found.
        Returns:
        The configuration value with this name, as a List, or the default value if not found.
      • getPatternList

        List<Pattern> getPatternList​(String name,
                                     List<String> dflt)
        Access some named configuration value as a List. The value must be a comma separated set of regexes.
        Parameters:
        name - The configuration value name.
        dflt - The value to return if not found.
        Returns:
        The configuration value with this name, as a List, or the default value if not found.
      • getRawProperty

        String getRawProperty​(String name)
        Access the undereferenced value of the given property. That is, Spring-style property placeholders will not be expanded as they would be in other getters on this interface. For example, consider the following configuration:
         
         property1=foo
         property2=${property1}
         
         

        Invoking getString(String), passing "property2" will return "foo". However, invoking this method with the same argument will return "${property1}".

        Typically, a client of this method, e.g. a dynamic configuration management tool, is interested in reporting on the system's actual state from which return values of other getters are calculated. In such cases, caller-specified default values have no utility. Thus this method does not accept an argument specifying the property's default value.

        For a given undefined property "X", this method should return exactly the same value as getString("X"). Thus it may not be possible in all cases to distinguish between defined and undefined properties.

        Parameters:
        name - a property name. Must not be null
        Returns:
        the property value. Property placeholders will not have been dereferenced. The value representing an non-existent property is implementation dependent.
      • getToolGroup

        List<String> getToolGroup​(String category)
        KNL-989 Access the list of tools by group
        Parameters:
        category - The tool category
        Returns:
        An unordered list of tool ids (String) in selected group, or an empty list if there are none for this category.
      • getToolOrder

        List<String> getToolOrder​(String category)
        KNL-989 Access the list of tool ids in order for this category, to impose on the displays of many tools
        Parameters:
        category - Site type
        Returns:
        An unordered list of group names (String), or an empty list if there are none for this category.
      • toolGroupIsSelected

        boolean toolGroupIsSelected​(String groupName,
                                    String toolId)
        KNL-989 Returns true if selected tool is contained in pre-initialized list of selected items
      • toolGroupIsRequired

        boolean toolGroupIsRequired​(String groupName,
                                    String toolId)
        KNL-989 Returns true if selected tool is contained in pre-initialized list of required items
      • getCategoryGroups

        List<String> getCategoryGroups​(String category)
        KNL-989 Access the list of groups by category (site type)
        Parameters:
        category - The tool category
        Returns:
        An ordered list of tool ids (String) indicating the desired tool display order, or an empty list if there are none for this category.
      • getToolsRequired

        List<String> getToolsRequired​(String category)
        Access the list of tool ids that are required for this category.
        Parameters:
        category - The tool category.
        Returns:
        A list of tool ids (String) that are required for this category, or an empty list if there are none for this category.
      • getDefaultTools

        List<String> getDefaultTools​(String category)
        Access the list of tool ids that are selected by default for this category.
        Parameters:
        category - The tool category.
        Returns:
        A list of tool ids (String) for this category to use by default, or an empty list if there are none for this category.
      • getToolCategories

        List<String> getToolCategories​(String category)
        access the list of tool categories for the given site type
        Parameters:
        category - the site type
        Returns:
        a list of tool category ids in order
      • getToolCategoriesAsMap

        Map<String,​List<String>> getToolCategoriesAsMap​(String category)
        access the map of tool categories to tool ids for this site type
        Parameters:
        category - the site type
        Returns:
        a map of tool category ids to tool ids
      • getToolToCategoryMap

        Map<String,​String> getToolToCategoryMap​(String category)
        access a map of tool id to tool category id for this site type
        Parameters:
        category - the site type
        Returns:
        map with tool id as key and category id as value
      • getSakaiLocales

        Locale[] getSakaiLocales()
        Get the list of allowed locales as controlled by config params for "locales" and "locales.more" Defaults when nothing is specified in the config files come from SakaiLocales.SAKAI_LOCALES_DEFAULT
        Returns:
        an array of all allowed Locales for this installation
        See Also:
        SakaiLocales
      • getLocaleFromString

        Locale getLocaleFromString​(String localeString)
        Parse a string into a Locale
        Returns:
        Locale based on its string representation (language_region) OR default Locale if the string cannot be parsed
      • getCommaSeparatedListAsSet

        Set<String> getCommaSeparatedListAsSet​(String key)
        Retrieves the string property by key, then splits it by comma. The trimmed tokens are then returned in a set. If the key isn't present, an empty set will be returned.
        Parameters:
        key - The property key
        Returns:
        A set of trimmed tokens from a comma separated list
      • getConfig

        <T> T getConfig​(String name,
                        T defaultValue)
        Retrieves config values from the configuration service
        Parameters:
        name - the name of the setting to retrieve, Should be a string name: e.g. auto.ddl, mystuff.config, etc.
        defaultValue - a specified default value to return if this setting cannot be found, NOTE: You can set the default value to null but you must specify the class type in parens
        Returns:
        the value of the configuration setting OR the default value if none can be found
      • getConfigItem

        ServerConfigurationService.ConfigItem getConfigItem​(String name)
        Retrieve the internally stored the config item, this is not really for general use, if you want the value of a configuration variable then you should use getConfig(String, Object)
        Parameters:
        name - the name of the setting to retrieve, Should be a string name: e.g. auto.ddl, mystuff.config, etc.
        Returns:
        the config item OR null if none exists
      • getConfigData

        ServerConfigurationService.ConfigData getConfigData()
        Returns data about all the configuration values which are known to the system at the time and some stats which are useful
        Returns:
        a config data class with data about the known configuration values