directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1066906 - in /directory: apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ shared/branches/m1/ldap/src/main/ja...
Date Thu, 03 Feb 2011 18:34:15 GMT
Author: elecharny
Date: Thu Feb  3 18:34:15 2011
New Revision: 1066906

URL: http://svn.apache.org/viewvc?rev=1066906&view=rev
Log:
Moved the SyncModifyDn control

Added:
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDn.java
      - copied, changed from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ISyncModifyDn.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java
      - copied, changed from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDn.java
Removed:
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ISyncModifyDn.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDn.java
Modified:
    directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnFactory.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValue.java
    directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java

Modified: directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Thu Feb  3 18:34:15 2011
@@ -87,7 +87,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
 import org.apache.directory.shared.ldap.codec.controls.search.entryChange.EntryChangeDecorator;
 import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
@@ -120,6 +119,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.Subentries;
 import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
 import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
 import org.apache.directory.shared.ldap.model.name.Ava;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
@@ -186,7 +186,7 @@ public abstract class ServerContext impl
         ADS_CONTROLS.put( Subentries.OID, ControlEnum.SUBENTRIES_CONTROL );
         ADS_CONTROLS.put( SyncDoneValue.OID, ControlEnum.SYNC_DONE_VALUE_CONTROL );
         ADS_CONTROLS.put( SyncInfoValue.OID, ControlEnum.SYNC_INFO_VALUE_CONTROL );
-        ADS_CONTROLS.put( ISyncModifyDn.OID, ControlEnum.SYNC_MODIFY_DN_CONTROL );
+        ADS_CONTROLS.put( SyncModifyDn.OID, ControlEnum.SYNC_MODIFY_DN_CONTROL );
         ADS_CONTROLS.put( ISyncRequestValue.OID, ControlEnum.SYNC_REQUEST_VALUE_CONTROL );
         ADS_CONTROLS.put( ISyncStateValue.OID, ControlEnum.SYNC_STATE_VALUE_CONTROL );
     }

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
Thu Feb  3 18:34:15 2011
@@ -43,7 +43,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueDecorator;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -76,6 +75,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
 import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
 import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
 import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnType;
 import org.apache.directory.shared.ldap.model.message.controls.SyncStateTypeEnum;
 import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
@@ -350,11 +350,11 @@ public class SyncReplConsumer implements
                     break;
 
                 case MODDN:
-                    Control adsModDnControl = syncResult.getControls().get( ISyncModifyDn.OID
);
+                    Control adsModDnControl = syncResult.getControls().get( SyncModifyDn.OID
);
                     //Apache Directory Server's special control
                     SyncModifyDnDecorator syncModDnControl = 
                         new SyncModifyDnDecorator( directoryService.getLdapCodecService()
);
-                    syncModDnControl.setDecorated( ( ISyncModifyDn ) adsModDnControl );
+                    syncModDnControl.setDecorated( ( SyncModifyDn ) adsModDnControl );
                     applyModDnOperation( syncModDnControl );
                     break;
 
@@ -743,7 +743,7 @@ public class SyncReplConsumer implements
     }
 
 
