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