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 * This class defines a data structure that can be used to hold 023 * information about a request to cancel or abandon an operation in 024 * progress. 025 */ 026@org.opends.server.types.PublicAPI( 027 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, 028 mayInstantiate=false, 029 mayExtend=false, 030 mayInvoke=true) 031public final class CancelRequest 032{ 033 /** 034 * Indicates whether to send a response to the original request if 035 * the operation is canceled. 036 */ 037 private final boolean notifyOriginalRequestor; 038 039 /** 040 * A message that explains the purpose for this cancellation (may be 041 * included in the response to the original requestor). 042 */ 043 private final LocalizableMessage cancelReason; 044 045 046 047 /** 048 * Creates a new cancel request with the provided information. 049 * 050 * @param notifyOriginalRequestor Indicates whether the original 051 * requestor should receive a 052 * response if the operation is 053 * canceled. 054 * @param cancelReason A message that explains the 055 * purpose for this cancellation. 056 */ 057 public CancelRequest(boolean notifyOriginalRequestor, 058 LocalizableMessage cancelReason) 059 { 060 this.notifyOriginalRequestor = notifyOriginalRequestor; 061 this.cancelReason = cancelReason; 062 } 063 064 065 066 /** 067 * Indicates whether the original requestor should receive a 068 * response to the request if the operation is canceled. 069 * 070 * @return <CODE>true</CODE> if the original requestor should 071 * receive a response if the operation is canceled, or 072 * <CODE>false</CODE> if not. 073 */ 074 public boolean notifyOriginalRequestor() 075 { 076 return notifyOriginalRequestor; 077 } 078 079 080 081 /** 082 * Retrieves a message that explains the purpose for this 083 * cancellation. 084 * 085 * @return A message that explains the purpose for this 086 * cancellation. 087 */ 088 public LocalizableMessage getCancelReason() 089 { 090 return cancelReason; 091 } 092} 093