001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2008 Sun Microsystems, Inc. 025 * Portions Copyright 2011-2015 ForgeRock AS 026 */ 027package org.opends.server.types; 028 029import org.forgerock.i18n.LocalizableMessage; 030 031 032 033import static org.opends.messages.CoreMessages.*; 034 035 036 037/** 038 * This enumeration defines the set of possible reasons for the 039 * closure of a connection between a client and the Directory Server. 040 */ 041@org.opends.server.types.PublicAPI( 042 stability=org.opends.server.types.StabilityLevel.VOLATILE, 043 mayInstantiate=false, 044 mayExtend=false, 045 mayInvoke=true) 046public enum DisconnectReason 047{ 048 /** 049 * The disconnect reason that indicates that the client connection 050 * was closed because the client unbind from the server. 051 */ 052 UNBIND( 053 INFO_DISCONNECT_DUE_TO_UNBIND.get()), 054 055 056 057 /** 058 * The disconnect reason that indicates that the client connection 059 * was closed because the client disconnected without unbinding. 060 */ 061 CLIENT_DISCONNECT( 062 INFO_DISCONNECT_DUE_TO_CLIENT_CLOSURE.get()), 063 064 065 066 /** 067 * The disconnect reason that indicates that the client connection 068 * was closed because the client connection was rejected. 069 */ 070 CONNECTION_REJECTED( 071 INFO_DISCONNECT_DUE_TO_REJECTED_CLIENT.get()), 072 073 074 075 /** 076 * The disconnect reason that indicates that the client connection 077 * was closed because of an I/O error. 078 */ 079 IO_ERROR( 080 INFO_DISCONNECT_DUE_TO_IO_ERROR.get()), 081 082 083 084 /** 085 * The disconnect reason that indicates that the client connection 086 * was closed because of a protocol error. 087 */ 088 PROTOCOL_ERROR( 089 INFO_DISCONNECT_DUE_TO_PROTOCOL_ERROR.get()), 090 091 092 093 /** 094 * The disconnect reason that indicates that the client connection 095 * was closed because the Directory Server shut down. 096 */ 097 SERVER_SHUTDOWN( 098 INFO_DISCONNECT_DUE_TO_SERVER_SHUTDOWN.get()), 099 100 101 102 /** 103 * The disconnect reason that indicates that the client connection 104 * was closed because an administrator terminated the connection. 105 */ 106 ADMIN_DISCONNECT( 107 INFO_DISCONNECT_BY_ADMINISTRATOR.get()), 108 109 110 111 /** 112 * The disconnect reason that indicates that the client connection 113 * was closed because of a security problem. 114 */ 115 SECURITY_PROBLEM( 116 INFO_DISCONNECT_DUE_TO_SECURITY_PROBLEM.get()), 117 118 119 120 /** 121 * The disconnect reason that indicates that the client connection was closed 122 * because the bound user's entry is no longer accessible. 123 */ 124 INVALID_CREDENTIALS( 125 INFO_DISCONNECT_DUE_TO_INVALID_CREDENTIALS.get()), 126 127 128 129 /** 130 * The disconnect reason that indicates that the client connection 131 * was closed because the maximum allowed request size was exceeded. 132 */ 133 MAX_REQUEST_SIZE_EXCEEDED( 134 INFO_DISCONNECT_DUE_TO_MAX_REQUEST_SIZE.get()), 135 136 137 138 /** 139 * The disconnect reason that indicates that the client connection 140 * was closed because an administrative limit was exceeded. 141 */ 142 ADMIN_LIMIT_EXCEEDED( 143 INFO_DISCONNECT_DUE_TO_ADMIN_LIMIT.get()), 144 145 146 147 /** 148 * The disconnect reason that indicates that the client connection 149 * was closed because the idle time limit was exceeded. 150 */ 151 IDLE_TIME_LIMIT_EXCEEDED( 152 INFO_DISCONNECT_DUE_TO_IDLE_TIME_LIMIT.get()), 153 154 155 156 /** 157 * The disconnect reason that indicates that the client connection 158 * was closed because of an I/O timeout. 159 */ 160 IO_TIMEOUT( 161 INFO_DISCONNECT_DUE_TO_IO_TIMEOUT.get()), 162 163 164 165 /** 166 * The disconnect reason that indicates that the client connection 167 * was closed because of an internal error within the server. 168 */ 169 SERVER_ERROR( 170 INFO_DISCONNECT_DUE_TO_SERVER_ERROR.get()), 171 172 173 174 /** 175 * The disconnect reason that indicates that the client connection 176 * was closed by a plugin. 177 */ 178 CLOSED_BY_PLUGIN( 179 INFO_DISCONNECT_BY_PLUGIN.get()), 180 181 182 183 /** 184 * The disconnect reason that indicates that the client connection 185 * was closed for some other reason. 186 */ 187 OTHER( 188 INFO_DISCONNECT_OTHER.get()); 189 190 191 192 /** The disconnect reason. */ 193 private LocalizableMessage message; 194 195 196 /** 197 * Creates a new disconnect reason element with the provided closure 198 * message. 199 * 200 * @param message The message for this disconnect reason. 201 */ 202 private DisconnectReason(LocalizableMessage message) 203 { 204 this.message = message; 205 } 206 207 208 209 /** 210 * Retrieves the human-readable disconnect reason. 211 * 212 * @return The human-readable disconnect reason. 213 */ 214 public LocalizableMessage getClosureMessage() 215 { 216 return message; 217 } 218 219 220 221 /** 222 * Retrieves a string representation of this disconnect reason. 223 * 224 * @return A string representation of this disconnect reason. 225 */ 226 public String toString() 227 { 228 return message.toString(); 229 } 230} 231