001/* 002 * Copyright 2013-2017 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2017 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 result code values that may be included in a 032 * an assured replication server result. 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 AssuredReplicationServerResultCode 046{ 047 /** 048 * Indicates that the requested level of assurance was successfully attained. 049 */ 050 COMPLETE(0), 051 052 053 054 /** 055 * Indicates that the requested level of assurance could not be attained 056 * before the timeout elapsed. 057 */ 058 TIMEOUT(1), 059 060 061 062 /** 063 * Indicates that a replication conflict was encountered that will prevent 064 * the associated operation from being applied to the target server. 065 */ 066 CONFLICT(2), 067 068 069 070 /** 071 * Indicates that the target server was shut down while waiting for an 072 * assurance result. 073 */ 074 SERVER_SHUTDOWN(3), 075 076 077 078 /** 079 * Indicates that the target server became unavailable while waiting for an 080 * assurance result. 081 */ 082 UNAVAILABLE(4), 083 084 085 086 /** 087 * Indicates that the replication assurance engine detected a duplicate 088 * request for the same operation. 089 */ 090 DUPLICATE(5); 091 092 093 094 // The integer value for this server result code. 095 private final int intValue; 096 097 098 099 /** 100 * Creates a new assured replication server result code with the specified 101 * integer value. 102 * 103 * @param intValue The integer value for this assured replication server 104 * result code. 105 */ 106 AssuredReplicationServerResultCode(final int intValue) 107 { 108 this.intValue = intValue; 109 } 110 111 112 113 /** 114 * Retrieves the integer value for this assured replication server result 115 * code. 116 * 117 * @return The integer value for this assured replication server result code. 118 */ 119 public int intValue() 120 { 121 return intValue; 122 } 123 124 125 126 /** 127 * Retrieves the assured replication server result code with the specified 128 * integer value. 129 * 130 * @param intValue The integer value for the server result code to 131 * retrieve. 132 * 133 * @return The requested assured replication server result code, or 134 * {@code null} if there is no server result code with the specified 135 * integer value. 136 */ 137 public static AssuredReplicationServerResultCode valueOf(final int intValue) 138 { 139 for (final AssuredReplicationServerResultCode rc : values()) 140 { 141 if (rc.intValue == intValue) 142 { 143 return rc; 144 } 145 } 146 147 return null; 148 } 149}