com.sun.identity.sm
Class OrganizationConfigManager

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

public class OrganizationConfigManager
extends java.lang.Object

The class OrganizationConfigManager provides interfaces to manage an organization's configuration data. It provides interfaces to create and delete organizations, service attributes for organizations and service configuration parameters.

The organization configuration can be managed in a hierarchical manner, and a forward slash "/" will be used to separate the name hierarchy. Hence the root of the organization hierarchy will be represented by a single forward slash "/", and sub-organizations will be separated by "/". For example "/a/b/c" would represent a "c" sub-organization within "b" which would be a sub-organization of "a".


Constructor Summary
OrganizationConfigManager(SSOToken token, java.lang.String orgName)
          Constructor to obtain an instance of OrganizationConfigManager for an organization by providing an authenticated identity of the user.
 
Method Summary
 void addAttributeValues(java.lang.String serviceName, java.lang.String attrName, java.util.Set values)
          Adds organization attributes for the service.
 java.lang.String addListener(ServiceListener listener)
          Registers for changes to organization's configuration.
 ServiceConfig addServiceConfig(java.lang.String serviceName, java.util.Map attributes)
          Adds a service configuration object for the given service name for this organization.
 void assignService(java.lang.String serviceName, java.util.Map attributes)
          Assigns the given service to the orgnization with the respective attributes.
 OrganizationConfigManager createSubOrganization(java.lang.String subOrgName, java.util.Map attributes)
          Creates a sub-organization under the current organization and sets the specified attributes.
 void deleteSubOrganization(java.lang.String subOrgName, boolean recursive)
          Deletes the given sub-organization.
 java.util.Set getAssignableServices()
          Returns a set of service names that can be assigned to a realm.
 java.util.Set getAssignedServices()
          Returns a set of service names that are assigned to a realm.
 java.util.Set getAssignedServices(boolean includeMandatory)
          Returns a set of service names that are assigned to a realm.
 java.util.Map getAttributes(java.lang.String serviceName)
          Returns the organization creation attributes for the service.
 java.util.Set getConfiguredServices()
          Deprecated. This method has been deprecated, use getAssignedServices() instead.
 java.lang.String getNamingAttrForOrg()
           
 java.lang.String getOrganizationName()
          Returns the fully qualified name of the organization from the root
 OrganizationConfigManager getParentOrgConfigManager()
          Returns the OrganizationConfigManager of the parent for the given organization name.
 java.util.Set getPeerOrganizationNames()
          Returns the names of all peer-organizations.
 java.util.Map getServiceAttributes(java.lang.String serviceName)
          Returns attributes configured for the service.
 ServiceConfig getServiceConfig(java.lang.String serviceName)
          Returns the service configuration object for the given service name.
 java.util.Set getServiceSchemas()
          Returns a set of service schemas to be used for creation of an organization.
 java.util.Set getSubOrganizationNames()
          Returns the names of all sub-organizations.
 java.util.Set getSubOrganizationNames(java.lang.String pattern, boolean recursive)
          Returns names of sub-organizations matching the given pattern.
 OrganizationConfigManager getSubOrgConfigManager(java.lang.String subOrgName)
          Returns the OrganizationConfigManager for the given organization name.
static void loadDefaultServices(SSOToken token, OrganizationConfigManager ocm)
          Loads default services to a newly created realm
 void modifyService(java.lang.String serviceName, java.util.Map attributes)
          Sets the attributes related to provided service.
 void removeAttribute(java.lang.String serviceName, java.lang.String attrName)
          Removes the given organization creation attribute for the service.
 void removeAttributeValues(java.lang.String serviceName, java.lang.String attrName, java.util.Set values)
          Removes the given organization creation attribute values for the service.
 void removeListener(java.lang.String listenerID)
          Removes the listener from the organization for the given listener ID.
 void removeServiceConfig(java.lang.String serviceName)
          Removes the service configuration object for the given service name for this organization.
 void setAttributes(java.lang.String serviceName, java.util.Map attributes)
          Sets/Creates organization attributes for the service.
 void unassignService(java.lang.String serviceName)
          Unassigns the service from the organization.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrganizationConfigManager

public OrganizationConfigManager(SSOToken token,
                                 java.lang.String orgName)
                          throws SMSException
Constructor to obtain an instance of OrganizationConfigManager for an organization by providing an authenticated identity of the user. The organization name would be "/" seperated to represent organization hierarchy.
Parameters:
token - single sign on token of authenticated user identity.
orgName - name of the organization. The value of null or "/" would represent the root organization.
Throws:
SMSException - if an error has occurred while getting the instance of OrganizationConfigManager .
Method Detail

getOrganizationName

public java.lang.String getOrganizationName()
Returns the fully qualified name of the organization from the root
Returns:
the name of the organization

getConfiguredServices

public java.util.Set getConfiguredServices()
                                    throws SMSException
Deprecated. This method has been deprecated, use getAssignedServices() instead.

