001/*
002 * Copyright 2010-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
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 */
021package com.unboundid.ldap.sdk.unboundidds.extensions;
022
023
024
025import com.unboundid.asn1.ASN1Element;
026import com.unboundid.asn1.ASN1OctetString;
027import com.unboundid.util.NotMutable;
028import com.unboundid.util.ThreadSafety;
029import com.unboundid.util.ThreadSafetyLevel;
030import com.unboundid.util.Validator;
031
032
033
034/**
035 * This class provides an implementation of a changelog batch starting point
036 * which may be used to start a batch of changes at a change identified by a
037 * replication CSN.  The first change of the batch will be the change with this
038 * CSN.
039 * <BR>
040 * <BLOCKQUOTE>
041 *   <B>NOTE:</B>  This class, and other classes within the
042 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
043 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
044 *   server products.  These classes provide support for proprietary
045 *   functionality or for external specifications that are not considered stable
046 *   or mature enough to be guaranteed to work in an interoperable way with
047 *   other types of LDAP servers.
048 * </BLOCKQUOTE>
049 */
050@NotMutable()
051@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
052public final class ResumeWithCSNStartingPoint
053       extends ChangelogBatchStartingPoint
054{
055  /**
056   * The BER type to use for the ASN.1 element used to encode this starting
057   * point.
058   */
059  static final byte TYPE = (byte) 0x81;
060
061
062
063  /**
064   * The serial version UID for this serializable class.
065   */
066  private static final long serialVersionUID = -5205334877324505765L;
067
068
069
070  // The replication CSN which may be used to define the starting point for the
071  // changelog batch request.
072  private final String csn;
073
074
075
076  /**
077   * Creates a new instance of this changelog batch starting point using the
078   * provided replication CSN.
079   *
080   * @param  csn  The replication CSN which may be used to define the starting
081   *              point for the get changelog batch request.  It must not be
082   *              {@code null}.
083   */
084  public ResumeWithCSNStartingPoint(final String csn)
085  {
086    Validator.ensureNotNull(csn);
087
088    this.csn = csn;
089  }
090
091
092
093  /**
094   * Retrieves the replication CSN which may be used to define the starting
095   * point for the get changelog batch request.
096   *
097   * @return  The replication CSN which may be used to define the starting point
098   *          for the get changelog batch request.
099   */
100  public String getCSN()
101  {
102    return csn;
103  }
104
105
106
107  /**
108   * {@inheritDoc}
109   */
110  @Override()
111  public ASN1Element encode()
112  {
113    return new ASN1OctetString(TYPE, csn);
114  }
115
116
117
118  /**
119   * {@inheritDoc}
120   */
121  @Override()
122  public void toString(final StringBuilder buffer)
123  {
124    buffer.append("ResumeWithCSNStartingPoint(csn='");
125    buffer.append(csn);
126    buffer.append("')");
127  }
128}