001/* 002 * Copyright 2017-2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2017-2018 Ping Identity Corporation 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk.unboundidds.controls; 022 023 024 025import com.unboundid.util.ThreadSafety; 026import com.unboundid.util.ThreadSafetyLevel; 027 028 029 030/** 031 * This enum defines the set of validation level values that may be used in 032 * conjunction with the {@link UniquenessRequestControl}. 033 * <BR> 034 * <BLOCKQUOTE> 035 * <B>NOTE:</B> This class, and other classes within the 036 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 037 * supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661 038 * server products. These classes provide support for proprietary 039 * functionality or for external specifications that are not considered stable 040 * or mature enough to be guaranteed to work in an interoperable way with 041 * other types of LDAP servers. 042 * </BLOCKQUOTE> 043 */ 044@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 045public enum UniquenessValidationLevel 046{ 047 /** 048 * Indicates that no uniqueness validation should be performed. This 049 * validation level has the same effect for requests sent directly to a 050 * Directory Server and requests sent through a Directory Proxy Server. 051 */ 052 NONE(0), 053 054 055 056 /** 057 * Indicates that a single search should be performed per subtree view to 058 * ensure that there are no uniqueness conflicts. This has the following 059 * behavior: 060 * <UL> 061 * <LI> 062 * If the request is received by a Directory Server instance, then only 063 * that instance will be searched for potential conflicts. No replicas 064 * will be examined. 065 * </LI> 066 * <LI> 067 * If the request is received by a Directory Proxy Server instance that 068 * does not use entry balancing, then only one backend server will be 069 * searched for potential conflicts. 070 * </LI> 071 * <LI> 072 * If the request is received by a Directory Proxy Server instance that 073 * uses entry balancing, then the server may only search one backend 074 * server in one backend set if it can use its global index to identify 075 * which backend set is appropriate. However, if the scope of the 076 * uniqueness request control contains the entire set of entry-balanced 077 * data and the global index does not include enough information to 078 * restrict the search to one backend set, then it may be necessary to 079 * issue the search to one server in each backend set. 080 * </LI> 081 * </UL> 082 */ 083 ALL_SUBTREE_VIEWS(1), 084 085 086 087 /** 088 * Indicates that one server from each entry-balanced backend set should be 089 * searched for potential uniqueness conflicts. This has the following 090 * behavior: 091 * <UL> 092 * <LI> 093 * If the request is received by a Directory Server instance, then only 094 * that instance will be searched for potential conflicts. No replicas 095 * will be examined. 096 * </LI> 097 * <LI> 098 * If the request is received by a Directory Proxy Server instance that 099 * does not use entry balancing, then only one backend server will be 100 * searched for potential conflicts. 101 * </LI> 102 * <LI> 103 * If the request is received by a Directory Proxy Server instance that 104 * uses entry balancing and the scope of the uniqueness request control 105 * covers the entire set of entry-balanced data, then one server from each 106 * backend set will be searched for potential conflicts. 107 * </LI> 108 * <LI> 109 * If the request is received by a Directory Proxy Server instance that 110 * uses entry balancing, and if the uniqueness request control has a base 111 * DN that is below the balancing point, and if the server's global index 112 * can be used to identify which backend set contains the entry with that 113 * DN, then it may only be necessary to search within that one backend 114 * set, and only within one server in that set. However, if the global 115 * index cannot be used to identify the appropriate backend set, then it 116 * may be necessary to search one server in each backend set. 117 * </LI> 118 * </UL> 119 */ 120 ALL_BACKEND_SETS(2), 121 122 123 124 /** 125 * Indicates that all available servers within the scope of the uniqueness 126 * criteria should be searched for potential uniqueness conflicts. This has 127 * the following behavior: 128 * <UL> 129 * <LI> 130 * If the request is received by a Directory Server instance, then only 131 * that instance will be searched for potential conflicts. No replicas 132 * will be examined. 133 * </LI> 134 * <LI> 135 * If the request is received by a Directory Proxy Server instance that 136 * does not use entry balancing, then all backend servers with a health 137 * check state of "AVAILABLE" will be searched for potential conflicts. 138 * </LI> 139 * <LI> 140 * If the request is received by a Directory Proxy Server instance that 141 * uses entry balancing and the scope of the uniqueness request control 142 * covers the entire set of entry-balanced data, then all backend servers 143 * with a health check state of "AVAILABLE" will be searched for 144 * potential conflicts, across all backend sets. 145 * </LI> 146 * <LI> 147 * If the request is received by a Directory Proxy Server instance that 148 * uses entry balancing, and if the uniqueness request control has a base 149 * DN that is below the balancing point, and if the server's global index 150 * can be used to identify which backend set contains the entry with that 151 * DN, then it may only be necessary to search all available servers 152 * within that one backend set. However, if the global index cannot be 153 * used to identify the appropriate backend set, then it may be necessary 154 * to search all available servers in all backend sets. 155 * </LI> 156 * </UL> 157 */ 158 ALL_AVAILABLE_BACKEND_SERVERS(3); 159 160 161 162 // The integer value for this uniqueness validation level. 163 private final int intValue; 164 165 166 167 /** 168 * Creates a new uniqueness validation level with the provided integer value. 169 * 170 * @param intValue The integer value for this uniqueness validation level. 171 */ 172 UniquenessValidationLevel(final int intValue) 173 { 174 this.intValue = intValue; 175 } 176 177 178 179 /** 180 * Retrieves the integer value for this uniqueness validation level. 181 * 182 * @return The integer value for this uniqueness validation level. 183 */ 184 public int intValue() 185 { 186 return intValue; 187 } 188 189 190 191 /** 192 * Retrieves the uniqueness validation level with the specified integer value. 193 * 194 * @param intValue The integer value for the uniqueness validation level to 195 * retrieve. 196 * 197 * @return The uniqueness validation level for the provided integer value, or 198 * {@code null} if there is no validation level with the given 199 * integer value. 200 */ 201 public static UniquenessValidationLevel valueOf(final int intValue) 202 { 203 switch (intValue) 204 { 205 case 0: 206 return NONE; 207 case 1: 208 return ALL_SUBTREE_VIEWS; 209 case 2: 210 return ALL_BACKEND_SETS; 211 case 3: 212 return ALL_AVAILABLE_BACKEND_SERVERS; 213 default: 214 return null; 215 } 216 } 217}