com.sun.identity.sm
Class ServiceSchema

java.lang.Object
  |
  +--com.sun.identity.sm.ServiceSchema

public class ServiceSchema
extends java.lang.Object

The class ServiceSchema provides interfaces to manage the schema information of a service. The schema for a service can be one of the following types: GLOBAL, ORGANIZATION, DYNAMIC, USER, and POLICY.


Method Summary
 void addAttributeSchema(java.io.InputStream xmlAttrSchema)
          Adds the attribute schema to this service.
 void addSubSchema(java.io.InputStream xmlSubSchema)
          Adds the service's sub-schema given the XML input stream that follows the SMS DTD.
 java.util.Map getAttributeDefaults()
          Returns a map of all the attribute and their default values in this schema.
 AttributeSchema getAttributeSchema(java.lang.String attributeName)
          Returns the schema for an attribute given the name of the attribute, defined for this service.
 java.util.Set getAttributeSchemaNames()
          Returns the names of the schema attributes defined for the service.
 java.util.Set getAttributeSchemas()
          Returns the attribute schemas defined for the service.
 java.lang.String getI18NFileName()
          Returns the I18N properties file name for the service schema.
 java.lang.String getI18NKey()
          Returns the I18N key that points to the description of the service.
 java.lang.String getName()
          Returns the name of the schema.
 java.lang.String getPropertiesViewBeanURL()
          Returns the view bean URL for this service
 java.util.Map getReadOnlyAttributeDefaults()
          Returns an unmodifiable map of all the attribute and their default values in this schema.
 org.w3c.dom.Node getSchemaNode()
          Returns the Node of this schema element.
 java.util.Set getServiceAttributeNames()
          Returns the attribute schemas defined for the service that is not a status attribute and is not a service attribute.
 java.lang.String getServiceName()
          Returns the name of the service.
 SchemaType getServiceType()
          Returns the schema type.
 java.lang.String getStatusAttribute()
          Returns the name of the status attribute, as defined in the Service schema
 ServiceSchema getSubSchema(java.lang.String subSchemaName)
          Returns ServiceSchema object given the name of the service's sub-schema.
 java.util.Set getSubSchemaNames()
          Returns the names of sub-schemas for the service.
 java.lang.String getVersion()
          Returns the version of the service.
 boolean isExportable()
          Returns true if the service configuration created can be exported to other organizations.
 void removeAttributeDefaults(java.util.Set attrs)
          Removes the default values of attributes in the schema.
 void removeAttributeSchema(java.lang.String attrName)
          Removes the attribute schema from this service.
 void removeSubSchema(java.lang.String subSchemaName)
          Removes the service's sub-schema from the service.
 void setAttributeDefaults(java.util.Map attrs)
          Method to change the default values of attributes in the schema.
 void setAttributeDefaults(java.lang.String attrName, java.util.Set values)
          Method to change default value for a specific attribute.
 void setExportable(boolean exportable)
          Sets the exportable nature of the service configurations created for this schema.
 void setI18NFileName(java.lang.String url)
          Sets the I18N properties file name for the service schema
 void setI18Nkey(java.lang.String key)
          Sets the value of the I18N key in the service schema.
 void setInheritance(java.lang.String value)
          Set the value of inheritance attribute in service schema.
 boolean supportsMultipleConfigurations()
          Returns true if service schema supports multiple configurations; false otherwise
 java.lang.String toString()
          Returns string representation of the schema.
 java.util.Map validateAndInheritDefaults(java.util.Map attrMap, boolean inherit)
          Validates the attrMap against the attributes defined in this schema of the service.
 java.util.Map validateAndInheritDefaults(java.util.Map attrMap, java.lang.String orgName, boolean inherit)
          Validates the attrMap against the attributes defined in this schema of the service for the given organization.
 boolean validateAttributes(java.util.Map attributeSet)
          Determines whether each attribute in the attribute set is valid.
 boolean validateAttributes(java.util.Map attributeSet, java.lang.String orgName)
          Determines whether each attribute in the attribute set is valid for the given organization.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getServiceName

public java.lang.String getServiceName()
Returns the name of the service.
Returns:
the name of the schema

getVersion

public java.lang.String getVersion()
Returns the version of the service.
Returns:
version of the service schema

getName

public java.lang.String getName()
Returns the name of the schema.
Returns:
the name of the schema

getServiceType

