com.iplanet.am.sdk
Interface AMObject

All Superinterfaces:
AMConstants
All Known Subinterfaces:
AMAssignableDynamicGroup, AMDynamicGroup, AMGroup, AMGroupContainer, AMOrganization, AMOrganizationalUnit, AMPeopleContainer, AMRole, AMStaticGroup, AMTemplate, AMUser

public interface AMObject
extends AMConstants

The AMObject interface provides methods to manage various Sun ONE Identity Server objects and their attributes.


Field Summary
static int ASSIGNABLE_DYNAMIC_GROUP
          Represents a Dynamic Group object type
static int DYNAMIC_GROUP
          Represents a Dynamic Group object type
static int FILTERED_ROLE
          Represents a Filtered Role object type
static int GROUP
          Represents a Group object type
static int GROUP_CONTAINER
          Represents a group container object type
static int GROUP_PROFILE
          Represents group profile Information
static int MANAGED_ROLE
          Represents a Managed Role object type
static int ORGANIZATION
          Represents an Organization object type
static int ORGANIZATIONAL_UNIT
          Represents a Organizational Unit object type
static int PEOPLE_CONTAINER
          Represents a People Container object type
static int POLICY
          Represents Policy Information
static int ROLE
          Represents a Role object type
static int ROLE_PROFILE
          Represents role profile Information
static int SERVICE
          Represents Service Information
static int STATIC_GROUP
          Represents a Static Group object type
static int TEMPLATE
          Represents a Template object type
static int UNKNOWN_OBJECT_TYPE
          Represents an object type that cannot be identified
static int USER
          Represents a User object type
 
Fields inherited from interface com.iplanet.am.sdk.AMConstants
SCOPE_BASE, SCOPE_ONE, SCOPE_SUB, SUBSCRIBABLE_ATTRIBUTE, UNIQUE_MEMBER_ATTRIBUTE
 
Method Summary
 void addEventListener(AMEventListener listener)
          Register a event listener that needs to be invoked when a relevant event occurs.
 void assignPolicies(java.lang.String serviceName, java.util.Set policyDNs)
          Assigns the given policies to this object.
 AMTemplate createPolicyTemplate(java.lang.String serviceName, java.util.Map attributes)
          Creates a Policy Template with no priority for the given service associated with this AMObject.
 AMTemplate createPolicyTemplate(java.lang.String serviceName, java.util.Map attributes, int priority)
          Creates a Policy Template with a priority for the given service associated with this AMObject.
 AMTemplate createTemplate(int templateType, java.lang.String serviceName, java.util.Map attributes)
          Creates a Template with no priority for the given service associated with this AMObject.
 AMTemplate createTemplate(int templateType, java.lang.String serviceName, java.util.Map attributes, int priority)
          Creates a Template with a priority for the given service associated with this AMObject.
 void delete()
          Deletes the object.
 void delete(boolean recursive)
          Deletes object(s).
 java.util.Set getAttribute(java.lang.String attributeName)
          Gets attribute value.
 byte[][] getAttributeByteArray(java.lang.String attributeName)
          Gets attribute value.
 java.util.Map getAttributes()
          Gets Map of all attributes.
 java.util.Map getAttributes(java.util.Set attributeNames)
          Gets Map of specified attributes.
 java.util.Map getAttributesByteArray()
          Gets Map of all attributes.
 java.util.Map getAttributesByteArray(java.util.Set attributeNames)
          Gets Map of specified attributes.
 java.lang.String getDN()
          Gets the DN of the entry.
 java.lang.String getOrganizationDN()
          Gets the object's organization.
 java.lang.String getParentDN()
          Gets the parent DN of the entry.
 java.util.Map getPolicy(java.lang.String serviceName)
          Gets the effective service policy defined at this object after considering any inheritance from any policy tempates.
 AMTemplate getPolicyTemplate(java.lang.String serviceName)
          Gets the policy template for a service defined for this object ignoring any inheritance.
 java.util.Map getServiceAttributes(java.lang.String serviceName)
          Gets Map of all attributes of specified service.
 java.lang.String getStringAttribute(java.lang.String attributeName)
          Gets string type attribute value.
 AMTemplate getTemplate(java.lang.String serviceName, int templateType)
          Gets the Template for the given service associated with this AMObject.
 boolean isExists()
          Checks if the entry exists in the directory or not.
 void removeAttributes(java.util.Set attributes)
          Removes attributes in this AMObject.
 void removeEventListener(AMEventListener listener)
          UnRegister a previously registered event listener.
 java.util.Set search(int level, java.lang.String filter)
          Search objects based on specified level and filter.
 void setAttributes(java.util.Map attributes)
          Sets attribute values in this AMObject.
 void setStringAttribute(java.lang.String attributeName, java.lang.String value)
          Sets string type attribute value.
 void store()
          Stores the change to directory server.
 void unassignPolicies(java.lang.String serviceName, java.util.Set policyDNs)
          Unassigns the given policies from this object.
 

