Class ServiceManager


  • public class ServiceManager
    extends Object
    The ServiceManager class provides methods to register/remove services and to list currently registered services. It also provides methods to obtain an instance of ServiceSchemaManager and an instance of ServiceConfigManager.
    • Constructor Detail

      • ServiceManager

        public ServiceManager​(SSOToken token)
                       throws SSOException,
                              SMSException
        Creates an instance of ServiceManager. The SSOToken is used to identify the user performing service operations.
        Parameters:
        token - the authenticated single sign on token.
        Throws:
        SSOException - if the user's single sign on token is invalid or expired
        SMSException - if an error occurred while performing the operation
    • Method Detail

      • getSchemaManager

        public ServiceSchemaManager getSchemaManager​(String serviceName,
                                                     String version)
                                              throws SMSException,
                                                     SSOException
        Returns the ServiceSchemaManager for the given service name and version.
        Parameters:
        serviceName - the name of the service
        version - the version of the service
        Returns:
        the ServiceSchemaManager for the given service name and version
        Throws:
        SSOException - if the user's single sign on token is invalid or expired
        SMSException - if an error occurred while performing the operation
      • getConfigManager

        public ServiceConfigManager getConfigManager​(String serviceName,
                                                     String version)
                                              throws SMSException,
                                                     SSOException
        Returns the ServiceConfigManager for the given service name and version.
        Parameters:
        serviceName - the name of the service
        version - the version of the service
        Returns:
        the ServiceConfigManager for the given service name and version.
        Throws:
        SSOException - if the user's single sign on token is invalid or expired
        SMSException - if an error occurred while performing the operation
      • getOrganizationConfigManager

        public OrganizationConfigManager getOrganizationConfigManager​(String orgName)
                                                               throws SMSException,
                                                                      SSOException
        Returns the OrganizationConfigManager for the given organization name. If the orgName either null or empty or "/", the organization configuration for the root organization will be returned.
        Parameters:
        orgName - the name of the organization
        Returns:
        the OrganizationConfigManager for the given organization name
        Throws:
        SSOException - if the user's single sign on token is invalid or expired
        SMSException - if an error occurred while performing the operation
      • getServiceNames

        public Set<String> getServiceNames()
                                    throws SMSException
        Returns all the service names that have been registered.
        Returns:
        the set of names of services that have been registered
        Throws:
        SMSException - if an error occurred while performing the operation
      • getServiceNamesAndOCs

        public Map getServiceNamesAndOCs​(String schemaType)
        Returns a map of service names and the related object classes for the given schemaType.
        Parameters:
        schemaType - name of the schema
        Returns:
        Map of service names and objectclasses
      • getServiceVersions

        public Set getServiceVersions​(String serviceName)
                               throws SMSException
        Returns all versions supported by the service.
        Parameters:
        serviceName - service name.
        Returns:
        the set of versions supported by the service
        Throws:
        SMSException - if an error occurred while performing the operation
      • registerServices

        public Set registerServices​(InputStream xmlServiceSchema)
                             throws SMSException,
                                    SSOException
        Registers one or more services, defined by the XML input stream that follows the SMS DTD.
        Parameters:
        xmlServiceSchema - the input stream of service metadata in XML conforming to SMS DTD.
        Returns:
        set of registered service names.
        Throws:
        SMSException - if an error occurred while performing the operation.
        SSOException - if the user's single sign on token is invalid or expired.
      • registerServices

        public Set registerServices​(InputStream xmlServiceSchema,
                                    AMEncryption decryptObj)
                             throws SMSException,
                                    SSOException
        Registers one or more services, defined by the XML input stream that follows the SMS DTD.
        Parameters:
        xmlServiceSchema - the input stream of service metadata in XML conforming to SMS DTD.
        decryptObj - Object to decrypt the password in the XML.
        Returns:
        set of registered service names.
        Throws:
        SMSException - if an error occurred while performing the operation
        SSOException - if the user's single sign on token is invalid or expired.
      • addPluginSchema

        public void addPluginSchema​(Document pluginDoc)
                             throws SMSException,
                                    SSOException
        Adds a new plugin schema to an existing service
        Parameters:
        pluginDoc -
        Throws:
        SMSException - if an error occurred while performing the operation
        SSOException - if the user's single sign on token is invalid or expired.
      • removePluginSchema

        public void removePluginSchema​(String serviceName,
                                       String interfaceName,
                                       String pluginName)
                                throws SMSException,
                                       SSOException
        Removes a plugin schema from a service
        Parameters:
        serviceName - The name of the service
        interfaceName - The name of the plugin interface
        pluginName - The name of the plugin schema
        Throws:
        SMSException - if an error occurred while performing the operation
        SSOException - if the user's single sign on token is invalid or expired.
      • removeService

        public void removeService​(String serviceName,
                                  String version)
                           throws SMSException,
                                  SSOException
        Removes the service schema and configuration for the given service name.
        Parameters:
        serviceName - the name of the service
        version - the version of the service
        Throws:
        SMSException - if an error occurred while performing the operation
        SSOException - if the user's single sign on token is invalid or expired
      • deleteService

        public void deleteService​(String serviceName)
                           throws SMSException,
                                  SSOException
        Deletes only the schema for the given service name. This is provided only for backward compatibility for DSAME 5.0 and will be deprecated in the future release. Alternative is to use ServiceSchemaManager.replaceSchema().
        Parameters:
        serviceName - Name of service to be deleted.
        Throws:
        SMSException - if an error occurred while performing the operation
        SSOException - if the user's single sign on token is invalid or expired
      • getBaseDN

        public static String getBaseDN()
        Returns the base DN (or root DN) that was set in serverconfig.xml at install time.
      • getServiceDN

        public static String getServiceDN()
        Returns the DN beneath the getBaseDN() in which service data is stored.
      • getAMServerInstances

        public static Set getAMServerInstances()
        Returns all AM Server instance. Read the configured servers from platform service's iplanet-am-platform-server-list
      • searchOrganizationNames

        public Set searchOrganizationNames​(String serviceName,
                                           String attrName,
                                           Set values)
                                    throws SMSException,
                                           SSOException
        Returns organization names that match the given attribute name and values. Only exact matching is supported, and if more than one value is provided the organization must have all these values for the attribute. Basically an AND is performed for attribute values for searching.
        Parameters:
        serviceName - service name under which the attribute is to be sought.
        attrName - name of the attribute to search.
        values - set of attribute values to search.
        Returns:
        organizations that match the attribute name and values.
        Throws:
        SMSException - if an error occurred while performing the operation.
        SSOException - if the user's single sign on token is invalid or expired.
      • clearCache

        public void clearCache()
        Removes all the SMS cached entries. This method should be called to clear the cache for example, if ACIs for the SMS entries are changed in the directory. Also, this clears the SMS entries only in this JVM instance. If multiple instances (of JVM) are running this method must be called within each instance.
      • isCoexistenceMode

        public static boolean isCoexistenceMode()
        Returns the flag which lets IdRepo and SM know that we are running in the co-existence mode.
        Returns:
        true or false depending on if the coexistence flag is enabled or not.
      • getVersion

        protected static String getVersion​(String serviceName)
        Returns the version for a service. This is to handle the co-existence of OpenSSO and AM 7.1 in realm mode. The co-existence of OpenSSO and AM 7.1 in legacy mode is handled by the call to isCoexistenceMode() method. There is a special service named "iPlanetAMProviderConfigService" used in AM 7.x code for ID-FF metadata, the version for the service is "1.1", all the rest of service is "1.0" right now. This method can be removed if no need to support Co-existence of OpenSSO and AM 7.x any more.
        Parameters:
        serviceName - Name of the service.
        Returns:
        version of the service, the value will be 1.0 or 1.1.
      • isRealmEnabled

        public static boolean isRealmEnabled()
        Returns true if current service configuration uses the realm model to store the configuration data.
        Returns:
        true is realm model is used for storing configuration data; false otherwise.
      • isAMSDKConfigured

        public static boolean isAMSDKConfigured()
                                         throws SMSException
        Returns true if AMSDK IdRepo plugin is configured in any of the realms
        Throws:
        SMSException
      • isConfigMigratedTo70

        public static boolean isConfigMigratedTo70()
        Returns true if configuration data has been migrated to Access Manager 7.0. Else false otherwise.
        Returns:
        true if configuration data has been migrated to AM 7.0; false otherwise
      • getCacheIndex

        protected static String getCacheIndex​(String serviceName,
                                              String version)
      • getServiceNameDN

        protected static String getServiceNameDN​(String serviceName)
      • getServiceNameDN

        protected static String getServiceNameDN​(String serviceName,
                                                 String version)
      • checkAndEncryptPasswordSyntax

        protected static void checkAndEncryptPasswordSyntax​(Document doc,
                                                            boolean encrypt)
                                                     throws SMSException
        Throws:
        SMSException
      • schemaChanged

        protected static void schemaChanged()
      • servicesAssignedByDefault

        public static Set servicesAssignedByDefault()
        Returns service names that will be assigned to a realm during creation.
      • isAMSDKEnabled

        public static boolean isAMSDKEnabled()
        Returns true if AMSDK IdRepo plugin is enabled/present in IdRepo Service Configuration schema