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.ResultCode;
036import org.forgerock.opendj.ldap.controls.Control;
037import org.forgerock.opendj.ldap.controls.ControlDecoder;
038
039/**
040 * A Generic Extended result indicates the final status of an Generic Extended
041 * operation.
042 */
043public interface GenericExtendedResult extends ExtendedResult {
044
045    @Override
046    GenericExtendedResult addControl(Control control);
047
048    @Override
049    GenericExtendedResult addReferralURI(String uri);
050
051    @Override
052    Throwable getCause();
053
054    @Override
055    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
056            throws DecodeException;
057
058    @Override
059    List<Control> getControls();
060
061    @Override
062    String getDiagnosticMessage();
063
064    @Override
065    String getMatchedDN();
066
067    @Override
068    String getOID();
069
070    @Override
071    List<String> getReferralURIs();
072
073    @Override
074    ResultCode getResultCode();
075
076    @Override
077    ByteString getValue();
078
079    @Override
080    boolean hasValue();
081
082    @Override
083    boolean isReferral();
084
085    @Override
086    boolean isSuccess();
087
088    @Override
089    GenericExtendedResult setCause(Throwable cause);
090
091    @Override
092    GenericExtendedResult setDiagnosticMessage(String message);
093
094    @Override
095    GenericExtendedResult setMatchedDN(String dn);
096
097    /**
098     * Sets the numeric OID, if any, associated with this extended result.
099     *
100     * @param oid
101     *            The numeric OID associated with this extended result, or
102     *            {@code null} if there is no value.
103     * @return This generic extended result.
104     * @throws UnsupportedOperationException
105     *             If this generic extended result does not permit the result
106     *             name to be set.
107     */
108    GenericExtendedResult setOID(String oid);
109
110    @Override
111    GenericExtendedResult setResultCode(ResultCode resultCode);
112
113    /**
114     * Sets the value, if any, associated with this extended result. Its format
115     * is defined by the specification of this extended result.
116     * <p>
117     * If {@code value} is not an instance of {@code ByteString} then it will be
118     * converted using the {@link ByteString#valueOf(Object)} method.
119     *
120     * @param value
121     *            The value associated with this extended result, or
122     *            {@code null} if there is no value.
123     * @return This generic extended result.
124     * @throws UnsupportedOperationException
125     *             If this generic extended result does not permit the result
126     *             value to be set.
127     */
128    GenericExtendedResult setValue(Object value);
129
130}