Field Detail

USER

public static final int USER
Represents a User object type

ORGANIZATION

public static final int ORGANIZATION
Represents an Organization object type

ORGANIZATIONAL_UNIT

public static final int ORGANIZATIONAL_UNIT
Represents a Organizational Unit object type

GROUP_CONTAINER

public static final int GROUP_CONTAINER
Represents a group container object type

PEOPLE_CONTAINER

public static final int PEOPLE_CONTAINER
Represents a People Container object type

ROLE

public static final int ROLE
Represents a Role object type

MANAGED_ROLE

public static final int MANAGED_ROLE
Represents a Managed Role object type

FILTERED_ROLE

public static final int FILTERED_ROLE
Represents a Filtered Role object type

GROUP

public static final int GROUP
Represents a Group object type

STATIC_GROUP

public static final int STATIC_GROUP
Represents a Static Group object type

DYNAMIC_GROUP

public static final int DYNAMIC_GROUP
Represents a Dynamic Group object type

ASSIGNABLE_DYNAMIC_GROUP

public static final int ASSIGNABLE_DYNAMIC_GROUP
Represents a Dynamic Group object type

TEMPLATE

public static final int TEMPLATE
Represents a Template object type

POLICY

public static final int POLICY
Represents Policy Information

SERVICE

public static final int SERVICE
Represents Service Information

ROLE_PROFILE

public static final int ROLE_PROFILE
Represents role profile Information

GROUP_PROFILE

public static final int GROUP_PROFILE
Represents group profile Information

UNKNOWN_OBJECT_TYPE

public static final int UNKNOWN_OBJECT_TYPE
Represents an object type that cannot be identified
Method Detail

getDN

public java.lang.String getDN()
Gets the DN of the entry.
Returns:
String DN

getParentDN

public java.lang.String getParentDN()
Gets the parent DN of the entry.
Returns:
String DN

store

public void store()
           throws AMException,
                  SSOException
Stores the change to directory server.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

isExists

public boolean isExists()
                 throws SSOException
Checks if the entry exists in the directory or not. First a syntax check is done on the DN string corresponding to the entry. If the DN syntax is valid, a directory call will be made to check for the existence of the entry.

NOTE: This method internally invokes a call to the directory to verify the existence of the entry. There could be a performance overhead. Hence, please use your discretion while using this method.

Returns:
false if the entry does not have a valid DN syntax or if the entry does not exists in the Directory. False otherwise.
Throws:
SSOException - if the sign-on is no longer valid.

getAttributes

public java.util.Map getAttributes()
                            throws AMException,
                                   SSOException
Gets Map of all attributes. Map key is the attribute name and value is the attribute value.
Returns:
Map of all attributes.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getAttributesByteArray

public java.util.Map getAttributesByteArray()
                                     throws AMException,
                                            SSOException
Gets Map of all attributes. Map key is the attribute name and value is the attribute value in byte[][] format.
Returns:
Map of all attributes.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getAttributes

public java.util.Map getAttributes(java.util.Set attributeNames)
                            throws AMException,
                                   SSOException
Gets Map of specified attributes. Map key is the attribute name and value is the attribute value.
Parameters:
attributeNames - The Set of attribute names.
Returns:
Map of specified attributes.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getAttributesByteArray

public java.util.Map getAttributesByteArray(java.util.Set attributeNames)
                                     throws AMException,
                                            SSOException
