001/* 002 * Copyright 2014-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2014-2020 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) 2015-2020 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.ThreadSafety; 045import com.unboundid.util.ThreadSafetyLevel; 046 047import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*; 048 049 050 051/** 052 * This class provides a request control which may be used to request that the 053 * Directory Proxy Server return the backend set IDs for the entry-balancing 054 * backend set(s) in which an operation was processed successfully. It may be 055 * used in conjunction with the route to backend set request control in order 056 * to specify which backend set(s) should be used to process an operation. 057 * <BR> 058 * <BLOCKQUOTE> 059 * <B>NOTE:</B> This class, and other classes within the 060 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 061 * supported for use against Ping Identity, UnboundID, and 062 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 063 * for proprietary functionality or for external specifications that are not 064 * considered stable or mature enough to be guaranteed to work in an 065 * interoperable way with other types of LDAP servers. 066 * </BLOCKQUOTE> 067 * <BR> 068 * This control may be used for a number of different kinds of requests, 069 * including: 070 * <UL> 071 * <LI>If an add request includes a get backend set ID request control, the 072 * add response will include a get backend set ID response control if the 073 * entry was successfully added to an entry-balanced data set.</LI> 074 * <LI>If a simple bind request includes a get backend set ID request control, 075 * the bind response will include a get backend set ID response control if 076 * the authentication was successful and the entry for the authenticated 077 * user exists in an entry-balanced data set. This control is currently 078 * not supported for use with SASL bind operations.</LI> 079 * <LI>If a compare request includes a get backend set ID request control, the 080 * compare response will include a get backend set ID response control if 081 * the result code is either COMPARE_TRUE or COMPARE_FALSE and the target 082 * entry exists in an entry-balanced data set.</LI> 083 * <LI>If a delete request includes a get backend set ID request control, the 084 * delete response will include a get backend set ID response control if 085 * the entry was successfully removed from an entry-balanced data 086 * set.</LI> 087 * <LI>If an atomic multi-update extended request includes a get backend set 088 * ID request control and the request is successfully processed through an 089 * entry-balancing request processor, then the extended response will 090 * include a get backend set ID response control. A non-atomic 091 * multi-update extended request should not include the get backend set ID 092 * request control in the extended operation itself, but may be attached 093 * to any or all of the requests inside the multi-update operation, in 094 * which case the server will return a multi-update response control 095 * attached to the corresponding successful responses.</LI> 096 * <LI>If an extended request includes a get backend set ID request control 097 * and that request is successfully processed by a proxied extended 098 * operation handler, then the extended response will include a get 099 * backend set ID response control indicating the backend set(s) that 100 * returned a success result during internal processing. Note that if the 101 * same extended request was processed by multiple entry-balancing 102 * request processors (i.e., if the deployment includes multiple 103 * entry-balanced subtrees), then the extended response may include a 104 * separate get backend set ID response control for each entry-balancing 105 * request processor used to process the request.</LI> 106 * <LI>If a modify request includes a get backend set ID request control, the 107 * modify response will include a get backend set ID response control if 108 * the entry was successfully modified in an entry-balanced data set.</LI> 109 * <LI>If a modify DN request includes a get backend set ID request control, 110 * the modify DN response will include a get backend set ID response 111 * control if the entry was successfully moved and/or renamed in an 112 * entry-balanced data set.</LI> 113 * <LI>If a modify DN request includes a get backend set ID request control, 114 * the modify DN response will include a get backend set ID response 115 * control if the entry was successfully moved and/or renamed in an 116 * entry-balanced data set.</LI> 117 * <LI>If a search request includes a get backend set ID request control, any 118 * search result entries retrieved from an entry-balanced data set will 119 * include a get backend set ID response control. The search result done 120 * message will not include a get backend set ID response control.</LI> 121 * </UL> 122 * 123 * Note the response for any operation involving an entry that exists outside of 124 * an entry-balanced dat set will not include a get backend set ID response 125 * control. Similarly, the response for any non-successful operation may not 126 * include a get backend set ID response control even if it involved processing 127 * in one or more backend sets. Also note that even if an entry exists in 128 * multiple backend sets (i.e., because it is at or above the balancing point), 129 * the get backend set ID response control may only include one backend set ID 130 * if only one backend set was accessed during the course of processing the 131 * operation. 132 * <BR><BR> 133 * The get backend set ID request control has an OID of 134 * "1.3.6.1.4.1.30221.2.5.33" and no value. It is recommended that the control 135 * be non-critical so that the associated operation may still be processed even 136 * if the target server does not support this control (and note that even if 137 * the server supports the control, the server may not return a response control 138 * if the operation was not successful or did not access entry-balanced data). 139 * 140 * @see GetBackendSetIDResponseControl 141 * @see RouteToBackendSetRequestControl 142 */ 143@NotMutable() 144@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 145public final class GetBackendSetIDRequestControl 146 extends Control 147{ 148 /** 149 * The OID (1.3.6.1.4.1.30221.2.5.33) for the get backend set ID request 150 * control. 151 */ 152 public static final String GET_BACKEND_SET_ID_REQUEST_OID = 153 "1.3.6.1.4.1.30221.2.5.33"; 154 155 156 157 /** 158 * The serial version UID for this serializable class. 159 */ 160 private static final long serialVersionUID = 7874405591825684773L; 161 162 163 164 /** 165 * Creates a new get backend set ID request control. It will not be marked 166 * critical. 167 */ 168 public GetBackendSetIDRequestControl() 169 { 170 this(false); 171 } 172 173 174 175 /** 176 * Creates a new get backend set ID request control with the specified 177 * criticality. 178 * 179 * @param isCritical Indicates whether this control should be marked 180 * critical. 181 */ 182 public GetBackendSetIDRequestControl(final boolean isCritical) 183 { 184 super(GET_BACKEND_SET_ID_REQUEST_OID, isCritical, null); 185 } 186 187 188 189 /** 190 * Creates a new get backend set ID request control which is decoded from the 191 * provided generic control. 192 * 193 * @param control The generic control to be decoded as a get backend set ID 194 * request control. 195 * 196 * @throws LDAPException If the provided control cannot be decoded as a get 197 * backend set ID request control. 198 */ 199 public GetBackendSetIDRequestControl(final Control control) 200 throws LDAPException 201 { 202 super(control); 203 204 if (control.hasValue()) 205 { 206 throw new LDAPException(ResultCode.DECODING_ERROR, 207 ERR_GET_BACKEND_SET_ID_REQUEST_HAS_VALUE.get()); 208 } 209 } 210 211 212 213 /** 214 * {@inheritDoc} 215 */ 216 @Override() 217 public String getControlName() 218 { 219 return INFO_CONTROL_NAME_GET_BACKEND_SET_ID_REQUEST.get(); 220 } 221 222 223 224 /** 225 * {@inheritDoc} 226 */ 227 @Override() 228 public void toString(final StringBuilder buffer) 229 { 230 buffer.append("GetBackendSetIDRequestControl(isCritical="); 231 buffer.append(isCritical()); 232 buffer.append(')'); 233 } 234}