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 */ 026 027package org.forgerock.opendj.ldap.controls; 028 029import org.forgerock.opendj.ldap.DecodeException; 030import org.forgerock.opendj.ldap.DecodeOptions; 031 032/** 033 * A factory interface for decoding a control as a control of specific type. 034 * 035 * @param <C> 036 * The type of control decoded by this control decoder. 037 */ 038public interface ControlDecoder<C extends Control> { 039 /** 040 * Decodes the provided control as a {@code Control} of type {@code C}. 041 * 042 * @param control 043 * The control to be decoded. 044 * @param options 045 * The set of decode options which should be used when decoding 046 * the control. 047 * @return The decoded control. 048 * @throws DecodeException 049 * If the control contained the wrong OID, it did not have a 050 * value, or if its value could not be decoded. 051 */ 052 C decodeControl(Control control, DecodeOptions options) throws DecodeException; 053 054 /** 055 * Returns the numeric OID associated with this control decoder. 056 * 057 * @return The numeric OID associated with this control decoder. 058 */ 059 String getOID(); 060}