001/*
002 * Copyright 2009-2021 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2009-2021 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2009-2021 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.logs;
037
038
039
040import com.unboundid.util.NotNull;
041import com.unboundid.util.Nullable;
042import com.unboundid.util.ThreadSafety;
043import com.unboundid.util.ThreadSafetyLevel;
044
045
046
047/**
048 * This enum defines the set of access log message types.
049 * <BR>
050 * <BLOCKQUOTE>
051 *   <B>NOTE:</B>  This class, and other classes within the
052 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
053 *   supported for use against Ping Identity, UnboundID, and
054 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
055 *   for proprietary functionality or for external specifications that are not
056 *   considered stable or mature enough to be guaranteed to work in an
057 *   interoperable way with other types of LDAP servers.
058 * </BLOCKQUOTE>
059 */
060@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
061public enum AccessLogMessageType
062{
063  /**
064   * The message type that will be used for messages about the result of
065   * replication assurance processing.
066   */
067  ASSURANCE_COMPLETE("ASSURANCE-COMPLETE"),
068
069
070
071  /**
072   * The message type that will be used for messages about connections
073   * established to the Directory Server.
074   */
075  CLIENT_CERTIFICATE("CLIENT-CERTIFICATE"),
076
077
078
079  /**
080   * The message type that will be used for messages about connections
081   * established to the Directory Server.
082   */
083  CONNECT("CONNECT"),
084
085
086
087  /**
088   * The message type that will be used for messages about connections
089   * disconnected from the Directory Server.
090   */
091  DISCONNECT("DISCONNECT"),
092
093
094
095  /**
096   * The message type that will be used for messages about search result entries
097   * returned by the Directory Server.
098   */
099  ENTRY("ENTRY"),
100
101
102
103  /**
104   * The message type that will be used for messages that provide information
105   * about the beginning of an entry-rebalancing operation.
106   */
107  ENTRY_REBALANCING_REQUEST("ENTRY-REBALANCING-REQUEST"),
108
109
110
111  /**
112   * The message type that will be used for messages that provide information
113   * about the result of an entry-rebalancing operation.
114   */
115  ENTRY_REBALANCING_RESULT("ENTRY-REBALANCING-RESULT"),
116
117
118
119  /**
120   * The message type that will be used for messages about operations forwarded
121   * to another server.
122   */
123  FORWARD("FORWARD"),
124
125
126
127  /**
128   * The message type that will be used for messages about failed attempts to
129   * forward a request to another server.
130   */
131  FORWARD_FAILED("FORWARD-FAILED"),
132
133
134
135  /**
136   * The message type that will be used for intermediate response messages.
137   */
138  INTERMEDIATE_RESPONSE("INTERMEDIATE-RESPONSE"),
139
140
141
142  /**
143   * The message type that will be used for messages about search result
144   * references returned by the Directory Server.
145   */
146  REFERENCE("REFERENCE"),
147
148
149
150  /**
151   * The message type that will be used for messages about operation requests
152   * received from the Directory Server.
153   */
154  REQUEST("REQUEST"),
155
156
157
158  /**
159   * The message type that will be used for messages about operation results,
160   * which may include responses sent to clients or results for operations with
161   * no response.
162   */
163  RESULT("RESULT"),
164
165
166
167  /**
168   * The message type that will be used for messages about the processing
169   * performed to negotiate a secure form of communication between the client
170   * and the server.
171   */
172  SECURITY_NEGOTIATION("SECURITY-NEGOTIATION");
173
174
175
176  // The string that will be used to identify this message type in log files.
177  @NotNull private final String logIdentifier;
178
179
180
181  /**
182   * Creates a new access log message type with the provided information.
183   *
184   * @param  logIdentifier  The string that will be used to identify this
185   *                        message type in log files.
186   */
187  AccessLogMessageType(@NotNull final String logIdentifier)
188  {
189    this.logIdentifier = logIdentifier;
190  }
191
192
193
194  /**
195   * Retrieves the string that will be used to identify this message type in
196   * log files.
197   *
198   * @return  The string that will be used to identify this message type in log
199   *          files.
200   */
201  @NotNull()
202  public String getLogIdentifier()
203  {
204    return logIdentifier;
205  }
206
207
208
209  /**
210   * Retrieves the access log message type with the provided identifier.
211   *
212   * @param  logIdentifier  The identifier string for which to retrieve the
213   *                        corresponding access log message type.
214   *
215   * @return  The appropriate message type, or {@code null} if there is no
216   *          message type associated with the provided identifier.
217   */
218  @Nullable
219  public static AccessLogMessageType forName(
220                     @NotNull final String logIdentifier)
221  {
222    for (final AccessLogMessageType t : values())
223    {
224      if (t.logIdentifier.equals(logIdentifier))
225      {
226        return t;
227      }
228    }
229
230    return null;
231  }
232}