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 */
016
017package org.forgerock.opendj.ldap.requests;
018
019import org.forgerock.opendj.ldap.DecodeException;
020import org.forgerock.opendj.ldap.DecodeOptions;
021import org.forgerock.opendj.ldap.responses.ExtendedResult;
022
023/**
024 * A factory interface for decoding a generic extended request as an extended
025 * request of specific type.
026 *
027 * @param <R>
028 *            The type of extended request.
029 * @param <S>
030 *            The type of result.
031 */
032public interface ExtendedRequestDecoder<R extends ExtendedRequest<S>, S extends ExtendedResult> {
033    /**
034     * Decodes the provided extended operation request as an
035     * {@code ExtendedRequest} of type {@code R}.
036     *
037     * @param request
038     *            The extended operation request to be decoded.
039     * @param options
040     *            The set of decode options which should be used when decoding
041     *            the extended operation request.
042     * @return The decoded extended operation request.
043     * @throws DecodeException
044     *             If the provided extended operation request could not be
045     *             decoded. For example, if the request name was wrong, or if
046     *             the request value was invalid.
047     */
048    R decodeExtendedRequest(ExtendedRequest<?> request, DecodeOptions options)
049            throws DecodeException;
050
051}