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