directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1153179 - /directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java
Date Tue, 02 Aug 2011 16:17:31 GMT
Author: kayyagari
Date: Tue Aug  2 16:17:30 2011
New Revision: 1153179

URL: http://svn.apache.org/viewvc?rev=1153179&view=rev
Log:
o removed the variable copies and used the decorator instead

Modified:
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java?rev=1153179&r1=1153178&r2=1153179&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncModifyDnDecorator.java
Tue Aug  2 16:17:30 2011
@@ -52,20 +52,6 @@ import org.apache.directory.shared.ldap.
  */
 public class SyncModifyDnDecorator extends ControlDecorator<SyncModifyDn> implements
SyncModifyDn
 {
-    /** the entry's Dn to be changed */
-    private String entryDn;
-
-    /** target entry's new parent Dn */
-    private String newSuperiorDn;
-
-    /** the new Rdn */
-    private String newRdn;
-
-    /** flag to indicate whether to delete the old Rdn */
-    private boolean deleteOldRdn = false;
-
-    private SyncModifyDnType modDnType;
-
     /** global length for the control */
     private int syncModDnSeqLength;
 
@@ -85,7 +71,7 @@ public class SyncModifyDnDecorator exten
     public SyncModifyDnDecorator( LdapApiService codec, SyncModifyDnType type )
     {
         this( codec );
-        this.modDnType = type;
+        getDecorated().setModDnType( type );
     }
 
 
@@ -110,9 +96,13 @@ public class SyncModifyDnDecorator exten
     @Override
     public int computeLength()
     {
+        String entryDn = getDecorated().getEntryDn();
+        String newSuperiorDn = getDecorated().getNewSuperiorDn();
+        String newRdn = getDecorated().getNewRdn();
+        
         syncModDnSeqLength = 1 + TLV.getNbBytes( entryDn.length() ) + entryDn.length();
 
-        switch ( modDnType )
+        switch ( getDecorated().getModDnType() )
         {
             case MOVE:
                 int moveLen = 1 + TLV.getNbBytes( newSuperiorDn.length() ) + newSuperiorDn.length();
@@ -163,10 +153,14 @@ public class SyncModifyDnDecorator exten
         buffer.put( UniversalTag.SEQUENCE.getValue() );
         buffer.put( TLV.getBytes( syncModDnSeqLength ) );
 
+        String entryDn = getDecorated().getEntryDn();
+        String newSuperiorDn = getDecorated().getNewSuperiorDn();
+        String newRdn = getDecorated().getNewRdn();
+        
         // the entryDn
         Value.encode( buffer, entryDn );
 
-        switch ( modDnType )
+        switch ( getDecorated().getModDnType() )
         {
             case MOVE:
                 buffer.put( ( byte ) SyncModifyDnTags.MOVE_TAG.getValue() );
@@ -178,7 +172,7 @@ public class SyncModifyDnDecorator exten
                 buffer.put( ( byte ) SyncModifyDnTags.RENAME_TAG.getValue() );
                 buffer.put( TLV.getBytes( renameLen ) );
                 Value.encode( buffer, newRdn );
-                Value.encode( buffer, deleteOldRdn );
+                Value.encode( buffer, getDecorated().isDeleteOldRdn() );
                 break;
 
             case MOVEANDRENAME:
@@ -186,7 +180,7 @@ public class SyncModifyDnDecorator exten
                 buffer.put( TLV.getBytes( moveAndRenameLen ) );
                 Value.encode( buffer, newSuperiorDn );
                 Value.encode( buffer, newRdn );
-                Value.encode( buffer, deleteOldRdn );
+                Value.encode( buffer, getDecorated().isDeleteOldRdn() );
                 break;
         }
 
@@ -211,10 +205,14 @@ public class SyncModifyDnDecorator exten
                 buffer.put( UniversalTag.SEQUENCE.getValue() );
                 buffer.put( TLV.getBytes( syncModDnSeqLength ) );
 
+                String entryDn = getDecorated().getEntryDn();
+                String newSuperiorDn = getDecorated().getNewSuperiorDn();
+                String newRdn = getDecorated().getNewRdn();
+                
                 // the entryDn
                 Value.encode( buffer, entryDn );
 
-                switch ( modDnType )
+                switch ( getDecorated().getModDnType() )
                 {
                     case MOVE:
                         buffer.put( ( byte ) SyncModifyDnTags.MOVE_TAG.getValue() );
@@ -226,7 +224,7 @@ public class SyncModifyDnDecorator exten
                         buffer.put( ( byte ) SyncModifyDnTags.RENAME_TAG.getValue() );
                         buffer.put( TLV.getBytes( renameLen ) );
                         Value.encode( buffer, newRdn );
-                        Value.encode( buffer, deleteOldRdn );
+                        Value.encode( buffer, getDecorated().isDeleteOldRdn() );
                         break;
 
                     case MOVEANDRENAME:
@@ -234,7 +232,7 @@ public class SyncModifyDnDecorator exten
                         buffer.put( TLV.getBytes( moveAndRenameLen ) );
                         Value.encode( buffer, newSuperiorDn );
                         Value.encode( buffer, newRdn );
-                        Value.encode( buffer, deleteOldRdn );
+                        Value.encode( buffer, getDecorated().isDeleteOldRdn() );
                         break;
                 }
 
@@ -255,7 +253,7 @@ public class SyncModifyDnDecorator exten
      */
     public String getEntryDn()
     {
-        return entryDn;
+        return getDecorated().getEntryDn();
     }
 
 
@@ -264,7 +262,7 @@ public class SyncModifyDnDecorator exten
      */
     public void setEntryDn( String entryDn )
     {
-        this.entryDn = entryDn;
+        getDecorated().setEntryDn( entryDn );
     }
 
 
@@ -273,7 +271,7 @@ public class SyncModifyDnDecorator exten
      */
     public String getNewSuperiorDn()
     {
-        return newSuperiorDn;
+        return getDecorated().getNewSuperiorDn();
     }
 
 
@@ -282,7 +280,7 @@ public class SyncModifyDnDecorator exten
      */
     public void setNewSuperiorDn( String newSuperiorDn )
     {
-        this.newSuperiorDn = newSuperiorDn;
+        getDecorated().setNewSuperiorDn( newSuperiorDn );
     }
 
 
@@ -291,7 +289,7 @@ public class SyncModifyDnDecorator exten
      */
     public String getNewRdn()
     {
-        return newRdn;
+        return getDecorated().getNewRdn();
     }
 
 
@@ -300,7 +298,7 @@ public class SyncModifyDnDecorator exten
      */
     public void setNewRdn( String newRdn )
     {
-        this.newRdn = newRdn;
+        getDecorated().setNewRdn( newRdn );
     }
 
 
@@ -309,7 +307,7 @@ public class SyncModifyDnDecorator exten
      */
     public boolean isDeleteOldRdn()
     {
-        return deleteOldRdn;
+        return getDecorated().isDeleteOldRdn();
     }
 
 
@@ -318,7 +316,7 @@ public class SyncModifyDnDecorator exten
      */
     public void setDeleteOldRdn( boolean deleteOldRdn )
     {
-        this.deleteOldRdn = deleteOldRdn;
+        getDecorated().setDeleteOldRdn( deleteOldRdn );
     }
 
 
@@ -327,7 +325,7 @@ public class SyncModifyDnDecorator exten
      */
     public SyncModifyDnType getModDnType()
     {
-        return modDnType;
+        return getDecorated().getModDnType();
     }
 
 
@@ -336,11 +334,11 @@ public class SyncModifyDnDecorator exten
      */
     public void setModDnType( SyncModifyDnType modDnType )
     {
-        if( this.modDnType != null )
+        if( getDecorated().getModDnType() != null )
         {
             throw new IllegalStateException( "cannot overwrite the existing modDnType value"
);
         }
-        this.modDnType = modDnType;
+        getDecorated().setModDnType( modDnType );
     }
 
 



Mime
View raw message