001    /*
002     * Copyright 2009-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.logs;
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 access log message types.
038     */
039    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
040    public enum AccessLogMessageType
041    {
042      /**
043       * The message type that will be used for messages about the result of
044       * replication assurance processing.
045       */
046      ASSURANCE_COMPLETE("ASSURANCE-COMPLETE"),
047    
048    
049    
050      /**
051       * The message type that will be used for messages about connections
052       * established to the Directory Server.
053       */
054      CLIENT_CERTIFICATE("CLIENT-CERTIFICATE"),
055    
056    
057    
058      /**
059       * The message type that will be used for messages about connections
060       * established to the Directory Server.
061       */
062      CONNECT("CONNECT"),
063    
064    
065    
066      /**
067       * The message type that will be used for messages about connections
068       * disconnected from the Directory Server.
069       */
070      DISCONNECT("DISCONNECT"),
071    
072    
073    
074      /**
075       * The message type that will be used for messages about search result entries
076       * returned by the Directory Server.
077       */
078      ENTRY("ENTRY"),
079    
080    
081    
082      /**
083       * The message type that will be used for messages that provide information
084       * about the beginning of an entry-rebalancing operation.
085       */
086      ENTRY_REBALANCING_REQUEST("ENTRY-REBALANCING-REQUEST"),
087    
088    
089    
090      /**
091       * The message type that will be used for messages that provide information
092       * about the result of an entry-rebalancing operation.
093       */
094      ENTRY_REBALANCING_RESULT("ENTRY-REBALANCING-RESULT"),
095    
096    
097    
098      /**
099       * The message type that will be used for messages about operations forwarded
100       * to another server.
101       */
102      FORWARD("FORWARD"),
103    
104    
105    
106      /**
107       * The message type that will be used for messages about failed attempts to
108       * forward a request to another server.
109       */
110      FORWARD_FAILED("FORWARD-FAILED"),
111    
112    
113    
114      /**
115       * The message type that will be used for intermediate response messages.
116       */
117      INTERMEDIATE_RESPONSE("INTERMEDIATE-RESPONSE"),
118    
119    
120    
121      /**
122       * The message type that will be used for messages about search result
123       * references returned by the Directory Server.
124       */
125      REFERENCE("REFERENCE"),
126    
127    
128    
129      /**
130       * The message type that will be used for messages about operation requests
131       * received from the Directory Server.
132       */
133      REQUEST("REQUEST"),
134    
135    
136    
137      /**
138       * The message type that will be used for messages about operation results,
139       * which may include responses sent to clients or results for operations with
140       * no response.
141       */
142      RESULT("RESULT"),
143    
144    
145    
146      /**
147       * The message type that will be used for messages about the processing
148       * performed to negotiate a secure form of communication between the client
149       * and the server.
150       */
151      SECURITY_NEGOTIATION("SECURITY-NEGOTIATION");
152    
153    
154    
155      // The string that will be used to identify this message type in log files.
156      private final String logIdentifier;
157    
158    
159    
160      /**
161       * Creates a new access log message type with the provided information.
162       *
163       * @param  logIdentifier  The string that will be used to identify this
164       *                        message type in log files.
165       */
166      private AccessLogMessageType(final String logIdentifier)
167      {
168        this.logIdentifier = logIdentifier;
169      }
170    
171    
172    
173      /**
174       * Retrieves the string that will be used to identify this message type in
175       * log files.
176       *
177       * @return  The string that will be used to identify this message type in log
178       *          files.
179       */
180      public String getLogIdentifier()
181      {
182        return logIdentifier;
183      }
184    
185    
186    
187      /**
188       * Retrieves the access log message type with the provided identifier.
189       *
190       * @param  logIdentifier  The identifier string for which to retrieve the
191       *                        corresponding access log message type.
192       *
193       * @return  The appropriate message type, or {@code null} if there is no
194       *          message type associated with the provided identifier.
195       */
196      public static AccessLogMessageType forName(final String logIdentifier)
197      {
198        for (final AccessLogMessageType t : values())
199        {
200          if (t.getLogIdentifier().equals(logIdentifier))
201          {
202            return t;
203          }
204        }
205    
206        return null;
207      }
208    }