1 /* 2 * @(#)Control.java 1.8 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package javax.naming.ldap; 9 10 /** 11 * This interface represents an LDAPv3 control as defined in 12 * <A HREF="ftp://ftp.isi.edu/in-notes/rfc2251.txt">RFC 2251</A>. 13 *<p> 14 * The LDAPv3 protocol uses controls to send and receive additional data 15 * to affect the behavior of predefined operations. 16 * Controls can be sent along with any LDAP operation to the server. 17 * These are referred to as <em>request controls</em>. For example, a 18 * "sort" control can be sent with an LDAP search operation to 19 * request that the results be returned in a particular order. 20 * Solicited and unsolicited controls can also be returned with 21 * responses from the server. Such controls are referred to as 22 * <em>response controls</em>. For example, an LDAP server might 23 * define a special control to return change notifications. 24 *<p> 25 * This interface is used to represent both request and response controls. 26 * 27 * @author Rosanna Lee 28 * @author Scott Seligman 29 * @author Vincent Ryan 30 * @version 1.8 03/12/19 31 * 32 * @see ControlFactory 33 * @since 1.3 34 */ 35 public interface Control extends java.io.Serializable { 36 /** 37 * Indicates a critical control. 38 * The value of this constant is <tt>true</tt>. 39 */ 40 public static final boolean CRITICAL = true; 41 42 /** 43 * Indicates a non-critical control. 44 * The value of this constant is <tt>false</tt>. 45 */ 46 public static final boolean NONCRITICAL = false; 47 48 /** 49 * Retrieves the object identifier assigned for the LDAP control. 50 * 51 * @return The non-null object identifier string. 52 */ 53 public String getID(); 54 55 /** 56 * Determines the criticality of the LDAP control. 57 * A critical control must not be ignored by the server. 58 * In other words, if the server receives a critical control 59 * that it does not support, regardless of whether the control 60 * makes sense for the operation, the operation will not be performed 61 * and an <tt>OperationNotSupportedException</tt> will be thrown. 62 * @return true if this control is critical; false otherwise. 63 */ 64 public boolean isCritical(); 65 66 /** 67 * Retrieves the ASN.1 BER encoded value of the LDAP control. 68 * The result is the raw BER bytes including the tag and length of 69 * the control's value. It does not include the controls OID or criticality. 70 * 71 * Null is returned if the value is absent. 72 * 73 * @return A possibly null byte array representing the ASN.1 BER encoded 74 * value of the LDAP control. 75 */ 76 public byte[] getEncodedValue(); 77 78 // static final long serialVersionUID = -591027748900004825L; 79 } 80