Returns the services configured for the organization.
Returns:
service names configured for the organization.
Throws:
SMSException - if there is an error accessing the data store to read the configured services.

getServiceSchemas

public java.util.Set getServiceSchemas()
                                throws SMSException
Returns a set of service schemas to be used for creation of an organization. The service schemas contain a list of attributes and their schema, and will be provided as ServiceSchema.
Returns:
Set of ServiceSchema to be used for creation of an organization.
Throws:
SMSException - if there is an error accessing the data store to read the service schemas.

createSubOrganization

public OrganizationConfigManager createSubOrganization(java.lang.String subOrgName,
                                                       java.util.Map attributes)
                                                throws SMSException
Creates a sub-organization under the current organization and sets the specified attributes. The sub-organization created can be only one level below the current organization. For multiple levels this method must be called recursively with the corresponding OrganizationConfigManager . The organization name must not have forward slash ("/"). For eg., the actual organization name 'iplanet' cannot be 'iplan/et' because we are using '/' as the seperator here. The attributes for the organization can be null; else would contain service name as the key and another Map as the value that would contain the key-values pair for the services.
Parameters:
subOrgName - the name of the sub-organization.
attributes - Map of attributes for the organization per service. The parameter Map attributes contains another Map as its value, which then has attribute names and values. The way it is arranged is: Map::attributes --> Key: String::ServiceName Value: Map::svcAttributes Map::svcAttributes --> Key: String::AttributeName Value: Set::AttributeValues
Returns:
organization config manager of the newly created sub-organization.
Throws:
SMSException - if creation of sub-organization failed, or if creation of sub-organization is attempted when configuration is not migrated to realms.

getSubOrganizationNames

public java.util.Set getSubOrganizationNames()
                                      throws SMSException
Returns the names of all sub-organizations.
Returns:
set of names of all sub-organizations.
Throws:
SMSException - if there is an error accessing the data store to read the sub-organization names.

getPeerOrganizationNames

public java.util.Set getPeerOrganizationNames()
                                       throws SMSException
Returns the names of all peer-organizations.
Returns:
set of names of all peer-organizations.
Throws:
SMSException - if there is an error accessing the data store to read the peer-organization names.

getSubOrganizationNames

public java.util.Set getSubOrganizationNames(java.lang.String pattern,
                                             boolean recursive)
                                      throws SMSException
Returns names of sub-organizations matching the given pattern. If the parameter recursive is set to true, search will be performed for the entire sub-tree. The pattern can contain "*" as the wildcard to represent zero or more characters.
Parameters:
pattern - pattern that will be used for searching, where "*" will be the wildcard.
recursive - if set to true the entire sub-tree will be searched for the organization names.
Returns:
names of sub-organizations matching the pattern.
Throws:
SMSException - if there is an error accessing the data store to read the sub-organization names.

deleteSubOrganization

public void deleteSubOrganization(java.lang.String subOrgName,
                                  boolean recursive)
                           throws SMSException
Deletes the given sub-organization. If the parameter recursive is set to true, then the suborganization and the sub-tree will be deleted. If the parameter recursive is set to false then the sub-organization shall be deleted provided it is the leaf node. If there are entries beneath the sub-organization and if the parameter recursive is set to false, then an exception is thrown that this sub-organization cannot be deleted.
Parameters:
subOrgName - sub-organization name to be deleted.
recursive - if set to true the entire sub-tree will be deleted.
Throws:
SMSException - if the sub-organization name cannot be found, or if there are entries beneath the sub-organization and if the parameter recursive is set to false.

getSubOrgConfigManager

public OrganizationConfigManager getSubOrgConfigManager(java.lang.String subOrgName)
                                                 throws SMSException
Returns the OrganizationConfigManager for the given organization name.
Parameters:
subOrgName - the name of the organization.
Returns:
the configuration manager for the given organization.
Throws:
SMSException - if the organization name cannot be found or user doesn't have access to that organization.

getAttributes

public java.util.Map getAttributes(java.lang.String serviceName)
                            throws SMSException
Returns the organization creation attributes for the service.
Parameters:
serviceName - name of the service.
Returns:
map of organization creation attribute values for service
Throws:
SMSException - if there is an error accessing the data store to read the attributes of the service.

addAttributeValues

public void addAttributeValues(java.lang.String serviceName,
                               java.lang.String attrName,
                               java.util.Set values)
                        throws SMSException
Adds organization attributes for the service. If the attribute already exists, the values will be appended to it, provided it is a multi-valued attribute. It will throw exception if we try to add a value to an attribute which has the same value already.
Parameters:
serviceName - name of the service.
attrName - name of the attribute.
values - values for the attribute.
Throws:
SMSException - if we try to add a value to an attribute which has the same value already.

setAttributes

public void setAttributes(java.lang.String serviceName,
                          java.util.Map attributes)
                   throws SMSException
Sets/Creates organization attributes for the service. If the attributes already exists, the given attribute values will replace them.
Parameters:
serviceName - name of the service.
attributes - attribute-values pairs.
Throws:
SMSException - if the serviceName cannot be found.