public SchemaType getServiceType()
Returns the schema type.
Returns:
the schema type.

getI18NKey

public java.lang.String getI18NKey()
Returns the I18N key that points to the description of the service.
Returns:
the I18N key that points to the description of the service

supportsMultipleConfigurations

public boolean supportsMultipleConfigurations()
Returns true if service schema supports multiple configurations; false otherwise
Returns:
true if service schema supports multiple configurations; false otherwise

setI18Nkey

public void setI18Nkey(java.lang.String key)
                throws SMSException,
                       SSOException
Sets the value of the I18N key in the service schema.
Parameters:
key - Value to be set for the I18N key of the service schema.
Throws:
SMSException - if there is a problem setting the value in the data store.
SSOException - If the user has an invalid SSO token.

setInheritance

public void setInheritance(java.lang.String value)
                    throws SMSException,
                           SSOException
Set the value of inheritance attribute in service schema.
Parameters:
value - New value of inheritance attribute.
Throws:
SMSException - if there is a problem setting the value in the data store.
SSOException - if the user has an invalid single sign on token.

getPropertiesViewBeanURL

public java.lang.String getPropertiesViewBeanURL()
Returns the view bean URL for this service
Returns:
file name that contains I18N messages

getStatusAttribute

public java.lang.String getStatusAttribute()
Returns the name of the status attribute, as defined in the Service schema
Returns:
String name of status attribute

isExportable

public boolean isExportable()
Returns true if the service configuration created can be exported to other organizations.
Returns:
true if service configurations for this schema can be exported to other organizations; false otherwise.

setExportable

public void setExportable(boolean exportable)
Sets the exportable nature of the service configurations created for this schema. Setting it to true allows the configurations to be exported to other organizations and a value of false disables exporting of configuration data.
Parameters:
exportable - true if service configurations for this schema can be exported to other organizations; false otherwise.

getI18NFileName

public java.lang.String getI18NFileName()
Returns the I18N properties file name for the service schema.
Returns:
the I18N properties file name for the service schema

setI18NFileName

public void setI18NFileName(java.lang.String url)
                     throws SMSException,
                            SSOException
Sets the I18N properties file name for the service schema
Parameters:
url - properties file name
Throws:
SMSException - if an error occurred while trying to perform the operation
SSOException - if the single sign on token is invalid or expired

getAttributeSchemaNames

public java.util.Set getAttributeSchemaNames()
Returns the names of the schema attributes defined for the service. It does not return the schema attributes defined for the sub-schema.
Returns:
the names of schema attributes defined for the service

getAttributeSchema

public AttributeSchema getAttributeSchema(java.lang.String attributeName)
Returns the schema for an attribute given the name of the attribute, defined for this service. It returns only the attribute schema defined at the top level for the service and not from the sub-schema.
Parameters:
attributeName - the name of the schema attribute
Returns:
the schema for the attribute

getAttributeSchemas

public java.util.Set getAttributeSchemas()
Returns the attribute schemas defined for the service. It does not return the schema attributes defined for the sub-schema.
Returns:
attribute schemas defined for the service

getServiceAttributeNames

public java.util.Set getServiceAttributeNames()
Returns the attribute schemas defined for the service that is not a status attribute and is not a service attribute. It does not return the schema attributes defined for the sub-schema.
Returns:
attribute schemas defined for the service

validateAndInheritDefaults

public java.util.Map validateAndInheritDefaults(java.util.Map attrMap,
                                                boolean inherit)
                                         throws SMSException
Validates the attrMap against the attributes defined in this schema of the service. It will throw an exception if the map contains any attribute not listed in the schema. It will also pick up default values for any attributes not in the map but which are listed in the schema, if the boolean inherit is set to true.
Parameters:
attrMap - map of attributes
inherit - if true, then inherit the default values
Returns:
Map of validated attributes with default values
Throws:
SMSException - if invalid attribute names are present in the attrMap.

validateAndInheritDefaults

public java.util.Map validateAndInheritDefaults(java.util.Map attrMap,
                                                java.lang.String orgName,
                                                boolean inherit)
                                         throws SMSException
Validates the attrMap against the attributes defined in this schema of the service for the given organization. It will throw an exception if the map contains any attribute not listed in the schema. It will also pick up default values for any attributes not in the map but which are listed in the schema, if the boolean inherit is set to true.
Parameters:
attrMap - map of attributes
inherit - if true, then inherit the default values
Returns:
Map of validated attributes with default values
Throws:
SMSException - if invalid attribute names are present in the attrMap.

