001/* 002 * Copyright 2007-2014 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2008-2014 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk; 022 023 024 025import java.io.Serializable; 026 027import com.unboundid.asn1.ASN1OctetString; 028import com.unboundid.util.Extensible; 029import com.unboundid.util.ThreadSafety; 030import com.unboundid.util.ThreadSafetyLevel; 031 032 033 034/** 035 * This interface defines a method that may be implemented by controls that may 036 * be included in the response from a directory server. The LDAP SDK will 037 * maintain a mapping between response control OIDs and the decodeable control 038 * classes that may be used to attempt to decode them. If a control cannot be 039 * decoded using this interface and an exception is thrown, then it will be 040 * treated as a generic control. 041 */ 042@Extensible() 043@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 044public interface DecodeableControl 045 extends Serializable 046{ 047 /** 048 * Creates a new instance of this decodeable control from the provided 049 * information. 050 * 051 * @param oid The OID for the control. 052 * @param isCritical Indicates whether the control should be marked 053 * critical. 054 * @param value The encoded value for the control. This may be 055 * {@code null} if no value was provided. 056 * 057 * @return The decoded representation of this control. 058 * 059 * @throws LDAPException If the provided information cannot be decoded as a 060 * valid instance of this decodeable control. 061 */ 062 Control decodeControl(final String oid, final boolean isCritical, 063 final ASN1OctetString value) 064 throws LDAPException; 065}