public class OrganizationConfigManager extends Object
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 and Description |
---|
OrganizationConfigManager(SSOToken token,
String orgName)
Constructor to obtain an instance of
OrganizationConfigManager
for an organization by providing
an authenticated identity of the user. |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeValues(String serviceName,
String attrName,
Set values)
Adds organization attributes for the service.
|
String |
addListener(ServiceListener listener)
Deprecated.
Use
ServiceConfigManager.addListener(ServiceListener) instead. |
ServiceConfig |
addServiceConfig(String serviceName,
Map attributes)
Adds a service configuration object for the given
service name for this organization.
|
void |
assignService(String serviceName,
Map attributes)
Assigns the given service to the orgnization with
the respective attributes.
|
OrganizationConfigManager |
createSubOrganization(String subOrgName,
DataStoreId dataStoreId)
Creates a sub-organization under the current organization, without any child entries.
|
OrganizationConfigManager |
createSubOrganization(String subOrgName,
Map attributes)
Creates a sub-organization under the current
organization and sets the specified attributes.
|
void |
deleteSubOrganization(String subOrgName,
boolean recursive)
Deletes the given sub-organization.
|
Set<String> |
getAssignableServices()
Returns a set of service names that can be assigned
to a realm.
|
Set<String> |
getAssignedServices()
Returns a set of service names that are assigned to
a realm.
|
Set<String> |
getAssignedServices(boolean includeMandatory)
Returns a set of service names that are assigned to a realm.
|
Map |
getAttributes(String serviceName)
Returns the organization creation attributes for
the service.
|
Set |
getConfiguredServices()
Deprecated.
This method has been deprecated, use
getAssignedServices()
instead. |
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. |
Set |
getPeerOrganizationNames()
Returns the names of all peer-organizations.
|
Map |
getServiceAttributes(String serviceName)
Returns attributes configured for the service.
|
ServiceConfig |
getServiceConfig(String serviceName)
Returns the service configuration object for the
given service name.
|
Set |
getServiceSchemas()
Returns a set of service schemas to be used for
creation of an organization.
|
Set |
getSubOrganizationNames()
Returns the names of all sub-organizations.
|
Set |
getSubOrganizationNames(String pattern,
boolean recursive)
Returns names of sub-organizations matching the
given pattern.
|
Set |
getSubOrganizationNames(String pattern,
boolean recursive,
DataStoreId dataStoreId)
Returns names of sub-organizations matching the
given pattern.
|
OrganizationConfigManager |
getSubOrgConfigManager(String subOrgName)
Returns the
OrganizationConfigManager
for the given organization name. |
static void |
loadDefaultServices(OrganizationConfigManager ocm)
Loads default services to a newly created realm
|
void |
modifyService(String serviceName,
Map attributes)
Sets the attributes related to provided service.
|
void |
removeAttribute(String serviceName,
String attrName)
Removes the given organization creation attribute
for the service.
|
void |
removeAttributeValues(String serviceName,
String attrName,
Set values)
Removes the given organization creation attribute
values for the service.
|
void |
removeListener(String listenerID)
Deprecated.
Use
ServiceConfigManager.removeListener(String) instead. |
void |
removeServiceConfig(String serviceName)
Removes the service configuration object for the
given service name for this organization.
|
void |
setAttributes(String serviceName,
Map attributes)
Sets/Creates organization attributes for the
service.
|
void |
unassignService(String serviceName)
Unassigns the service from the organization.
|
void |
validateOrgAliasCollision(Collection<String> aliases)
Checks org alias name for collisions
|
@Inject public OrganizationConfigManager(SSOToken token, String orgName) throws SMSException
OrganizationConfigManager
for an organization by providing
an authenticated identity of the user. The organization name would be "/"
seperated to represent organization hierarchy.token
- single sign on token of authenticated user identity.orgName
- name of the organization. The value of null
or
"/" would represent the root organization.SMSException
- if an error has occurred while getting the instance of
OrganizationConfigManager
.public String getOrganizationName()
public Set getConfiguredServices() throws SMSException
getAssignedServices()
instead.SMSException
- if there is an error accessing the data store to read the
configured services.public Set getServiceSchemas() throws SMSException
ServiceSchema
.ServiceSchema
to be used for creation of an
organization.SMSException
- if there is an error accessing the data store to read the
service schemas.public OrganizationConfigManager createSubOrganization(String subOrgName, Map attributes) throws SMSException
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.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::AttributeValuesSMSException
- if creation of sub-organization failed, or if creation of
sub-organization is attempted when configuration is not
migrated to realms.public OrganizationConfigManager createSubOrganization(String subOrgName, DataStoreId dataStoreId) throws SMSException
Creates a sub-organization under the current organization, without any child entries. The sub-organization
created can only be one level below the current organization. For multiple levels, this method must be called
recursively with the corresponding OrganizationConfigManager
.
The organization name must not contain a forward slash ("/") because this character is used as a separator, e.g. "abc/def" means "def" is a sub-realm of "abc".
subOrgName
- the name of the sub-organization.dataStoreId
- the data store ID within which to create the sub-organization.SMSException
- if the creation of the sub-organization failed or is attempted when configuration is not migrated
to realms.public void validateOrgAliasCollision(Collection<String> aliases) throws SMSException
aliases
- The realms aliasesSMSException
- if org alias collision is foundpublic Set getSubOrganizationNames() throws SMSException
SMSException
- if there is an error accessing the data store to read the
sub-organization names.public Set getPeerOrganizationNames() throws SMSException
SMSException
- if there is an error accessing the data store to read the
peer-organization names.public Set getSubOrganizationNames(String pattern, boolean recursive) throws SMSException
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.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.SMSException
- if there is an error accessing the data store to read the
sub-organization names.public Set getSubOrganizationNames(String pattern, boolean recursive, DataStoreId dataStoreId) throws SMSException
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.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.dataStoreId
- the ID for the data store within which to search.SMSException
- if there is an error accessing the data store to read the
sub-organization names.public void deleteSubOrganization(String subOrgName, boolean recursive) throws SMSException
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.subOrgName
- sub-organization name to be deleted.recursive
- if set to true
the entire sub-tree will be
deleted.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
.public OrganizationConfigManager getSubOrgConfigManager(String subOrgName) throws SMSException
OrganizationConfigManager
for the given organization name.subOrgName
- the name of the organization.SMSException
- if the organization name cannot be found or user doesn't have
access to that organization.public Map getAttributes(String serviceName) throws SMSException
serviceName
- name of the service.SMSException
- if there is an error accessing the data store to read the
attributes of the service.public void addAttributeValues(String serviceName, String attrName, Set values) throws SMSException
serviceName
- name of the service.attrName
- name of the attribute.values
- values for the attribute.SMSException
- if we try to add a value to an attribute which has the same
value already.public void setAttributes(String serviceName, Map attributes) throws SMSException
serviceName
- name of the service.attributes
- attribute-values pairs.SMSException
- if the serviceName cannot be found.public void removeAttribute(String serviceName, String attrName) throws SMSException
serviceName
- name of service.attrName
- name of attribute.SMSException
- if the organization attribute for the service to be removed
cannot be found, or if the service name cannot be found.public void removeAttributeValues(String serviceName, String attrName, Set values) throws SMSException
serviceName
- name of service.attrName
- name of attribute.values
- attribute values to be removed.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.public ServiceConfig getServiceConfig(String serviceName) throws SMSException
serviceName
- name of a service.SMSException
- if there is an error accessing the data store to read the
service configuration, or if the service name cannot be
found.public ServiceConfig addServiceConfig(String serviceName, Map attributes) throws SMSException
SMSException
will be thrown.serviceName
- name of the service.attributes
- service configuration attributes.SMSException
- if the service configuration has been added already.public void removeServiceConfig(String serviceName) throws SMSException
serviceName
- name of the service.SMSException
- if the service name cannot be found, or not added to the
organization.@Deprecated public String addListener(ServiceListener listener)
ServiceConfigManager.addListener(ServiceListener)
instead.listener
- callback object that will be invoked when organization
configuration has changed@Deprecated public void removeListener(String listenerID)
ServiceConfigManager.removeListener(String)
instead.listenerID
- the listener ID issued when the listener was registeredpublic Set<String> getAssignableServices() throws SMSException
SMSException
- if there is an error accessing the data store to read the
service configurationpublic Set<String> getAssignedServices() throws SMSException
SMSException
- if there is an error accessing the data store to read the
service configurationpublic Set<String> getAssignedServices(boolean includeMandatory) throws SMSException
includeMandatory
- true
to include mandatory service names.SMSException
- if there is an error accessing the data store to read the
service configurationpublic void assignService(String serviceName, Map attributes) throws SMSException
SMSException
will be thrown.serviceName
- name of the serviceattributes
- service configuration attributesSMSException
- if the service configuration has been added already.public Map getServiceAttributes(String serviceName) throws SMSException
serviceName
- name of the serviceSMSException
- if there is an error accessing the data store to read the
service configuration, or if the service name cannot be
found.public void unassignService(String serviceName) throws SMSException
serviceName
- name of the serviceSMSException
- if the service name cannot be found or assigned, or if the
service is a mandatory service.public void modifyService(String serviceName, Map attributes) throws SMSException
serviceName
- name of the serviceattributes
- attributes of the serviceSMSException
- if the service name cannot be found or not assigned to the
organization.public OrganizationConfigManager getParentOrgConfigManager() throws SMSException
OrganizationConfigManager
of the parent for the given organization name.SMSException
- if user doesn't have access to that organization.public static void loadDefaultServices(OrganizationConfigManager ocm) throws SMSException
SMSException
Copyright © 2010-2018, ForgeRock All Rights Reserved.