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