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 2009 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 Extended result indicates the status of an Extended operation and any
041 * additional information associated with the Extended operation, including the
042 * optional response name and value. These can be retrieved using the
043 * {@link #getOID} and {@link #getValue} methods respectively.
044 */
045public interface ExtendedResult extends Result {
046
047    @Override
048    ExtendedResult addControl(Control control);
049
050    @Override
051    ExtendedResult addReferralURI(String uri);
052
053    @Override
054    Throwable getCause();
055
056    @Override
057    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
058            throws DecodeException;
059
060    @Override
061    List<Control> getControls();
062
063    @Override
064    String getDiagnosticMessage();
065
066    @Override
067    String getMatchedDN();
068
069    /**
070     * Returns the numeric OID, if any, associated with this extended result.
071     *
072     * @return The numeric OID associated with this extended result, or
073     *         {@code null} if there is no OID.
074     */
075    String getOID();
076
077    @Override
078    List<String> getReferralURIs();
079
080    @Override
081    ResultCode getResultCode();
082
083    /**
084     * Returns the value, if any, associated with this extended result. Its
085     * format is defined by the specification of this extended result.
086     *
087     * @return The value associated with this extended result, or {@code null}
088     *         if there is no value.
089     */
090    ByteString getValue();
091
092    /**
093     * Returns {@code true} if this extended result has a value. In some
094     * circumstances it may be useful to determine if a extended result has a
095     * value, without actually calculating the value and incurring any
096     * performance costs.
097     *
098     * @return {@code true} if this extended result has a value, or
099     *         {@code false} if there is no value.
100     */
101    boolean hasValue();
102
103    @Override
104    boolean isReferral();
105
106    @Override
107    boolean isSuccess();
108
109    @Override
110    ExtendedResult setCause(Throwable cause);
111
112    @Override
113    ExtendedResult setDiagnosticMessage(String message);
114
115    @Override
116    ExtendedResult setMatchedDN(String dn);
117
118    @Override
119    ExtendedResult setResultCode(ResultCode resultCode);
120}