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