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