001/* 002 * Copyright 2012-2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2018 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.ldap.sdk.ResultCode; 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 the 035 * result of an entry rebalancing operation. 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@NotMutable() 048@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 049public final class EntryRebalancingResultAccessLogMessage 050 extends EntryRebalancingRequestAccessLogMessage 051{ 052 /** 053 * The serial version UID for this serializable class. 054 */ 055 private static final long serialVersionUID = -5593721315305821425L; 056 057 058 059 // Indicates whether any changes were made to data in the source backend set. 060 private final Boolean sourceAltered; 061 062 // Indicates whether any changes were made to data in the target backend set. 063 private final Boolean targetAltered; 064 065 // The number of entries added to the target server. 066 private final Integer entriesAddedToTarget; 067 068 // The number of entries deleted from the source server. 069 private final Integer entriesDeletedFromSource; 070 071 // The number of entries read from the source server. 072 private final Integer entriesReadFromSource; 073 074 // The result code for the entry rebalancing operation. 075 private final ResultCode resultCode; 076 077 // A message with information about any administrative action that may be 078 // required to complete the entry rebalancing processing. 079 private final String adminActionRequired; 080 081 // A message with additional information about any errors that occurred during 082 // entry rebalancing processing. 083 private final String errorMessage; 084 085 086 087 /** 088 * Creates a new entry rebalancing result access log message from the provided 089 * message string. 090 * 091 * @param s The string to be parsed as an entry rebalancing result access 092 * log message. 093 * 094 * @throws LogException If the provided string cannot be parsed as a valid 095 * log message. 096 */ 097 public EntryRebalancingResultAccessLogMessage(final String s) 098 throws LogException 099 { 100 this(new LogMessage(s)); 101 } 102 103 104 105 /** 106 * Creates a new entry rebalancing result access log message from the provided 107 * log message. 108 * 109 * @param m The log message to be parsed as an entry rebalancing result 110 * access log message. 111 */ 112 public EntryRebalancingResultAccessLogMessage(final LogMessage m) 113 { 114 super(m); 115 116 final Integer rcInteger = getNamedValueAsInteger("resultCode"); 117 if (rcInteger == null) 118 { 119 resultCode = null; 120 } 121 else 122 { 123 resultCode = ResultCode.valueOf(rcInteger); 124 } 125 126 adminActionRequired = getNamedValue("adminActionRequired"); 127 entriesAddedToTarget = getNamedValueAsInteger("entriesAddedToTarget"); 128 entriesDeletedFromSource = 129 getNamedValueAsInteger("entriesDeletedFromSource"); 130 entriesReadFromSource = getNamedValueAsInteger("entriesReadFromSource"); 131 errorMessage = getNamedValue("errorMessage"); 132 sourceAltered = getNamedValueAsBoolean("sourceAltered"); 133 targetAltered = getNamedValueAsBoolean("targetAltered"); 134 } 135 136 137 138 /** 139 * Retrieves the result code for the entry-rebalancing operation. 140 * 141 * @return The result code for the entry-rebalancing operation, or 142 * {@code null} if it is not included in the log message. 143 */ 144 public ResultCode getResultCode() 145 { 146 return resultCode; 147 } 148 149 150 151 /** 152 * Retrieves a message with information about any errors that were encountered 153 * during processing. 154 * 155 * @return A message with information about any errors that were encountered 156 * during processing, or {@code null} if no errors were encountered 157 * or it is not included in the log message. 158 */ 159 public String getErrorMessage() 160 { 161 return errorMessage; 162 } 163 164 165 166 /** 167 * Retrieves a message with information about any administrative action that 168 * may be required to bring the source and target servers back to a consistent 169 * state with regard to the migrated subtree. 170 * 171 * @return A message with information about any administrative action that 172 * may be required to bring the source and target servers back to a 173 * consistent state with regard to the migrated subtree, or 174 * {@code null} if no administrative action is required or it is not 175 * included in the log message. 176 */ 177 public String getAdminActionRequired() 178 { 179 return adminActionRequired; 180 } 181 182 183 184 /** 185 * Indicates whether data in the source server was altered as a result of 186 * processing for this entry-rebalancing operation. 187 * 188 * @return {@code true} if data in the source server was altered as a result 189 * of processing for this entry-rebalancing operation, {@code false} 190 * if no data in the source server was altered as a result of 191 * entry-rebalancing processing, or {@code null} if it is not 192 * included in the log message. 193 */ 194 public Boolean sourceAltered() 195 { 196 return sourceAltered; 197 } 198 199 200 201 /** 202 * Indicates whether data in the target server was altered as a result of 203 * processing for this entry-rebalancing operation. 204 * 205 * @return {@code true} if data in the target server was altered as a result 206 * of processing for this entry-rebalancing operation, {@code false} 207 * if no data in the target server was altered as a result of 208 * entry-rebalancing processing, or {@code null} if it is not 209 * included in the log message. 210 */ 211 public Boolean targetAltered() 212 { 213 return targetAltered; 214 } 215 216 217 218 /** 219 * Retrieves the number of entries that were read from the source server. 220 * 221 * @return The number of entries that were read from the source server, or 222 * {@code null} if it is not included in the log message. 223 */ 224 public Integer getEntriesReadFromSource() 225 { 226 return entriesReadFromSource; 227 } 228 229 230 231 /** 232 * Retrieves the number of entries that were added to the target server. 233 * 234 * @return The number of entries that were added to the target server, or 235 * {@code null} if it is not included in the log message. 236 */ 237 public Integer getEntriesAddedToTarget() 238 { 239 return entriesAddedToTarget; 240 } 241 242 243 244 /** 245 * Retrieves the number of entries that were deleted from the source server. 246 * 247 * @return The number of entries that were deleted from the source server, or 248 * {@code null} if it is not included in the log message. 249 */ 250 public Integer getEntriesDeletedFromSource() 251 { 252 return entriesDeletedFromSource; 253 } 254 255 256 257 /** 258 * {@inheritDoc} 259 */ 260 @Override() 261 public AccessLogMessageType getMessageType() 262 { 263 return AccessLogMessageType.ENTRY_REBALANCING_RESULT; 264 } 265}