You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/05/03 19:51:37 UTC

svn commit: r940533 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn: SyncModifyDnControlGrammar.java SyncModifyDnControlStatesEnum.java

Author: elecharny
Date: Mon May  3 17:51:37 2010
New Revision: 940533

URL: http://svn.apache.org/viewvc?rev=940533&view=rev
Log:
Fixed the transitions, and the test

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlStatesEnum.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java?rev=940533&r1=940532&r2=940533&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java Mon May  3 17:51:37 2010
@@ -59,7 +59,7 @@ import org.slf4j.LoggerFactory;
  * 
  *      MoveAndRename SEQUENCE {
  *          superior-name   LDAPDN
- *          new-rd RDN,
+ *          new-rdn RDN,
  *          delete-old-rdn BOOLEAN
  *      }
  * 
@@ -109,8 +109,8 @@ public class SyncModifyDnControlGrammar 
          * Stores the entryDn value
          */
         super.transitions[SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            IStates.INIT_GRAMMAR_STATE,
-            SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE, UniversalTag.OCTET_STRING_TAG, new GrammarAction(
+            SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE,
+            SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, UniversalTag.OCTET_STRING_TAG, new GrammarAction(
                 "Set SyncModifyDnControl entryDn value" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
@@ -142,23 +142,38 @@ public class SyncModifyDnControlGrammar 
          * Stores the newSuperiorDn value
          */
 
-        super.transitions[IStates.INIT_GRAMMAR_STATE][SyncModifyDnControlTags.MOVE_TAG.getValue()] = new GrammarTransition(
-            IStates.INIT_GRAMMAR_STATE, SyncModifyDnControlStatesEnum.MOVE_DN_STATE,
+        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE][SyncModifyDnControlTags.MOVE_TAG.getValue()] = new GrammarTransition(
+            SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, SyncModifyDnControlStatesEnum.MOVE_STATE,
             SyncModifyDnControlTags.MOVE_TAG.getValue(), new GrammarAction( "Set SyncModifyDnControl newSuperiorDn" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
                     SyncModifyDnControlContainer syncModifyDnControlContainer = ( SyncModifyDnControlContainer ) container;
                     syncModifyDnControlContainer.getSyncModifyDnControl().setModDnType( SyncModifyDnType.MOVE );
+
                     // We need to read the move operation's superiorDN
-                    syncModifyDnControlContainer.grammarEndAllowed( false );
+                    Value value = syncModifyDnControlContainer.getCurrentTLV().getValue();
+
+                    // Check that the value is into the allowed interval
+                    String newSuperiorDn = StringTools.utf8ToString( value.getData() );
+                    
+                    if ( IS_DEBUG )
+                    {
+                        LOG.debug( "ModDN entryDn = {}", newSuperiorDn );
+                    }
+                    
+                    syncModifyDnControlContainer.getSyncModifyDnControl().setNewSuperiorDn( newSuperiorDn );
+                    
+                    // move on to the next transistion
+                    syncModifyDnControlContainer.grammarEndAllowed( true );
                 }
             } );
 
+        
         /**
          * read the newSuperiorDn
          * move-name       [0] LDAPDN
-         */
+         *
         super.transitions[SyncModifyDnControlStatesEnum.MOVE_DN_STATE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.MOVE_DN_STATE, SyncModifyDnControlStatesEnum.NEW_SUPERIOR_DN_STATE,
             UniversalTag.OCTET_STRING_TAG, new GrammarAction( "Set SyncModifyDnControl newSuperiorDn" )
@@ -193,7 +208,7 @@ public class SyncModifyDnControlGrammar 
          * }
          *            
          * Stores the newRdn value
-         */
+         *
         super.transitions[SyncModifyDnControlStatesEnum.NEW_SUPERIOR_DN_STATE][SyncModifyDnControlTags.RENAME_TAG.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.NEW_SUPERIOR_DN_STATE, SyncModifyDnControlStatesEnum.NEW_RDN_STATE,
             UniversalTag.OCTET_STRING_TAG, new GrammarAction( "Set SyncModifyDnControl newRdn value" )
@@ -226,7 +241,7 @@ public class SyncModifyDnControlGrammar 
          *  }
          *     
          * Stores the deleteOldRdn flag
-         */
+         *
         super.transitions[SyncModifyDnControlStatesEnum.NEW_RDN_STATE][UniversalTag.BOOLEAN_TAG] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.NEW_RDN_STATE, SyncModifyDnControlStatesEnum.DEL_OLD_RDN_STATE,
             UniversalTag.BOOLEAN_TAG, new GrammarAction( "Set SyncModifyDnControl deleteOldRdn value" )
@@ -251,7 +266,7 @@ public class SyncModifyDnControlGrammar 
                     // terminal state
                     syncModifyDnControlContainer.grammarEndAllowed( true );
                 }
-            } );
+            } );*/
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlStatesEnum.java?rev=940533&r1=940532&r2=940533&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlStatesEnum.java Mon May  3 17:51:37 2010
@@ -45,29 +45,35 @@ public class SyncModifyDnControlStatesEn
     /** Sequence Value */
     public static final int SYNC_MODDN_VALUE_SEQUENCE_STATE = 1;
 
