com.sun.jndi.ldap.ctl
Class RealAttributesOnlyControl

java.lang.Object
  extended by com.sun.jndi.ldap.BasicControl
      extended by com.sun.jndi.ldap.ctl.RealAttributesOnlyControl
All Implemented Interfaces:
java.io.Serializable, javax.naming.ldap.Control

public class RealAttributesOnlyControl
extends com.sun.jndi.ldap.BasicControl

This class implements a LDAP request control for notifying the server that only real attributes be returned during LDAP search operation.

A real attribute is stored with the entry. Unlike virtual attribute it is physically present in the entry.

This control can be included with any JNDI operation that results in LDAP search. RealAttributeOnlyControl and VirtualAttributesOnlyControl function in a mutually exclusive way. If both controls are included in the search request, the server may send an error back as there are no results to return. If neither of the controls is included in the search request the server will return both virtual and real attributes.

The object identifier for Real Attributes Only control is 2.16.840.1.113730.3.4.17 and the control has no value.

The following code sample shows how the control may be used:


     // create an initial context using the supplied environment properties
     LdapContext ctx = new InitialLdapContext(env, null);

     ctx.setRequestControls(new Control[] {
         new RealAttributesOnlyControl()
     };
     NamingEnumeration results
            = ctx.search(searchBase, filter, constraints);

       while (results != null && results.hasMore()) {
           SearchResult sr = (SearchResult) results.next();

             // Gets only real attributes
           Attributes realAttrs = sr.getAttributes();

 

Author:
Jayalaxmi Hangal
See Also:
VirtualAttributesOnlyControl, Serialized Form

Field Summary
static java.lang.String OID
          The real attributes only control's assigned object identifier is 2.16.840.1.113730.3.4.17
private static long serialVersionUID
           
 
Fields inherited from class com.sun.jndi.ldap.BasicControl
criticality, id, value
 
Fields inherited from interface javax.naming.ldap.Control
CRITICAL, NONCRITICAL
 
Constructor Summary
RealAttributesOnlyControl()
          Constructs a control to return only real attributes in the search result.
 
Method Summary
 
Methods inherited from class com.sun.jndi.ldap.BasicControl
getEncodedValue, getID, isCritical
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
The real attributes only control's assigned object identifier is 2.16.840.1.113730.3.4.17

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

RealAttributesOnlyControl

public RealAttributesOnlyControl()
Constructs a control to return only real attributes in the search result. The control is always marked critical.