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.NotExtensible;
026import com.unboundid.util.NotMutable;
027import com.unboundid.util.ThreadSafety;
028import com.unboundid.util.ThreadSafetyLevel;
029
030
031
032/**
033 * This class provides a data structure that holds information about a log
034 * message that may appear in the Directory Server access log about a compare
035 * request received from a client.
036 * <BR>
037 * <BLOCKQUOTE>
038 *   <B>NOTE:</B>  This class, and other classes within the
039 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
040 *   supported for use against Ping Identity, UnboundID, and
041 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
042 *   for proprietary functionality or for external specifications that are not
043 *   considered stable or mature enough to be guaranteed to work in an
044 *   interoperable way with other types of LDAP servers.
045 * </BLOCKQUOTE>
046 */
047@NotExtensible()
048@NotMutable()
049@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
050public class CompareRequestAccessLogMessage
051       extends OperationRequestAccessLogMessage
052{
053  /**
054   * The serial version UID for this serializable class.
055   */
056  private static final long serialVersionUID = 5478010218343234128L;
057
058
059
060  // The name of the attribute for which the compare is to be performed.
061  private final String attributeName;
062
063  // The DN of the entry for which the compare is to be performed.
064  private final String dn;
065
066
067
068  /**
069   * Creates a new compare request access log message from the provided message
070   * string.
071   *
072   * @param  s  The string to be parsed as a compare request access log message.
073   *
074   * @throws  LogException  If the provided string cannot be parsed as a valid
075   *                        log message.
076   */
077  public CompareRequestAccessLogMessage(final String s)
078         throws LogException
079  {
080    this(new LogMessage(s));
081  }
082
083
084
085  /**
086   * Creates a new compare request access log message from the provided log
087   * message.
088   *
089   * @param  m  The log message to be parsed as a compare request access log
090   *            message.
091   */
092  public CompareRequestAccessLogMessage(final LogMessage m)
093  {
094    super(m);
095
096    dn            = getNamedValue("dn");
097    attributeName = getNamedValue("attr");
098  }
099
100
101
102  /**
103   * Retrieves the DN of the entry for which the compare is to be performed.
104   *
105   * @return  The DN of the entry for which the compare is to be performed, or
106   *          {@code null} if it is not included in the log message.
107   */
108  public final String getDN()
109  {
110    return dn;
111  }
112
113
114
115  /**
116   * Retrieves the name of the attribute for which the compare is to be
117   * performed.
118   *
119   * @return  The name of the attribute for which the compare is to be
120   *          performed, or {@code null} if it is not included in the log
121   *          message.
122   */
123  public final String getAttributeName()
124  {
125    return attributeName;
126  }
127
128
129
130  /**
131   * {@inheritDoc}
132   */
133  @Override()
134  public final AccessLogOperationType getOperationType()
135  {
136    return AccessLogOperationType.COMPARE;
137  }
138}