001 /*
002 * Copyright 2010-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.extensions;
022
023
024
025 import com.unboundid.asn1.ASN1Element;
026 import com.unboundid.asn1.ASN1OctetString;
027 import com.unboundid.util.NotMutable;
028 import com.unboundid.util.ThreadSafety;
029 import com.unboundid.util.ThreadSafetyLevel;
030 import com.unboundid.util.Validator;
031
032
033
034 /**
035 * <BLOCKQUOTE>
036 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
037 * LDAP SDK for Java. It is not available for use in applications that
038 * include only the Standard Edition of the LDAP SDK, and is not supported for
039 * use in conjunction with non-UnboundID products.
040 * </BLOCKQUOTE>
041 * This class provides an implementation of a changelog batch starting point
042 * which may be used to start a batch of changes at a change identified by a
043 * replication CSN. The first change of the batch will be the change with this
044 * CSN.
045 */
046 @NotMutable()
047 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
048 public final class ResumeWithCSNStartingPoint
049 extends ChangelogBatchStartingPoint
050 {
051 /**
052 * The BER type to use for the ASN.1 element used to encode this starting
053 * point.
054 */
055 static final byte TYPE = (byte) 0x81;
056
057
058
059 /**
060 * The serial version UID for this serializable class.
061 */
062 private static final long serialVersionUID = -5205334877324505765L;
063
064
065
066 // The replication CSN which may be used to define the starting point for the
067 // changelog batch request.
068 private final String csn;
069
070
071
072 /**
073 * Creates a new instance of this changelog batch starting point using the
074 * provided replication CSN.
075 *
076 * @param csn The replication CSN which may be used to define the starting
077 * point for the get changelog batch request. It must not be
078 * {@code null}.
079 */
080 public ResumeWithCSNStartingPoint(final String csn)
081 {
082 Validator.ensureNotNull(csn);
083
084 this.csn = csn;
085 }
086
087
088
089 /**
090 * Retrieves the replication CSN which may be used to define the starting
091 * point for the get changelog batch request.
092 *
093 * @return The replication CSN which may be used to define the starting point
094 * for the get changelog batch request.
095 */
096 public String getCSN()
097 {
098 return csn;
099 }
100
101
102
103 /**
104 * {@inheritDoc}
105 */
106 @Override()
107 public ASN1Element encode()
108 {
109 return new ASN1OctetString(TYPE, csn);
110 }
111
112
113
114 /**
115 * {@inheritDoc}
116 */
117 @Override()
118 public void toString(final StringBuilder buffer)
119 {
120 buffer.append("ResumeWithCSNStartingPoint(csn='");
121 buffer.append(csn);
122 buffer.append("')");
123 }
124 }