com.sun.jndi.ldap.ctl
Class VirtualAttributesOnlyControl

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

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

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

A virtual attribute is not stored with the entry. It is computed and returned to the client application as a normal attribute during the LDAP operation.

This control can be included with any JNDI operation that results in a LDAP search. VirtualAttributeOnlyControl and RealAttributesOnlyControl 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 Virtual Attributes Only control is 2.16.840.1.113730.3.4.19 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 VirtualAttributesOnlyControl()
     };
     NamingEnumeration results
            = ctx.search(searchBase, filter, constraints);

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

           // Gets only virtual attributes
           Attributes virtualAttrs = sr.getAttributes();


 

Author:
Jayalaxmi Hangal
See Also:
RealAttributesOnlyControl, Serialized Form

Field Summary
static java.lang.String OID
          The virtual attributes only control's assigned object identifier is 2.16.840.1.113730.3.4.19
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
VirtualAttributesOnlyControl()
          Constructs a control to return only virtual 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 virtual attributes only control's assigned object identifier is 2.16.840.1.113730.3.4.19

See Also:
Constant Field Values

serialVersionUID

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

VirtualAttributesOnlyControl

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