001 /* 002 * Copyright 2013-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2015 UnboundID Corp. 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 */ 021 package com.unboundid.ldap.sdk.unboundidds.controls; 022 023 024 025 import com.unboundid.util.ThreadSafety; 026 import com.unboundid.util.ThreadSafetyLevel; 027 028 029 030 /** 031 * <BLOCKQUOTE> 032 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID 033 * LDAP SDK for Java. It is not available for use in applications that 034 * include only the Standard Edition of the LDAP SDK, and is not supported for 035 * use in conjunction with non-UnboundID products. 036 * </BLOCKQUOTE> 037 * This enum defines the set of result code values that may be included in a 038 * an assured replication server result. 039 */ 040 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 041 public enum AssuredReplicationServerResultCode 042 { 043 /** 044 * Indicates that the requested level of assurance was successfully attained. 045 */ 046 COMPLETE(0), 047 048 049 050 /** 051 * Indicates that the requested level of assurance could not be attained 052 * before the timeout elapsed. 053 */ 054 TIMEOUT(1), 055 056 057 058 /** 059 * Indicates that a replication conflict was encountered that will prevent 060 * the associated operation from being applied to the target server. 061 */ 062 CONFLICT(2), 063 064 065 066 /** 067 * Indicates that the target server was shut down while waiting for an 068 * assurance result. 069 */ 070 SERVER_SHUTDOWN(3), 071 072 073 074 /** 075 * Indicates that the target server became unavailable while waiting for an 076 * assurance result. 077 */ 078 UNAVAILABLE(4), 079 080 081 082 /** 083 * Indicates that the replication assurance engine detected a duplicate 084 * request for the same operation. 085 */ 086 DUPLICATE(5); 087 088 089 090 // The integer value for this server result code. 091 private final int intValue; 092 093 094 095 /** 096 * Creates a new assured replication server result code with the specified 097 * integer value. 098 * 099 * @param intValue The integer value for this assured replication server 100 * result code. 101 */ 102 AssuredReplicationServerResultCode(final int intValue) 103 { 104 this.intValue = intValue; 105 } 106 107 108 109 /** 110 * Retrieves the integer value for this assured replication server result 111 * code. 112 * 113 * @return The integer value for this assured replication server result code. 114 */ 115 public int intValue() 116 { 117 return intValue; 118 } 119 120 121 122 /** 123 * Retrieves the assured replication server result code with the specified 124 * integer value. 125 * 126 * @param intValue The integer value for the server result code to 127 * retrieve. 128 * 129 * @return The requested assured replication server result code, or 130 * {@code null} if there is no server result code with the specified 131 * integer value. 132 */ 133 public static AssuredReplicationServerResultCode valueOf(final int intValue) 134 { 135 for (final AssuredReplicationServerResultCode rc : values()) 136 { 137 if (rc.intValue == intValue) 138 { 139 return rc; 140 } 141 } 142 143 return null; 144 } 145 }