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