Package com.sun.identity.sm
Class ServiceManager
- java.lang.Object
-
- com.sun.identity.sm.ServiceManager
-
public class ServiceManager extends Object
TheServiceManager
class provides methods to register/remove services and to list currently registered services. It also provides methods to obtain an instance ofServiceSchemaManager
and an instance ofServiceConfigManager
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static Set
accessManagerServers
protected static String
ATTR_SERVER_LIST
protected static String
COEXISTENCE_ATTR_NAME
protected static String
DEFAULT_SERVICES_FOR_REALMS
protected static Set
defaultServicesToLoad
static String
PLATFORM_SERVICE
protected static String
REALM_ATTR_NAME
protected static String
REALM_ENTRY
static String
REALM_SERVICE
protected static Set
requiredServices
protected static String
SERVICE_VERSION
protected static String
serviceDN
protected static HashMap
serviceNameDefaultVersion
protected static CachedSubEntries
serviceNames
protected static HashMap
serviceVersions
protected static SMSEntry
smsEntry
-
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 void
addPluginSchema(Document pluginDoc)
Adds a new plugin schema to an existing serviceprotected static void
checkAndEncryptPasswordSyntax(Document doc, boolean encrypt)
protected static void
checkAndEncryptPasswordSyntax(Document doc, boolean encrypt, AMEncryption encryptObj)
void
clearCache()
Removes all the SMS cached entries.void
deleteService(String serviceName)
Deletes only the schema for the given service name.static Set
getAMServerInstances()
Returns all AM Server instance.static String
getBaseDN()
Returns the base DN (or root DN) that was set inserverconfig.xml
at install time.protected static String
getCacheIndex(String serviceName, String version)
ServiceConfigManager
getConfigManager(String serviceName, String version)
Returns theServiceConfigManager
for the given service name and version.OrganizationConfigManager
getOrganizationConfigManager(String orgName)
Returns theOrganizationConfigManager
for the given organization name.ServiceSchemaManager
getSchemaManager(String serviceName, String version)
Returns theServiceSchemaManager
for the given service name and version.static String
getServiceDN()
Returns the DN beneath thegetBaseDN()
in which service data is stored.protected static String
getServiceNameDN(String serviceName)
protected static String
getServiceNameDN(String serviceName, String version)
Set<String>
getServiceNames()
Returns all the service names that have been registered.Map
getServiceNamesAndOCs(String schemaType)
Returns a map of service names and the related object classes for the givenschemaType
.Set
getServiceVersions(String serviceName)
Returns all versions supported by the service.protected static String
getVersion(String serviceName)
Returns the version for a service.protected static Set
getVersions(SSOToken token, String serviceName)
static boolean
isAMSDKConfigured()
Returnstrue
if AMSDK IdRepo plugin is configured in any of the realmsstatic boolean
isAMSDKEnabled()
Returnstrue
if AMSDK IdRepo plugin is enabled/present in IdRepo Service Configuration schemastatic boolean
isCoexistenceMode()
Returns the flag which lets IdRepo and SM know that we are running in the co-existence mode.static boolean
isConfigMigratedTo70()
Returnstrue
if configuration data has been migrated to Access Manager 7.0.static boolean
isRealmEnabled()
Returnstrue
if current service configuration uses the realm model to store the configuration data.Document
parseServicesFile(InputStream xmlServiceSchema)
Document
parseServicesFile(InputStream xmlServiceSchema, AMEncryption decryptObj)
Set
registerServices(InputStream xmlServiceSchema)
Registers one or more services, defined by the XML input stream that follows the SMS DTD.Set
registerServices(InputStream xmlServiceSchema, AMEncryption decryptObj)
Registers one or more services, defined by the XML input stream that follows the SMS DTD.void
removePluginSchema(String serviceName, String interfaceName, String pluginName)
Removes a plugin schema from a servicevoid
removeService(String serviceName, String version)
Removes the service schema and configuration for the given service name.protected static void
schemaChanged()
Set
searchOrganizationNames(String serviceName, String attrName, Set values)
Returns organization names that match the given attribute name and values.protected static String
serviceDefaultVersion(SSOToken token, String serviceName)
static Set
servicesAssignedByDefault()
Returns service names that will be assigned to a realm during creation.String
toXML(AMEncryption encryptObj)
protected static boolean
validateServiceSchema(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
. TheSSOToken
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 expiredSMSException
- if an error occurred while performing the operation
-
-
Method Detail
-
getSchemaManager
public ServiceSchemaManager getSchemaManager(String serviceName, String version) throws SMSException, SSOException
Returns theServiceSchemaManager
for the given service name and version.- Parameters:
serviceName
- the name of the serviceversion
- 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 expiredSMSException
- if an error occurred while performing the operation
-
getConfigManager
public ServiceConfigManager getConfigManager(String serviceName, String version) throws SMSException, SSOException
Returns theServiceConfigManager
for the given service name and version.- Parameters:
serviceName
- the name of the serviceversion
- 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 expiredSMSException
- if an error occurred while performing the operation
-
getOrganizationConfigManager
public OrganizationConfigManager getOrganizationConfigManager(String orgName) throws SMSException, SSOException
Returns theOrganizationConfigManager
for the given organization name. If theorgName
eithernull
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 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:
SMSException
SSOException
-
parseServicesFile
public Document parseServicesFile(InputStream xmlServiceSchema, AMEncryption decryptObj) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
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.xml
at 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()
Returnstrue
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
Returnstrue
if AMSDK IdRepo plugin is configured in any of the realms- Throws:
SMSException
-
isConfigMigratedTo70
public static boolean isConfigMigratedTo70()
Returnstrue
if configuration data has been migrated to Access Manager 7.0. Elsefalse
otherwise.- Returns:
true
if configuration data has been migrated to AM 7.0;false
otherwise
-
getVersions
protected static Set getVersions(SSOToken token, String serviceName) throws SMSException, SSOException
- Throws:
SMSException
SSOException
-
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:
SMSException
SSOException
-
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:
SMSException
SSOException
-
isAMSDKEnabled
public static boolean isAMSDKEnabled()
Returnstrue
if AMSDK IdRepo plugin is enabled/present in IdRepo Service Configuration schema
-
-