Package com.sun.identity.sm
Class ServiceSchemaManager
- java.lang.Object
-
- com.sun.identity.sm.ServiceSchemaManager
-
public class ServiceSchemaManager extends Object
The classServiceSchemaManagerprovides interfaces to manage the service's schema. It provides access toServiceSchema, which represents a single "schema" in the service.
-
-
Constructor Summary
Constructors Constructor Description ServiceSchemaManager(SSOToken token, String serviceName, String version)Creates an instance ofServiceSchemaManagerfor the given service and version pair.ServiceSchemaManager(String serviceName, SSOToken token)Constructor for service's schema manager to manage the attributes and sub configurations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddListener(ServiceListener listener)Registers for changes to service's schema.voidaddPluginInterface(String interfaceName, String interfaceClass, String i18nKey)Adds a new plugin interface objct to service's schema.booleanequals(Object o)Returns true if the given object equals this object.protected DocumentgetDocumentCopy()ServiceSchemagetDynamicSchema()Returns the dynamic service configuration schema.ServiceSchemagetGlobalSchema()Returns the global service configuration schema.StringgetI18NFileName()Returns the I18N properties file name for the service.StringgetI18NJarURL()Returns the URL of the JAR file that contains the I18N properties file.StringgetI18NKey()Returns i18nKey of the schema.StringgetLastModifiedTime()Returns the last modified time stamp of this service schema.StringgetName()Returns the name of the service.ServiceSchemagetOrganizationCreationSchema()Returns the organization creation configuration schema if present; else returnsnullServiceSchemagetOrganizationSchema()Returns the organization service configuration schema.PluginInterfacegetPluginInterface(String pluginInterfaceName)Returns thePluginInterfaceobject of the service for the specified plugin interface nameSetgetPluginInterfaceNames()Returns the names of the plugin interfaces used by the servicePluginSchemagetPluginSchema(String pluginSchemaName, String interfaceName, String orgName)Returns the PluginSchema object given the schema name and the interface name for the specified organization.SetgetPluginSchemaNames(String interfaceName, String orgName)Returns the names of plugins configured for the plugin interface.ServiceSchemagetPolicySchema()Returns the policy service configuration schema.StringgetPropertiesViewBeanURL()Returns URL of the view bean for the serviceStringgetResourceName()Returns the service's resource name for CREST representation, or the service name if a resource name is not defined.intgetRevisionNumber()iPlanet_PUBLIC-METHOD Returns the revision number of the service schema.InputStreamgetSchema()Returns the service schema in XML for this service.ServiceSchemagetSchema(SchemaType type)Returns the configuration schema for the given schema typeServiceSchemagetSchema(String type)Returns the configuration schema for the given schema typeSet<SchemaType>getSchemaTypes()Returns the schema types available with this service.SetgetServiceAttributeNames(SchemaType type)Returns the attribute schemas for the given schema type excluding status and service identifier attributes.StringgetServiceHierarchy()Returns the service's hierarchy.ServiceSchemagetUserSchema()Returns the user service configuration schema.StringgetVersion()Returns the version of the service.inthashCode()booleanisSSOTokenValid()Returns true if admin token cached within this class is valid<E extends Exception>
voidmodifySchema(org.forgerock.util.Function<Document,Boolean,E> modifier)voidremoveListener(String listenerID)Removes the listener from the service for the given listener ID.voidremovePluginInterface(String interfacename)Removes the plugin interface object from the service schema.voidreplaceSchema(InputStream xmlServiceSchema)Replaces the existing service schema with the given schema defined by the XML input stream that follows the SMS DTD.protected voidreplaceSchema(Document document)voidsetI18NFileName(String url)Sets the I18N properties file name for the servicevoidsetI18NJarURL(String url)Sets the URL of the JAR file that contains the I18N propertiesvoidsetI18NKey(String i18nKey)Sets the i18nKey of the schema.voidsetPropertiesViewBeanURL(String url)Sets the URL of the view bean for the service.voidsetResourceName(String name)Sets the service's resource name for CREST representation.voidsetRevisionNumber(int revisionNumber)iPlanet_PUBLIC-METHOD Sets the revision number for the service schema.voidsetServiceHierarchy(String newhierarchy)Sets the service's hierarchyStringtoString()Returns the string representation of the Service Schema.StringtoXML(AMEncryption encryptObj)
-
-
-
Constructor Detail
-
ServiceSchemaManager
public ServiceSchemaManager(String serviceName, SSOToken token) throws SMSException, SSOException
Constructor for service's schema manager to manage the attributes and sub configurations. Assumes service version number to be1.0 .- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
ServiceSchemaManager
public ServiceSchemaManager(SSOToken token, String serviceName, String version) throws SMSException, SSOException
Creates an instance ofServiceSchemaManagerfor the given service and version pair. It requires an user identity, that will used to perform operations with. It is assumed that the application calling this constructor should authenticate the user.- Parameters:
token- single sign on token of the user identity on whose behalf the operations are performed.serviceName- the name of the service.version- the version of the service.- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
-
Method Detail
-
getName
public String getName()
Returns the name of the service.- Returns:
- the name of the service
-
getVersion
public String getVersion()
Returns the version of the service.- Returns:
- the version of the service
-
getI18NFileName
public String getI18NFileName()
Returns the I18N properties file name for the service.- Returns:
- the I18N properties file name for the service
-
setI18NFileName
public void setI18NFileName(String url) throws SMSException, SSOException
Sets the I18N properties file name for the service- Parameters:
url- properties file name- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
getI18NJarURL
public String getI18NJarURL()
Returns the URL of the JAR file that contains the I18N properties file. The method could return null, in which case the properties file should be inCLASSPATH.- Returns:
- the URL of the JAR file containing the
I18Nproperties file.
-
setI18NJarURL
public void setI18NJarURL(String url) throws SMSException, SSOException
Sets the URL of the JAR file that contains the I18N properties- Parameters:
url- URL- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
getServiceHierarchy
public String getServiceHierarchy()
Returns the service's hierarchy.- Returns:
- service hierarchy in slash format.
-
setServiceHierarchy
public void setServiceHierarchy(String newhierarchy) throws SMSException, SSOException
Sets the service's hierarchy- Parameters:
newhierarchy- service hierarchy- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
getI18NKey
public String getI18NKey()
Returns i18nKey of the schema.- Returns:
- i18nKey of the schema.
-
setI18NKey
public void setI18NKey(String i18nKey) throws SMSException, SSOException
Sets the i18nKey of the schema.- Parameters:
i18nKey-i18nKeyof the schema.- Throws:
SMSException- if an error occurred while trying to perform the operation.SSOException- if the single sign on token is invalid or expired.
-
getPropertiesViewBeanURL
public String getPropertiesViewBeanURL()
Returns URL of the view bean for the service- Returns:
- URL for view bean
-
setPropertiesViewBeanURL
public void setPropertiesViewBeanURL(String url) throws SMSException, SSOException
Sets the URL of the view bean for the service.- Parameters:
url- of the view bean for the service.- Throws:
SMSException- if an error occurred while trying to perform the operation.SSOException- if the single sign on token is invalid or expired.
-
getResourceName
public String getResourceName()
Returns the service's resource name for CREST representation, or the service name if a resource name is not defined.
-
setResourceName
public void setResourceName(String name) throws SMSException, SSOException
Sets the service's resource name for CREST representation.- Parameters:
name- resource name for CREST representation- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expired
-
getRevisionNumber
public int getRevisionNumber()
iPlanet_PUBLIC-METHOD Returns the revision number of the service schema.- Returns:
- the revision number of the service schema
-
setRevisionNumber
public void setRevisionNumber(int revisionNumber) throws SMSException, SSOExceptioniPlanet_PUBLIC-METHOD Sets the revision number for the service schema.- Parameters:
revisionNumber- revision number 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.
-
getSchemaTypes
public Set<SchemaType> getSchemaTypes() throws SMSException
Returns the schema types available with this service.- Returns:
- set of
SchemaTypesin this service. - Throws:
SMSException- if an error occurred while trying to perform the operation
-
getSchema
public ServiceSchema getSchema(String type) throws SMSException
Returns the configuration schema for the given schema type- Parameters:
type- schema type.- Returns:
- service schema.
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getSchema
public ServiceSchema getSchema(SchemaType type) throws SMSException
Returns the configuration schema for the given schema type- Parameters:
type- schema type.- Returns:
- service schema.
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getOrganizationCreationSchema
public ServiceSchema getOrganizationCreationSchema() throws SMSException
Returns the organization creation configuration schema if present; else returnsnull- Returns:
- service schema.
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getServiceAttributeNames
public Set getServiceAttributeNames(SchemaType type) throws SMSException
Returns the attribute schemas for the given schema type excluding status and service identifier attributes.- Parameters:
type- schema type.- Returns:
- service schema.
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getGlobalSchema
public ServiceSchema getGlobalSchema() throws SMSException
Returns the global service configuration schema.- Returns:
- the global service configuration schema
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getOrganizationSchema
public ServiceSchema getOrganizationSchema() throws SMSException
Returns the organization service configuration schema.- Returns:
- the organization service configuration schema
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getDynamicSchema
public ServiceSchema getDynamicSchema() throws SMSException
Returns the dynamic service configuration schema.- Returns:
- the dynamic service configuration schema
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getUserSchema
public ServiceSchema getUserSchema() throws SMSException
Returns the user service configuration schema.- Returns:
- the user service configuration schema
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getPolicySchema
public ServiceSchema getPolicySchema() throws SMSException
Returns the policy service configuration schema.- Returns:
- the policy service configuration schema
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
getSchema
public InputStream getSchema() throws SMSException
Returns the service schema in XML for this service.- Returns:
- the service schema in XML for this service
- Throws:
SMSException- if an error occurred while trying to perform the operation
-
replaceSchema
public void replaceSchema(InputStream xmlServiceSchema) throws SSOException, SMSException, IOException
Replaces the existing service schema with the given schema defined by the XML input stream that follows the SMS DTD.- Parameters:
xmlServiceSchema- the XML format of the service schema- Throws:
SMSException- if an error occurred while trying to perform the operationSSOException- if the single sign on token is invalid or expiredIOException- if an error occurred with theInputStream
-
equals
public boolean equals(Object o)
Returns true if the given object equals this object.
-
toString
public String toString()
Returns the string representation of the Service Schema.
-
addListener
public String addListener(ServiceListener listener)
Registers for changes to service's schema. The object will be called when schema for this service and version is changed.- Parameters:
listener- callback object that will be invoked when schema changes.- Returns:
- an ID of the registered listener.
-
removeListener
public void removeListener(String listenerID)
Removes the listener from the service for the given listener ID. The ID was issued when the listener was registered.- Parameters:
listenerID- the listener ID issued when the listener was registered
-
getLastModifiedTime
public String getLastModifiedTime() throws SMSException, SSOException
Returns the last modified time stamp of this service schema. 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 datastore.SSOException- if the single sign-on token of the user is invalid.
-
getPluginInterfaceNames
public Set getPluginInterfaceNames()
Returns the names of the plugin interfaces used by the service- Returns:
- service's plugin interface names
-
getPluginInterface
public PluginInterface getPluginInterface(String pluginInterfaceName)
Returns thePluginInterfaceobject of the service for the specified plugin interface name- Parameters:
pluginInterfaceName- name of the plugin interface- Returns:
- plugin interface configured for the service; else
null
-
addPluginInterface
public void addPluginInterface(String interfaceName, String interfaceClass, String i18nKey) throws SMSException, SSOException
Adds a new plugin interface objct to service's schema.- Parameters:
interfaceName- name for the plugin interfaceinterfaceClass- fully qualified interface class namei18nKey- I18N key that will by used by UI to get messages to display the interface name- Throws:
SMSExceptionSSOException
-
removePluginInterface
public void removePluginInterface(String interfacename) throws SMSException, SSOException
Removes the plugin interface object from the service schema.- Parameters:
interfacename- Name of the plugin class.- Throws:
SMSExceptionSSOException
-
getPluginSchemaNames
public Set getPluginSchemaNames(String interfaceName, String orgName) throws SMSException
Returns the names of plugins configured for the plugin interface. If organization isnull, returns the plugins configured for the "root" organization.- Throws:
SMSException
-
getPluginSchema
public PluginSchema getPluginSchema(String pluginSchemaName, String interfaceName, String orgName) throws SMSException
Returns the PluginSchema object given the schema name and the interface name for the specified organization. If organization isnull, returns the PluginSchema for the "root" organization.- Throws:
SMSException
-
isSSOTokenValid
public boolean isSSOTokenValid()
Returns true if admin token cached within this class is valid- Returns:
- true is admin token is valid
-
getDocumentCopy
protected Document getDocumentCopy() throws SMSException
- Throws:
SMSException
-
replaceSchema
protected void replaceSchema(Document document) throws SSOException, SMSException
- Throws:
SSOExceptionSMSException
-
modifySchema
public <E extends Exception> void modifySchema(org.forgerock.util.Function<Document,Boolean,E> modifier) throws E extends Exception, SMSException, SSOException
- Throws:
E extends ExceptionSMSExceptionSSOException
-
toXML
public String toXML(AMEncryption encryptObj) throws SMSException
- Throws:
SMSException
-
-