001/*
002 * Copyright 2009-2017 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2017 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.controls;
022
023
024
025import com.unboundid.ldap.sdk.Control;
026import com.unboundid.ldap.sdk.LDAPException;
027import com.unboundid.ldap.sdk.ResultCode;
028import com.unboundid.util.NotMutable;
029import com.unboundid.util.ThreadSafety;
030import com.unboundid.util.ThreadSafetyLevel;
031
032import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033
034
035
036/**
037 * This class provides an implementation of a control which may be used to
038 * process an add, delete, modify, or modify DN operation in the Directory
039 * Server which will not be replicated to other servers.  This control is
040 * primarily intended for use in manually resolving replication conflicts.
041 * <BR>
042 * <BLOCKQUOTE>
043 *   <B>NOTE:</B>  This class, and other classes within the
044 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
045 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
046 *   server products.  These classes provide support for proprietary
047 *   functionality or for external specifications that are not considered stable
048 *   or mature enough to be guaranteed to work in an interoperable way with
049 *   other types of LDAP servers.
050 * </BLOCKQUOTE>
051 * <BR>
052 * <H2>Example</H2>
053 * The following example demonstrates the use of the replication repair request
054 * control:
055 * <PRE>
056 * ModifyRequest modifyRequest = new ModifyRequest("dc=example,dc=com",
057 *      new Modification(ModificationType.REPLACE, "attrName", "attrValue"));
058 * modifyRequest.addControl(new ReplicationRepairRequestControl());
059 * LDAPResult modifyResult = connection.modify(modifyRequest);
060 * </PRE>
061 */
062@NotMutable()
063@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
064public final class ReplicationRepairRequestControl
065       extends Control
066{
067  /**
068   * The OID (1.3.6.1.4.1.30221.1.5.2) for the replication repair request
069   * control.
070   */
071  public static final String REPLICATION_REPAIR_REQUEST_OID =
072       "1.3.6.1.4.1.30221.1.5.2";
073
074
075
076  /**
077   * The serial version UID for this serializable class.
078   */
079  private static final long serialVersionUID = 8036161025439278805L;
080
081
082
083  /**
084   * Creates a new replication repair request control.  It will be marked
085   * critical.
086   */
087  public ReplicationRepairRequestControl()
088  {
089    super(REPLICATION_REPAIR_REQUEST_OID, true, null);
090  }
091
092
093
094  /**
095   * Creates a new replication repair request control which is decoded from
096   * the provided generic control.
097   *
098   * @param  control  The generic control to be decoded as a replication repair
099   *                  request control.
100   *
101   * @throws  LDAPException  If the provided control cannot be decoded as a
102   *                         replication repair request control.
103   */
104  public ReplicationRepairRequestControl(final Control control)
105         throws LDAPException
106  {
107    super(control);
108
109    if (control.hasValue())
110    {
111      throw new LDAPException(ResultCode.DECODING_ERROR,
112                              ERR_REPLICATION_REPAIR_REQUEST_HAS_VALUE.get());
113    }
114  }
115
116
117
118  /**
119   * {@inheritDoc}
120   */
121  @Override()
122  public String getControlName()
123  {
124    return INFO_CONTROL_NAME_REPLICATION_REPAIR_REQUEST.get();
125  }
126
127
128
129  /**
130   * {@inheritDoc}
131   */
132  @Override()
133  public void toString(final StringBuilder buffer)
134  {
135    buffer.append("ReplicationRepairRequestControl()");
136  }
137}