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 * docs/licenses/cddl.txt 011 * or http://www.opensource.org/licenses/cddl1.php. 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 * docs/licenses/cddl.txt. 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 2010-2014 UnboundID Corp. 026 */ 027 package com.unboundid.directory.sdk.ds.types; 028 029 030 031 import java.io.Serializable; 032 033 import com.unboundid.util.NotMutable; 034 import com.unboundid.util.ThreadSafety; 035 import com.unboundid.util.ThreadSafetyLevel; 036 037 038 039 /** 040 * This class defines a structure which may be used to provide information about 041 * the result of the processing performed by an intermediate response plugin. 042 */ 043 @NotMutable() 044 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 045 public final class IntermediateResponsePluginResult 046 implements Serializable 047 { 048 /** 049 * A predefined result instance that indicates all processing completed 050 * successfully. 051 */ 052 public static final IntermediateResponsePluginResult SUCCESS = 053 new IntermediateResponsePluginResult(false, true, true, true); 054 055 056 057 /** 058 * The serial version UID for this serializable class. 059 */ 060 private static final long serialVersionUID = -4104659694213854665L; 061 062 063 064 // Indicates whether the client connection was terminated by the plugin. 065 private final boolean connectionTerminated; 066 067 // Indicates whether the server should continue processing other 068 // intermediate response plugins for the associated response. 069 private final boolean continuePluginProcessing; 070 071 // Indicates whether the server should continue processing for the associated 072 // operation. 073 private final boolean continueOperationProcessing; 074 075 // Indicates whether the associated intermediate response should be returned 076 // to the client. 077 private final boolean sendIntermediateResponse; 078 079 080 081 /** 082 * Creates a new intermediate response plugin result with the provided 083 * information. 084 * 085 * @param connectionTerminated Indicates whether the client 086 * connection was terminated by the 087 * plugin. 088 * @param continuePluginProcessing Indicates whether to continue 089 * processing other intermediate response 090 * plugins for the associated response. 091 * @param sendIntermediateResponse Indicates whether to send the 092 * intermediate response to the client. 093 * @param continueOperationProcessing Indicates whether to continue 094 * processing the associated operation. 095 */ 096 public IntermediateResponsePluginResult(final boolean connectionTerminated, 097 final boolean continuePluginProcessing, 098 final boolean sendIntermediateResponse, 099 final boolean continueOperationProcessing) 100 { 101 this.connectionTerminated = connectionTerminated; 102 this.continuePluginProcessing = continuePluginProcessing; 103 this.continueOperationProcessing = continueOperationProcessing; 104 this.sendIntermediateResponse = sendIntermediateResponse; 105 } 106 107 108 109 /** 110 * Indicates whether the client connection was terminated by the plugin. 111 * 112 * @return {@code true} if the client connection was terminated by the 113 * plugin, or {@code false} if not. 114 */ 115 public boolean connectionTerminated() 116 { 117 return connectionTerminated; 118 } 119 120 121 122 /** 123 * Indicates whether to continue processing other intermediate response 124 * plugins for the associated response. 125 * 126 * @return {@code true} if the server should continue processing other 127 * intermediate response plugins for the associated response, or 128 * {@code false} if not. 129 */ 130 public boolean continuePluginProcessing() 131 { 132 return continuePluginProcessing; 133 } 134 135 136 137 /** 138 * Indicates whether the associated intermediate response should be returned 139 * to the client. 140 * 141 * @return {@code true} if the intermediate response should be returned to 142 * the client, or {@code false} if the server should not return the 143 * intermediate response to the client. 144 */ 145 public boolean sendIntermediateResponse() 146 { 147 return sendIntermediateResponse; 148 } 149 150 151 152 /** 153 * Indicates whether to continue processing for the associated operation. 154 * 155 * @return {@code true} if the server should continue processing for the 156 * associated operation, or {@code false} if not and the operation 157 * response should be sent to the client. 158 */ 159 public boolean continueOperationProcessing() 160 { 161 return continueOperationProcessing; 162 } 163 164 165 166 /** 167 * Retrieves a string representation of this intermediate response plugin 168 * result. 169 * 170 * @return A string representation of this intermediate response plugin 171 * result. 172 */ 173 @Override() 174 public String toString() 175 { 176 final StringBuilder buffer = new StringBuilder(); 177 178 buffer.append("IntermediateResponsePluginResult(connectionTerminated="); 179 buffer.append(connectionTerminated); 180 buffer.append(", continuePluginProcessing="); 181 buffer.append(continuePluginProcessing); 182 buffer.append(", sendIntermediateResponse="); 183 buffer.append(sendIntermediateResponse); 184 buffer.append(", continueOperationProcessing="); 185 buffer.append(continueOperationProcessing); 186 buffer.append(')'); 187 188 return buffer.toString(); 189 } 190 }