-    private void applyModDnOperation( ISyncModifyDn modDnControl ) throws Exception
+    private void applyModDnOperation( SyncModifyDn modDnControl ) throws Exception
     {
         SyncModifyDnType modDnType = modDnControl.getModDnType();
 

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
Thu Feb  3 18:34:15 2011
@@ -38,7 +38,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueFactory;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueFactory;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnFactory;
 import org.apache.directory.shared.ldap.codec.controls.search.entryChange.EntryChangeFactory;
 import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsFactory;
@@ -55,6 +54,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.Subentries;
 import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
 import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 
 
@@ -107,7 +107,7 @@ public class DefaultLdapCodecService imp
         controlFactories.put( SyncInfoValue.OID, syncInfoValueFactory );
         
         SyncModifyDnFactory syncModifyDnFactory = new SyncModifyDnFactory( this );
-        controlFactories.put( ISyncModifyDn.OID, syncModifyDnFactory );
+        controlFactories.put( SyncModifyDn.OID, syncModifyDnFactory );
         
         SyncRequestValueFactory syncRequestValueFactory = new SyncRequestValueFactory( this
);
         controlFactories.put( ISyncRequestValue.OID, syncRequestValueFactory );

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnDecorator.java
Thu Feb  3 18:34:15 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn;
 
@@ -33,22 +33,24 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnImpl;
 import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnType;
 
 
 /**
  * A SyncModifyDnControl object, to send the parameters used in a MODIFYDN operation
  * that was carried out on a syncrepl provider server.
- * 
+ *
  * The consumer will use the values present in this control to perform the same operation
  * on its local data, which helps in avoiding huge number of updates to the consumer.
- * 
+ *
  * NOTE: syncrepl, defined in RFC 4533, doesn't mention about this approach, this is a special
  *       extension provided by Apache Directory Server
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SyncModifyDnDecorator extends ControlDecorator<ISyncModifyDn> implements
ISyncModifyDn
+public class SyncModifyDnDecorator extends ControlDecorator<SyncModifyDn> implements
SyncModifyDn
 {
     /** the entry's Dn to be changed */
     private String entryDn;
@@ -69,17 +71,17 @@ public class SyncModifyDnDecorator exten
 
     private int renameLen = 0;
     private int moveAndRenameLen = 0;
-    
+
     /** An instance of this decoder */
     private Asn1Decoder decoder = new Asn1Decoder();
 
-    
+
     public SyncModifyDnDecorator( ILdapCodecService codec )
     {
-        super( codec, new SyncModifyDn() );
+        super( codec, new SyncModifyDnImpl() );
     }
 
-    
+
     public SyncModifyDnDecorator( ILdapCodecService codec, SyncModifyDnType type )
     {
         this( codec );
@@ -87,7 +89,7 @@ public class SyncModifyDnDecorator exten
     }
 
 
-    public SyncModifyDnDecorator( ILdapCodecService codec, ISyncModifyDn control )
+    public SyncModifyDnDecorator( ILdapCodecService codec, SyncModifyDn control )
     {
         super( codec, control );
     }
@@ -95,16 +97,17 @@ public class SyncModifyDnDecorator exten
 
     /**
      * Compute the SyncStateValue length.
-     * 
+     *
      * SyncStateValue :
      * 0x30 L1
-     *  | 
+     *  |
      *  +--> 0x04 L2 uid=jim...       (entryDn)
      * [+--> 0x04 L3 ou=system...     (newSuperior)
      * [+--> 0x04 L4 uid=jack...      (newRdn)
      * [+--> 0x04 0x01 [0x00|0x01]... (deleteOldRdn)
-     *   
+     *
      */
+    @Override
     public int computeLength()
     {
         syncModDnSeqLength = 1 + TLV.getNbBytes( entryDn.length() ) + entryDn.length();
@@ -136,18 +139,19 @@ public class SyncModifyDnDecorator exten
         }
 
         valueLength = 1 + TLV.getNbBytes( syncModDnSeqLength ) + syncModDnSeqLength;
-        
+
         return valueLength;
     }
 
 
     /**
      * Encode the SyncStateValue control
-     * 
+     *
      * @param buffer The encoded sink
      * @return A ByteBuffer that contains the encoded PDU
      * @throws EncoderException If anything goes wrong.
      */
+    @Override
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
     {
         if ( buffer == null )
@@ -155,13 +159,13 @@ public class SyncModifyDnDecorator exten
             throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
         }
 
-        // Encode the SEQ 
+        // Encode the SEQ
         buffer.put( UniversalTag.SEQUENCE.getValue() );
         buffer.put( TLV.getBytes( syncModDnSeqLength ) );
 
         // the entryDn
         Value.encode( buffer, entryDn );
