Spring LDAP Framework

org.springframework.ldap.core
Interface DirContextOperations

All Superinterfaces:
AttributeModificationsAware, Context, DirContext
All Known Implementing Classes:
DirContextAdapter

public interface DirContextOperations
extends DirContext, AttributeModificationsAware

Interface for DirContextAdapter.

Author:
Mattias Hellborg Arthursson
See Also:
DirContextAdapter

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
 void addAttributeValue(String name, Object value)
          Add a value to the Attribute with the specified name.
 void addAttributeValue(String name, Object value, boolean addIfDuplicateExists)
          Add a value to the Attribute with the specified name.
 boolean attributeExists(String name)
          Check if an Object attribute exists, regardless of whether it has a value or not.
 Attributes getAttributes()
          Get all the Attributes.
 SortedSet getAttributeSortedStringSet(String name)
          Get all String values of the attribute as a SortedSet.
 Name getDn()
          Returns the DN relative to the base path.
 String getNameInNamespace()
           
 String[] getNamesOfModifiedAttributes()
          Creates a String array of the names of the attributes which have been changed.
 Object getObjectAttribute(String name)
          Get the value of an Object attribute.
 Object[] getObjectAttributes(String name)
          Get all values of an Object attribute.
 String getReferralUrl()
          If this instance results from a referral, this method returns the url of the referred server.
 String getStringAttribute(String name)
          Get the value of a String attribute.
 String[] getStringAttributes(String name)
          Get all values of a String attribute.
 boolean isReferral()
          Checks whether this instance results from a referral.
 boolean isUpdateMode()
          Gets the update mode.
 void removeAttributeValue(String name, Object value)
          Remove a value from the Attribute with the specified name.
 void setAttributeValue(String name, Object value)
          Set the with the name name to the value.
 void setAttributeValues(String name, Object[] values)
          Sets a multivalue attribute, disregarding the order of the values.
 void setAttributeValues(String name, Object[] values, boolean orderMatters)
          Sets a multivalue attribute.
 void setDn(Name dn)
          Set the dn of this entry.
 void update()
          Update the attributes.This will mean that the getters ( getStringAttribute methods) will return the updated values, and the modifications will be forgotten (i.e.
 
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, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
Methods inherited from interface org.springframework.ldap.core.AttributeModificationsAware
getModificationItems
 

Method Detail

isUpdateMode

boolean isUpdateMode()
Gets the update mode. An entry in update mode will keep track of its modifications so that they can be retrieved using AttributeModificationsAware.getModificationItems(). The update mode should be true for a new entry and true for an existing entry that is being updated.

Returns:
update mode.

getNamesOfModifiedAttributes

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

String getStringAttribute(String name)
Get the value of a String attribute. If more than one attribute value exists for the specified attribute, only the first one will be returned. If an attribute has no value, null will be returned.

Parameters:
name - name of the attribute.
Returns:
the value of the attribute if it exists, or null if the attribute doesn't exist or if it exists but with no value.
Throws:
ClassCastException - if the value of the entry is not a String.

getObjectAttribute

Object getObjectAttribute(String name)
Get the value of an Object attribute. If more than one attribute value exists for the specified attribute, only the first one will be returned. If an attribute has no value, null will be returned.

Parameters:
name - name of the attribute.
Returns:
the attribute value as an object if it exists, or null if the attribute doesn't exist or if it exists but with no value.

attributeExists

boolean attributeExists(String name)
Check if an Object attribute exists, regardless of whether it has a value or not.

Parameters:
name - name of the attribute
Returns:
true if the attribute exists, false otherwise

setAttributeValue

void setAttributeValue(String name,
                       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

void setAttributeValues(String name,
                        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

void setAttributeValues(String name,
                        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.

addAttributeValue

void addAttributeValue(String name,
                       Object value)
Add a value to the Attribute with the specified name. If the Attribute doesn't exist it will be created. This method makes sure that the there will be no duplicates of an added value - it the value exists it will not be added again.

Parameters:
name - the name of the Attribute to which the specified value should be added.
value - the Attribute value to add.

addAttributeValue

void addAttributeValue(String name,
                       Object value,
                       boolean addIfDuplicateExists)
Add a value to the Attribute with the specified name. If the Attribute doesn't exist it will be created. The addIfDuplicateExists parameter controls the handling of duplicates. It false, this method makes sure that the there will be no duplicates of an added value - it the value exists it will not be added again.

Parameters:
name - the name of the Attribute to which the specified value should be added.
value - the Attribute value to add.
addIfDuplicateExists - true will add the value regardless of whether there is an identical value already, allowing for duplicate attribute values; false will not add the value if it already exists.

removeAttributeValue

void removeAttributeValue(String name,
                          Object value)
Remove a value from the Attribute with the specified name. If the Attribute doesn't exist, do nothing.

Parameters:
name - the name of the Attribute from which the specified value should be removed.
value - the value to remove.

update

void update()
Update the attributes.This will mean that the getters ( getStringAttribute methods) will return the updated values, and the modifications will be forgotten (i.e. AttributeModificationsAware.getModificationItems() will return an empty array.


getStringAttributes

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

Parameters:
name - name of the attribute.
Returns:
a (possibly empty) array containing all registered values of the attribute as Strings if the attribute is defined or null otherwise.
Throws:
ArrayStoreException - if any of the attribute values is not a String.

getObjectAttributes

Object[] getObjectAttributes(String name)
Get all values of an Object attribute.

Parameters:
name - name of the attribute.
Returns:
a (possibly empty) array containing all registered values of the attribute if the attribute is defined or null otherwise.
Since:
1.3

getAttributeSortedStringSet

SortedSet getAttributeSortedStringSet(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, or null if the attribute does not exist.

getDn

Name getDn()
Returns the DN relative to the base path.

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

setDn

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

Parameters:
dn - the dn.

getNameInNamespace

String getNameInNamespace()
Specified by:
getNameInNamespace in interface Context

getReferralUrl

String getReferralUrl()
If this instance results from a referral, this method returns the url of the referred server.

Returns:
The url of the referred server, e.g. ldap://localhost:389, or the empty string if this is not a referral.
Since:
1.3

isReferral

boolean isReferral()
Checks whether this instance results from a referral.

Returns:
true if this instance results from a referral, false otherwise.
Since:
1.3

getAttributes

Attributes getAttributes()
Get all the Attributes.

Returns:
all the Attributes.
Since:
1.3

Spring LDAP Framework

Copyright © 2005-2010 The Spring LDAP Framework. All Rights Reserved.