public interface Persistent
The enterprise server caches persistent objects on a
per-manager-session basis. A manager's session lasts for the period between a call to ServiceProvider.bind
and a subsequent call to ServiceProvider.unbind
or ServiceProvider.bind
(see ServiceProvider
for details on binding).
If the directory is modified during a Manager's session, ServiceProvider.clearCache
or ServiceProvider.bind
must be called again to see the new versions of the objects.
Persistent objects implement a change notification system. Interested objects can register as listeners to listen for changes to Persistent objects. Since persistent objects are cached on a per-manager-session basis, if the same persistent object is accessed more than once within a manager session, multiple references to the same object will be handed out by this API, and not references to multiple cached copies of the persistent data. Thus, if a listener is added to a persistent object, it will recieve change notifications for any update to the object provided that the update originates in the same manager session. Updates notifications will not be sent if the persisent object is changed by another manager session, or if it is changed in the directory by any other external systems.
Modifier and Type | Method and Description |
---|---|
void |
addListener(PersistentChangeListener l)
Adds a listener to this object.
|
void |
delListener(PersistentChangeListener l)
Removes a listener from this object.
|
java.lang.Object[] |
getAttribute(java.lang.String name)
Returns the named attribute from this object's LDAP entry.
|
java.lang.String |
getDisplayName()
This method returns a cached copy of the value of
getAttribute("displayname")[0] , or, if no such
attribute exists, the value of the LDAP RDN for this Persistent object's LDAP entry. |
java.lang.String |
getId()
Returns the unique system-generated identifier of this object.
|
java.lang.String |
getName()
Returns the value of the LDAP RDN for this object, which is unique amongst its sibling objects.
|
void |
setAttribute(java.lang.String name,
java.lang.Object[] values)
Overwrites the values of the named attribute in this object's LDAP entry.
|
void |
setAttribute(java.lang.String name,
java.lang.String[] values)
Deprecated.
use setAttribute(String name, Object values[]) instead
|
void |
setDisplayName(java.lang.String name)
Sets the display name of this object.
|
java.lang.String getId()
java.lang.String getName()
java.lang.String getDisplayName()
getAttribute("displayname")[0]
, or, if no such
attribute exists, the value of the LDAP RDN for this Persistent object's LDAP entry.void setDisplayName(java.lang.String name) throws CommunicationException, AccessControlException
setAttribute
method for
the "displayname" attribute of this object.AccessControlException
- Thrown if the current manager doesn't have the privilige of setting the display name.CommunicationException
- Thrown if there is a problem communicating with the directory.java.lang.Object[] getAttribute(java.lang.String name) throws CommunicationException, AccessControlException
name
- The name of the attribute in the LDAP schema for this object.CommunicationException
- Thrown if there is a problem communicating with the directory.AccessControlException
- Thrown if the current manager does not have permission to access
the named attribute.void setAttribute(java.lang.String name, java.lang.Object[] values) throws CommunicationException, AccessControlException, ViolateSchemaException
name
- The name of the attribute in the LDAP schema for this object.values
- The new values for the attribute.CommunicationException
- Thrown if there is a problem communicating with the directory.AccessControlException
- Thrown if the current manager does not have write access for the named attribute.ViolateSchemaException
- Thrown if this object's LDAP schema does not allow the given attribute or if multiple values are given for a single-valued attribute.void setAttribute(java.lang.String name, java.lang.String[] values) throws CommunicationException, AccessControlException, ViolateSchemaException
name
- The name of the attribute in the LDAP schema for this object.values
- The new values for the attribute.CommunicationException
- Thrown if there is a problem communicating with the directory.AccessControlException
- Thrown if the current manager does not have write access for the named attribute.ViolateSchemaException
- Thrown if this object's LDAP schema does not allow the given attribute or if multiple values are given for a single-valued attribute.void addListener(PersistentChangeListener l)
listener
- The listener that is interested in changes to this object.void delListener(PersistentChangeListener l)
listener
- The listener that is no longer interested in changes to this object.