com.iplanet.am.sdk
Class AMStoreConnection

java.lang.Object
  |
  +--com.iplanet.am.sdk.AMStoreConnection
All Implemented Interfaces:
AMConstants

public final class AMStoreConnection
extends java.lang.Object
implements AMConstants

The AMStoreConnection class represents a connection to the Sun ONE Identity Server datastore. It provides methods to creat, remove and get different type of Sun ONE Identity Server SDK objects in the datatore. AMStoreConnection controls and manages access to the datastore.


Fields inherited from interface com.iplanet.am.sdk.AMConstants
SCOPE_BASE, SCOPE_ONE, SCOPE_SUB, SUBSCRIBABLE_ATTRIBUTE, UNIQUE_MEMBER_ATTRIBUTE
 
Constructor Summary
AMStoreConnection(SSOToken ssoToken)
          Gets the connection to the Sun ONE Identity Server datastore if the Session is valid.
 
Method Summary
 AMOrganization createTopOrganization(java.lang.String orgName, java.util.Map avPairs)
          Bootstraps the Organization tree by creating the Top Organization tree.
 int getAMObjectType(java.lang.String DN)
          Gets the type of the object given its DN.
 AMAssignableDynamicGroup getAssignableDynamicGroup(java.lang.String assignableDynamicGroupDN)
          Gets the handle to the AMAssignableDynamicGroup object represented by DN.
 java.util.Set getAttributeNames(java.lang.String serviceName, AMSchema.Type schemaType)
          Gets the service attribute names for a given service name and schema type
 AMDynamicGroup getDynamicGroup(java.lang.String dynamicGroupDN)
          Gets the handle to the AMDynamicGroup object represented by DN.
 AMGroupContainer getGroupContainer(java.lang.String groupContainerDN)
          Gets the handle to the AMGroupContainer object represented by DN.
static java.lang.String getGroupContainerNamingAttribute()
          Gets the group container naming attribute.
static java.lang.String getGroupNamingAttribute()
          Gets the group naming attribute.
 java.lang.String getI18NPropertiesFileName(java.lang.String serviceName)
          Gets the I18N properties file name that contains the internationalized messages.
 AMOrganization getOrganization(java.lang.String orgDN)
          Gets the handle to the AMOrganization object represented by DN.
 AMOrganizationalUnit getOrganizationalUnit(java.lang.String orgUnitDN)
          Gets the handle to the AMOrganizationalUnit object represented by DN.
static java.lang.String getOrganizationalUnitNamingAttribute()
          Gets the organizationalUnit naming attribute.
static java.lang.String getOrganizationNamingAttribute()
          Gets the org naming attribute.
 AMPeopleContainer getPeopleContainer(java.lang.String peopleContainerDN)
          Gets the handle to the AMPeopleContainer object represented by DN.
static java.lang.String getPeopleContainerNamingAttribute()
          Gets the people container naming attribute.
 AMTemplate getPolicyTemplate(java.lang.String templateDN)
          Gets the handle to the AMTemplate object represented by DN.
 java.lang.String getPropertiesViewBeanURL(java.lang.String serviceName)
          Gets the URL of the view bean for the service
 AMRole getRole(java.lang.String roleDN)
          Gets the handle to the AMRole object represented by DN.
static java.lang.String getRoleNamingAttribute()
          Gets the role naming attribute.
 AMSchema getSchema(java.lang.String serviceName, AMSchema.Type schemaType)
          Deprecated. This method has been deprecated. Please use com.sun.identity.sm.ServiceSchemaManager.getSchema().
 java.util.Set getSchemaTypes(java.lang.String serviceName)
          Deprecated. This method has been deprecated. Please use com.sun.identity.sm.ServiceSchemaManager.getSchemaTypes().
 java.util.Set getServiceHierarchy()
          Gets the service hiearchy for all registered services
 java.util.Set getServiceNames()
          Gets the set of names of services that have been loaded to the datastore
 AMStaticGroup getStaticGroup(java.lang.String groupDN)
          Gets the handle to the AMStaticGroup object represented by DN.
 java.util.Set getTopLevelContainers()
          Gets the top level containers (Organizations, PeopleContainers, Roles, etc) for the particular user based on ssoToken as the starting point in the tree.
 java.util.Set getTopLevelOrganizations()
          Gets the "real" or "physical" top level organizations as the starting point in the tree.
 AMUser getUser(java.lang.String userDN)
          Gets the handle to the AMUser object represented by DN.