removeAttribute

public void removeAttribute(java.lang.String serviceName,
                            java.lang.String attrName)
                     throws SMSException
Removes the given organization creation attribute for the service.
Parameters:
serviceName - name of service.
attrName - name of attribute.
Throws:
SMSException - if the organization attribute for the service to be removed cannot be found, or if the service name cannot be found.

removeAttributeValues

public void removeAttributeValues(java.lang.String serviceName,
                                  java.lang.String attrName,
                                  java.util.Set values)
                           throws SMSException
Removes the given organization creation attribute values for the service.
Parameters:
serviceName - name of service.
attrName - name of attribute.
values - attribute values to be removed.
Throws:
SMSException - if the organization attribute for the service to be removed cannot be found, or if the service name cannot be found, or if the value cannot be removed.

getServiceConfig

public ServiceConfig getServiceConfig(java.lang.String serviceName)
                               throws SMSException
Returns the service configuration object for the given service name.
Parameters:
serviceName - name of a service.
Returns:
service configuration object for the service.
Throws:
SMSException - if there is an error accessing the data store to read the service configuration, or if the service name cannot be found.

addServiceConfig

public ServiceConfig addServiceConfig(java.lang.String serviceName,
                                      java.util.Map attributes)
                               throws SMSException
Adds a service configuration object for the given service name for this organization. If the service has been already added a SMSException will be thrown.
Parameters:
serviceName - name of the service.
attributes - service configuration attributes.
Returns:
service configuration object.
Throws:
SMSException - if the service configuration has been added already.

removeServiceConfig

public void removeServiceConfig(java.lang.String serviceName)
                         throws SMSException
Removes the service configuration object for the given service name for this organization.
Parameters:
serviceName - name of the service.
Throws:
SMSException - if the service name cannot be found, or not added to the organization.

addListener

public java.lang.String addListener(ServiceListener listener)
Registers for changes to organization's configuration. The object will be called when configuration for this organization is changed.
Parameters:
listener - callback object that will be invoked when organization configuration has changed
Returns:
an ID of the registered listener.

removeListener

public void removeListener(java.lang.String listenerID)
Removes the listener from the organization 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

getAssignableServices

public java.util.Set getAssignableServices()
                                    throws SMSException
Returns a set of service names that can be assigned to a realm. This set excludes name of services that are already assigned to the realm and services that are required for the existence of a realm.
Returns:
a set of service names that can be assigned to a realm.
Throws:
SMSException - if there is an error accessing the data store to read the service configuration

getAssignedServices

public java.util.Set getAssignedServices()
                                  throws SMSException
Returns a set of service names that are assigned to a realm.
Returns:
a set of service names that are assigned to a realm.
Throws:
SMSException - if there is an error accessing the data store to read the service configuration

getAssignedServices

public java.util.Set getAssignedServices(boolean includeMandatory)
                                  throws SMSException
Returns a set of service names that are assigned to a realm.
Parameters:
includeMandatory - true to include mandatory service names.
Returns:
a set of service names that are assigned to a realm.
Throws:
SMSException - if there is an error accessing the data store to read the service configuration

assignService

public void assignService(java.lang.String serviceName,
                          java.util.Map attributes)
                   throws SMSException
Assigns the given service to the orgnization with the respective attributes. If the service has been already added a SMSException will be thrown.
Parameters:
serviceName - name of the service
attributes - service configuration attributes
Throws:
SMSException - if the service configuration has been added already.

getServiceAttributes

public java.util.Map getServiceAttributes(java.lang.String serviceName)
                                   throws SMSException
Returns attributes configured for the service.
Parameters:
serviceName - name of the service
Returns:
a map of attributes for the service
Throws:
SMSException - if there is an error accessing the data store to read the service configuration, or if the service name cannot be found.

unassignService

public void unassignService(java.lang.String serviceName)
                     throws SMSException
Unassigns the service from the organization.
Parameters:
serviceName - name of the service
Throws:
SMSException - if the service name cannot be found or assigned, or if the service is a mandatory service.

modifyService

public void modifyService(java.lang.String serviceName,
                          java.util.Map attributes)
                   throws SMSException
Sets the attributes related to provided service. The assumption is that the service is already assigned to the organization. The attributes for the service are validated against the service schema.
Parameters:
serviceName - name of the service
attributes - attributes of the service
Throws:
SMSException - if the service name cannot be found or not assigned to the organization.

getNamingAttrForOrg

public java.lang.String getNamingAttrForOrg()

getParentOrgConfigManager

public OrganizationConfigManager getParentOrgConfigManager()
                                                    throws SMSException
Returns the OrganizationConfigManager of the parent for the given organization name.
Returns:
the configuration manager of the parent for the given organization.
Throws:
SMSException - if user doesn't have access to that organization.

loadDefaultServices

public static void loadDefaultServices(SSOToken token,
                                       OrganizationConfigManager ocm)
                                throws SMSException
Loads default services to a newly created realm


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