Gets Map of specified attributes. Map key is the attribute name and value is the attribute value in byte[][] format.
Parameters:
attributeNames - The Set of attribute names.
Returns:
Map of specified attributes.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getAttribute

public java.util.Set getAttribute(java.lang.String attributeName)
                           throws AMException,
                                  SSOException
Gets attribute value.
Parameters:
attributeName - Attribute name
Returns:
Set of attribute values.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getAttributeByteArray

public byte[][] getAttributeByteArray(java.lang.String attributeName)
                               throws AMException,
                                      SSOException
Gets attribute value.
Parameters:
attributeName - Attribute name
Returns:
attribute values in byte[][] format or null if the attribute does not exist.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String attributeName)
                                    throws AMException,
                                           SSOException
Gets string type attribute value.
Parameters:
attributeName - Attribute name
Returns:
String value of attribute
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getServiceAttributes

public java.util.Map getServiceAttributes(java.lang.String serviceName)
                                   throws AMException,
                                          SSOException
Gets Map of all attributes of specified service. Map key is the attribute name and value is the attribute value.
Parameters:
serviceName - Service name
Returns:
Map of all attributes of specified service, an empty Map will be returned if no service attribute is defined in the specified service.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

createTemplate

public AMTemplate createTemplate(int templateType,
                                 java.lang.String serviceName,
                                 java.util.Map attributes)
                          throws java.lang.UnsupportedOperationException,
                                 AMException,
                                 SSOException
Creates a Template with no priority for the given service associated with this AMObject.
Parameters:
templateType - either AMTemplate.POLICY_TEMPLATE or AMTemplate.DYNAMIC_TEMPLATE
serviceName - serviceName
attributes - Map of attributes name-value pairs. if it is null defalut values will be used
Returns:
AMTemplate the service template for this AMObject
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method

createTemplate

public AMTemplate createTemplate(int templateType,
                                 java.lang.String serviceName,
                                 java.util.Map attributes,
                                 int priority)
                          throws java.lang.UnsupportedOperationException,
                                 AMException,
                                 SSOException
Creates a Template with a priority for the given service associated with this AMObject.
Parameters:
templateType - either AMTemplate.POLICY_TEMPLATE or AMTemplate.DYNAMIC_TEMPLATE
serviceName - serviceName
attributes - Map of attributes name-value pairs
priority - template priority (0 is the highest priority)
Returns:
AMTemplate the service template for this AMObject
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method

getTemplate

public AMTemplate getTemplate(java.lang.String serviceName,
                              int templateType)
                       throws java.lang.UnsupportedOperationException,
                              AMException,
                              SSOException
Gets the Template for the given service associated with this AMObject.
Parameters:
serviceName - serviceName
templateType - either AMTemplate.POLICY_TEMPLATE or AMTemplate.DYNAMIC_TEMPLATE
Returns:
AMTemplate the service template for this AMObject
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method

assignPolicies

public void assignPolicies(java.lang.String serviceName,
                           java.util.Set policyDNs)
                    throws AMException,
                           SSOException
Assigns the given policies to this object.
Parameters:
serviceName - serviceName
policyDNs - Set of policy DN string
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

unassignPolicies

public void unassignPolicies(java.lang.String serviceName,
                             java.util.Set policyDNs)
                      throws AMException,
                             SSOException
Unassigns the given policies from this object.
Parameters:
serviceName - serviceName
policyDNs - Set of policy DN string
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

setAttributes

public void setAttributes(java.util.Map attributes)
                   throws AMException,
                          SSOException
Sets attribute values in this AMObject. Note that this method sets or replaces the attribute value with the new value supplied.
Parameters:
attributes - Map where key is the attribute name and value is the attribute value
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

removeAttributes

public void removeAttributes(java.util.Set attributes)
                      throws AMException,
                             SSOException
Removes attributes in this AMObject.
Parameters:
attributes - The Set of attribute names
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

setStringAttribute

public void setStringAttribute(java.lang.String attributeName,
                               java.lang.String value)
                        throws AMException,
                               SSOException
Sets string type attribute value.
Parameters:
attributeName - Attribute name
value - value to be set for the attributeName
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

