Class G11NSettings

  • All Implemented Interfaces:
    AMClientDataListener, ServiceListener

    public class G11NSettings
    extends Object
    implements ServiceListener, AMClientDataListener
    G11NSettings service identifies the list of valid charsets to be used for any given locale.It is a helper class to identify suitable charset to be used for a client. Client will provide supported charsets using CcppAccept-Charset attribute and this class has methods such as getCharset() to parse the parameter and locate a charset suitable for a given client for a locale
    • Method Detail

      • getInstance

        public static G11NSettings getInstance()
        Returns:
        unique instance of G11NSettings Object Gets singletion instance of G11NSettings Reads the G11NSettings Service and find out charsets applicable for a given locale.
      • getDefaultCharsetForLocale

        public String getDefaultCharsetForLocale​(Locale loc)
        Returns:
        preferred charset to be used for the locale It uses fall back mechanism by dropping variant, country to find suitable charset.
      • getCharsetForLocale

        public List getCharsetForLocale​(String loc)
        Parameters:
        loc - locale such as en, en_US
        Returns:
        list of charsets supported by a locale
      • getCharsetAliasTable

        public Map getCharsetAliasTable​(String mimeCharset)
        Parameters:
        mimeCharset -
        Returns:
        a Map which can provide equivalent charset names. Currently, OpenAM uses only Java name; however an application can be configured to have different names for platform level mapping etc.
      • getJavaCharset

        public String getJavaCharset​(String mimeCharset)
        Parameters:
        mimeCharset -
        Returns:
        charset name used in Java. If there is no such mapping, same mimecharset is returned
      • schemaChanged

        public void schemaChanged​(String serviceName,
                                  String version)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's schema has been changed.
        Specified by:
        schemaChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
      • globalConfigChanged

        public void globalConfigChanged​(String serviceName,
                                        String version,
                                        String groupName,
                                        String serviceComponent,
                                        int type)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's global configuration data has been changed. The parameter groupName denote the name of the configuration grouping (e.g. default) and serviceComponent denotes the service's sub-component that changed (e.g. /NamedPolicy, /Templates).
        Specified by:
        globalConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service.
        version - version of the service.
        groupName - name of the configuration grouping.
        serviceComponent - name of the service components that changed.
        type - change type, i.e., ADDED, REMOVED or MODIFIED.
      • organizationConfigChanged

        public void organizationConfigChanged​(String serviceName,
                                              String version,
                                              String orgName,
                                              String groupName,
                                              String serviceComponent,
                                              int type)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's organization configuration data has been changed. The parameters orgName, groupName and serviceComponent denotes the organization name, configuration grouping name and service's sub-component that are changed respectively.
        Specified by:
        organizationConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
        orgName - organization name as DN
        groupName - name of the configuration grouping
        serviceComponent - the name of the service components that changed
        type - change type, i.e., ADDED, REMOVED or MODIFIED
      • getCharset

        public String getCharset​(String clientType,
                                 Locale loc)
                          throws ClientException
        Parameters:
        clientType - Client type identified by CDM module
        loc - Locale such as en_US This method computes the characterset to be used for any given clientType It uses Ccpp-Accept-Charset of the ClientType and picks appropriate charset for any given locale. CcppAccept-Charset list may have Q factor to weigh the client preference of the charset
        Returns:
        string Charset to be used for the given locale
        Throws:
        ClientException
      • clientChanged

        public void clientChanged​(String clientType,
                                  int dbType,
                                  int opType)
        Description copied from interface: AMClientDataListener
        Called when a client-type data gets changed.
        Specified by:
        clientChanged in interface AMClientDataListener
        Parameters:
        clientType - The clientType that changed.
        dbType - The database that contained the clientType AMClientCapData.INTERNAL or AMClientCapData.EXTERNAL.
        opType - The type of the change - AMClientCapData.ADDED OR AMClientCapData.REMOVED OR AMClientCapData.MODIFIED