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 theDefaultDirObjectFactoryin 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 ofModificationItemobjects, suitable as input toLdapTemplate.modifyAttributes(DirContextOperations).This class is aware of the specifics of
Nameinstances 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. IfNameinstances 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 usingNameequality. This means that if an thememberhas 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.protectedDirContextAdapter(DirContextAdapter main)Constructor for cloning an existing adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttributeValue(java.lang.String name, java.lang.Object value)Add a value to the Attribute with the specified name.voidaddAttributeValue(java.lang.String name, java.lang.Object value, boolean addIfDuplicateExists)Add a value to the Attribute with the specified name.java.lang.ObjectaddToEnvironment(java.lang.String propName, java.lang.Object propVal)booleanattributeExists(java.lang.String name)Check if an Object attribute exists, regardless of whether it has a value or not.voidbind(java.lang.String name, java.lang.Object obj)voidbind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs)voidbind(javax.naming.Name name, java.lang.Object obj)voidbind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs)voidclose()java.lang.StringcomposeName(java.lang.String name, java.lang.String prefix)javax.naming.NamecomposeName(javax.naming.Name name, javax.naming.Name prefix)javax.naming.ContextcreateSubcontext(java.lang.String name)javax.naming.directory.DirContextcreateSubcontext(java.lang.String name, javax.naming.directory.Attributes attrs)javax.naming.ContextcreateSubcontext(javax.naming.Name name)javax.naming.directory.DirContextcreateSubcontext(javax.naming.Name name, javax.naming.directory.Attributes attrs)voiddestroySubcontext(java.lang.String name)voiddestroySubcontext(javax.naming.Name name)booleanequals(java.lang.Object o)protected booleanexists(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 booleanexists(javax.naming.directory.Attribute attr)Checks if an entry has a specific attribute.javax.naming.directory.AttributesgetAttributes()Get all attributes.javax.naming.directory.AttributesgetAttributes(java.lang.String name)javax.naming.directory.AttributesgetAttributes(java.lang.String name, java.lang.String[] attrIds)javax.naming.directory.AttributesgetAttributes(javax.naming.Name name)javax.naming.directory.AttributesgetAttributes(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.NamegetDn()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.StringgetNameInNamespace()javax.naming.NameParsergetNameParser(java.lang.String name)javax.naming.NameParsergetNameParser(javax.naming.Name name)java.lang.String[]getNamesOfModifiedAttributes()Creates a String array of the names of the attributes which have been changed.java.lang.ObjectgetObjectAttribute(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.StringgetReferralUrl()If this instance results from a referral, this method returns the url of the referred server.javax.naming.directory.DirContextgetSchema(java.lang.String name)javax.naming.directory.DirContextgetSchema(javax.naming.Name name)javax.naming.directory.DirContextgetSchemaClassDefinition(java.lang.String name)javax.naming.directory.DirContextgetSchemaClassDefinition(javax.naming.Name name)java.lang.StringgetStringAttribute(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.inthashCode()booleanisReferral()Checks whether this instance results from a referral.booleanisUpdateMode()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.Objectlookup(java.lang.String name)java.lang.Objectlookup(javax.naming.Name name)java.lang.ObjectlookupLink(java.lang.String name)java.lang.ObjectlookupLink(javax.naming.Name name)voidmodifyAttributes(java.lang.String name, int modOp, javax.naming.directory.Attributes attrs)voidmodifyAttributes(java.lang.String name, javax.naming.directory.ModificationItem[] mods)voidmodifyAttributes(javax.naming.Name name, int modOp, javax.naming.directory.Attributes attrs)voidmodifyAttributes(javax.naming.Name name, javax.naming.directory.ModificationItem[] mods)voidrebind(java.lang.String name, java.lang.Object obj)voidrebind(java.lang.String name, java.lang.Object obj, javax.naming.directory.Attributes attrs)voidrebind(javax.naming.Name name, java.lang.Object obj)voidrebind(javax.naming.Name name, java.lang.Object obj, javax.naming.directory.Attributes attrs)voidremoveAttributeValue(java.lang.String name, java.lang.Object value)Remove a value from the Attribute with the specified name.java.lang.ObjectremoveFromEnvironment(java.lang.String propName)voidrename(java.lang.String oldName, java.lang.String newName)voidrename(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)voidsetAttribute(javax.naming.directory.Attribute attribute)Set the supplied attribute.voidsetAttributeValue(java.lang.String name, java.lang.Object value)Set the with the namenameto thevalue.voidsetAttributeValues(java.lang.String name, java.lang.Object[] values)Sets a multivalue attribute, disregarding the order of the values.voidsetAttributeValues(java.lang.String name, java.lang.Object[] values, boolean orderMatters)Sets a multivalue attribute.voidsetDn(javax.naming.Name dn)Set the dn of this entry.voidsetUpdateMode(boolean mode)Sets the update mode.java.lang.StringtoString()voidunbind(java.lang.String name)voidunbind(javax.naming.Name name)voidupdate()Update the attributes.This will mean that the getters (getStringAttributemethods) 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 befalsefor a new entry andtruefor 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 betruefor a new entry andtruefor an existing entry that is being updated.- Specified by:
isUpdateModein 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:
getNamesOfModifiedAttributesin 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:
getModificationItemsin 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,nullwill be returned.- Specified by:
getStringAttributein interfaceLdapDataEntry- Parameters:
name- name of the attribute.- Returns:
- the value of the attribute if it exists, or
nullif 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,nullwill be returned.- Specified by:
getObjectAttributein interfaceLdapDataEntry- Parameters:
name- name of the attribute.- Returns:
- the attribute value as an object if it exists, or
nullif 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:
attributeExistsin interfaceLdapDataEntry- Parameters:
name- name of the attribute- Returns:
trueif the attribute exists,falseotherwise
-
setAttributeValue
public void setAttributeValue(java.lang.String name, java.lang.Object value)Set the with the namenameto thevalue. If the value is aNameinstance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValuein 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 aNameinstance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
addAttributeValuein 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. TheaddIfDuplicateExistsparameter 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 aNameinstance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
addAttributeValuein interfaceLdapDataEntry- Parameters:
name- the name of the Attribute to which the specified value should be added.value- the Attribute value to add.addIfDuplicateExists-truewill add the value regardless of whether there is an identical value already, allowing for duplicate attribute values;falsewill 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 aNameinstance, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
removeAttributeValuein 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 areNameinstances, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValuesin 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 areNameinstances, equality for Distinguished Names will be used for calculating attribute modifications.- Specified by:
setAttributeValuesin 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 (getStringAttributemethods) will return the updated values, and the modifications will be forgotten (i.e.AttributeModificationsAware.getModificationItems()will return an empty array.- Specified by:
updatein interfaceDirContextOperations
-
getStringAttributes
public java.lang.String[] getStringAttributes(java.lang.String name)
Get all values of a String attribute.- Specified by:
getStringAttributesin 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
nullotherwise.
-
getObjectAttributes
public java.lang.Object[] getObjectAttributes(java.lang.String name)
Get all values of an Object attribute.- Specified by:
getObjectAttributesin 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
nullotherwise.
-
getAttributeSortedStringSet
public java.util.SortedSet<java.lang.String> getAttributeSortedStringSet(java.lang.String name)
Get all String values of the attribute as aSortedSet.- Specified by:
getAttributeSortedStringSetin interfaceLdapDataEntry- Parameters:
name- name of the attribute.- Returns:
- a
SortedSetcontaining all values of the attribute, ornullif 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:
getAttributesin interfaceLdapDataEntry- Returns:
- all attributes.
-
getAttributes
public javax.naming.directory.Attributes getAttributes(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
getAttributesin 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:
getAttributesin 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:
getAttributesin 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:
getAttributesin 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:
modifyAttributesin 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:
modifyAttributesin 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:
modifyAttributesin 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:
modifyAttributesin 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:
bindin 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:
bindin 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:
rebindin 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:
rebindin 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:
createSubcontextin 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:
createSubcontextin 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:
getSchemain 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:
getSchemain 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:
getSchemaClassDefinitionin 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:
getSchemaClassDefinitionin 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:
searchin 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:
searchin 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:
searchin 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:
searchin 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:
searchin 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:
searchin 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:
searchin 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:
searchin interfacejavax.naming.directory.DirContext- Throws:
javax.naming.NamingException
-
lookup
public java.lang.Object lookup(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
lookupin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
lookup
public java.lang.Object lookup(java.lang.String name) throws javax.naming.NamingException- Specified by:
lookupin 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:
bindin 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:
bindin 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:
rebindin 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:
rebindin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
unbind
public void unbind(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
unbindin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
unbind
public void unbind(java.lang.String name) throws javax.naming.NamingException- Specified by:
unbindin 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:
renamein 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:
renamein 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:
listin 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:
listin 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:
listBindingsin 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:
listBindingsin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
destroySubcontext
public void destroySubcontext(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
destroySubcontextin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
destroySubcontext
public void destroySubcontext(java.lang.String name) throws javax.naming.NamingException- Specified by:
destroySubcontextin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.Context createSubcontext(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
createSubcontextin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
createSubcontext
public javax.naming.Context createSubcontext(java.lang.String name) throws javax.naming.NamingException- Specified by:
createSubcontextin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
lookupLink
public java.lang.Object lookupLink(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
lookupLinkin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
lookupLink
public java.lang.Object lookupLink(java.lang.String name) throws javax.naming.NamingException- Specified by:
lookupLinkin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
getNameParser
public javax.naming.NameParser getNameParser(javax.naming.Name name) throws javax.naming.NamingException- Specified by:
getNameParserin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
getNameParser
public javax.naming.NameParser getNameParser(java.lang.String name) throws javax.naming.NamingException- Specified by:
getNameParserin 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:
composeNamein 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:
composeNamein 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:
addToEnvironmentin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
removeFromEnvironment
public java.lang.Object removeFromEnvironment(java.lang.String propName) throws javax.naming.NamingException- Specified by:
removeFromEnvironmentin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
getEnvironment
public java.util.Hashtable<?,?> getEnvironment() throws javax.naming.NamingException- Specified by:
getEnvironmentin interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
close
public void close() throws javax.naming.NamingException- Specified by:
closein interfacejavax.naming.Context- Throws:
javax.naming.NamingException
-
getNameInNamespace
public java.lang.String getNameInNamespace()
- Specified by:
getNameInNamespacein interfacejavax.naming.Context- Specified by:
getNameInNamespacein 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:
getDnin 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:
setDnin interfaceDirContextOperations- Parameters:
dn- the dn.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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:
getReferralUrlin 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:
isReferralin interfaceDirContextOperations- Returns:
trueif this instance results from a referral,falseotherwise.
-
-