001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2013-2016 ForgeRock AS. 016 */ 017package org.opends.server.replication.plugin; 018 019import java.io.IOException; 020 021import org.forgerock.opendj.io.ASN1Writer; 022import org.forgerock.opendj.ldap.ByteString; 023import org.opends.server.controls.ControlDecoder; 024import org.opends.server.types.Control; 025import org.opends.server.types.DirectoryException; 026 027/** 028 * This class implements the Sun-defined replication repair control. 029 * This control can be used to modify the content of a replicated database 030 * on a single server without impacting the other servers that are replicated 031 * with this server. 032 * It also allows to modify attributes like entryuuid and ds-sync-hist that 033 * are normally not modifiable from an external connection. 034 */ 035public class ReplicationRepairRequestControl extends Control 036{ 037 /** ControlDecoder implementation to decode this control from a ByteString. */ 038 private static final class Decoder 039 implements ControlDecoder<ReplicationRepairRequestControl> 040 { 041 @Override 042 public ReplicationRepairRequestControl decode(boolean isCritical, 043 ByteString value) 044 throws DirectoryException 045 { 046 return new ReplicationRepairRequestControl(isCritical); 047 } 048 049 @Override 050 public String getOID() 051 { 052 return OID_REPLICATION_REPAIR_CONTROL; 053 } 054 } 055 056 /** The Control Decoder that can be used to decode this control. */ 057 public static final ControlDecoder<ReplicationRepairRequestControl> DECODER = 058 new Decoder(); 059 060 /** The OID of the Replication repair Control. */ 061 public static final String 062 OID_REPLICATION_REPAIR_CONTROL = "1.3.6.1.4.1.26027.1.5.2"; 063 064 /** Creates a new instance of the replication repair request control with the default settings. */ 065 public ReplicationRepairRequestControl() 066 { 067 super(OID_REPLICATION_REPAIR_CONTROL, false); 068 } 069 070 /** 071 * Creates a new instance of the replication repair control with the 072 * provided information. 073 * 074 * @param isCritical Indicates whether support for this control should be 075 * considered a critical part of the client processing. 076 */ 077 public ReplicationRepairRequestControl(boolean isCritical) 078 { 079 super(OID_REPLICATION_REPAIR_CONTROL, isCritical); 080 } 081 082 /** 083 * Writes this control value to an ASN.1 writer. The value (if any) must be 084 * written as an ASN1OctetString. 085 * 086 * @param writer The ASN.1 writer to use. 087 * @throws IOException If a problem occurs while writing to the stream. 088 */ 089 @Override 090 protected void writeValue(ASN1Writer writer) throws IOException { 091 // No value element 092 } 093 094 @Override 095 public void toString(StringBuilder buffer) 096 { 097 buffer.append("ReplicationRepairRequestControl()"); 098 } 099}