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.StaticUtils; 043import com.unboundid.util.ThreadSafety; 044import com.unboundid.util.ThreadSafetyLevel; 045 046 047 048/** 049 * This enum defines the set of access log message types. 050 * <BR> 051 * <BLOCKQUOTE> 052 * <B>NOTE:</B> This class, and other classes within the 053 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 054 * supported for use against Ping Identity, UnboundID, and 055 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 056 * for proprietary functionality or for external specifications that are not 057 * considered stable or mature enough to be guaranteed to work in an 058 * interoperable way with other types of LDAP servers. 059 * </BLOCKQUOTE> 060 */ 061@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 062public enum AccessLogMessageType 063{ 064 /** 065 * The message type that will be used for messages about the result of 066 * replication assurance processing. 067 */ 068 ASSURANCE_COMPLETE("ASSURANCE-COMPLETE"), 069 070 071 072 /** 073 * The message type that will be used for messages about connections 074 * established to the Directory Server. 075 */ 076 CLIENT_CERTIFICATE("CLIENT-CERTIFICATE"), 077 078 079 080 /** 081 * The message type that will be used for messages about connections 082 * established to the Directory Server. 083 */ 084 CONNECT("CONNECT"), 085 086 087 088 /** 089 * The message type that will be used for messages about connections 090 * disconnected from the Directory Server. 091 */ 092 DISCONNECT("DISCONNECT"), 093 094 095 096 /** 097 * The message type that will be used for messages about search result entries 098 * returned by the Directory Server. 099 */ 100 ENTRY("ENTRY"), 101 102 103 104 /** 105 * The message type that will be used for messages that provide information 106 * about the beginning of an entry-rebalancing operation. 107 */ 108 ENTRY_REBALANCING_REQUEST("ENTRY-REBALANCING-REQUEST"), 109 110 111 112 /** 113 * The message type that will be used for messages that provide information 114 * about the result of an entry-rebalancing operation. 115 */ 116 ENTRY_REBALANCING_RESULT("ENTRY-REBALANCING-RESULT"), 117 118 119 120 /** 121 * The message type that will be used for messages about operations forwarded 122 * to another server. 123 */ 124 FORWARD("FORWARD"), 125 126 127 128 /** 129 * The message type that will be used for messages about failed attempts to 130 * forward a request to another server. 131 */ 132 FORWARD_FAILED("FORWARD-FAILED"), 133 134 135 136 /** 137 * The message type that will be used for intermediate response messages. 138 */ 139 INTERMEDIATE_RESPONSE("INTERMEDIATE-RESPONSE"), 140 141 142 143 /** 144 * The message type that will be used for messages about search result 145 * references returned by the Directory Server. 146 */ 147 REFERENCE("REFERENCE"), 148 149 150 151 /** 152 * The message type that will be used for messages about operation requests 153 * received from the Directory Server. 154 */ 155 REQUEST("REQUEST"), 156 157 158 159 /** 160 * The message type that will be used for messages about operation results, 161 * which may include responses sent to clients or results for operations with 162 * no response. 163 */ 164 RESULT("RESULT"), 165 166 167 168 /** 169 * The message type that will be used for messages about the processing 170 * performed to negotiate a secure form of communication between the client 171 * and the server. 172 */ 173 SECURITY_NEGOTIATION("SECURITY-NEGOTIATION"); 174 175 176 177 // The string that will be used to identify this message type in log files. 178 @NotNull private final String logIdentifier; 179 180 181 182 /** 183 * Creates a new access log message type with the provided information. 184 * 185 * @param logIdentifier The string that will be used to identify this 186 * message type in log files. 187 */ 188 AccessLogMessageType(@NotNull final String logIdentifier) 189 { 190 this.logIdentifier = logIdentifier; 191 } 192 193 194 195 /** 196 * Retrieves the string that will be used to identify this message type in 197 * log files. 198 * 199 * @return The string that will be used to identify this message type in log 200 * files. 201 */ 202 @NotNull() 203 public String getLogIdentifier() 204 { 205 return logIdentifier; 206 } 207 208 209 210 /** 211 * Retrieves the access log message type with the provided identifier. 212 * 213 * @param logIdentifier The identifier string for which to retrieve the 214 * corresponding access log message type. 215 * 216 * @return The appropriate message type, or {@code null} if there is no 217 * message type associated with the provided identifier. 218 */ 219 @Nullable 220 public static AccessLogMessageType forName( 221 @NotNull final String logIdentifier) 222 { 223 final String normalizedIdentifier = 224 StaticUtils.toUpperCase(logIdentifier).replace('_', '-'); 225 for (final AccessLogMessageType t : values()) 226 { 227 if (t.logIdentifier.equals(normalizedIdentifier)) 228 { 229 return t; 230 } 231 } 232 233 return null; 234 } 235}