001/* 002 * Copyright 2009-2019 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2019 Ping Identity Corporation 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 */ 021package com.unboundid.ldap.sdk.unboundidds.logs; 022 023 024 025import com.unboundid.util.NotMutable; 026import com.unboundid.util.ThreadSafety; 027import com.unboundid.util.ThreadSafetyLevel; 028 029 030 031/** 032 * This class provides a data structure that holds information about a log 033 * message that may appear in the Directory Server access log about a 034 * connection that has been closed. 035 * <BR> 036 * <BLOCKQUOTE> 037 * <B>NOTE:</B> This class, and other classes within the 038 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 039 * supported for use against Ping Identity, UnboundID, and 040 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 041 * for proprietary functionality or for external specifications that are not 042 * considered stable or mature enough to be guaranteed to work in an 043 * interoperable way with other types of LDAP servers. 044 * </BLOCKQUOTE> 045 */ 046@NotMutable() 047@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 048public final class DisconnectAccessLogMessage 049 extends AccessLogMessage 050{ 051 /** 052 * The serial version UID for this serializable class. 053 */ 054 private static final long serialVersionUID = -6224280874144845557L; 055 056 057 058 // The message providing additional information about the disconnect. 059 private final String message; 060 061 // The reason for the disconnect. 062 private final String reason; 063 064 065 066 /** 067 * Creates a new disconnect access log message from the provided message 068 * string. 069 * 070 * @param s The string to be parsed as a disconnect access log message. 071 * 072 * @throws LogException If the provided string cannot be parsed as a valid 073 * log message. 074 */ 075 public DisconnectAccessLogMessage(final String s) 076 throws LogException 077 { 078 this(new LogMessage(s)); 079 } 080 081 082 083 /** 084 * Creates a new disconnect access log message from the provided log message. 085 * 086 * @param m The log message to be parsed as a disconnect access log message. 087 */ 088 public DisconnectAccessLogMessage(final LogMessage m) 089 { 090 super(m); 091 092 reason = getNamedValue("reason"); 093 message = getNamedValue("msg"); 094 } 095 096 097 098 /** 099 * Retrieves the disconnect reason for the log message. 100 * 101 * @return The disconnect reason for the log message, or {@code null} if it 102 * is not included in the log message. 103 */ 104 public String getDisconnectReason() 105 { 106 return reason; 107 } 108 109 110 111 /** 112 * Retrieves a message with additional information about the disconnect. 113 * 114 * @return A message with additional information about the disconnect, or 115 * {@code null} if it is not included in the log message. 116 */ 117 public String getMessage() 118 { 119 return message; 120 } 121 122 123 124 /** 125 * {@inheritDoc} 126 */ 127 @Override() 128 public AccessLogMessageType getMessageType() 129 { 130 return AccessLogMessageType.DISCONNECT; 131 } 132}