-//    /** modDn control's entryDN */
-//    public static final int ENTRY_DN_STATE = 1;
+    /** modDn control's entryDN */
+    public static final int ENTRY_DN_STATE = 2;
     
     /** modDn control's move operation state */
-    public static final int MOVE_DN_STATE = 2;
+    public static final int MOVE_STATE = 3;
     
-    /** modDn control's newSuperiorDN */
-    public static final int NEW_SUPERIOR_DN_STATE = 3;
+    /** modDn rename sequence */
+    public static final int RENAME_STATE = 4;
 
-    /** modDn control's rename operation state */
-    public static final int RENAME_DN_STATE = 5;
-    
-    /** modDn control's newRDN */
-    public static final int NEW_RDN_STATE = 6;
+    /** modDn rename sequence */
+    public static final int MOVE_AND_RENAME_STATE = 5;
+
+    /** modDn control's rename newRDN */
+    public static final int RENAME_NEW_RDN_STATE = 6;
 
-    /** modDn control's rename operation state */
-    public static final int MOVE_AND_RENAME_DN_STATE = 7;
+    /** modDn control's rename deleteOldRdn flag */
+    public static final int RENAME_DEL_OLD_RDN_STATE = 7;
     
-    /** modDn control's deleteOldRdn flag */
-    public static final int DEL_OLD_RDN_STATE = 8;
+    /** modDn control's move and rename newSuperiorDN */
+    public static final int MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE = 8;
+
+    /** modDn control's move and rename newRDN */
+    public static final int MOVE_AND_RENAME_NEW_RDN_STATE = 9;
+
+    /** modDn control's move and rename deleteOldRdn flag */
+    public static final int MOVE_AND_RENAME_DEL_OLD_RDN_STATE = 10;
 
     /** terminal state */
-    public static final int LAST_SYNC_MODDN_VALUE_STATE = 9;
+    public static final int LAST_SYNC_MODDN_VALUE_STATE = 10;
     
     // =========================================================================
     // States debug strings
@@ -76,14 +82,16 @@ public class SyncModifyDnControlStatesEn
     private static String[] syncModifyDnString = new String[]
         { 
         "START_SYNC_MODDN", 
-//        "SYNC_MODDN_VALUE_SEQUENCE_STATE", 
+        "SYNC_MODDN_VALUE_SEQUENCE_STATE", 
         "ENTRY_DN_STATE",
-        "MOVE_DN_STATE", 
-        "NEW_SUPERIOR_DN_STATE",
-        "RENAME_DN_STATE",
-        "NEW_RDN_STATE",
-        "MOVE_AND_RENAME_DN_STATE",
-        "DEL_OLD_RDN_STATE"
+        "MOVE_STATE", 
+        "RENAME_STATE",
+        "MOVE_AND_RENAME_STATE",
+        "RENAME_NEW_RDN_STATE",
+        "RENAME_DEL_OLD_RDN_STATE",
+        "MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE",
+        "MOVE_AND_RENAME_NEW_RDN_STATE",
+        "MOVE_AND_RENAME_DEL_OLD_RDN_STATE",
         };
 
     /** The instance */