001 /*
002 * Copyright 2009-2015 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2015 UnboundID Corp.
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 */
021 package com.unboundid.ldap.sdk.unboundidds.logs;
022
023
024
025 import com.unboundid.util.NotExtensible;
026 import com.unboundid.util.NotMutable;
027 import com.unboundid.util.ThreadSafety;
028 import com.unboundid.util.ThreadSafetyLevel;
029
030
031
032 /**
033 * <BLOCKQUOTE>
034 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
035 * LDAP SDK for Java. It is not available for use in applications that
036 * include only the Standard Edition of the LDAP SDK, and is not supported for
037 * use in conjunction with non-UnboundID products.
038 * </BLOCKQUOTE>
039 * This class provides a data structure that holds information about a log
040 * message that may appear in the Directory Server access log about a compare
041 * request received from a client.
042 */
043 @NotExtensible()
044 @NotMutable()
045 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
046 public class CompareRequestAccessLogMessage
047 extends OperationRequestAccessLogMessage
048 {
049 /**
050 * The serial version UID for this serializable class.
051 */
052 private static final long serialVersionUID = 5478010218343234128L;
053
054
055
056 // The name of the attribute for which the compare is to be performed.
057 private final String attributeName;
058
059 // The DN of the entry for which the compare is to be performed.
060 private final String dn;
061
062
063
064 /**
065 * Creates a new compare request access log message from the provided message
066 * string.
067 *
068 * @param s The string to be parsed as a compare request access log message.
069 *
070 * @throws LogException If the provided string cannot be parsed as a valid
071 * log message.
072 */
073 public CompareRequestAccessLogMessage(final String s)
074 throws LogException
075 {
076 this(new LogMessage(s));
077 }
078
079
080
081 /**
082 * Creates a new compare request access log message from the provided log
083 * message.
084 *
085 * @param m The log message to be parsed as a compare request access log
086 * message.
087 */
088 public CompareRequestAccessLogMessage(final LogMessage m)
089 {
090 super(m);
091
092 dn = getNamedValue("dn");
093 attributeName = getNamedValue("attr");
094 }
095
096
097
098 /**
099 * Retrieves the DN of the entry for which the compare is to be performed.
100 *
101 * @return The DN of the entry for which the compare is to be performed, or
102 * {@code null} if it is not included in the log message.
103 */
104 public final String getDN()
105 {
106 return dn;
107 }
108
109
110
111 /**
112 * Retrieves the name of the attribute for which the compare is to be
113 * performed.
114 *
115 * @return The name of the attribute for which the compare is to be
116 * performed, or {@code null} if it is not included in the log
117 * message.
118 */
119 public final String getAttributeName()
120 {
121 return attributeName;
122 }
123
124
125
126 /**
127 * {@inheritDoc}
128 */
129 @Override()
130 public final AccessLogOperationType getOperationType()
131 {
132 return AccessLogOperationType.COMPARE;
133 }
134 }