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