Package com.sun.identity.sm
Class ServiceConfig
- java.lang.Object
-
- com.sun.identity.sm.ServiceConfig
-
public class ServiceConfig extends Object
The classServiceConfigprovides 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
Constructors Modifier Constructor Description protectedServiceConfig(ServiceConfigManager scm, com.sun.identity.sm.ServiceConfigImpl sc)Protected constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAttribute(String attrName, Set values)Adds a configuration parameter to the service configuration.voidaddExportedOrganizationNames(Set names)Adds the organization names to the list of organization names that can import this service configutation.voidaddSubConfig(String subConfigName, String subConfigId, int priority, Map attrs)Adds a service sub-configuration with configuration parameters.voidcheckAndCreateGroup(String dn, String groupName)voiddeleteLabeledUri(String luri)Deprecated.The labeledURI setting shall not be used for storing configuration data.booleanexists()Returnstrueif the entry existMap<String,Set<String>>getAttributes()Returns the service configuration parameters.Map<String,Set<String>>getAttributesForRead()Returns the service configuration parameters for read only, modification cannot be performed on the returnMap.MapgetAttributesWithoutDefaults()Returns the service configuration parameters without inheriting the default values from service's schema.Map<String,Set<String>>getAttributesWithoutDefaultsForRead()Returns the service configuration parameters for read only without inheriting the default values from service's schema.StringgetComponentName()Returns the service component name.StringgetDN()Returns the LDAP DN represented by thisServiceConfigobject.SetgetExportedOrganizationNames()Returns the organization names to which the service configuration is being exported.SetgetExportedSubConfigNames(String serviceId)Returns a set of exported fully qualified sub-configuration names that can be imported used locally as service configurationStringgetLabeledUri()Deprecated.The labeledURI setting shall not be used for storing configuration data.StringgetLastModifiedTime()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 entryStringgetName()Returns the service name.intgetPriority()Returns the priority assigned to the service configuration.StringgetSchemaID()Returns the service component's schema ID.StringgetServiceName()Returns the name of this service configuration.ServiceConfiggetSubConfig(String subConfigName)Returns the service's sub-configuration given the service's sub-configuration name.Set<String>getSubConfigNames()Returns the names of all service's sub-configurations.Set<String>getSubConfigNames(String pattern)Method to get names of service's sub-configurations that match the given pattern.Set<String>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.StringgetVersion()Returns the service versionvoidimportSubConfig(String subConfigName, String exportedSubConfigName)Imports a service sub-configuration to the list of localy defined sub-configuration.booleanisValid()Returns the status of this Service Configuration Object.voidremoveAttribute(String attrName)Removes a configuration parameter from the service configuration.voidremoveAttributes(Set attrNames)Removes a configuration parameters from the service configuration.voidremoveAttributeValues(String attrName, Set values)Removes the specific values for the given configuration parameter.voidremoveSharedOrganizationNames(Set names)Removes the organization names from the list of organization names that can import the service configuration.voidremoveSubConfig(String subConfigName)Removes the service sub-configuration.voidreplaceAttributeValue(String attrName, String oldValue, String newValue)Replaces old value of the configuration parameter with new value.voidreplaceAttributeValues(String attrName, Set oldValues, Set newValues)Replaces the old values of the configuration parameter with the new values.voidsetAttributes(Map attrs)Sets the service configuration parameters.voidsetExportedOrganizationNames(Set names)Sets the organization names that can import the service configuration.voidsetLabeledUri(String luri)Deprecated.The labeledURI setting shall not be used for storing configuration data.voidsetPriority(int priority)Sets the priority to the service configuration.StringtoString()Returns String representation of theServiceConfigobject.StringtoXML(String NodeTag, AMEncryption encryptObj)StringtoXML(String NodeTag, AMEncryption encryptObj, String orgName)
-
-
-
Constructor Detail
-
ServiceConfig
protected ServiceConfig(ServiceConfigManager scm, com.sun.identity.sm.ServiceConfigImpl sc) throws SMSException, SSOException
Protected constructor- Throws:
SMSExceptionSSOException
-
-
Method Detail
-
getServiceName
public String getServiceName()
Returns the name of this service configuration.- Returns:
- the name of this service configuration
-
getVersion
public String getVersion()
Returns the service version- Returns:
- service version
-
getComponentName
public String getComponentName()
Returns the service component name. It is "/" separated and the root component name is "/".- Returns:
- service component name
-
getName
public String getName()
Returns the service name.- Returns:
- service name
-
getSchemaID
public String 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
public void setPriority(int priority) throws SSOException, SMSExceptionSets 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
public String 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
public void setLabeledUri(String luri) throws SSOException, SMSException
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
public void deleteLabeledUri(String luri) throws SSOException, SMSException
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
public Set<String> getSubConfigNames() throws SMSException
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
public Set<String> getSubConfigNames(String pattern) throws SMSException
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
public Set<String> getSubConfigNames(String pattern, String schemaName) throws SMSException
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.
-
getExportedSubConfigNames
public Set getExportedSubConfigNames(String serviceId) throws SMSException
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
public ServiceConfig getSubConfig(String subConfigName) throws SSOException, SMSException
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
ServiceConfigobject 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, int priority, Map 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
-
removeSubConfig
public void removeSubConfig(String subConfigName) throws SMSException, SSOException
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 Map<String,Set<String>> getAttributes()
Returns the service configuration parameters. The keys in theMapcontains the attribute names and their corresponding values in theMapis aSetthat 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
Mapwhere key is the attribute name and value is theSetof attribute values
-
getAttributesWithoutDefaults
public Map getAttributesWithoutDefaults()
Returns the service configuration parameters without inheriting the default values from service's schema. The keys in theMapcontains the attribute names and their corresponding values in theMapis aSetthat contains the values for the attribute.
-
getAttributesForRead
public Map<String,Set<String>> getAttributesForRead()
Returns the service configuration parameters for read only, modification cannot be performed on the returnMap. The keys in theMapcontains the attribute names and their corresponding values in theMapis aSetthat 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
Mapwhere key is the attribute name and value is theSetof attribute values
-
getAttributesWithoutDefaultsForRead
public Map<String,Set<String>> getAttributesWithoutDefaultsForRead()
Returns the service configuration parameters for read only without inheriting the default values from service's schema. The keys in theMapcontains the attribute names and their corresponding values in theMapis aSetthat contains the values for the attribute.
-
setAttributes
public void setAttributes(Map attrs) throws SMSException, SSOException
Sets the service configuration parameters. The keys in theMapcontains the attribute names and their corresponding values in theMapis aSetthat 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- theMapwhere key is the attribute name and value is theSetof 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
-
addAttribute
public void addAttribute(String attrName, Set values) throws SMSException, SSOException
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
public void removeAttribute(String attrName) throws SMSException, SSOException
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
public void removeAttributes(Set attrNames) throws SMSException, SSOException
Removes a configuration parameters from the service configuration.- Parameters:
attrNames-Setof 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 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- if 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 oldValues, Set 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
public String getDN()
Returns the LDAP DN represented by thisServiceConfigobject.- Returns:
- the LDAP DN represented by this
ServiceConfigobject.
-
getLastModifiedTime
public String getLastModifiedTime() throws SMSException, SSOException
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
public Set 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
public void setExportedOrganizationNames(Set names) throws SMSException, SSOException
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:
SMSExceptionSSOException
-
addExportedOrganizationNames
public void addExportedOrganizationNames(Set names) throws SMSException, SSOException
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:
SMSExceptionSSOException
-
removeSharedOrganizationNames
public void removeSharedOrganizationNames(Set names) throws SMSException, SSOException
Removes the organization names from the list of organization names that can import the service configuration. If the organization has already imported the service configutation, it would have to be undone before the organization name can be removed from the list. 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.- Parameters:
names- names of the organizations that will be removed from the list of organization names that can import the service configutation- Throws:
SMSExceptionSSOException
-
toString
public String toString()
Returns String representation of theServiceConfigobject. It returns attributes defined and sub configurations.
-
checkAndCreateGroup
public void checkAndCreateGroup(String dn, String groupName) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
isValid
public boolean isValid()
Returns the status of this Service Configuration Object. Must be used by classes that cache ServiceConfig.- Returns:
trueif this object is still valid.
-
exists
public boolean exists()
Returnstrueif the entry exist
-
toXML
public String toXML(String NodeTag, AMEncryption encryptObj) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
toXML
public String toXML(String NodeTag, AMEncryption encryptObj, String orgName) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
-