addAttributeSchema

public void addAttributeSchema(java.io.InputStream xmlAttrSchema)
                        throws SSOException,
                               SMSException
Adds the attribute schema to this service. The schema is defined in XML input stream that follows the SMS DTD.
Parameters:
xmlAttrSchema - the XML format of the attribute schema
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

removeAttributeSchema

public void removeAttributeSchema(java.lang.String attrName)
                           throws SSOException,
                                  SMSException
Removes the attribute schema from this service.
Parameters:
attrName - the name of the attribute schema
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

getAttributeDefaults

public java.util.Map getAttributeDefaults()
Returns a map of all the attribute and their default values in this schema.
Returns:
Map of Attribute Names and Sets of their default values as defined in the Schema

getReadOnlyAttributeDefaults

public java.util.Map getReadOnlyAttributeDefaults()
Returns an unmodifiable map of all the attribute and their default values in this schema.
Returns:
Map of Attribute Names and Sets of their default values as defined in the Schema

setAttributeDefaults

public void setAttributeDefaults(java.util.Map attrs)
                          throws SSOException,
                                 SMSException
Method to change the default values of attributes in the schema.
Parameters:
attrs - A map of the names of AttributeSchema to modify, and a Set of Values which should replace the default values of the current schema.
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

setAttributeDefaults

public void setAttributeDefaults(java.lang.String attrName,
                                 java.util.Set values)
                          throws SchemaException,
                                 SMSException,
                                 SSOException
Method to change default value for a specific attribute.
Parameters:
attrName - Name of the attribute for which defaults values need to be replaced.
values - Set of new values to replace the old ones.
Throws:
SchemaException - if an error occurred while parsing the XML
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

removeAttributeDefaults

public void removeAttributeDefaults(java.util.Set attrs)
                             throws SMSException,
                                    SSOException
Removes the default values of attributes in the schema.
Parameters:
attrs - A set of the names of AttributeSchema.
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

getSubSchemaNames

public java.util.Set getSubSchemaNames()
Returns the names of sub-schemas for the service.
Returns:
the names of service's sub-schemas

getSubSchema

public ServiceSchema getSubSchema(java.lang.String subSchemaName)
                           throws SMSException
Returns ServiceSchema object given the name of the service's sub-schema.
Parameters:
subSchemaName - the name of the service's sub-schema
Returns:
ServiceSchema object
Throws:
SMSException - if an error occurred while performing the operation

addSubSchema

public void addSubSchema(java.io.InputStream xmlSubSchema)
                  throws SSOException,
                         SMSException
Adds the service's sub-schema given the XML input stream that follows the SMS DTD.
Parameters:
xmlSubSchema - the XML format of the sub-schema
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

removeSubSchema

public void removeSubSchema(java.lang.String subSchemaName)
                     throws SSOException,
                            SMSException
Removes the service's sub-schema from the service.
Parameters:
subSchemaName - the name of the service's sub-schema
Throws:
SMSException - if an error occurred while performing the operation
SSOException - if the single sign on token is invalid or expired

validateAttributes

public boolean validateAttributes(java.util.Map attributeSet)
                           throws SMSException
Determines whether each attribute in the attribute set is valid. Iterates though the set checking each element to see if there is a validator that needs to execute.
Parameters:
attributeSet - the Map where key is the attribute name and value is the Set of attribute values
Returns:
true if all attributes are valid
Throws:
SMSException - if an error occurred while performing the operation

validateAttributes

public boolean validateAttributes(java.util.Map attributeSet,
                                  java.lang.String orgName)
                           throws SMSException
Determines whether each attribute in the attribute set is valid for the given organization. Iterates though the set checking each element to see if there is a validator that needs to execute.
Parameters:
attributeSet - the Map where key is the attribute name and value is the Set of attribute values
orgName - organization name
Returns:
true if all attributes are valid
Throws:
SMSException - if an error occurred while performing the operation

toString

public java.lang.String toString()
Returns string representation of the schema.
Overrides:
toString in class java.lang.Object
Returns:
string representation of the schema.

getSchemaNode

public org.w3c.dom.Node getSchemaNode()
Returns the Node of this schema element. Used by Policy component's ServiceType to get ActionSchema.
Returns:
the Node of this schema element. Used by Policy component's ServiceType to get ActionSchema.


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.