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 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2014-2015 ForgeRock AS
026 */
027package org.opends.server.types;
028
029import org.forgerock.i18n.LocalizableMessage;
030
031
032
033/**
034 * This class defines an exception that may be thrown if the operation
035 * being processed is cancelled for some reason (e.g., an abandon or
036 * cancel request from the client).
037 */
038@org.opends.server.types.PublicAPI(
039     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
040     mayInstantiate=true,
041     mayExtend=false,
042     mayInvoke=true)
043public final class CanceledOperationException
044    extends IdentifiedException
045{
046  /**
047   * The serial version identifier required to satisfy the compiler
048   * because this class extends <CODE>java.lang.Exception</CODE>,
049   * which implements the <CODE>java.io.Serializable</CODE> interface.
050   * This value was generated using the <CODE>serialver</CODE>
051   * command-line utility included with the Java SDK.
052   */
053  private static final long serialVersionUID = -1936491673256446966L;
054
055
056
057  /**
058   * The cancel result that provides information about the status of
059   * the cancellation.
060   */
061  private final CancelRequest cancelRequest;
062
063
064
065  /**
066   * Creates a new cancelled operation exception with the provided
067   * result and no additional message.
068   *
069   * @param  cancelRequest  The result of the cancel processing.
070   */
071  public CanceledOperationException(CancelRequest cancelRequest)
072  {
073    super();
074
075
076    this.cancelRequest = cancelRequest;
077  }
078
079
080
081  /**
082   * Creates a new cancelled operation exception with the provided
083   * information.
084   *
085   * @param  cancelRequest The request of the cancel processing.
086   * @param  message       The message providing additional
087   *                       information about the cancel processing, or
088   *                       <CODE>null</CODE> if there is no message.
089   */
090  public CanceledOperationException(CancelRequest cancelRequest,
091                                     LocalizableMessage message)
092  {
093    super(message);
094
095
096    this.cancelRequest = cancelRequest;
097  }
098
099
100
101  /**
102   * Retrieves the cancel request for this cancelled operation
103   * exception.
104   *
105   * @return  The cancel request for this cancelled operation
106   *          exception.
107   */
108  public CancelRequest getCancelRequest()
109  {
110    return cancelRequest;
111  }
112}
113