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
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.replication.plugin;
028    
029    
030    import org.opends.server.types.Control;
031    import org.opends.server.types.LDAPException;
032    
033    
034    
035    /**
036     * This class implements the Sun-defined replication repair control.
037     * This control can be used to modify the content of a replicated database
038     * on a single server without impacting the other servers that are replicated
039     * with this server.
040     * It also allows to modify attributes like entryuuid and ds-sync-hist that
041     * are normally not modifiable from an external connection.
042     */
043    public class ReplicationRepairRequestControl
044           extends Control
045    {
046      /**
047       * The OID of the Replication repair Control.
048       */
049      public static final String
050              OID_REPLICATION_REPAIR_CONTROL = "1.3.6.1.4.1.26027.1.5.2";
051    
052    
053      /**
054       * Creates a new instance of the replication repair request control with the
055       * default settings.
056       */
057      public ReplicationRepairRequestControl()
058      {
059        super(OID_REPLICATION_REPAIR_CONTROL, false);
060    
061      }
062    
063    
064    
065      /**
066       * Creates a new instance of the replication repair control with the
067       * provided information.
068       *
069       * @param  oid         The OID to use for this control.
070       * @param  isCritical  Indicates whether support for this control should be
071       *                     considered a critical part of the client processing.
072       */
073      public ReplicationRepairRequestControl(String oid, boolean isCritical)
074      {
075        super(oid, isCritical);
076    
077      }
078    
079    
080    
081      /**
082       * Creates a new replication repair request control from the contents of the
083       * provided control.
084       *
085       * @param  control  The generic control containing the information to use to
086       *                  create this replication repair request control.
087       *
088       * @return  The replication repair request control decoded from the provided
089       *          control.
090       *
091       * @throws  LDAPException  If this control cannot be decoded as a valid
092       *                         replication repair request control.
093       */
094      public static ReplicationRepairRequestControl decodeControl(Control control)
095             throws LDAPException
096      {
097        return new ReplicationRepairRequestControl(control.getOID(),
098                                               control.isCritical());
099      }
100    
101    
102    
103      /**
104       * Retrieves a string representation of this replication repair request
105       * control.
106       *
107       * @return  A string representation of this replication repair request
108       *          control.
109       */
110      public String toString()
111      {
112        StringBuilder buffer = new StringBuilder();
113        toString(buffer);
114        return buffer.toString();
115      }
116    
117    
118    
119      /**
120       * Appends a string representation of this replication repair request control
121       * to the provided buffer.
122       *
123       * @param  buffer  The buffer to which the information should be appended.
124       */
125      public void toString(StringBuilder buffer)
126      {
127        buffer.append("ReplicationRepairRequestControl()");
128      }
129    }
130