static java.lang.String getUserNamingAttribute()
          Gets the user naming attribute.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMStoreConnection

public AMStoreConnection(SSOToken ssoToken)
                  throws SSOException
Gets the connection to the Sun ONE Identity Server datastore if the Session is valid.
Parameters:
SSOToken - a valid SSO token object to authenticate before getting the connection
Throws:
SSOException - if ssoToken is invalid or expired.
Method Detail

getUserNamingAttribute

public static java.lang.String getUserNamingAttribute()
Gets the user naming attribute.

getGroupNamingAttribute

public static java.lang.String getGroupNamingAttribute()
Gets the group naming attribute.

getRoleNamingAttribute

public static java.lang.String getRoleNamingAttribute()
Gets the role naming attribute.

getOrganizationNamingAttribute

public static java.lang.String getOrganizationNamingAttribute()
Gets the org naming attribute.

getOrganizationalUnitNamingAttribute

public static java.lang.String getOrganizationalUnitNamingAttribute()
Gets the organizationalUnit naming attribute.

getPeopleContainerNamingAttribute

public static java.lang.String getPeopleContainerNamingAttribute()
Gets the people container naming attribute.

getGroupContainerNamingAttribute

public static java.lang.String getGroupContainerNamingAttribute()
Gets the group container naming attribute.

getTopLevelOrganizations

public java.util.Set getTopLevelOrganizations()
                                       throws AMException,
                                              SSOException
Gets the "real" or "physical" top level organizations as the starting point in the tree.
Returns:
Set Set of DN Strings for top level Organizations
Throws:
AMException - if an error occured when retrieving the information from the data store.
SSOException - if ssoToken is invalid or expired.

getTopLevelContainers

public java.util.Set getTopLevelContainers()
                                    throws AMException,
                                           SSOException
Gets the top level containers (Organizations, PeopleContainers, Roles, etc) for the particular user based on ssoToken as the starting point in the tree.
Returns:
Set Set of DBObjects that are top level containers for the singed in user.
Throws:
AMException - if an error occured when retrieving the information from the data store.
SSOException - if ssoToken is invalid or expired.

createTopOrganization

public AMOrganization createTopOrganization(java.lang.String orgName,
                                            java.util.Map avPairs)
                                     throws AMException,
                                            SSOException
Bootstraps the Organization tree by creating the Top Organization tree.
Parameters:
orgName - name of the top organization
avPairs - Attribute-Value pairs for the top organization
Throws:
AMException - if an error occured during the process of creation.
SSOException - if ssoToken is invalid or expired.

getUser

public AMUser getUser(java.lang.String userDN)
               throws SSOException
Gets the handle to the AMUser object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMUser returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
userDN - user DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getPolicyTemplate

public AMTemplate getPolicyTemplate(java.lang.String templateDN)
                             throws AMException,
                                    SSOException
Gets the handle to the AMTemplate object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMTemplate returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
templatDN - a policy template DN
Throws:
AMException - if the DN does not represent a Policy template DN
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getOrganization

public AMOrganization getOrganization(java.lang.String orgDN)
                               throws SSOException
Gets the handle to the AMOrganization object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMOrganization returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
orgDN - organization DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getOrganizationalUnit

public AMOrganizationalUnit getOrganizationalUnit(java.lang.String orgUnitDN)
                                           throws SSOException
Gets the handle to the AMOrganizationalUnit object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMOrganizationialUnit returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
orgUnitDN - organizational unit DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getRole

public AMRole getRole(java.lang.String roleDN)
               throws SSOException
Gets the handle to the AMRole object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMRole returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
roleDN - role DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getStaticGroup

public AMStaticGroup getStaticGroup(java.lang.String groupDN)
                             throws SSOException
Gets the handle to the AMStaticGroup object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMStaticGroup returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
groupDN - group DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getAssignableDynamicGroup