delete

public void delete()
            throws AMException,
                   SSOException
Deletes the object.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

delete

public void delete(boolean recursive)
            throws AMException,
                   SSOException
Deletes object(s). This method takes a boolean parameter, if its value is true, will remove the object and any objects under it, otherwise, will try to remove the object only. Two notes on recursive delete. First, be aware of the PERFORMANCE hit when large amount of child objects present. Second, it won't follow referral.
Parameters:
recursive - if true delete the object and any objects under it, otherwise, delete the object only.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

search

public java.util.Set search(int level,
                            java.lang.String filter)
                     throws AMException,
                            SSOException
Search objects based on specified level and filter.
Parameters:
level - The search level starting from the object
filter - The search filter
Returns:
Set of object DN's matching the search
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

addEventListener

public void addEventListener(AMEventListener listener)
                      throws SSOException
Register a event listener that needs to be invoked when a relevant event occurs. If the listener was already registered, then it is registered only once; no duplicate registration is allowed.

Object.equals() method on the listener object is used to determine duplicates.

Parameters:
listener - listener object that will be called upon when an event occurs.
Throws:
SSOException - if errors were encountered in adding a new SSOTokenListener instance

removeEventListener

public void removeEventListener(AMEventListener listener)
UnRegister a previously registered event listener. If the listener was not registered previously, the method simply returns without doing anything.
Parameters:
listener - listener object that will be removed or unregistered.

createPolicyTemplate

public AMTemplate createPolicyTemplate(java.lang.String serviceName,
                                       java.util.Map attributes)
                                throws java.lang.UnsupportedOperationException,
                                       AMException,
                                       SSOException
Creates a Policy Template with no priority for the given service associated with this AMObject. This is a convenience method and is equivalent to createTemplate(AMTemplate.POLICY_TEMPLATE, serviceName, attributes).
Parameters:
serviceName - serviceName
attributes - Map of attributes name-value pairs
Returns:
AMTemplate the service template for this AMObject
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method

createPolicyTemplate

public AMTemplate createPolicyTemplate(java.lang.String serviceName,
                                       java.util.Map attributes,
                                       int priority)
                                throws java.lang.UnsupportedOperationException,
                                       AMException,
                                       SSOException
Creates a Policy Template with a priority for the given service associated with this AMObject. This is a convenience method and is equivalent to createTemplate(AMTemplate.POLICY_TEMPLATE, serviceName, attributes, priority).
Parameters:
serviceName - serviceName
attributes - Map of attributes name-value pairs
priority - template priority (0 is the highest priority)
Returns:
AMTemplate the service template for this AMObject
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method

getPolicyTemplate

public AMTemplate getPolicyTemplate(java.lang.String serviceName)
                             throws java.lang.UnsupportedOperationException,
                                    AMException,
                                    SSOException
Gets the policy template for a service defined for this object ignoring any inheritance. This is a convenience method and is equivalent to getTemplate(serviceName, AMTemplate.POLICY_TEMPLATE). AMUser object will throw UnsupportedOperationException because this method is not relevant for AMUser.
Returns:
AMTemplate the policy template of the service for this object
Throws:
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign on is no longer valid

getPolicy

public java.util.Map getPolicy(java.lang.String serviceName)
                        throws java.lang.UnsupportedOperationException,
                               AMException,
                               SSOException
Gets the effective service policy defined at this object after considering any inheritance from any policy tempates.
Returns:
Map the effective service policy for the object after inheritance; key is the attribute name and value is attribute value. An empty Map will be returned if no policy attribute is defined in the specified service.
Throws:
java.lang.UnsupportedOperationException - if the class implementing this interface does not support this method
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign on is no longer valid

getOrganizationDN

public java.lang.String getOrganizationDN()
                                   throws AMException,
                                          SSOException
Gets the object's organization. NOTE: Obtaining an organization DN involves considerable overhead. Hence after obtaining the organization DN, each object saves this information. Consecutives method calls on this object fetch the value stored in the object. Creating a new AMObject instance every time to obtain the organization DN is not recommended.
Returns:
The object's organization DN.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store or the object doesn't have organzation DN.
SSOException - if the sign on is no longer valid