Package com.sun.identity.sm
Class ServiceConfig
java.lang.Object
com.sun.identity.sm.ServiceConfig
The class
ServiceConfig
provides interfaces to manage the
configuration information of a service configuration. It provides methods to
get and set configuration parameters for this service configuration.-
Constructor Summary
ModifierConstructorDescriptionprotected
ServiceConfig
(ServiceConfigManager scm, com.sun.identity.sm.ServiceConfigImpl sc) Protected constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String attrName, Set<String> values) Adds a configuration parameter to the service configuration.void
addExportedOrganizationNames
(Set<String> names) Adds the organization names to the list of organization names that can import this service configutation.void
addSubConfig
(String subConfigName, String subConfigId, int priority, org.forgerock.openam.sm.ConfigurationAttributes attrs) Adds a service sub-configuration with configuration parameters.void
addSubConfig
(String subConfigName, String subConfigId, int priority, org.forgerock.openam.sm.ConfigurationAttributes attrs, boolean isNewRealm) Adds a service sub-configuration with configuration parameters.void
addSubConfig
(String subConfigName, String subConfigId, org.forgerock.openam.sm.ConfigurationAttributes attrs) Adds a service sub-configuration with configuration parameters.void
checkAndCreateGroup
(String dn, String groupName, org.forgerock.openam.services.datastore.DataStoreId dataStoreId) void
deleteLabeledUri
(String luri) Deprecated.The labeledURI setting shall not be used for storing configuration data.boolean
exists()
Returnstrue
if the entry existorg.forgerock.openam.sm.ConfigurationAttributes
Returns a defensive copy of service configuration parameters.org.forgerock.openam.sm.ConfigurationAttributes
Returns the service configuration parameters for read only, modification cannot be performed on the returnMap
.org.forgerock.openam.sm.ConfigurationAttributes
Returns the service configuration parameters without inheriting the default values from service's schema.org.forgerock.openam.sm.ConfigurationAttributes
Returns the service configuration parameters for read only without inheriting the default values from service's schema.getAttributeValue
(String attributeName) Returns a service configuration parameter's values.Returns the service component name.getDN()
Returns the LDAP DN represented by thisServiceConfig
object.Returns the organization names to which the service configuration is being exported.getExportedSubConfigNames
(String serviceId) Returns a set of exported fully qualified sub-configuration names that can be imported used locally as service configurationDeprecated.The labeledURI setting shall not be used for storing configuration data.Returns the last modified time stamp of this configuration This method is expensive because it does not cache the modified time stamp but goes directly to the data store to obtain the value of this entrygetName()
Returns the service name.int
Returns the priority assigned to the service configuration.Returns the service component's schema ID.Returns the name of this service configuration.getSubConfig
(String subConfigName) Returns the service's sub-configuration given the service's sub-configuration name.getSubConfigEntity
(String entityName) Method to retrieve a single service sub-configuration entry by name.Returns the names of all service's sub-configurations.getSubConfigNames
(String pattern) Method to get names of service's sub-configurations that match the given pattern.getSubConfigNames
(String pattern, String schemaName) Method to get names of service's sub-configurations that match the given pattern and belongs to the specified service schema name.Returns the service versionvoid
importSubConfig
(String subConfigName, String exportedSubConfigName) Imports a service sub-configuration to the list of localy defined sub-configuration.boolean
isAttributePresentInSubConfigs
(String attributeName, String attributeValue, String... subSchemaNamesToSearchIn) Checks whether a config attribute value exists in any of thisServiceConfig
's sub-configurations.boolean
isValid()
Returns the status of this Service Configuration Object.boolean
isValid
(org.forgerock.openam.services.datastore.DataStoreId dataStoreId) Returns the status of this Service Configuration Object with a specific datastore.void
removeAttribute
(String attrName) Removes a configuration parameter from the service configuration.void
removeAttributes
(Set<String> attrNames) Removes a configuration parameters from the service configuration.void
removeAttributeValues
(String attrName, Set<String> values) Removes the specific values for the given configuration parameter.void
removeSharedOrganizationNames
(Set<String> names) Removes the organization names from the list of organization names that can import the service configuration.void
removeSubConfig
(String subConfigName) Removes the service sub-configuration.void
replaceAttributeValue
(String attrName, String oldValue, String newValue) Replaces old value of the configuration parameter with new value.void
Replaces the old values of the configuration parameter with the new values.void
setAttributes
(Map attrs) void
setAttributes
(org.forgerock.openam.sm.ConfigurationAttributes attrs) Sets the service configuration parameters.void
setExportedOrganizationNames
(Set<String> names) Sets the organization names that can import the service configuration.void
setLabeledUri
(String luri) Deprecated.The labeledURI setting shall not be used for storing configuration data.void
setPriority
(int priority) Sets the priority to the service configuration.toString()
Returns String representation of theServiceConfig
object.
-
Constructor Details
-
ServiceConfig
Protected constructor
-
-
Method Details
-
getServiceName
Returns the name of this service configuration.- Returns:
- the name of this service configuration
-
getVersion
Returns the service version- Returns:
- service version
-
getComponentName
Returns the service component name. It is "/" separated and the root component name is "/".- Returns:
- service component name
-
getName
Returns the service name.- Returns:
- service name
-
getSchemaID
Returns the service component's schema ID. For global and organization's root configurations it returns an empty string.- Returns:
- service component's schema ID
-
getPriority
public int getPriority()Returns the priority assigned to the service configuration.- Returns:
- the priority assigned to the service configuration
-
setPriority
Sets the priority to the service configuration.- Parameters:
priority
- the priority to be assigned to the configuration- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
getLabeledUri
Deprecated.The labeledURI setting shall not be used for storing configuration data.Returns the labeled uri assigned to the service configuration.- Returns:
- the labeled uri assigned to the service configuration
-
setLabeledUri
Deprecated.The labeledURI setting shall not be used for storing configuration data.Sets the labeled uri to the service configuration.- Parameters:
luri
- the labeled uri to be assigned to the configuration- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
deleteLabeledUri
Deprecated.The labeledURI setting shall not be used for storing configuration data.delete the labeled uri to the service configuration.- Parameters:
luri
- the labeled uri to be assigned to the configuration- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
getSubConfigNames
Returns the names of all service's sub-configurations.- Returns:
- set of names of all service's sub-configurations
- Throws:
SMSException
- if there is an error accessing the data store
-
getSubConfigNames
Method to get names of service's sub-configurations that match the given pattern.- Parameters:
pattern
- pattern to match for sub-configuration names- Returns:
- names of the service sub-configuration
- Throws:
SMSException
- if an error occurred while performing the operation.
-
getSubConfigNames
Method to get names of service's sub-configurations that match the given pattern and belongs to the specified service schema name.- Parameters:
pattern
- pattern to match for other entities.schemaName
- service schema name.- Returns:
- names of the service sub-configuration
- Throws:
SMSException
- if an error occurred while performing the operation.
-
getSubConfigEntity
Method to retrieve a single service sub-configuration entry by name. Avoids otherwise having to filter through a large list of entries using getSubConfigNames(String pattern)- Parameters:
entityName
- name to match for entity- Returns:
- Details of the entry found
- Throws:
SMSException
- if an error occurred while performing the operation
-
getExportedSubConfigNames
Returns a set of exported fully qualified sub-configuration names that can be imported used locally as service configuration- Parameters:
serviceId
- service schema identifier- Returns:
- names of fully qualified applicable service sub-configurations
- Throws:
SMSException
- if an error occurred while performing the operation.
-
getSubConfig
Returns the service's sub-configuration given the service's sub-configuration name.- Parameters:
subConfigName
- The name of the service's sub-configuration to retrieve.- Returns:
- The
ServiceConfig
object corresponding to the specified name of the service's sub-configuration. - Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
addSubConfig
public void addSubConfig(String subConfigName, String subConfigId, org.forgerock.openam.sm.ConfigurationAttributes attrs) throws SMSException, SSOException Adds a service sub-configuration with configuration parameters.- Parameters:
subConfigName
- the name of service sub-configuration to addsubConfigId
- type of service sub-configurationattrs
- configuration parameters for the sub-configuration- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
addSubConfig
public void addSubConfig(String subConfigName, String subConfigId, int priority, org.forgerock.openam.sm.ConfigurationAttributes attrs) throws SMSException, SSOException Adds a service sub-configuration with configuration parameters.- Parameters:
subConfigName
- the name of service sub-configuration to addsubConfigId
- type of service sub-configurationpriority
- the priority of the configurationattrs
- configuration parameters for the sub-configuration- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
addSubConfig
public void addSubConfig(String subConfigName, String subConfigId, int priority, org.forgerock.openam.sm.ConfigurationAttributes attrs, boolean isNewRealm) throws SMSException, SSOException Adds a service sub-configuration with configuration parameters.- Parameters:
subConfigName
- the name of service sub-configuration to addsubConfigId
- type of service sub-configurationpriority
- the priority of the configurationattrs
- configuration parameters for the sub-configurationisNewRealm
- indicates if the realm is being created- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
removeSubConfig
Removes the service sub-configuration.- Parameters:
subConfigName
- name of service sub-configuration to remove- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
importSubConfig
public void importSubConfig(String subConfigName, String exportedSubConfigName) throws SMSException, SSOException Imports a service sub-configuration to the list of localy defined sub-configuration. The imported sub-configuration name must be fully qualified, as obtained fromgetExportedSubConfigNames
.- Parameters:
subConfigName
- the name of service sub-configuration to add locallyexportedSubConfigName
- the fully qualified name of the exported sub-configuration name- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
getAttributes
public org.forgerock.openam.sm.ConfigurationAttributes getAttributes()Returns a defensive copy of service configuration parameters. The keys in theMap
contains the attribute names and their corresponding values in theMap
is aSet
that contains the values for the attribute. This method picks up the default values for any attributes not defined in theServiceConfig
. The default values for these attributes are picked up from the Service Schema. If there is no default value defined, then this method will still return the attribute-value pair, except that the Set will be a Collections.EMPTY_SET. This is distinct from a Set containing only one empty value. The latter represents an attribute whose value has been set to an empty value by the application using thesetAttributes()
method. In case the retrieved attributes are not modified by the caller, usegetAttributesForRead()
instead.- Returns:
- The
Map
where key is the attribute name and value is theSet
of attribute values.
-
getAttributeValue
Returns a service configuration parameter's values. The value is an immutableSet
that contains the values for the attribute.- Parameters:
attributeName
- The name of the attribute to return.- Returns:
- The immutable
Set
of attribute values. May be null if the attribute isn't defined.
-
getAttributesWithoutDefaults
public org.forgerock.openam.sm.ConfigurationAttributes getAttributesWithoutDefaults()Returns the service configuration parameters without inheriting the default values from service's schema. The keys in theMap
contains the attribute names and their corresponding values in theMap
is aSet
that contains the values for the attribute. -
getAttributesForRead
public org.forgerock.openam.sm.ConfigurationAttributes getAttributesForRead()Returns the service configuration parameters for read only, modification cannot be performed on the returnMap
. The keys in theMap
contains the attribute names and their corresponding values in theMap
is aSet
that contains the values for the attribute. This method picks up the default values for any attributes not defined in theServiceConfig
. The default values for these attributes are picked up from the Service Schema. If there is no default value defined, then this method will still return the attribute-value pair, except that the Set will be a Collections.EMPTY_SET. This is distinct from an empty Set with no entries in it. AN empty set represents an attribute whose value has been set to an empty value by the application using thesetAttributes()
method.- Returns:
- the
Map
where key is the attribute name and value is theSet
of attribute values
-
getAttributesWithoutDefaultsForRead
public org.forgerock.openam.sm.ConfigurationAttributes getAttributesWithoutDefaultsForRead()Returns the service configuration parameters for read only without inheriting the default values from service's schema. The keys in theMap
contains the attribute names and their corresponding values in theMap
is aSet
that contains the values for the attribute. -
setAttributes
public void setAttributes(org.forgerock.openam.sm.ConfigurationAttributes attrs) throws SMSException, SSOException Sets the service configuration parameters. The keys in theMap
contains the attribute names and their corresponding values in theMap
is aSet
that contains the values for the attribute. This method will replace the existing attribute values with the given one. For attributes that are not specified inattrs
, it will not be modified.- Parameters:
attrs
- theMap
where key is the attribute name and value is theSet
of attribute values- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
setAttributes
- Throws:
SMSException
SSOException
-
addAttribute
Adds a configuration parameter to the service configuration.- Parameters:
attrName
- the name of the attribute to addvalues
- the set of values to add- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
removeAttribute
Removes a configuration parameter from the service configuration.- Parameters:
attrName
- the name of the attribute to remove- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
removeAttributes
Removes a configuration parameters from the service configuration.- Parameters:
attrNames
-Set
of attribute names to remove- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
removeAttributeValues
public void removeAttributeValues(String attrName, Set<String> values) throws SMSException, SSOException Removes the specific values for the given configuration parameter.- Parameters:
attrName
- the name of the attributevalues
- set of attribute values to remove from the given attribute- Throws:
SMSException
- f there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
replaceAttributeValue
public void replaceAttributeValue(String attrName, String oldValue, String newValue) throws SMSException, SSOException Replaces old value of the configuration parameter with new value.- Parameters:
attrName
- the name of the attributeoldValue
- the old value to remove from the attributenewValue
- the new value to add to the attribute- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
replaceAttributeValues
public void replaceAttributeValues(String attrName, Set<String> oldValues, Set<String> newValues) throws SMSException, SSOException Replaces the old values of the configuration parameter with the new values.- Parameters:
attrName
- the name of the attributeoldValues
- the set of old values to remove from the attributenewValues
- the set of new values to add to the attribute- Throws:
SMSException
- if there is an error occurred while performing the operationSSOException
- if the user's single sign-on is invalid or expired
-
getDN
Returns the LDAP DN represented by thisServiceConfig
object.- Returns:
- the LDAP DN represented by this
ServiceConfig
object.
-
getLastModifiedTime
Returns the last modified time stamp of this configuration This method is expensive because it does not cache the modified time stamp but goes directly to the data store to obtain the value of this entry- Returns:
- The last modified time stamp as a string with the format of
yyyyMMddhhmmss
- Throws:
SMSException
- if there is an error trying to read from the data storeSSOException
- if the single sign-on token of the user is invalid.
-
getExportedOrganizationNames
Returns the organization names to which the service configuration is being exported. The organization names would be fully qualified starting with a forward slash "/". To specify an entire sub-tree that can use the service configuration, a "*" would have to be appended after the final forward slash. For example "/a/b/c/*" would imply all sub-organization under "/a/b/c" can use this service configuration. Exporting implies privileges to read the service configuration data, but not to modify or delete.- Returns:
- names of organizations to which service configuration configuration is exported
-
setExportedOrganizationNames
Sets the organization names that can import the service configuration. The organization names must be fully qualified, starting with a forward slash "/". To specify an entire sub-tree that can use the service configuration, a "*" would have to be appended after the final forward slash. For example "/a/b/c/*" would imply all sub-organization under "/a/b/c" can use this service configuration. Exporting implies privileges to read the service configuration data and not to modify or delete.- Parameters:
names
- names of the organizations that can import the service configuration- Throws:
SMSException
SSOException
-
addExportedOrganizationNames
Adds the organization names to the list of organization names that can import this service configutation. If one does not exist it will be created. The organization names must be fully qualified, starting with a forward slash "/". To specify an entire sub-tree that can use the service configuration, a "*" would have to be appended after the final forward slash. For example "/a/b/c/*" would imply all sub-organization under "/a/b/c" can use this service configuration. Exporting implies privileges to read the service configuration data and not to modify or delete.- Parameters:
names
- names of the organizations that can import the service configuration- Throws:
SMSException
SSOException
-
toString
Returns String representation of theServiceConfig
object. It returns attributes defined and sub configurations. -
checkAndCreateGroup
public void checkAndCreateGroup(String dn, String groupName, org.forgerock.openam.services.datastore.DataStoreId dataStoreId) throws SMSException, SSOException - Throws:
SMSException
SSOException
-
isValid
public boolean isValid()Returns the status of this Service Configuration Object. Must be used by classes that cache ServiceConfig.- Returns:
true
if this object is still valid.
-
isValid
public boolean isValid(org.forgerock.openam.services.datastore.DataStoreId dataStoreId) Returns the status of this Service Configuration Object with a specific datastore. Must be used by classes that cache ServiceConfig with knowledge of their datastore.- Returns:
true
if this object is still valid.
-
exists
public boolean exists()Returnstrue
if the entry exist -
toXML
public String toXML(String NodeTag, com.iplanet.services.util.AMEncryption encryptObj) throws SMSException, SSOException - Throws:
SMSException
SSOException
-
toXML
public String toXML(String NodeTag, com.iplanet.services.util.AMEncryption encryptObj, String orgName) throws SMSException, SSOException - Throws:
SMSException
SSOException
-
isAttributePresentInSubConfigs
public boolean isAttributePresentInSubConfigs(String attributeName, String attributeValue, String... subSchemaNamesToSearchIn) throws SMSException Checks whether a config attribute value exists in any of thisServiceConfig
's sub-configurations.- Parameters:
attributeName
- the attribute name to search for, cannot be blankattributeValue
- the attribute value to search for, cannot be blanksubSchemaNamesToSearchIn
- the schema names to look for the attribute in, if not provided will look in all sub-schemas- Returns:
true
if attribute value is found in any of theServiceConfig
's sub-configurations, otherwisefalse
- Throws:
SMSException
- if sub-configuration names cannot be retrieved from the data store
-