001/* 002 * Copyright 2012-2024 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2012-2024 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2012-2024 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.logs; 037 038 039 040import com.unboundid.ldap.sdk.ResultCode; 041import com.unboundid.util.NotMutable; 042import com.unboundid.util.NotNull; 043import com.unboundid.util.Nullable; 044import com.unboundid.util.ThreadSafety; 045import com.unboundid.util.ThreadSafetyLevel; 046 047 048 049/** 050 * This class provides a data structure that holds information about a log 051 * message that may appear in the Directory Server access log about a the 052 * result of an entry rebalancing operation. 053 * <BR> 054 * <BLOCKQUOTE> 055 * <B>NOTE:</B> This class, and other classes within the 056 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 057 * supported for use against Ping Identity, UnboundID, and 058 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 059 * for proprietary functionality or for external specifications that are not 060 * considered stable or mature enough to be guaranteed to work in an 061 * interoperable way with other types of LDAP servers. 062 * </BLOCKQUOTE> 063 */ 064@NotMutable() 065@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 066public final class EntryRebalancingResultAccessLogMessage 067 extends EntryRebalancingRequestAccessLogMessage 068{ 069 /** 070 * The serial version UID for this serializable class. 071 */ 072 private static final long serialVersionUID = -5593721315305821425L; 073 074 075 076 // Indicates whether any changes were made to data in the source backend set. 077 @Nullable private final Boolean sourceAltered; 078 079 // Indicates whether any changes were made to data in the target backend set. 080 @Nullable private final Boolean targetAltered; 081 082 // The number of entries added to the target server. 083 @Nullable private final Integer entriesAddedToTarget; 084 085 // The number of entries deleted from the source server. 086 @Nullable private final Integer entriesDeletedFromSource; 087 088 // The number of entries read from the source server. 089 @Nullable private final Integer entriesReadFromSource; 090 091 // The result code for the entry rebalancing operation. 092 @Nullable private final ResultCode resultCode; 093 094 // A message with information about any administrative action that may be 095 // required to complete the entry rebalancing processing. 096 @Nullable private final String adminActionRequired; 097 098 // A message with additional information about any errors that occurred during 099 // entry rebalancing processing. 100 @Nullable private final String errorMessage; 101 102 103 104 /** 105 * Creates a new entry rebalancing result access log message from the provided 106 * message string. 107 * 108 * @param s The string to be parsed as an entry rebalancing result access 109 * log message. 110 * 111 * @throws LogException If the provided string cannot be parsed as a valid 112 * log message. 113 */ 114 public EntryRebalancingResultAccessLogMessage(@NotNull final String s) 115 throws LogException 116 { 117 this(new LogMessage(s)); 118 } 119 120 121 122 /** 123 * Creates a new entry rebalancing result access log message from the provided 124 * log message. 125 * 126 * @param m The log message to be parsed as an entry rebalancing result 127 * access log message. 128 */ 129 public EntryRebalancingResultAccessLogMessage(@NotNull final LogMessage m) 130 { 131 super(m); 132 133 final Integer rcInteger = getNamedValueAsInteger("resultCode"); 134 if (rcInteger == null) 135 { 136 resultCode = null; 137 } 138 else 139 { 140 resultCode = ResultCode.valueOf(rcInteger); 141 } 142 143 adminActionRequired = getNamedValue("adminActionRequired"); 144 entriesAddedToTarget = getNamedValueAsInteger("entriesAddedToTarget"); 145 entriesDeletedFromSource = 146 getNamedValueAsInteger("entriesDeletedFromSource"); 147 entriesReadFromSource = getNamedValueAsInteger("entriesReadFromSource"); 148 errorMessage = getNamedValue("errorMessage"); 149 sourceAltered = getNamedValueAsBoolean("sourceAltered"); 150 targetAltered = getNamedValueAsBoolean("targetAltered"); 151 } 152 153 154 155 /** 156 * Retrieves the result code for the entry-rebalancing operation. 157 * 158 * @return The result code for the entry-rebalancing operation, or 159 * {@code null} if it is not included in the log message. 160 */ 161 @Nullable() 162 public ResultCode getResultCode() 163 { 164 return resultCode; 165 } 166 167 168 169 /** 170 * Retrieves a message with information about any errors that were encountered 171 * during processing. 172 * 173 * @return A message with information about any errors that were encountered 174 * during processing, or {@code null} if no errors were encountered 175 * or it is not included in the log message. 176 */ 177 @Nullable() 178 public String getErrorMessage() 179 { 180 return errorMessage; 181 } 182 183 184 185 /** 186 * Retrieves a message with information about any administrative action that 187 * may be required to bring the source and target servers back to a consistent 188 * state with regard to the migrated subtree. 189 * 190 * @return A message with information about any administrative action that 191 * may be required to bring the source and target servers back to a 192 * consistent state with regard to the migrated subtree, or 193 * {@code null} if no administrative action is required or it is not 194 * included in the log message. 195 */ 196 @Nullable() 197 public String getAdminActionRequired() 198 { 199 return adminActionRequired; 200 } 201 202 203 204 /** 205 * Indicates whether data in the source server was altered as a result of 206 * processing for this entry-rebalancing operation. 207 * 208 * @return {@code true} if data in the source server was altered as a result 209 * of processing for this entry-rebalancing operation, {@code false} 210 * if no data in the source server was altered as a result of 211 * entry-rebalancing processing, or {@code null} if it is not 212 * included in the log message. 213 */ 214 @Nullable() 215 public Boolean sourceAltered() 216 { 217 return sourceAltered; 218 } 219 220 221 222 /** 223 * Indicates whether data in the target server was altered as a result of 224 * processing for this entry-rebalancing operation. 225 * 226 * @return {@code true} if data in the target server was altered as a result 227 * of processing for this entry-rebalancing operation, {@code false} 228 * if no data in the target server was altered as a result of 229 * entry-rebalancing processing, or {@code null} if it is not 230 * included in the log message. 231 */ 232 @Nullable() 233 public Boolean targetAltered() 234 { 235 return targetAltered; 236 } 237 238 239 240 /** 241 * Retrieves the number of entries that were read from the source server. 242 * 243 * @return The number of entries that were read from the source server, or 244 * {@code null} if it is not included in the log message. 245 */ 246 @Nullable() 247 public Integer getEntriesReadFromSource() 248 { 249 return entriesReadFromSource; 250 } 251 252 253 254 /** 255 * Retrieves the number of entries that were added to the target server. 256 * 257 * @return The number of entries that were added to the target server, or 258 * {@code null} if it is not included in the log message. 259 */ 260 @Nullable() 261 public Integer getEntriesAddedToTarget() 262 { 263 return entriesAddedToTarget; 264 } 265 266 267 268 /** 269 * Retrieves the number of entries that were deleted from the source server. 270 * 271 * @return The number of entries that were deleted from the source server, or 272 * {@code null} if it is not included in the log message. 273 */ 274 @Nullable() 275 public Integer getEntriesDeletedFromSource() 276 { 277 return entriesDeletedFromSource; 278 } 279 280 281 282 /** 283 * {@inheritDoc} 284 */ 285 @Override() 286 @NotNull() 287 public AccessLogMessageType getMessageType() 288 { 289 return AccessLogMessageType.ENTRY_REBALANCING_RESULT; 290 } 291}