org.springframework.ldap.support
Interface DirContextOperations

All Superinterfaces:
AttributeModificationsAware, javax.naming.Context, javax.naming.directory.DirContext
All Known Implementing Classes:
DirContextAdapter

public interface DirContextOperations
extends javax.naming.directory.DirContext, AttributeModificationsAware

Interface for DirContextAdapter to simplify mock testing.

Author:
Mattias Arthursson

Field Summary
 
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
 
Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
 
Method Summary
 java.util.SortedSet getAttributeSortedStringSet(java.lang.String name)
          Get all String values of the attribute as a SortedSet.
 javax.naming.Name getDn()
          Returns DN, for example uid=some.user,ou=People,ou=EU.
 java.lang.String[] getNamesOfModifiedAttributes()
          Creates a String array of the names of the attributes which have been changed.
 java.lang.Object getObjectAttribute(java.lang.String name)
          Get the value of an Object attribute.
 java.lang.String getStringAttribute(java.lang.String name)
          Get the value of a String attribute.
 java.lang.String[] getStringAttributes(java.lang.String name)
          Get all values of a String attribute.
 boolean isUpdateMode()
          Gets the update mode.
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Set the with the name name to the value.
 void setAttributeValues(java.lang.String name, java.lang.Object[] values)
          Sets a multivalue attribute, disregarding the order of the values.
 void setAttributeValues(java.lang.String name, java.lang.Object[] values, boolean orderMatters)
          Sets a multivalue attribute.
 void setDn(javax.naming.Name dn)
          Set the dn of this entry.
 void update()
          Update the attributes.
 
Methods inherited from interface javax.naming.directory.DirContext
bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search
 
Methods inherited from interface javax.naming.Context
addToEnvironment, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
Methods inherited from interface org.springframework.ldap.support.AttributeModificationsAware
getModificationItems
 

Method Detail

isUpdateMode

public boolean isUpdateMode()
Gets the update mode. The update mode should be true for a new entry and true for an existing entry that is being updated.

Returns:
update mode

getNamesOfModifiedAttributes

public java.lang.String[] getNamesOfModifiedAttributes()
Creates a String array of the names of the attributes which have been changed. If this is a new entry, all set entries will be in the list. If this is an updated entry, only changed and removed entries will be in the array.

Returns:
Array of String

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name)
Get the value of a String attribute.

Parameters:
name - name of the attribute.
Returns:
the value of the attribute.

getObjectAttribute

public java.lang.Object getObjectAttribute(java.lang.String name)
Get the value of an Object attribute.

Parameters:
name - name of the attribute.
Returns:
the attribute value as an object if it exists, or null otherwise.

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
Set the with the name name to the value.

Parameters:
name - name of the attribute.
value - value to set the attribute to.

setAttributeValues

public void setAttributeValues(java.lang.String name,
                               java.lang.Object[] values)
Sets a multivalue attribute, disregarding the order of the values. If value is null or value.length == 0 then the attribute will be removed. If update mode, changes will be made only if the array has more or less objects or if one or more object has changed. Reordering the objects will not cause an update.

Parameters:
name - The id of the attribute.
values - Attribute values.

setAttributeValues

public void setAttributeValues(java.lang.String name,
                               java.lang.Object[] values,
                               boolean orderMatters)
Sets a multivalue attribute. If value is null or value.length == 0 then the attribute will be removed. If update mode, changes will be made if the array has more or less objects or if one or more string has changed. Reordering the objects will only cause an update if orderMatters is set to true.

Parameters:
name - The id of the attribute.
values - Attribute values.
orderMatters - If true, it will be changed even if data was just reordered.

update

public void update()
Update the attributes. This will mean that the getters (getStringAttribute methods) will return the updated values. Remove the attributes to be updated.


getStringAttributes

public java.lang.String[] getStringAttributes(java.lang.String name)
Get all values of a String attribute.

Parameters:
name - name of the attribute.
Returns:
all registered values of the attribute.

getAttributeSortedStringSet

public java.util.SortedSet getAttributeSortedStringSet(java.lang.String name)
Get all String values of the attribute as a SortedSet.

Parameters:
name - name of the attribute.
Returns:
a SortedSet containing all values of the attribute.

getDn

public javax.naming.Name getDn()
Returns DN, for example uid=some.user,ou=People,ou=EU.

Returns:
The distinguished name of the current context.
See Also:
DirContextAdapter.getNameInNamespace()

setDn

public void setDn(javax.naming.Name dn)
Set the dn of this entry.

Parameters:
dn - the dn.


Copyright � 2002-2006. All Rights Reserved.