001/*
002 * Copyright 2009-2019 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2019 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
046 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
047 *   for proprietary functionality or for external specifications that are not
048 *   considered stable or mature enough to be guaranteed to work in an
049 *   interoperable way with other types of LDAP servers.
050 * </BLOCKQUOTE>
051 * <BR>
052 * This request control has an OID of 1.3.6.1.4.1.30221.1.5.2 and a criticality
053 * of true.  It does not have a value.
054 * <BR><BR>
055 * <H2>Example</H2>
056 * The following example demonstrates the use of the replication repair request
057 * control:
058 * <PRE>
059 * ModifyRequest modifyRequest = new ModifyRequest("dc=example,dc=com",
060 *      new Modification(ModificationType.REPLACE, "attrName", "attrValue"));
061 * modifyRequest.addControl(new ReplicationRepairRequestControl());
062 * LDAPResult modifyResult = connection.modify(modifyRequest);
063 * </PRE>
064 */
065@NotMutable()
066@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
067public final class ReplicationRepairRequestControl
068       extends Control
069{
070  /**
071   * The OID (1.3.6.1.4.1.30221.1.5.2) for the replication repair request
072   * control.
073   */
074  public static final String REPLICATION_REPAIR_REQUEST_OID =
075       "1.3.6.1.4.1.30221.1.5.2";
076
077
078
079  /**
080   * The serial version UID for this serializable class.
081   */
082  private static final long serialVersionUID = 8036161025439278805L;
083
084
085
086  /**
087   * Creates a new replication repair request control.  It will be marked
088   * critical.
089   */
090  public ReplicationRepairRequestControl()
091  {
092    super(REPLICATION_REPAIR_REQUEST_OID, true, null);
093  }
094
095
096
097  /**
098   * Creates a new replication repair request control which is decoded from
099   * the provided generic control.
100   *
101   * @param  control  The generic control to be decoded as a replication repair
102   *                  request control.
103   *
104   * @throws  LDAPException  If the provided control cannot be decoded as a
105   *                         replication repair request control.
106   */
107  public ReplicationRepairRequestControl(final Control control)
108         throws LDAPException
109  {
110    super(control);
111
112    if (control.hasValue())
113    {
114      throw new LDAPException(ResultCode.DECODING_ERROR,
115                              ERR_REPLICATION_REPAIR_REQUEST_HAS_VALUE.get());
116    }
117  }
118
119
120
121  /**
122   * {@inheritDoc}
123   */
124  @Override()
125  public String getControlName()
126  {
127    return INFO_CONTROL_NAME_REPLICATION_REPAIR_REQUEST.get();
128  }
129
130
131
132  /**
133   * {@inheritDoc}
134   */
135  @Override()
136  public void toString(final StringBuilder buffer)
137  {
138    buffer.append("ReplicationRepairRequestControl()");
139  }
140}