001/* 002 * Copyright 2014-2022 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2014-2022 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2014-2022 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.controls; 037 038 039 040import com.unboundid.ldap.sdk.Control; 041import com.unboundid.ldap.sdk.LDAPException; 042import com.unboundid.ldap.sdk.ResultCode; 043import com.unboundid.util.NotMutable; 044import com.unboundid.util.NotNull; 045import com.unboundid.util.ThreadSafety; 046import com.unboundid.util.ThreadSafetyLevel; 047 048import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*; 049 050 051 052/** 053 * This class provides a request control which may be used to request that the 054 * Directory Proxy Server return the backend set IDs for the entry-balancing 055 * backend set(s) in which an operation was processed successfully. It may be 056 * used in conjunction with the route to backend set request control in order 057 * to specify which backend set(s) should be used to process an operation. 058 * <BR> 059 * <BLOCKQUOTE> 060 * <B>NOTE:</B> This class, and other classes within the 061 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 062 * supported for use against Ping Identity, UnboundID, and 063 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 064 * for proprietary functionality or for external specifications that are not 065 * considered stable or mature enough to be guaranteed to work in an 066 * interoperable way with other types of LDAP servers. 067 * </BLOCKQUOTE> 068 * <BR> 069 * This control may be used for a number of different kinds of requests, 070 * including: 071 * <UL> 072 * <LI>If an add request includes a get backend set ID request control, the 073 * add response will include a get backend set ID response control if the 074 * entry was successfully added to an entry-balanced data set.</LI> 075 * <LI>If a simple bind request includes a get backend set ID request control, 076 * the bind response will include a get backend set ID response control if 077 * the authentication was successful and the entry for the authenticated 078 * user exists in an entry-balanced data set. This control is currently 079 * not supported for use with SASL bind operations.</LI> 080 * <LI>If a compare request includes a get backend set ID request control, the 081 * compare response will include a get backend set ID response control if 082 * the result code is either COMPARE_TRUE or COMPARE_FALSE and the target 083 * entry exists in an entry-balanced data set.</LI> 084 * <LI>If a delete request includes a get backend set ID request control, the 085 * delete response will include a get backend set ID response control if 086 * the entry was successfully removed from an entry-balanced data 087 * set.</LI> 088 * <LI>If an atomic multi-update extended request includes a get backend set 089 * ID request control and the request is successfully processed through an 090 * entry-balancing request processor, then the extended response will 091 * include a get backend set ID response control. A non-atomic 092 * multi-update extended request should not include the get backend set ID 093 * request control in the extended operation itself, but may be attached 094 * to any or all of the requests inside the multi-update operation, in 095 * which case the server will return a multi-update response control 096 * attached to the corresponding successful responses.</LI> 097 * <LI>If an extended request includes a get backend set ID request control 098 * and that request is successfully processed by a proxied extended 099 * operation handler, then the extended response will include a get 100 * backend set ID response control indicating the backend set(s) that 101 * returned a success result during internal processing. Note that if the 102 * same extended request was processed by multiple entry-balancing 103 * request processors (i.e., if the deployment includes multiple 104 * entry-balanced subtrees), then the extended response may include a 105 * separate get backend set ID response control for each entry-balancing 106 * request processor used to process the request.</LI> 107 * <LI>If a modify request includes a get backend set ID request control, the 108 * modify response will include a get backend set ID response control if 109 * the entry was successfully modified in an entry-balanced data set.</LI> 110 * <LI>If a modify DN request includes a get backend set ID request control, 111 * the modify DN response will include a get backend set ID response 112 * control if the entry was successfully moved and/or renamed in an 113 * entry-balanced data set.</LI> 114 * <LI>If a modify DN request includes a get backend set ID request control, 115 * the modify DN response will include a get backend set ID response 116 * control if the entry was successfully moved and/or renamed in an 117 * entry-balanced data set.</LI> 118 * <LI>If a search request includes a get backend set ID request control, any 119 * search result entries retrieved from an entry-balanced data set will 120 * include a get backend set ID response control. The search result done 121 * message will not include a get backend set ID response control.</LI> 122 * </UL> 123 * 124 * Note the response for any operation involving an entry that exists outside of 125 * an entry-balanced dat set will not include a get backend set ID response 126 * control. Similarly, the response for any non-successful operation may not 127 * include a get backend set ID response control even if it involved processing 128 * in one or more backend sets. Also note that even if an entry exists in 129 * multiple backend sets (i.e., because it is at or above the balancing point), 130 * the get backend set ID response control may only include one backend set ID 131 * if only one backend set was accessed during the course of processing the 132 * operation. 133 * <BR><BR> 134 * The get backend set ID request control has an OID of 135 * "1.3.6.1.4.1.30221.2.5.33" and no value. It is recommended that the control 136 * be non-critical so that the associated operation may still be processed even 137 * if the target server does not support this control (and note that even if 138 * the server supports the control, the server may not return a response control 139 * if the operation was not successful or did not access entry-balanced data). 140 * 141 * @see GetBackendSetIDResponseControl 142 * @see RouteToBackendSetRequestControl 143 */ 144@NotMutable() 145@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 146public final class GetBackendSetIDRequestControl 147 extends Control 148{ 149 /** 150 * The OID (1.3.6.1.4.1.30221.2.5.33) for the get backend set ID request 151 * control. 152 */ 153 @NotNull public static final String GET_BACKEND_SET_ID_REQUEST_OID = 154 "1.3.6.1.4.1.30221.2.5.33"; 155 156 157 158 /** 159 * The serial version UID for this serializable class. 160 */ 161 private static final long serialVersionUID = 7874405591825684773L; 162 163 164 165 /** 166 * Creates a new get backend set ID request control. It will not be marked 167 * critical. 168 */ 169 public GetBackendSetIDRequestControl() 170 { 171 this(false); 172 } 173 174 175 176 /** 177 * Creates a new get backend set ID request control with the specified 178 * criticality. 179 * 180 * @param isCritical Indicates whether this control should be marked 181 * critical. 182 */ 183 public GetBackendSetIDRequestControl(final boolean isCritical) 184 { 185 super(GET_BACKEND_SET_ID_REQUEST_OID, isCritical, null); 186 } 187 188 189 190 /** 191 * Creates a new get backend set ID request control which is decoded from the 192 * provided generic control. 193 * 194 * @param control The generic control to be decoded as a get backend set ID 195 * request control. 196 * 197 * @throws LDAPException If the provided control cannot be decoded as a get 198 * backend set ID request control. 199 */ 200 public GetBackendSetIDRequestControl(@NotNull final Control control) 201 throws LDAPException 202 { 203 super(control); 204 205 if (control.hasValue()) 206 { 207 throw new LDAPException(ResultCode.DECODING_ERROR, 208 ERR_GET_BACKEND_SET_ID_REQUEST_HAS_VALUE.get()); 209 } 210 } 211 212 213 214 /** 215 * {@inheritDoc} 216 */ 217 @Override() 218 @NotNull() 219 public String getControlName() 220 { 221 return INFO_CONTROL_NAME_GET_BACKEND_SET_ID_REQUEST.get(); 222 } 223 224 225 226 /** 227 * {@inheritDoc} 228 */ 229 @Override() 230 public void toString(@NotNull final StringBuilder buffer) 231 { 232 buffer.append("GetBackendSetIDRequestControl(isCritical="); 233 buffer.append(isCritical()); 234 buffer.append(')'); 235 } 236}