Path: blob/master/src/java.naming/share/classes/javax/naming/ldap/Control.java
41159 views
/*1* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.naming.ldap;2627/**28* This interface represents an LDAPv3 control as defined in29* <A HREF="http://www.ietf.org/rfc/rfc2251.txt">RFC 2251</A>.30*<p>31* The LDAPv3 protocol uses controls to send and receive additional data32* to affect the behavior of predefined operations.33* Controls can be sent along with any LDAP operation to the server.34* These are referred to as <em>request controls</em>. For example, a35* "sort" control can be sent with an LDAP search operation to36* request that the results be returned in a particular order.37* Solicited and unsolicited controls can also be returned with38* responses from the server. Such controls are referred to as39* <em>response controls</em>. For example, an LDAP server might40* define a special control to return change notifications.41*<p>42* This interface is used to represent both request and response controls.43*44* @author Rosanna Lee45* @author Scott Seligman46* @author Vincent Ryan47*48* @see ControlFactory49* @since 1.350*/51public interface Control extends java.io.Serializable {52/**53* Indicates a critical control.54* The value of this constant is {@code true}.55*/56public static final boolean CRITICAL = true;5758/**59* Indicates a non-critical control.60* The value of this constant is {@code false}.61*/62public static final boolean NONCRITICAL = false;6364/**65* Retrieves the object identifier assigned for the LDAP control.66*67* @return The non-null object identifier string.68*/69public String getID();7071/**72* Determines the criticality of the LDAP control.73* A critical control must not be ignored by the server.74* In other words, if the server receives a critical control75* that it does not support, regardless of whether the control76* makes sense for the operation, the operation will not be performed77* and an {@code OperationNotSupportedException} will be thrown.78* @return true if this control is critical; false otherwise.79*/80public boolean isCritical();8182/**83* Retrieves the ASN.1 BER encoded value of the LDAP control.84* The result is the raw BER bytes including the tag and length of85* the control's value. It does not include the controls OID or criticality.86*87* Null is returned if the value is absent.88*89* @return A possibly null byte array representing the ASN.1 BER encoded90* value of the LDAP control.91*/92public byte[] getEncodedValue();9394// static final long serialVersionUID = -591027748900004825L;95}969798