001/*
002 * Copyright 2009-2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2009-2020 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) 2015-2020 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.ThreadSafety;
041import com.unboundid.util.ThreadSafetyLevel;
042
043
044
045/**
046 * This enum defines the set of access log operation types.
047 * <BR>
048 * <BLOCKQUOTE>
049 *   <B>NOTE:</B>  This class, and other classes within the
050 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
051 *   supported for use against Ping Identity, UnboundID, and
052 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
053 *   for proprietary functionality or for external specifications that are not
054 *   considered stable or mature enough to be guaranteed to work in an
055 *   interoperable way with other types of LDAP servers.
056 * </BLOCKQUOTE>
057 */
058@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
059public enum AccessLogOperationType
060{
061  /**
062   * The operation type that will be used for messages about abandon operations.
063   */
064  ABANDON("ABANDON"),
065
066
067
068  /**
069   * The operation type that will be used for messages about add operations.
070   */
071  ADD("ADD"),
072
073
074
075  /**
076   * The operation type that will be used for messages about bind operations.
077   */
078  BIND("BIND"),
079
080
081
082  /**
083   * The operation type that will be used for messages about compare operations.
084   */
085  COMPARE("COMPARE"),
086
087
088
089  /**
090   * The operation type that will be used for messages about delete operations.
091   */
092  DELETE("DELETE"),
093
094
095
096  /**
097   * The operation type that will be used for messages about extended
098   * operations.
099   */
100  EXTENDED("EXTENDED"),
101
102
103
104  /**
105   * The operation type that will be used for messages about modify operations.
106   */
107  MODIFY("MODIFY"),
108
109
110
111  /**
112   * The operation type that will be used for messages about modify DN
113   * operations.
114   */
115  MODDN("MODDN"),
116
117
118
119  /**
120   * The operation type that will be used for messages about search operations.
121   */
122  SEARCH("SEARCH"),
123
124
125
126  /**
127   * The operation type that will be used for messages about unbind operations.
128   */
129  UNBIND("UNBIND");
130
131
132
133  // The string that will be used to identify this message type in log files.
134  private final String logIdentifier;
135
136
137
138  /**
139   * Creates a new access log operation type with the provided information.
140   *
141   * @param  logIdentifier  The string that will be used to identify this
142   *                        operation type in log files.
143   */
144  AccessLogOperationType(final String logIdentifier)
145  {
146    this.logIdentifier = logIdentifier;
147  }
148
149
150
151  /**
152   * Retrieves the string that will be used to identify this operation type in
153   * log files.
154   *
155   * @return  The string that will be used to identify this operation type in
156   *          log files.
157   */
158  public String getLogIdentifier()
159  {
160    return logIdentifier;
161  }
162
163
164
165  /**
166   * Retrieves the access log operation type with the provided identifier.
167   *
168   * @param  logIdentifier  The identifier string for which to retrieve the
169   *                        corresponding access log operation type.
170   *
171   * @return  The appropriate operation type, or {@code null} if there is no
172   *          operation type associated with the provided identifier.
173   */
174  public static AccessLogOperationType forName(final String logIdentifier)
175  {
176    for (final AccessLogOperationType t : values())
177    {
178      if (t.logIdentifier.equals(logIdentifier))
179      {
180        return t;
181      }
182    }
183
184    return null;
185  }
186}