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