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