001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2010 Sun Microsystems, Inc. 015 * Portions copyright 2012-2015 ForgeRock AS. 016 */ 017 018package org.forgerock.opendj.ldap.responses; 019 020import java.util.List; 021 022import org.forgerock.opendj.ldap.ByteString; 023import org.forgerock.opendj.ldap.DecodeException; 024import org.forgerock.opendj.ldap.DecodeOptions; 025import org.forgerock.opendj.ldap.controls.Control; 026import org.forgerock.opendj.ldap.controls.ControlDecoder; 027 028/** 029 * A Generic Intermediate response provides a mechanism for communicating 030 * unrecognized or unsupported Intermediate responses to the client. 031 */ 032public interface GenericIntermediateResponse extends IntermediateResponse { 033 034 @Override 035 GenericIntermediateResponse addControl(Control control); 036 037 @Override 038 <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) 039 throws DecodeException; 040 041 @Override 042 List<Control> getControls(); 043 044 @Override 045 String getOID(); 046 047 @Override 048 ByteString getValue(); 049 050 @Override 051 boolean hasValue(); 052 053 /** 054 * Sets the numeric OID, if any, associated with this intermediate response. 055 * 056 * @param oid 057 * The numeric OID associated with this intermediate response, or 058 * {@code null} if there is no value. 059 * @return This generic intermediate response. 060 * @throws UnsupportedOperationException 061 * If this intermediate response does not permit the response 062 * name to be set. 063 */ 064 GenericIntermediateResponse setOID(String oid); 065 066 /** 067 * Sets the value, if any, associated with this intermediate response. Its 068 * format is defined by the specification of this intermediate response. 069 * <p> 070 * If {@code value} is not an instance of {@code ByteString} then it will be 071 * converted using the {@link ByteString#valueOfObject(Object)} method. 072 * 073 * @param value 074 * The value associated with this intermediate response, or 075 * {@code null} if there is no value. 076 * @return This generic intermediate response. 077 * @throws UnsupportedOperationException 078 * If this intermediate response does not permit the response 079 * value to be set. 080 */ 081 GenericIntermediateResponse setValue(Object value); 082 083}