001/* 002 * Copyright 2009-2023 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2009-2023 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-2023 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 operation 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 AccessLogOperationType 062{ 063 /** 064 * The operation type that will be used for messages about abandon operations. 065 */ 066 ABANDON("ABANDON"), 067 068 069 070 /** 071 * The operation type that will be used for messages about add operations. 072 */ 073 ADD("ADD"), 074 075 076 077 /** 078 * The operation type that will be used for messages about bind operations. 079 */ 080 BIND("BIND"), 081 082 083 084 /** 085 * The operation type that will be used for messages about compare operations. 086 */ 087 COMPARE("COMPARE"), 088 089 090 091 /** 092 * The operation type that will be used for messages about delete operations. 093 */ 094 DELETE("DELETE"), 095 096 097 098 /** 099 * The operation type that will be used for messages about extended 100 * operations. 101 */ 102 EXTENDED("EXTENDED"), 103 104 105 106 /** 107 * The operation type that will be used for messages about modify operations. 108 */ 109 MODIFY("MODIFY"), 110 111 112 113 /** 114 * The operation type that will be used for messages about modify DN 115 * operations. 116 */ 117 MODDN("MODDN"), 118 119 120 121 /** 122 * The operation type that will be used for messages about search operations. 123 */ 124 SEARCH("SEARCH"), 125 126 127 128 /** 129 * The operation type that will be used for messages about unbind operations. 130 */ 131 UNBIND("UNBIND"); 132 133 134 135 // The string that will be used to identify this message type in log files. 136 @NotNull private final String logIdentifier; 137 138 139 140 /** 141 * Creates a new access log operation type with the provided information. 142 * 143 * @param logIdentifier The string that will be used to identify this 144 * operation type in log files. 145 */ 146 AccessLogOperationType(@NotNull final String logIdentifier) 147 { 148 this.logIdentifier = logIdentifier; 149 } 150 151 152 153 /** 154 * Retrieves the string that will be used to identify this operation type in 155 * log files. 156 * 157 * @return The string that will be used to identify this operation type in 158 * log files. 159 */ 160 @NotNull() 161 public String getLogIdentifier() 162 { 163 return logIdentifier; 164 } 165 166 167 168 /** 169 * Retrieves the access log operation type with the provided identifier. 170 * 171 * @param logIdentifier The identifier string for which to retrieve the 172 * corresponding access log operation type. 173 * 174 * @return The appropriate operation type, or {@code null} if there is no 175 * operation type associated with the provided identifier. 176 */ 177 @Nullable() 178 public static AccessLogOperationType forName( 179 @NotNull final String logIdentifier) 180 { 181 for (final AccessLogOperationType t : values()) 182 { 183 if (t.logIdentifier.equalsIgnoreCase(logIdentifier)) 184 { 185 return t; 186 } 187 } 188 189 // Handle a few additional option for modify DN operations. 190 if (logIdentifier.equalsIgnoreCase("MODIFY_DN") || 191 logIdentifier.equalsIgnoreCase("MODIFY-DN") || 192 logIdentifier.equalsIgnoreCase("MOD_DN") || 193 logIdentifier.equalsIgnoreCase("MOD-DN")) 194 { 195 return MODDN; 196 } 197 198 return null; 199 } 200}