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