Package com.sun.identity.sm
Class ServiceManager
- java.lang.Object
-
- com.sun.identity.sm.ServiceManager
-
public class ServiceManager extends Object
TheServiceManagerclass provides methods to register/remove services and to list currently registered services. It also provides methods to obtain an instance ofServiceSchemaManagerand an instance ofServiceConfigManager.
-
-
Field Summary
Fields Modifier and Type Field Description protected static SetaccessManagerServersprotected static StringATTR_SERVER_LISTprotected static StringCOEXISTENCE_ATTR_NAMEprotected static StringDEFAULT_SERVICES_FOR_REALMSprotected static SetdefaultServicesToLoadstatic StringPLATFORM_SERVICEprotected static StringREALM_ATTR_NAMEprotected static StringREALM_ENTRYstatic StringREALM_SERVICEprotected static SetrequiredServicesprotected static StringSERVICE_VERSIONprotected static StringserviceDNprotected static HashMapserviceNameDefaultVersionprotected static CachedSubEntriesserviceNamesprotected static HashMapserviceVersionsprotected static SMSEntrysmsEntry
-
Constructor Summary
Constructors Constructor Description ServiceManager(SSOToken token)Creates an instance ofServiceManager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPluginSchema(Document pluginDoc)Adds a new plugin schema to an existing serviceprotected static voidcheckAndEncryptPasswordSyntax(Document doc, boolean encrypt)protected static voidcheckAndEncryptPasswordSyntax(Document doc, boolean encrypt, AMEncryption encryptObj)voidclearCache()Removes all the SMS cached entries.voiddeleteService(String serviceName)Deletes only the schema for the given service name.static SetgetAMServerInstances()Returns all AM Server instance.static StringgetBaseDN()Returns the base DN (or root DN) that was set inserverconfig.xmlat install time.protected static StringgetCacheIndex(String serviceName, String version)ServiceConfigManagergetConfigManager(String serviceName, String version)Returns theServiceConfigManagerfor the given service name and version.OrganizationConfigManagergetOrganizationConfigManager(String orgName)Returns theOrganizationConfigManagerfor the given organization name.ServiceSchemaManagergetSchemaManager(String serviceName, String version)Returns theServiceSchemaManagerfor the given service name and version.static StringgetServiceDN()Returns the DN beneath thegetBaseDN()in which service data is stored.protected static StringgetServiceNameDN(String serviceName)protected static StringgetServiceNameDN(String serviceName, String version)Set<String>getServiceNames()Returns all the service names that have been registered.MapgetServiceNamesAndOCs(String schemaType)Returns a map of service names and the related object classes for the givenschemaType.SetgetServiceVersions(String serviceName)Returns all versions supported by the service.protected static StringgetVersion(String serviceName)Returns the version for a service.protected static SetgetVersions(SSOToken token, String serviceName)static booleanisAMSDKConfigured()Returnstrueif AMSDK IdRepo plugin is configured in any of the realmsstatic booleanisAMSDKEnabled()Returnstrueif AMSDK IdRepo plugin is enabled/present in IdRepo Service Configuration schemastatic booleanisCoexistenceMode()Returns the flag which lets IdRepo and SM know that we are running in the co-existence mode.static booleanisConfigMigratedTo70()Returnstrueif configuration data has been migrated to Access Manager 7.0.static booleanisRealmEnabled()Returnstrueif current service configuration uses the realm model to store the configuration data.DocumentparseServicesFile(InputStream xmlServiceSchema)DocumentparseServicesFile(InputStream xmlServiceSchema, AMEncryption decryptObj)SetregisterServices(InputStream xmlServiceSchema)Registers one or more services, defined by the XML input stream that follows the SMS DTD.SetregisterServices(InputStream xmlServiceSchema, AMEncryption decryptObj)Registers one or more services, defined by the XML input stream that follows the SMS DTD.voidremovePluginSchema(String serviceName, String interfaceName, String pluginName)Removes a plugin schema from a servicevoidremoveService(String serviceName, String version)Removes the service schema and configuration for the given service name.protected static voidschemaChanged()SetsearchOrganizationNames(String serviceName, String attrName, Set values)Returns organization names that match the given attribute name and values.protected static StringserviceDefaultVersion(SSOToken token, String serviceName)static SetservicesAssignedByDefault()Returns service names that will be assigned to a realm during creation.StringtoXML(AMEncryption encryptObj)protected static booleanvalidateServiceSchema(Node serviceNode)
-
-
-
Field Detail
-
serviceDN
protected static final String serviceDN
-
COEXISTENCE_ATTR_NAME
protected static final String COEXISTENCE_ATTR_NAME
- See Also:
- Constant Field Values
-
serviceNameDefaultVersion
protected static HashMap serviceNameDefaultVersion
-
REALM_ATTR_NAME
protected static final String REALM_ATTR_NAME
- See Also:
- Constant Field Values
-
REALM_SERVICE
public static final String REALM_SERVICE
- See Also:
- Constant Field Values
-
DEFAULT_SERVICES_FOR_REALMS
protected static final String DEFAULT_SERVICES_FOR_REALMS
- See Also:
- Constant Field Values
-
SERVICE_VERSION
protected static final String SERVICE_VERSION
- See Also:
- Constant Field Values
-
REALM_ENTRY
protected static final String REALM_ENTRY
-
PLATFORM_SERVICE
public static final String PLATFORM_SERVICE
- See Also:
- Constant Field Values
-
ATTR_SERVER_LIST
protected static final String ATTR_SERVER_LIST
- See Also:
- Constant Field Values
-
requiredServices
protected static Set requiredServices
-
defaultServicesToLoad
protected static Set defaultServicesToLoad
-
smsEntry
protected static SMSEntry smsEntry
-
serviceNames
protected static CachedSubEntries serviceNames
-
serviceVersions
protected static HashMap serviceVersions
-
accessManagerServers
protected static Set accessManagerServers
-
-
Constructor Detail
-
ServiceManager
public ServiceManager(SSOToken token) throws SSOException, SMSException
Creates an instance ofServiceManager. TheSSOTokenis 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 expiredSMSException- if an error occurred while performing the operation
-
-
Method Detail
-
getSchemaManager
public ServiceSchemaManager getSchemaManager(String serviceName, String version) throws SMSException, SSOException
Returns theServiceSchemaManagerfor the given service name and version.- Parameters:
serviceName- the name of the serviceversion- the version of the service- Returns:
- the
ServiceSchemaManagerfor the given service name and version - Throws:
SSOException- if the user's single sign on token is invalid or expiredSMSException- if an error occurred while performing the operation
-
getConfigManager
public ServiceConfigManager getConfigManager(String serviceName, String version) throws SMSException, SSOException
Returns theServiceConfigManagerfor the given service name and version.- Parameters:
serviceName- the name of the serviceversion- the version of the service- Returns:
- the
ServiceConfigManagerfor the given service name and version. - Throws:
SSOException- if the user's single sign on token is invalid or expiredSMSException- if an error occurred while performing the operation
-
getOrganizationConfigManager
public OrganizationConfigManager getOrganizationConfigManager(String orgName) throws SMSException, SSOException
Returns theOrganizationConfigManagerfor the given organization name. If theorgNameeithernullor empty or "/", the organization configuration for the root organization will be returned.- Parameters:
orgName- the name of the organization- Returns:
- the
OrganizationConfigManagerfor the given organization name - Throws:
SSOException- if the user's single sign on token is invalid or expiredSMSException- 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 givenschemaType.- 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 operationSSOException- if the user's single sign on token is invalid or expired.
-
parseServicesFile
public Document parseServicesFile(InputStream xmlServiceSchema) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
parseServicesFile
public Document parseServicesFile(InputStream xmlServiceSchema, AMEncryption decryptObj) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
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 operationSSOException- 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 serviceinterfaceName- The name of the plugin interfacepluginName- The name of the plugin schema- Throws:
SMSException- if an error occurred while performing the operationSSOException- 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 serviceversion- the version of the service- Throws:
SMSException- if an error occurred while performing the operationSSOException- 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 useServiceSchemaManager.replaceSchema().- Parameters:
serviceName- Name of service to be deleted.- Throws:
SMSException- if an error occurred while performing the operationSSOException- 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 inserverconfig.xmlat install time.
-
getServiceDN
public static String getServiceDN()
Returns the DN beneath thegetBaseDN()in which service data is stored.
-
getAMServerInstances
public static Set getAMServerInstances()
Returns all AM Server instance. Read the configured servers from platform service'siplanet-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()
Returnstrueif current service configuration uses the realm model to store the configuration data.- Returns:
trueis realm model is used for storing configuration data;falseotherwise.
-
isAMSDKConfigured
public static boolean isAMSDKConfigured() throws SMSExceptionReturnstrueif AMSDK IdRepo plugin is configured in any of the realms- Throws:
SMSException
-
isConfigMigratedTo70
public static boolean isConfigMigratedTo70()
Returnstrueif configuration data has been migrated to Access Manager 7.0. Elsefalseotherwise.- Returns:
trueif configuration data has been migrated to AM 7.0;falseotherwise
-
getVersions
protected static Set getVersions(SSOToken token, String serviceName) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
checkAndEncryptPasswordSyntax
protected static void checkAndEncryptPasswordSyntax(Document doc, boolean encrypt) throws SMSException
- Throws:
SMSException
-
checkAndEncryptPasswordSyntax
protected static void checkAndEncryptPasswordSyntax(Document doc, boolean encrypt, AMEncryption encryptObj) throws SMSException
- Throws:
SMSException
-
validateServiceSchema
protected static boolean validateServiceSchema(Node serviceNode) throws SMSException
- Throws:
SMSException
-
schemaChanged
protected static void schemaChanged()
-
serviceDefaultVersion
protected static String serviceDefaultVersion(SSOToken token, String serviceName) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
servicesAssignedByDefault
public static Set servicesAssignedByDefault()
Returns service names that will be assigned to a realm during creation.
-
toXML
public String toXML(AMEncryption encryptObj) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
isAMSDKEnabled
public static boolean isAMSDKEnabled()
Returnstrueif AMSDK IdRepo plugin is enabled/present in IdRepo Service Configuration schema
-
-