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
010     * docs/licenses/cddl.txt
011     * or http://www.opensource.org/licenses/cddl1.php.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * docs/licenses/cddl.txt.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Portions Copyright 2007-2012 UnboundID Corp.
026     *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
027     */
028    package com.unboundid.directory.sdk.common.types;
029    
030    
031    
032    /**
033     * This enumeration defines the set of possible reasons for the closure of a
034     * connection between a client and the server.
035     */
036    public enum DisconnectReason
037    {
038      /**
039       * The disconnect reason that indicates that the client connection was closed
040       * because the client unbind from the server.
041       */
042      UNBIND("Client Unbind"),
043    
044    
045    
046      /**
047       * The disconnect reason that indicates that the client connection was closed
048       * because the client disconnected without unbinding.
049       */
050      CLIENT_DISCONNECT("Client Disconnect"),
051    
052    
053    
054      /**
055       * The disconnect reason that indicates that the client connection was closed
056       * because the client connection was rejected.
057       */
058      CONNECTION_REJECTED("Client Connection Rejected"),
059    
060    
061    
062      /**
063       * The disconnect reason that indicates that the client connection was closed
064       * because of an I/O error.
065       */
066      IO_ERROR("I/O Error"),
067    
068    
069    
070      /**
071       * The disconnect reason that indicates that the client connection was closed
072       * because of a protocol error.
073       */
074      PROTOCOL_ERROR("Protocol Error"),
075    
076    
077    
078      /**
079       * The disconnect reason that indicates that the client connection was closed
080       * because the Directory Server shut down.
081       */
082      SERVER_SHUTDOWN("Server Shutdown"),
083    
084    
085    
086      /**
087       * The disconnect reason that indicates that the client connection was closed
088       * because an administrator terminated the connection.
089       */
090      ADMIN_DISCONNECT("Administrative Termination"),
091    
092    
093    
094      /**
095       * The disconnect reason that indicates that the client connection was closed
096       * because of a security problem.
097       */
098      SECURITY_PROBLEM("Security Problem"),
099    
100    
101    
102      /**
103       * The disconnect reason that indicates that the client connection was closed
104       * because the maximum allowed request size was exceeded.
105       */
106      MAX_REQUEST_SIZE_EXCEEDED("Maximum Request Size Exceeded"),
107    
108    
109    
110      /**
111       * The disconnect reason that indicates that the client connection was closed
112       * because an administrative limit was exceeded.
113       */
114      ADMIN_LIMIT_EXCEEDED("Administrative Limit Exceeded"),
115    
116    
117    
118      /**
119       * The disconnect reason that indicates that the client connection was closed
120       * because the idle time limit was exceeded.
121       */
122      IDLE_TIME_LIMIT_EXCEEDED("Idle Time Limit Exceeded"),
123    
124    
125    
126      /**
127       * The disconnect reason that indicates that the client connection was closed
128       * because of an I/O timeout.
129       */
130      IO_TIMEOUT("I/O Timeout"),
131    
132    
133    
134      /**
135       * The disconnect reason that indicates that the client connection
136       * was closed because of an internal error within the server.
137       */
138      SERVER_ERROR("Server Error"),
139    
140    
141    
142      /**
143       * The disconnect reason that indicates that the client connection
144       * was closed by a plugin.
145       */
146      CLOSED_BY_PLUGIN("Connection Closed by Plugin"),
147    
148    
149    
150      /**
151       * The disconnect reason that indicates that the client connection
152       * was closed for some other reason.
153       */
154      OTHER("Unknown Closure Reason");
155    
156    
157    
158      // The disconnect reason.
159      private final String message;
160    
161    
162      /**
163       * Creates a new disconnect reason element with the provided closure message.
164       *
165       * @param  message  The message for this disconnect reason.
166       */
167      private DisconnectReason(final String message)
168      {
169        this.message = message;
170      }
171    
172    
173    
174      /**
175       * Retrieves the human-readable disconnect reason.
176       *
177       * @return  The human-readable disconnect reason.
178       */
179      public String getClosureMessage()
180      {
181        return message;
182      }
183    
184    
185    
186      /**
187       * Retrieves a string representation of this disconnect reason.
188       *
189       * @return  A string representation of this disconnect reason.
190       */
191      @Override()
192      public String toString()
193      {
194        return message;
195      }
196    }