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 2009 Sun Microsystems, Inc.
015 * Portions copyright 2012 ForgeRock AS.
016 */
017
018package org.forgerock.opendj.ldap.responses;
019
020import java.util.List;
021
022import org.forgerock.opendj.ldap.ByteString;
023import org.forgerock.opendj.ldap.DecodeException;
024import org.forgerock.opendj.ldap.DecodeOptions;
025import org.forgerock.opendj.ldap.ResultCode;
026import org.forgerock.opendj.ldap.controls.Control;
027import org.forgerock.opendj.ldap.controls.ControlDecoder;
028
029/**
030 * A Extended result indicates the status of an Extended operation and any
031 * additional information associated with the Extended operation, including the
032 * optional response name and value. These can be retrieved using the
033 * {@link #getOID} and {@link #getValue} methods respectively.
034 */
035public interface ExtendedResult extends Result {
036
037    @Override
038    ExtendedResult addControl(Control control);
039
040    @Override
041    ExtendedResult addReferralURI(String uri);
042
043    @Override
044    Throwable getCause();
045
046    @Override
047    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
048            throws DecodeException;
049
050    @Override
051    List<Control> getControls();
052
053    @Override
054    String getDiagnosticMessage();
055
056    @Override
057    String getMatchedDN();
058
059    /**
060     * Returns the numeric OID, if any, associated with this extended result.
061     *
062     * @return The numeric OID associated with this extended result, or
063     *         {@code null} if there is no OID.
064     */
065    String getOID();
066
067    @Override
068    List<String> getReferralURIs();
069
070    @Override
071    ResultCode getResultCode();
072
073    /**
074     * Returns the value, if any, associated with this extended result. Its
075     * format is defined by the specification of this extended result.
076     *
077     * @return The value associated with this extended result, or {@code null}
078     *         if there is no value.
079     */
080    ByteString getValue();
081
082    /**
083     * Returns {@code true} if this extended result has a value. In some
084     * circumstances it may be useful to determine if a extended result has a
085     * value, without actually calculating the value and incurring any
086     * performance costs.
087     *
088     * @return {@code true} if this extended result has a value, or
089     *         {@code false} if there is no value.
090     */
091    boolean hasValue();
092
093    @Override
094    boolean isReferral();
095
096    @Override
097    boolean isSuccess();
098
099    @Override
100    ExtendedResult setCause(Throwable cause);
101
102    @Override
103    ExtendedResult setDiagnosticMessage(String message);
104
105    @Override
106    ExtendedResult setMatchedDN(String dn);
107
108    @Override
109    ExtendedResult setResultCode(ResultCode resultCode);
110}