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