-        
+
         switch ( modDnType )
         {
             case MOVE:
@@ -193,6 +197,7 @@ public class SyncModifyDnDecorator exten
     /**
      * {@inheritDoc}
      */
+    @Override
     public byte[] getValue()
     {
         if ( value == null )
@@ -202,7 +207,7 @@ public class SyncModifyDnDecorator exten
                 computeLength();
                 ByteBuffer buffer = ByteBuffer.allocate( valueLength );
 
-                // Encode the SEQ 
+                // Encode the SEQ
                 buffer.put( UniversalTag.SEQUENCE.getValue() );
                 buffer.put( TLV.getBytes( syncModDnSeqLength ) );
 
@@ -340,73 +345,6 @@ public class SyncModifyDnDecorator exten
 
 
     /**
-     * @see Object#equals(Object)
-     */
-    public boolean equals( Object o )
-    {
-        if ( !super.equals( o ) )
-        {
-            return false;
-        }
-
-        SyncModifyDnDecorator otherControl = ( SyncModifyDnDecorator ) o;
-        
-        if ( newRdn != null )
-        {
-            if ( newRdn.equals( otherControl.newRdn ) )
-            {
-                return false;
-            }
-        }
-        else
-        {
-            if ( otherControl.newRdn != null )
-            {
-                return false;
-            }
-        }
-        
-        if ( newSuperiorDn != null )
-        {
-            if ( newSuperiorDn.equals( otherControl.newSuperiorDn ) )
-            {
-                return false;
-            }
-        }
-        else
-        {
-            if ( otherControl.newSuperiorDn != null )
-            {
-                return false;
-            }
-        }
-        
-        return ( deleteOldRdn == otherControl.deleteOldRdn ) && 
-            ( modDnType == otherControl.modDnType ) &&
-            ( entryDn.equals( otherControl.entryDn ) );
-    }
-
-
-    /**
-     * @see Object#toString()
-     */
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append( "  SyncModifyDn control :\n" );
-        sb.append( "   oid          : '" ).append( getOid() ).append( '\n' );
-        sb.append( "   critical     : '" ).append( isCritical() ).append( '\n' );
-        sb.append( "   entryDn      : '" ).append( entryDn ).append( "'\n" );
-        sb.append( "   newSuperior  : '" ).append( newSuperiorDn ).append( "'\n" );
-        sb.append( "   newRdn       : '" ).append( newRdn ).append( "'\n" );
-        sb.append( "   deleteOldRdn : '" ).append( deleteOldRdn ).append( "'\n" );
-
-        return sb.toString();
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public Asn1Object decode( byte[] controlBytes ) throws DecoderException

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnFactory.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnFactory.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnFactory.java
Thu Feb  3 18:34:15 2011
@@ -29,15 +29,17 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.ldap.codec.IControlFactory;
 import org.apache.directory.shared.ldap.codec.ILdapCodecService;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnImpl;
 
 
 /**
- * A {@link IControlFactory} which creates {@link ISyncModifyDn} controls.
+ * A {@link IControlFactory} which creates {@link SyncModifyDn} controls.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class SyncModifyDnFactory implements IControlFactory<ISyncModifyDn, SyncModifyDnDecorator>
+public class SyncModifyDnFactory implements IControlFactory<SyncModifyDn, SyncModifyDnDecorator>
 {
     
     private ILdapCodecService codec;
@@ -59,7 +61,7 @@ public class SyncModifyDnFactory impleme
      */
     public String getOid()
     {
-        return ISyncModifyDn.OID;
+        return SyncModifyDn.OID;
     }
 
     
@@ -73,7 +75,7 @@ public class SyncModifyDnFactory impleme
     }
     
 
-    public SyncModifyDnDecorator decorate( ISyncModifyDn control )
+    public SyncModifyDnDecorator decorate( SyncModifyDn control )
     {
         SyncModifyDnDecorator decorator = null;
         
@@ -91,13 +93,13 @@ public class SyncModifyDnFactory impleme
     }
 
     
-    public ISyncModifyDn newControl()
+    public SyncModifyDn newControl()
     {
-        return new SyncModifyDn();
+        return new SyncModifyDnImpl();
     }
     
 
-    public Control toJndiControl( ISyncModifyDn control ) throws EncoderException
+    public Control toJndiControl( SyncModifyDn control ) throws EncoderException
     {
         SyncModifyDnDecorator decorator = decorate( control );
         ByteBuffer bb = ByteBuffer.allocate( decorator.computeLength() );
@@ -107,7 +109,7 @@ public class SyncModifyDnFactory impleme
     }
 
     
-    public ISyncModifyDn fromJndiControl( Control jndi ) throws DecoderException
+    public SyncModifyDn fromJndiControl( Control jndi ) throws DecoderException
     {
         SyncModifyDnDecorator decorator = newCodecControl();
         decorator.setCritical( jndi.isCritical() );

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValue.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValue.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValue.java
Thu Feb  3 18:34:15 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.model.message.controls;
 
@@ -23,7 +23,24 @@ import org.apache.directory.shared.ldap.
 
 
 /**
- * A syncDoneValue object as described in rfc4533.
+ * A syncDoneValue object as described in rfc4533 :
+ *
+ * <pre>
+ * 2.4.  Sync Done Control
+ *
+ *    The Sync Done Control is an LDAP Control [RFC4511] where the
+ *    controlType is the object identifier 1.3.6.1.4.1.4203.1.9.1.3 and the
+ *    controlValue contains a BER-encoded syncDoneValue.  The criticality
+ *    is FALSE (and hence absent).
+ *
+ *       syncDoneValue ::= SEQUENCE {
+ *           cookie          syncCookie OPTIONAL,
+ *           refreshDeletes  BOOLEAN DEFAULT FALSE
+ *       }
+ *
+ *    The Sync Done Control is only applicable to the SearchResultDone
+ *    Message.
+ * </pre>
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -53,7 +70,7 @@ public interface SyncDoneValue extends C
 
 
     /**
-     * @param refreshDeletes set the refreshDeletes flag 
+     * @param refreshDeletes set the refreshDeletes flag
      */
     void setRefreshDeletes( boolean refreshDeletes );
 

Copied: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDn.java
(from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ISyncModifyDn.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDn.java?p2=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDn.java&p1=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ISyncModifyDn.java&r1=1066851&r2=1066906&rev=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ISyncModifyDn.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDn.java
Thu Feb  3 18:34:15 2011
@@ -17,11 +17,10 @@
  *   under the License.
  *
  */
-package org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn;
+package org.apache.directory.shared.ldap.model.message.controls;
 
 
 import org.apache.directory.shared.ldap.model.message.Control;
-import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnType;
 
 
 /**
@@ -36,7 +35,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface ISyncModifyDn extends Control
+public interface SyncModifyDn extends Control
 {
 
     /** This control OID */

Copied: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java
(from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDn.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java?p2=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java&p1=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDn.java&r1=1066851&r2=1066906&rev=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDn.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java
Thu Feb  3 18:34:15 2011
@@ -17,19 +17,20 @@
  *   under the License.
  *
  */
-package org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn;
+package org.apache.directory.shared.ldap.model.message.controls;
+
+import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
 
 
-import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDnType;
 
 
 /**
- * A simple {@link ISyncModifyDn} implementation to hold properties.
+ * A simple {@link SyncModifyDn} implementation to hold properties.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class SyncModifyDn implements ISyncModifyDn
+public class SyncModifyDnImpl extends AbstractControl implements SyncModifyDn
 {
     /** the entry's Dn to be changed */
     private String entryDn;
@@ -44,34 +45,26 @@ public class SyncModifyDn implements ISy
     private boolean deleteOldRdn = false;
 
     private SyncModifyDnType modDnType;
-    
-    private boolean isCritical;
-    
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getOid()
-    {
-        return OID;
-    }
 
 
     /**
-     * {@inheritDoc}
+     * Creates a new instance of SyncModifyDnImpl.
      */
-    public boolean isCritical()
+    public SyncModifyDnImpl()
     {
-        return isCritical;
+        super( OID );
     }
 
 
     /**
-     * {@inheritDoc}
+     *
+     * Creates a new instance of SyncModifyDnImpl.
+     *
+     * @param isCritical The critical flag
      */
-    public void setCritical( boolean isCritical )
+    public SyncModifyDnImpl( boolean isCritical )
     {
-        this.isCritical = isCritical;
+        super( OID, isCritical );
     }
 
 
@@ -163,4 +156,107 @@ public class SyncModifyDn implements ISy
     {
         this.modDnType = modDnType;
     }
+
+
+
+
+    /**
+     * @see Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        int h = 37;
+
+        h = h*17 + super.hashCode();
+        h = h*17 + modDnType.getValue();
+        h = h*17 + ( deleteOldRdn ? 1 : 0 );
+
+        if ( entryDn != null )
+        {
+            h = h*17 + entryDn.hashCode();
+        }
+
+        if ( newRdn != null )
+        {
+            h = h*17 + newRdn.hashCode();
+        }
+
+        if ( newSuperiorDn != null )
+        {
+            h = h*17 + newSuperiorDn.hashCode();
+        }
+
+        return h;
+    }
+
+
+    /**
+     * @see Object#equals(Object)
+     */
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SyncModifyDnDecorator otherControl = ( SyncModifyDnDecorator ) o;
+
+        if ( newRdn != null )
+        {
+            if ( newRdn.equals( otherControl.getNewRdn() ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if ( otherControl.getNewRdn() != null )
+            {
+                return false;
+            }
+        }
+
+        if ( newSuperiorDn != null )
+        {
+            if ( newSuperiorDn.equals( otherControl.getNewSuperiorDn() ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if ( otherControl.getNewSuperiorDn() != null )
+            {
+                return false;
+            }
+        }
+
+        return ( deleteOldRdn == otherControl.isDeleteOldRdn() ) &&
+            ( modDnType == otherControl.getModDnType() ) &&
+            ( entryDn.equals( otherControl.getEntryDn() ) &&
+            ( isCritical() == otherControl.isCritical() ) );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "  SyncModifyDn control :\n" );
+        sb.append( "   oid          : '" ).append( getOid() ).append( '\n' );
+        sb.append( "   critical     : '" ).append( isCritical() ).append( '\n' );
+        sb.append( "   entryDn      : '" ).append( entryDn ).append( "'\n" );
+        sb.append( "   newSuperior  : '" ).append( newSuperiorDn ).append( "'\n" );
+        sb.append( "   newRdn       : '" ).append( newRdn ).append( "'\n" );
+        sb.append( "   deleteOldRdn : '" ).append( deleteOldRdn ).append( "'\n" );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java?rev=1066906&r1=1066905&r2=1066906&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
(original)
+++ directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
Thu Feb  3 18:34:15 2011
@@ -33,8 +33,8 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
 import org.apache.directory.shared.ldap.codec.ILdapCodecService;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
+import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,7 +66,7 @@ public class SyncModifyDnControlTest
         bb.flip();
 
         SyncModifyDnDecorator decorator = new SyncModifyDnDecorator( codec );
-        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
+        SyncModifyDn syncmodDnControl = (SyncModifyDn)decorator.decode( bb.array() );
 
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "ou=dc", syncmodDnControl.getNewSuperiorDn() );
@@ -101,7 +101,7 @@ public class SyncModifyDnControlTest
 
         SyncModifyDnDecorator decorator = new SyncModifyDnDecorator( codec );
         
-        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
+        SyncModifyDn syncmodDnControl = (SyncModifyDn)decorator.decode( bb.array() );
 
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "uid=j", syncmodDnControl.getNewRdn() );
@@ -136,7 +136,7 @@ public class SyncModifyDnControlTest
         bb.flip();
 
         SyncModifyDnDecorator decorator = new SyncModifyDnDecorator( codec );
-        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
+        SyncModifyDn syncmodDnControl = (SyncModifyDn)decorator.decode( bb.array() );
 
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "ou=dc", syncmodDnControl.getNewSuperiorDn() );



Mime
View raw message