Class DirContextAdapter
- java.lang.Object
-
- org.springframework.ldap.core.DirContextAdapter
-
- All Implemented Interfaces:
javax.naming.Context
,javax.naming.directory.DirContext
,AttributeModificationsAware
,DirContextOperations
,LdapDataEntry
public class DirContextAdapter extends java.lang.Object implements DirContextOperations
Adapter that implements the interesting methods of the DirContext interface. In particular it contains utility methods for getting and setting attributes. Using theDefaultDirObjectFactory
in yourContextSource
(which is the default) you will receive instances of this class from searches and lookups. This can be particularly useful when updating data, since this class implementsAttributeModificationsAware
, providing agetModificationItems()
method. When in update mode, an object of this class keeps track of the changes made to its attributes, making them available as an array ofModificationItem
objects, suitable as input toLdapTemplate.modifyAttributes(DirContextOperations)
.This class is aware of the specifics of
Name
instances with regards to equality when working with attribute values. This comes in very handy when working with e.g. security groups and modifications of them. IfName
instances are supplied to one of the Attribute manipulation methods (e.g.addAttributeValue(String, Object)
,removeAttributeValue(String, Object)
,setAttributeValue(String, Object)
, orsetAttributeValues(String, Object[])
), the produced modifications will be calculated usingName
equality. This means that if an themember
has a value of"cn=John Doe,ou=People"
, and we calladdAttributeValue("member", LdapUtils.newLdapName("CN=John Doe,OU=People")
, this will not be considered a modification since the two DN strings represent the same distinguished name (case and spacing between attributes is disregarded).Note that this is not a complete implementation of DirContext. Several methods are not relevant for the intended usage of this class, so they throw UnsupportOperationException.
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description DirContextAdapter()
Default constructor.DirContextAdapter(java.lang.String dnString)
Create a new DirContextAdapter from the supplied DN String.DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn)
Create a new adapter from the supplied attributes and dn.DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn, javax.naming.Name base)
Create a new adapter from the supplied attributes, dn, and base.DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn, javax.naming.Name base, java.lang.String referralUrl)
Create a new adapter from the supplied attributes, dn, base, and referral url.DirContextAdapter(javax.naming.Name dn)
Create a new adapter from the supplied dn.protected
DirContextAdapter(DirContextAdapter main)
Constructor for cloning an existing adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeValue(java.lang.String name, java.lang.Object value)
Add a value to the Attribute with the specified name.void
addAttributeValue(java.lang.String name, java.lang.Object value, boolean addIfDuplicateExists)
Add a value to the Attribute with the specified name.java.lang.Object
addToEnvironment(java.lang.String propName, java.lang.Object propVal)
boolean
attributeExists(java.lang.String name)
Check if an Object attribute exists, regardless of whether it has a value or not.void
bind(java.lang.String name, java.lang.Object obj)
void
bind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs)
void
bind(javax.naming.Name name, java.lang.Object obj)
void
bind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs)
void
close()
java.lang.String
composeName(java.lang.String name, java.lang.String prefix)
javax.naming.Name
composeName(javax.naming.Name name, javax.naming.Name prefix)
javax.naming.Context
createSubcontext(java.lang.String name)
javax.naming.directory.DirContext
createSubcontext(java.lang.String name, javax.naming.directory.Attributes attrs)
javax.naming.Context
createSubcontext(javax.naming.Name name)
javax.naming.directory.DirContext
createSubcontext(javax.naming.Name name, javax.naming.directory.Attributes attrs)
void
destroySubcontext(java.lang.String name)
void
destroySubcontext(javax.naming.Name name)
boolean
equals(java.lang.Object o)
protected boolean
exists(java.lang.String attrId)
Checks if the attribute exists in this entry, either it was read or it has been added and update() has been called.protected boolean
exists(javax.naming.directory.Attribute attr)
Checks if an entry has a specific attribute.javax.naming.directory.Attributes
getAttributes()
Get all attributes.javax.naming.directory.Attributes
getAttributes(java.lang.String name)
javax.naming.directory.Attributes
getAttributes(java.lang.String name, java.lang.String[] attrIds)
javax.naming.directory.Attributes
getAttributes(javax.naming.Name name)
javax.naming.directory.Attributes
getAttributes(javax.naming.Name name, java.lang.String[] attrIds)
java.util.SortedSet<java.lang.String>
getAttributeSortedStringSet(java.lang.String name)
Get all String values of the attribute as aSortedSet
.javax.naming.Name
getDn()
Returns the DN relative to the base path.java.util.Hashtable<?,?>
getEnvironment()
javax.naming.directory.ModificationItem[]
getModificationItems()
Creates an array of which attributes have been changed, added or removed since the initialization of this object.java.lang.String
getNameInNamespace()
javax.naming.NameParser
getNameParser(java.lang.String name)
javax.naming.NameParser
getNameParser(javax.naming.Name name)
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.Object[]
getObjectAttributes(java.lang.String name)
Get all values of an Object attribute.java.lang.String
getReferralUrl()
If this instance results from a referral, this method returns the url of the referred server.javax.naming.directory.DirContext
getSchema(java.lang.String name)
javax.naming.directory.DirContext
getSchema(javax.naming.Name name)
javax.naming.directory.DirContext
getSchemaClassDefinition(java.lang.String name)
javax.naming.directory.DirContext
getSchemaClassDefinition(javax.naming.Name name)
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.int
hashCode()
boolean
isReferral()
Checks whether this instance results from a referral.boolean
isUpdateMode()
Gets the update mode.javax.naming.NamingEnumeration<javax.naming.NameClassPair>
list(java.lang.String name)
javax.naming.NamingEnumeration<javax.naming.NameClassPair>
list(javax.naming.Name name)
javax.naming.NamingEnumeration<javax.naming.Binding>
listBindings(java.lang.String name)
javax.naming.NamingEnumeration<javax.naming.Binding>
listBindings(javax.naming.Name name)
java.lang.Object
lookup(java.lang.String name)
java.lang.Object
lookup(javax.naming.Name name)
java.lang.Object
lookupLink(java.lang.String name)
java.lang.Object
lookupLink(javax.naming.Name name)
void
modifyAttributes(java.lang.String name, int modOp, javax.naming.directory.Attributes attrs)
void
modifyAttributes(java.lang.String name, javax.naming.directory.ModificationItem[] mods)
void
modifyAttributes(javax.naming.Name name, int modOp, javax.naming.directory.Attributes attrs)
void
modifyAttributes(javax.naming.Name name, javax.naming.directory.ModificationItem[] mods)
void
rebind(java.lang.String name, java.lang.Object obj)
void
rebind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs)
void
rebind(javax.naming.Name name, java.lang.Object obj)
void
rebind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs)
void
removeAttributeValue(java.lang.String name, java.lang.Object value)
Remove a value from the Attribute with the specified name.java.lang.Object
removeFromEnvironment(java.lang.String propName)
void
rename(java.lang.String oldName, java.lang.String newName)
void
rename(javax.naming.Name oldName, javax.naming.Name newName)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(java.lang.String name, java.lang.String filterExpr, java.lang.Object[] filterArgs, javax.naming.directory.SearchControls cons)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(java.lang.String name, java.lang.String filter, javax.naming.directory.SearchControls cons)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(java.lang.String name, javax.naming.directory.Attributes matchingAttributes)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(java.lang.String name, javax.naming.directory.Attributes matchingAttributes, java.lang.String[] attributesToReturn)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(javax.naming.Name name, java.lang.String filterExpr, java.lang.Object[] filterArgs, javax.naming.directory.SearchControls cons)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(javax.naming.Name name, java.lang.String filter, javax.naming.directory.SearchControls cons)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(javax.naming.Name name, javax.naming.directory.Attributes matchingAttributes)
javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>
search(javax.naming.Name name, javax.naming.directory.Attributes matchingAttributes, java.lang.String[] attributesToReturn)
void
setAttribute(javax.naming.directory.Attribute attribute)
Set the supplied attribute.void
setAttributeValue(java.lang.String name, java.lang.Object value)
Set the with the namename
to thevalue
.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
setUpdateMode(boolean mode)
Sets the update mode.java.lang.String
toString()
void
unbind(java.lang.String name)
void
unbind(javax.naming.Name name)
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.
-
-
-
Constructor Detail
-
DirContextAdapter
public DirContextAdapter()
Default constructor.
-
DirContextAdapter
public DirContextAdapter(java.lang.String dnString)
Create a new DirContextAdapter from the supplied DN String.- Parameters:
dnString
- the DN string. Must be syntactically correct, or an exception will be thrown.
-
DirContextAdapter
public DirContextAdapter(javax.naming.Name dn)
Create a new adapter from the supplied dn.- Parameters:
dn
- the dn.
-
DirContextAdapter
public DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn)
Create a new adapter from the supplied attributes and dn.- Parameters:
attrs
- the attributes.dn
- the dn.
-
DirContextAdapter
public DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn, javax.naming.Name base)
Create a new adapter from the supplied attributes, dn, and base.- Parameters:
attrs
- the attributes.dn
- the dn.base
- the base name.
-
DirContextAdapter
public DirContextAdapter(javax.naming.directory.Attributes attrs, javax.naming.Name dn, javax.naming.Name base, java.lang.String referralUrl)
Create a new adapter from the supplied attributes, dn, base, and referral url.- Parameters:
attrs
- the attributes.dn
- the dn.base
- the base.referralUrl
- the referral url (if this instance results from a referral).
-
DirContextAdapter
protected DirContextAdapter(DirContextAdapter main)
Constructor for cloning an existing adapter.- Parameters:
main
- The adapter to be copied.
-
-
Method Detail
-
setUpdateMode
public void setUpdateMode(boolean mode)
Sets the update mode. The update mode should befalse
for a new entry andtrue
for an existing entry that is being updated.- Parameters:
mode
- Update mode.
-
isUpdateMode
public boolean isUpdateMode()
Gets the update mode. An entry in update mode will keep track of its modifications so that they can be retrieved usingAttributeModificationsAware.getModificationItems()
. The update mode should betrue
for a new entry andtrue
for an existing entry that is being updated.- Specified by:
isUpdateMode
in interfaceDirContextOperations
- 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.- Specified by:
getNamesOfModifiedAttributes
in interfaceDirContextOperations
- Returns:
- Array of String
-
getModificationItems
public javax.naming.directory.ModificationItem[] getModificationItems()
Creates an array of which attributes have been changed, added or removed since the initialization of this object.- Specified by:
getModificationItems
in interfaceAttributeModificationsAware
- Returns:
- an array of modification items.
-
exists
protected final boolean exists(javax.naming.directory.Attribute attr)
Checks if an entry has a specific attribute. This method simply calls exists(String) with the attribute name.- Parameters:
attr
- the attribute to check.- Returns:
- true if attribute exists in entry.
-
exists
protected final boolean exists(java.lang.String attrId)
Checks if the attribute exists in this entry, either it was read or it has been added and update() has been called.- Parameters:
attrId
- id of the attribute to check.- Returns:
- true if the attribute exists in the entry.
-
getStringAttribute
public java.lang.String getStringAttribute(java.lang.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.- Specified by:
getStringAttribute
in interfaceLdapDataEntry
- 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.
-
getObjectAttribute
public java.lang.Object getObjectAttribute(java.lang.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.- Specified by:
getObjectAttribute
in interfaceLdapDataEntry
- 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
public boolean attributeExists(java.lang.String name)
Check if an Object attribute exists, regardless of whether it has a value or not.- Specified by:
attributeExists
in interfaceLdapDataEntry
- Parameters:
name
- name of the attribute- Returns:
true
if the attribute exists,false
otherwise
-
setAttributeValue
public void setAttributeValue(java.lang.String name, java.lang.Object value)
Set the with the namename
to thevalue
. If the value is aName
instance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValue
in interfaceLdapDataEntry
- Parameters:
name
- name of the attribute.value
- value to set the attribute to.
-
addAttributeValue
public void addAttributeValue(java.lang.String name, java.lang.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. If the value is aName
instance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
addAttributeValue
in interfaceLdapDataEntry
- Parameters:
name
- the name of the Attribute to which the specified value should be added.value
- the Attribute value to add.
-
addAttributeValue
public void addAttributeValue(java.lang.String name, java.lang.Object value, boolean addIfDuplicateExists)
Add a value to the Attribute with the specified name. If the Attribute doesn't exist it will be created. TheaddIfDuplicateExists
parameter controls the handling of duplicates. Itfalse
, 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. If the value is aName
instance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
addAttributeValue
in interfaceLdapDataEntry
- 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
public void removeAttributeValue(java.lang.String name, java.lang.Object value)
Remove a value from the Attribute with the specified name. If the Attribute doesn't exist, do nothing. If the value is aName
instance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
removeAttributeValue
in interfaceLdapDataEntry
- Parameters:
name
- the name of the Attribute from which the specified value should be removed.value
- the value to remove.
-
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. If the values areName
instances, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValues
in interfaceLdapDataEntry
- 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. If the values areName
instances, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValues
in interfaceLdapDataEntry
- Parameters:
name
- The id of the attribute.values
- Attribute values.orderMatters
- Iftrue
, 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, and the modifications will be forgotten (i.e.AttributeModificationsAware.getModificationItems()
will return an empty array.- Specified by:
update
in interfaceDirContextOperations
-
getStringAttributes
public java.lang.String[] getStringAttributes(java.lang.String name)
Get all values of a String attribute.- Specified by:
getStringAttributes
in interfaceLdapDataEntry
- 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.
-
getObjectAttributes
public java.lang.Object[] getObjectAttributes(java.lang.String name)
Get all values of an Object attribute.- Specified by:
getObjectAttributes
in interfaceLdapDataEntry
- 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.
-
getAttributeSortedStringSet
public java.util.SortedSet<java.lang.String> getAttributeSortedStringSet(java.lang.String name)
Get all String values of the attribute as aSortedSet
.- Specified by:
getAttributeSortedStringSet
in interfaceLdapDataEntry
- Parameters:
name
- name of the attribute.- Returns:
- a
SortedSet
containing all values of the attribute, ornull
if the attribute does not exist.
-
setAttribute
public void setAttribute(javax.naming.directory.Attribute attribute)
Set the supplied attribute.- Parameters:
attribute
- the attribute to set.
-
getAttributes
public javax.naming.directory.Attributes getAttributes()
Get all attributes.- Specified by:
getAttributes
in interfaceLdapDataEntry
- Returns:
- all attributes.
-
getAttributes
public javax.naming.directory.Attributes getAttributes(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
getAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getAttributes
public javax.naming.directory.Attributes getAttributes(java.lang.String name) throws javax.naming.NamingException
- Specified by:
getAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getAttributes
public javax.naming.directory.Attributes getAttributes(javax.naming.Name name, java.lang.String[] attrIds) throws javax.naming.NamingException
- Specified by:
getAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getAttributes
public javax.naming.directory.Attributes getAttributes(java.lang.String name, java.lang.String[] attrIds) throws javax.naming.NamingException
- Specified by:
getAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
modifyAttributes
public void modifyAttributes(javax.naming.Name name, int modOp, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
modifyAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
modifyAttributes
public void modifyAttributes(java.lang.String name, int modOp, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
modifyAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
modifyAttributes
public void modifyAttributes(javax.naming.Name name, javax.naming.directory.ModificationItem[] mods) throws javax.naming.NamingException
- Specified by:
modifyAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
modifyAttributes
public void modifyAttributes(java.lang.String name, javax.naming.directory.ModificationItem[] mods) throws javax.naming.NamingException
- Specified by:
modifyAttributes
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
bind
public void bind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
bind
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
bind
public void bind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
bind
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
rebind
public void rebind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
rebind
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
rebind
public void rebind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
rebind
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.directory.DirContext createSubcontext(javax.naming.Name name, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
createSubcontext
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.directory.DirContext createSubcontext(java.lang.String name, javax.naming.directory.Attributes attrs) throws javax.naming.NamingException
- Specified by:
createSubcontext
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getSchema
public javax.naming.directory.DirContext getSchema(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
getSchema
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getSchema
public javax.naming.directory.DirContext getSchema(java.lang.String name) throws javax.naming.NamingException
- Specified by:
getSchema
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getSchemaClassDefinition
public javax.naming.directory.DirContext getSchemaClassDefinition(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
getSchemaClassDefinition
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
getSchemaClassDefinition
public javax.naming.directory.DirContext getSchemaClassDefinition(java.lang.String name) throws javax.naming.NamingException
- Specified by:
getSchemaClassDefinition
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(javax.naming.Name name, javax.naming.directory.Attributes matchingAttributes, java.lang.String[] attributesToReturn) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(java.lang.String name, javax.naming.directory.Attributes matchingAttributes, java.lang.String[] attributesToReturn) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(javax.naming.Name name, javax.naming.directory.Attributes matchingAttributes) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(java.lang.String name, javax.naming.directory.Attributes matchingAttributes) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(javax.naming.Name name, java.lang.String filter, javax.naming.directory.SearchControls cons) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(java.lang.String name, java.lang.String filter, javax.naming.directory.SearchControls cons) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(javax.naming.Name name, java.lang.String filterExpr, java.lang.Object[] filterArgs, javax.naming.directory.SearchControls cons) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
search
public javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> search(java.lang.String name, java.lang.String filterExpr, java.lang.Object[] filterArgs, javax.naming.directory.SearchControls cons) throws javax.naming.NamingException
- Specified by:
search
in interfacejavax.naming.directory.DirContext
- Throws:
javax.naming.NamingException
-
lookup
public java.lang.Object lookup(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
lookup
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
lookup
public java.lang.Object lookup(java.lang.String name) throws javax.naming.NamingException
- Specified by:
lookup
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
bind
public void bind(javax.naming.Name name, java.lang.Object obj) throws javax.naming.NamingException
- Specified by:
bind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
bind
public void bind(java.lang.String name, java.lang.Object obj) throws javax.naming.NamingException
- Specified by:
bind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
rebind
public void rebind(javax.naming.Name name, java.lang.Object obj) throws javax.naming.NamingException
- Specified by:
rebind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
rebind
public void rebind(java.lang.String name, java.lang.Object obj) throws javax.naming.NamingException
- Specified by:
rebind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
unbind
public void unbind(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
unbind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
unbind
public void unbind(java.lang.String name) throws javax.naming.NamingException
- Specified by:
unbind
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
rename
public void rename(javax.naming.Name oldName, javax.naming.Name newName) throws javax.naming.NamingException
- Specified by:
rename
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
rename
public void rename(java.lang.String oldName, java.lang.String newName) throws javax.naming.NamingException
- Specified by:
rename
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
list
public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
list
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
list
public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(java.lang.String name) throws javax.naming.NamingException
- Specified by:
list
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
listBindings
public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
listBindings
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
listBindings
public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(java.lang.String name) throws javax.naming.NamingException
- Specified by:
listBindings
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
destroySubcontext
public void destroySubcontext(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
destroySubcontext
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
destroySubcontext
public void destroySubcontext(java.lang.String name) throws javax.naming.NamingException
- Specified by:
destroySubcontext
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.Context createSubcontext(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
createSubcontext
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.Context createSubcontext(java.lang.String name) throws javax.naming.NamingException
- Specified by:
createSubcontext
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
lookupLink
public java.lang.Object lookupLink(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
lookupLink
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
lookupLink
public java.lang.Object lookupLink(java.lang.String name) throws javax.naming.NamingException
- Specified by:
lookupLink
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
getNameParser
public javax.naming.NameParser getNameParser(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
getNameParser
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
getNameParser
public javax.naming.NameParser getNameParser(java.lang.String name) throws javax.naming.NamingException
- Specified by:
getNameParser
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
composeName
public javax.naming.Name composeName(javax.naming.Name name, javax.naming.Name prefix) throws javax.naming.NamingException
- Specified by:
composeName
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
composeName
public java.lang.String composeName(java.lang.String name, java.lang.String prefix) throws javax.naming.NamingException
- Specified by:
composeName
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
addToEnvironment
public java.lang.Object addToEnvironment(java.lang.String propName, java.lang.Object propVal) throws javax.naming.NamingException
- Specified by:
addToEnvironment
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
removeFromEnvironment
public java.lang.Object removeFromEnvironment(java.lang.String propName) throws javax.naming.NamingException
- Specified by:
removeFromEnvironment
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
getEnvironment
public java.util.Hashtable<?,?> getEnvironment() throws javax.naming.NamingException
- Specified by:
getEnvironment
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
close
public void close() throws javax.naming.NamingException
- Specified by:
close
in interfacejavax.naming.Context
- Throws:
javax.naming.NamingException
-
getNameInNamespace
public java.lang.String getNameInNamespace()
- Specified by:
getNameInNamespace
in interfacejavax.naming.Context
- Specified by:
getNameInNamespace
in interfaceDirContextOperations
-
getDn
public javax.naming.Name getDn()
Returns the DN relative to the base path. NB: as of version 2.0 the returned name will be an LdapName instance.- Specified by:
getDn
in interfaceLdapDataEntry
- Returns:
- The distinguished name of the current context.
- See Also:
getNameInNamespace()
-
setDn
public final void setDn(javax.naming.Name dn)
Set the dn of this entry.- Specified by:
setDn
in interfaceDirContextOperations
- Parameters:
dn
- the dn.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getReferralUrl
public java.lang.String getReferralUrl()
If this instance results from a referral, this method returns the url of the referred server.- Specified by:
getReferralUrl
in interfaceDirContextOperations
- Returns:
- The url of the referred server, e.g.
ldap://localhost:389
, or the empty string if this is not a referral.
-
isReferral
public boolean isReferral()
Checks whether this instance results from a referral.- Specified by:
isReferral
in interfaceDirContextOperations
- Returns:
true
if this instance results from a referral,false
otherwise.
-
-