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
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.types;
028    
029    import org.opends.messages.Message;
030    
031    
032    /**
033     * This enumeration defines the set of possible outcomes that can
034     * result from processing a cancel request.  This is based on the
035     * specification contained in RFC 3909.
036     */
037    @org.opends.server.types.PublicAPI(
038         stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
039         mayInstantiate=false,
040         mayExtend=false,
041         mayInvoke=true)
042    public class CancelResult
043    {
044      // The result code associated with this cancel result.
045      private final ResultCode resultCode;
046    
047      // A human-readable response that the server
048      // provided for the result of the cancellation.
049      private final Message responseMessage;
050    
051      /**
052       * Creates a new cancel result with the provided result code.
053       *
054       * @param  resultCode  The result code associated with this cancel
055       *                     result.
056       *
057       * @param  responseMessage A human-readable response that the
058       *                         server provided for the result
059       *                         of the cancellation.
060       */
061      public CancelResult(ResultCode resultCode, Message responseMessage)
062      {
063        this.resultCode = resultCode;
064        this.responseMessage = responseMessage;
065      }
066    
067    
068    
069      /**
070       * Retrieves the result code associated with this cancel result.
071       *
072       * @return  The result code associated with this cancel result.
073       */
074      public final ResultCode getResultCode()
075      {
076        return resultCode;
077      }
078    
079      /**
080       * Retrieves the human-readable response that the server provided
081       * for the result of the cancellation.  The caller may alter the
082       * contents of this buffer.
083       *
084       * @return  The buffer that is used to hold a human-readable
085       *          response that the server provided for the result of this
086       *          cancellation.
087       */
088      public Message getResponseMessage()
089      {
090        return responseMessage;
091      }
092    
093      /**
094       * Retrieves a string representation of this cancel result.
095       *
096       * @return  A string representation of this cancel result.
097       */
098      public final String toString()
099      {
100        return String.valueOf(resultCode);
101      }
102    }
103