public AMAssignableDynamicGroup getAssignableDynamicGroup(java.lang.String assignableDynamicGroupDN)
                                                   throws SSOException
Gets the handle to the AMAssignableDynamicGroup object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMAssignableDynamicGroup returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
assignableDynamicGroupDN - assignable dynamic group DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getDynamicGroup

public AMDynamicGroup getDynamicGroup(java.lang.String dynamicGroupDN)
                               throws SSOException
Gets the handle to the AMDynamicGroup object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMDynamicGroup returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
dynamicGroupDN - group DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getPeopleContainer

public AMPeopleContainer getPeopleContainer(java.lang.String peopleContainerDN)
                                     throws SSOException
Gets the handle to the AMPeopleContainer object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMPeopleContainer returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
peopleContainerDN - peopleContainer DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getGroupContainer

public AMGroupContainer getGroupContainer(java.lang.String groupContainerDN)
                                   throws SSOException
Gets the handle to the AMGroupContainer object represented by DN. However, the validity of the handle returned by this method cannot be guaranteed, since the object is created in memory, and not instantiated from the datastore. Using the AMGroupContainer returned from this method may result in exceptions thrown in the later part of the application, if the DN is not valid or represents an entry that does not exist.

Validity of the DN can be verified by using isExists() method of the object returned.

Parameters:
groupContainerDN - groupContainer DN
Throws:
SSOException - if ssoToken is invalid or expired.
See Also:
AMObject.isExists()

getAMObjectType

public int getAMObjectType(java.lang.String DN)
                    throws AMException,
                           SSOException
Gets the type of the object given its DN.
Parameters:
DN - DN of the object whose type is to be known.
Throws:
AMException - if the data store is unavailable. or the object type is unknown
SSOException - if ssoToken is invalid or expired.

getServiceHierarchy

public java.util.Set getServiceHierarchy()
                                  throws AMException
Gets the service hiearchy for all registered services
Throws:
AMException - if an error is encountered in retrieving the service hierarchy. The return value is a Set of strings in slash format.

getServiceNames

public java.util.Set getServiceNames()
                              throws AMException
Gets the set of names of services that have been loaded to the datastore
Throws:
AMException - if an error is encountered in retrieving the names of the services

getSchemaTypes

public java.util.Set getSchemaTypes(java.lang.String serviceName)
                             throws AMException
Deprecated. This method has been deprecated. Please use com.sun.identity.sm.ServiceSchemaManager.getSchemaTypes().

Gets the SchemaTypes available for a particular service
Parameters:
serviceName - the name of the service whose schema types needs to be retrieved
Returns:
Set of AMSchema.Type objects
Throws:
AMException - if an error is encountered in retrieving the schemaTypes

getSchema

public AMSchema getSchema(java.lang.String serviceName,
                          AMSchema.Type schemaType)
                   throws AMException
Deprecated. This method has been deprecated. Please use com.sun.identity.sm.ServiceSchemaManager.getSchema().

Gets the AMSchema for the given service name and service type
Parameters:
serviceName - the name of the service
the - type of service schema that needs to be retrieved
Returns:
AMSchema the AMSchema corresponding to the given service name and schema type.
Throws:
AMException - if an error is encountered in retrieving the AMSchema

getI18NPropertiesFileName

public java.lang.String getI18NPropertiesFileName(java.lang.String serviceName)
                                           throws AMException
Gets the I18N properties file name that contains the internationalized messages.
Parameters:
serviceName - the service name
Returns:
String String representing i18N properties file name
Throws:
AMException - if an error is encountered while retrieving information

getPropertiesViewBeanURL

public java.lang.String getPropertiesViewBeanURL(java.lang.String serviceName)
                                          throws AMException
Gets the URL of the view bean for the service
Parameters:
serviceName - the service name
Returns:
String URL of the view bean for the service
Throws:
AMException - if an error is encountered while retrieving information

getAttributeNames

public java.util.Set getAttributeNames(java.lang.String serviceName,
                                       AMSchema.Type schemaType)
                                throws AMException
Gets the service attribute names for a given service name and schema type
Parameters:
serviceName - the name of the service
the - type of service schema
Returns:
Set Set of service attribute names