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.util.NotExtensible;
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 * beginning 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@NotExtensible()
064@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
065public class EntryRebalancingRequestAccessLogMessage
066       extends AccessLogMessage
067{
068  /**
069   * The serial version UID for this serializable class.
070   */
071  private static final long serialVersionUID = -7183383454122018479L;
072
073
074
075  // The maximum number of entries to include in the subtree move.
076  private final Integer sizeLimit;
077
078  // The unique identifier assigned to the entry rebalancing operation.
079  private final Long rebalancingOperationID;
080
081  // The connection ID of the client connection that performed an operation to
082  // trigger the entry rebalancing operation.
083  private final Long triggeringConnectionID;
084
085  // The operation ID of the operation that triggered the entry rebalancing
086  // operation.
087  private final Long triggeringOperationID;
088
089  // The name of the backend set containing the subtree to move.
090  private final String sourceBackendSetName;
091
092  // The address and port of the server in the source backend set from which
093  // the entries are being migrated.
094  private final String sourceBackendServer;
095
096  // The base DN of the subtree being moved from one backend set to another.
097  private final String subtreeBaseDN;
098
099  // The name of the backend set into which the subtree will be migrated.
100  private final String targetBackendSetName;
101
102  // The address and port of the server of the server in the target backend set
103  // into which the entries are being migrated.
104  private final String targetBackendServer;
105
106
107
108  /**
109   * Creates a new entry rebalancing request access log message from the
110   * provided message string.
111   *
112   * @param  s  The string to be parsed as an entry rebalancing request access
113   *            log message.
114   *
115   * @throws  LogException  If the provided string cannot be parsed as a valid
116   *                        log message.
117   */
118  public EntryRebalancingRequestAccessLogMessage(final String s)
119         throws LogException
120  {
121    this(new LogMessage(s));
122  }
123
124
125
126  /**
127   * Creates a new entry rebalancing request access log message from the
128   * provided log message.
129   *
130   * @param  m  The log message to be parsed as an entry rebalancing request
131   *            access log message.
132   */
133  public EntryRebalancingRequestAccessLogMessage(final LogMessage m)
134  {
135    super(m);
136
137    rebalancingOperationID = getNamedValueAsLong("rebalancingOp");
138    sizeLimit              = getNamedValueAsInteger("sizeLimit");
139    sourceBackendServer    = getNamedValue("sourceServer");
140    sourceBackendSetName   = getNamedValue("sourceBackendSet");
141    subtreeBaseDN          = getNamedValue("base");
142    targetBackendServer    = getNamedValue("targetServer");
143    targetBackendSetName   = getNamedValue("targetBackendSet");
144    triggeringConnectionID = getNamedValueAsLong("triggeredByConn");
145    triggeringOperationID  = getNamedValueAsLong("triggeredByOp");
146  }
147
148
149
150  /**
151   * Retrieves the unique identifier assigned to the entry rebalancing
152   * operation.
153   *
154   * @return  The unique identifier assigned to the entry rebalancing operation,
155   *          or {@code null} if it is not included in the log message.
156   */
157  public final Long getRebalancingOperationID()
158  {
159    return rebalancingOperationID;
160  }
161
162
163
164  /**
165   * Retrieves the connection ID for the connection that performed an operation
166   * to trigger the entry rebalancing operation.
167   *
168   * @return  Retrieves the connection ID for the connection that performed an
169   *          operation to trigger the entry rebalancing operation, or
170   *          {@code null} if it is not included in the log message.
171   */
172  public final Long getTriggeringConnectionID()
173  {
174    return triggeringConnectionID;
175  }
176
177
178
179  /**
180   * Retrieves the operation ID for the operation that triggered the entry
181   * rebalancing operation.
182   *
183   * @return  Retrieves the operation ID for the operation that triggered the
184   *          entry rebalancing operation, or {@code null} if it is not included
185   *          in the log message.
186   */
187  public final Long getTriggeringOperationID()
188  {
189    return triggeringOperationID;
190  }
191
192
193
194  /**
195   * Retrieves the base DN of the subtree that will be migrated during the entry
196   * rebalancing operation.
197   *
198   * @return  The base DN of the subtree that will be migrated during the entry
199   *          rebalancing operation, or {@code null} if it is not included in
200   *          the log message.
201   */
202  public final String getSubtreeBaseDN()
203  {
204    return subtreeBaseDN;
205  }
206
207
208
209  /**
210   * Retrieves the maximum number of entries that may be contained in the
211   * subtree for it to be successfully migrated.
212   *
213   * @return  The maximum number of entries that may be contained in the subtree
214   *          for it to be successfully migrated, or {@code null} if it is not
215   *          included in the log message.
216   */
217  public final Integer getSizeLimit()
218  {
219    return sizeLimit;
220  }
221
222
223
224  /**
225   * Retrieves the name of the backend set containing the subtree to be
226   * migrated.
227   *
228   * @return  The name of the backend set containing the subtree to be migrated,
229   *          or {@code null} if it is not included in the log message.
230   */
231  public final String getSourceBackendSetName()
232  {
233    return sourceBackendSetName;
234  }
235
236
237
238  /**
239   * The address and port of the backend server from which the subtree will be
240   * migrated.
241   *
242   * @return  The address and port of the backend server from which the subtree
243   *          will be migrated, or {@code null} if it is not included in the log
244   *          message.
245   */
246  public final String getSourceBackendServer()
247  {
248    return sourceBackendServer;
249  }
250
251
252
253  /**
254   * Retrieves the name of the backend set to which the subtree will be
255   * migrated.
256   *
257   * @return  The name of the backend set ot which the subtree will be migrated,
258   *          or {@code null} if it is not included in the log message.
259   */
260  public final String getTargetBackendSetName()
261  {
262    return targetBackendSetName;
263  }
264
265
266
267  /**
268   * Retrieves the address and port of the backend server to which the subtree
269   * will be migrated.
270   *
271   * @return  The address and port of the backend server to which the subtree
272   *          will be migrated, or {@code null} if it is not included in the log
273   *          message.
274   */
275  public final String getTargetBackendServer()
276  {
277    return targetBackendServer;
278  }
279
280
281
282  /**
283   * {@inheritDoc}
284   */
285  @Override()
286  public AccessLogMessageType getMessageType()
287  {
288    return AccessLogMessageType.ENTRY_REBALANCING_REQUEST;
289  }
290}