directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1588204 - in /directory/shared/trunk: integ/src/test/java/org/apache/directory/api/ldap/codec/api/ ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/ ldap/codec/standalone/src/test/java/org/apache/directory...
Date Thu, 17 Apr 2014 10:43:40 GMT
Author: elecharny
Date: Thu Apr 17 10:43:40 2014
New Revision: 1588204

URL: http://svn.apache.org/r1588204
Log:
Merged the two AdDirSync controls into one single control

Added:
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncGrammar.java
      - copied, changed from r1587971, directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncStatesEnum.java
      - copied, changed from r1587971, directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseStatesEnum.java
Removed:
    directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponse.java
    directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseImpl.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseContainer.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseFactory.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseStatesEnum.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseControlTest.java
Modified:
    directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
    directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
    directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
    directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
    directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
(original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
Thu Apr 17 10:43:40 2014
@@ -56,8 +56,7 @@ public class StandaloneLdapCodecServiceT
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,"
+
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,"
+
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory,"
+
-                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory," +
-                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponseFactory"
);
+                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory" );
 
         System.setProperty( StandaloneLdapApiService.EXTENDED_OPERATIONS_LIST,
             "org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.CancelFactory,"
+

Modified: directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
(original)
+++ directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
Thu Apr 17 10:43:40 2014
@@ -35,8 +35,6 @@ import org.apache.directory.api.ldap.cod
 import org.apache.directory.api.ldap.codec.controls.sort.SortResponseFactory;
 import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
 import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory;
-import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponse;
-import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponseFactory;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
 import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory;
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
@@ -137,10 +135,6 @@ public class CodecFactoryUtil
         ControlFactory<AdDirSync> adDirSyncFactory = new AdDirSyncFactory( apiService
);
         controlFactories.put( adDirSyncFactory.getOid(), adDirSyncFactory );
         LOG.info( "Registered pre-bundled control factory: {}", adDirSyncFactory.getOid()
);
-        
-        ControlFactory<AdDirSyncResponse> adDirSyncResponseFactory = new AdDirSyncResponseFactory(
apiService );
-        controlFactories.put( adDirSyncResponseFactory.getOid(), adDirSyncResponseFactory
);
-        LOG.info( "Registered pre-bundled control factory: {}", adDirSyncResponseFactory.getOid()
);
     }
 
 

Modified: directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
(original)
+++ directory/shared/trunk/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
Thu Apr 17 10:43:40 2014
@@ -60,8 +60,7 @@ public abstract class AbstractCodecServi
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,"
+
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,"
+
                 "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory,"
+
-                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory," +
-                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponseFactory"
);
+                "org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory" );
 
         System.setProperty( StandaloneLdapApiService.EXTENDED_OPERATIONS_LIST,
             "org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.CancelFactory,"
+

Modified: directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
(original)
+++ directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
Thu Apr 17 10:43:40 2014
@@ -33,11 +33,23 @@ import org.apache.directory.api.ldap.mod
  *     criticality             TRUE
  * }
  * 
+ * the control value can be one of the two structures :
+ * 
+ * Client side :
  * realReplControlValue ::= SEQUENCE {
  *     parentsFirst            integer
  *     maxReturnLength         integer
  *     cookie                  OCTET STRING
  * }
+ * 
+ * or
+ * 
+ * server side :
+ * realReplControlValue ::= SEQUENCE {
+ *     flag                  integer
+ *     maxReturnLength       integer
+ *     cookie                OCTET STRING
+ * }
  * </pre> 
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -83,4 +95,22 @@ public interface AdDirSync extends Contr
      * for the first control.
      */
     void setCookie( byte[] cookie );
+    
+    
+    /**
+     * @return The flag returned by the server. One of :
+     * <ul>
+     * <li>LDAP_DIRSYNC_OBJECT_SECURITY (0x0001)</li>
+     * <li>LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER (0x0800)</li>
+     * <li>LDAP_DIRSYNC_PUBLIC_DATA_ONLY (0x2000)(</li>
+     * <li>LDAP_DIRSYNC_INCREMENTAL_VALUES (0x7FFFFFFF)</li>
+     * </ul>
+     */
+    AdDirSyncFlag getFlag();
+    
+    
+    /**
+     * @param flag The flag. 
+     */
+    void setFlag( AdDirSyncFlag flag );
 }

Modified: directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
(original)
+++ directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
Thu Apr 17 10:43:40 2014
@@ -35,6 +35,9 @@ public class AdDirSyncImpl extends Abstr
     /** A flag used to tell the server to return the parent before the children */
     int parentFirst = 1;
     
+    /** A flag used to indicate that there are more data to return */
+    AdDirSyncFlag flag = AdDirSyncFlag.DEFAULT;
+
     /** The maximum number of attributes to return */
     int maxReturnLength = 0;
     
@@ -71,6 +74,24 @@ public class AdDirSyncImpl extends Abstr
     /**
      * {@inheritDoc}
      */
+    public AdDirSyncFlag getFlag()
+    {
+        return flag;
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setFlag( AdDirSyncFlag flag )
+    {
+        this.flag = flag;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public int getMaxReturnLength()
     {
         return maxReturnLength;

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
Thu Apr 17 10:43:40 2014
@@ -24,8 +24,6 @@ import org.apache.directory.api.ldap.cod
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
 import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncFactory;
-import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponse;
-import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponseFactory;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
 import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory;
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
@@ -104,9 +102,6 @@ public class ExtrasBundleActivator imple
         
         ControlFactory<AdDirSync> adDirSyncFactory = new AdDirSyncFactory( codec );
         codec.registerControl( adDirSyncFactory );
-        
-        ControlFactory<AdDirSyncResponse> adDirSyncResponseFactory = new AdDirSyncResponseFactory(
codec );
-        codec.registerControl( adDirSyncResponseFactory );
     }
 
 

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncDecorator.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncDecorator.java
Thu Apr 17 10:43:40 2014
@@ -66,10 +66,92 @@ public class AdDirSyncDecorator extends 
     {
         super( codec, control );
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int getParentFirst()
+    {
+        return getDecorated().getParentFirst();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setParentFirst( int parentFirst )
+    {
+        getDecorated().setParentFirst( parentFirst );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AdDirSyncFlag getFlag()
+    {
+        return getDecorated().getFlag();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setFlag( AdDirSyncFlag flag )
+    {
+        getDecorated().setFlag( flag );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int getMaxReturnLength()
+    {
+        return getDecorated().getMaxReturnLength();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setMaxReturnLength( int maxReturnLength )
+    {
+        getDecorated().setMaxReturnLength( maxReturnLength );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getCookie()
+    {
+        return getDecorated().getCookie();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCookie( byte[] cookie )
+    {
+        // Copy the bytes
+        if ( !Strings.isEmpty( cookie ) )
+        {
+            byte[] copy = new byte[cookie.length];
+            System.arraycopy( cookie, 0, copy, 0, cookie.length );
+            getDecorated().setCookie( copy );
+        }
+        else
+        {
+            getDecorated().setCookie( null );
+        }
+    }
 
 
     /**
-     * Compute the AdDirSync length.
+     * Compute the AdDirSync length. We use the client side control.
      * 0x30 L1
      * |
      * +--> 0x02 0x0(1-4) nnn  (parentFirst)
@@ -105,7 +187,7 @@ public class AdDirSyncDecorator extends 
 
 
     /**
-     * Encode the AdDirSync control
+     * Encode the AdDirSync control. We use the client side control.
      *
      * @param buffer The encoded sink
      * @return A ByteBuffer that contains the encoded PDU
@@ -177,70 +259,6 @@ public class AdDirSyncDecorator extends 
     /**
      * {@inheritDoc}
      */
-    public int getParentFirst()
-    {
-        return getDecorated().getParentFirst();
-    }
-
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void setParentFirst( int parentFirst )
-    {
-        getDecorated().setParentFirst( parentFirst );
-    }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
-    public int getMaxReturnLength()
-    {
-        return getDecorated().getMaxReturnLength();
-    }
-
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void setMaxReturnLength( int maxReturnLength )
-    {
-        getDecorated().setMaxReturnLength( maxReturnLength );
-    }
-    
-
-    /**
-     * {@inheritDoc}
-     */
-    public byte[] getCookie()
-    {
-        return getDecorated().getCookie();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setCookie( byte[] cookie )
-    {
-        // Copy the bytes
-        if ( !Strings.isEmpty( cookie ) )
-        {
-            byte[] copy = new byte[cookie.length];
-            System.arraycopy( cookie, 0, copy, 0, cookie.length );
-            getDecorated().setCookie( copy );
-        }
-        else
-        {
-            getDecorated().setCookie( null );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public Asn1Object decode( byte[] controlBytes ) throws DecoderException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );

Copied: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncGrammar.java
(from r1587971, directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncGrammar.java?p2=directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncGrammar.java&p1=directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseGrammar.java&r1=1587971&r2=1588204&rev=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseGrammar.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncGrammar.java
Thu Apr 17 10:43:40 2014
@@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * 
- * Implementation of AdDirSyncResponse Control. All the actions are declared in
+ * Implementation of AdDirSync Response Control. All the actions are declared in
  * this class. As it is a singleton, these declaration are only done once.
  *
  *  The decoded grammar is as follows :
@@ -51,45 +51,45 @@ import org.slf4j.LoggerFactory;
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class AdDirSyncResponseGrammar extends AbstractGrammar<AdDirSyncResponseContainer>
+public final class AdDirSyncGrammar extends AbstractGrammar<AdDirSyncContainer>
 {
 
     /** the logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AdDirSyncResponseGrammar.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( AdDirSyncGrammar.class );
 
     /** speedup for logger */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** AdDirSyncControlGrammar singleton instance */
-    private static final AdDirSyncResponseGrammar INSTANCE = new AdDirSyncResponseGrammar();
+    private static final AdDirSyncGrammar INSTANCE = new AdDirSyncGrammar();
 
 
     /**
      * 
-     * Creates a new instance of AdDirSyncResponseControlGrammar.
+     * Creates a new instance of AdDirSyncControlGrammar.
      *
      */
     @SuppressWarnings("unchecked")
-    private AdDirSyncResponseGrammar()
+    private AdDirSyncGrammar()
     {
-        setName( AdDirSyncResponseGrammar.class.getName() );
+        setName( AdDirSyncGrammar.class.getName() );
 
-        super.transitions = new GrammarTransition[AdDirSyncResponseStatesEnum.LAST_AD_DIR_SYNC_RESPONSE_STATE.ordinal()][256];
+        super.transitions = new GrammarTransition[AdDirSyncStatesEnum.LAST_AD_DIR_SYNC_STATE.ordinal()][256];
 
         /** 
-         * Transition from initial state to AdDirSyncResponse sequence
-         * AdDirSyncResponse ::= SEQUENCE {
+         * Transition from initial state to AdDirSync sequence
+         * AdDirSync ::= SEQUENCE {
          *     ...
          *     
-         * Initialize the adDirSyncResponse object
+         * Initialize the adDirSync object
          */
-        super.transitions[AdDirSyncResponseStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()]
= 
-            new GrammarTransition<AdDirSyncResponseContainer>(
-            AdDirSyncResponseStatesEnum.START_STATE, AdDirSyncResponseStatesEnum.AD_DIR_SYNC_RESPONSE_SEQUENCE_STATE,
+        super.transitions[AdDirSyncStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()]
= 
+            new GrammarTransition<AdDirSyncContainer>(
+            AdDirSyncStatesEnum.START_STATE, AdDirSyncStatesEnum.AD_DIR_SYNC_SEQUENCE_STATE,
             UniversalTag.SEQUENCE.getValue(),
-            new GrammarAction<AdDirSyncResponseContainer>( "Initialization" )
+            new GrammarAction<AdDirSyncContainer>( "Initialization" )
             {
-                public void action( AdDirSyncResponseContainer container ) throws DecoderException
+                public void action( AdDirSyncContainer container ) throws DecoderException
                 {
                 }
             } );
@@ -102,13 +102,13 @@ public final class AdDirSyncResponseGram
          *    ....
          * }
          */
-        super.transitions[AdDirSyncResponseStatesEnum.AD_DIR_SYNC_RESPONSE_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER
+        super.transitions[AdDirSyncStatesEnum.AD_DIR_SYNC_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER
             .getValue()] =
-            new GrammarTransition<AdDirSyncResponseContainer>( AdDirSyncResponseStatesEnum.AD_DIR_SYNC_RESPONSE_SEQUENCE_STATE,
-                AdDirSyncResponseStatesEnum.FLAG_STATE, UniversalTag.INTEGER.getValue(),
-                new GrammarAction<AdDirSyncResponseContainer>( "Set AdDirSyncResponseControl
parentFirst" )
+            new GrammarTransition<AdDirSyncContainer>( AdDirSyncStatesEnum.AD_DIR_SYNC_SEQUENCE_STATE,
+                AdDirSyncStatesEnum.FLAG_STATE, UniversalTag.INTEGER.getValue(),
+                new GrammarAction<AdDirSyncContainer>( "Set AdDirSyncControl parentFirst"
)
                 {
-                    public void action( AdDirSyncResponseContainer container ) throws DecoderException
+                    public void action( AdDirSyncContainer container ) throws DecoderException
                     {
                         BerValue value = container.getCurrentTLV().getValue();
 
@@ -130,11 +130,11 @@ public final class AdDirSyncResponseGram
                                 LOG.debug( "flag = {}", flagValue );
                             }
                             
-                            container.getAdDirSyncResponseControl().setFlag( flag );
+                            container.getAdDirSyncControl().setFlag( flag );
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            String msg = "Error while decoding the AdDirSyncResponse flag
: " + ide.getMessage();
+                            String msg = "Error while decoding the AdDirSync flag : " + ide.getMessage();
                             LOG.error( msg, ide );
                             throw new DecoderException( msg );
                         }
@@ -150,13 +150,13 @@ public final class AdDirSyncResponseGram
          *    ....
          * }
          */
-        super.transitions[AdDirSyncResponseStatesEnum.FLAG_STATE.ordinal()][UniversalTag.INTEGER
+        super.transitions[AdDirSyncStatesEnum.FLAG_STATE.ordinal()][UniversalTag.INTEGER
             .getValue()] =
-            new GrammarTransition<AdDirSyncResponseContainer>( AdDirSyncResponseStatesEnum.FLAG_STATE,
-                AdDirSyncResponseStatesEnum.MAX_RETURN_LENGTH_STATE, UniversalTag.INTEGER.getValue(),
-                new GrammarAction<AdDirSyncResponseContainer>( "Set AdDirSyncResponseControl
maxReturnLength" )
+            new GrammarTransition<AdDirSyncContainer>( AdDirSyncStatesEnum.FLAG_STATE,
+                AdDirSyncStatesEnum.MAX_RETURN_LENGTH_STATE, UniversalTag.INTEGER.getValue(),
+                new GrammarAction<AdDirSyncContainer>( "Set AdDirSyncControl maxReturnLength"
)
                 {
-                    public void action( AdDirSyncResponseContainer container ) throws DecoderException
+                    public void action( AdDirSyncContainer container ) throws DecoderException
                     {
                         BerValue value = container.getCurrentTLV().getValue();
 
@@ -169,11 +169,11 @@ public final class AdDirSyncResponseGram
                                 LOG.debug( "maxReturnLength = {}", maxReturnLength );
                             }
                             
-                            container.getAdDirSyncResponseControl().setMaxReturnLength( maxReturnLength
);
+                            container.getAdDirSyncControl().setMaxReturnLength( maxReturnLength
);
                         }
                         catch ( IntegerDecoderException ide )
                         {
-                            String msg = "Error while decoding the AdDirSyncResponse maxReturnLength
: " + ide.getMessage();
+                            String msg = "Error while decoding the AdDirSync maxReturnLength
: " + ide.getMessage();
                             LOG.error( msg, ide );
                             throw new DecoderException( msg );
                         }
@@ -188,13 +188,13 @@ public final class AdDirSyncResponseGram
          *     cookie                  OCTET STRING
          * }
          */
-        super.transitions[AdDirSyncResponseStatesEnum.MAX_RETURN_LENGTH_STATE.ordinal()][UniversalTag.OCTET_STRING
+        super.transitions[AdDirSyncStatesEnum.MAX_RETURN_LENGTH_STATE.ordinal()][UniversalTag.OCTET_STRING
             .getValue()] =
-            new GrammarTransition<AdDirSyncResponseContainer>( AdDirSyncResponseStatesEnum.MAX_RETURN_LENGTH_STATE,
-                AdDirSyncResponseStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
-                new GrammarAction<AdDirSyncResponseContainer>( "Set AdDirSyncResponseControl
cookie" )
+            new GrammarTransition<AdDirSyncContainer>( AdDirSyncStatesEnum.MAX_RETURN_LENGTH_STATE,
+                AdDirSyncStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
+                new GrammarAction<AdDirSyncContainer>( "Set AdDirSyncControl cookie"
)
                 {
-                    public void action( AdDirSyncResponseContainer container ) throws DecoderException
+                    public void action( AdDirSyncContainer container ) throws DecoderException
                     {
                         BerValue value = container.getCurrentTLV().getValue();
 
@@ -205,7 +205,7 @@ public final class AdDirSyncResponseGram
                             LOG.debug( "cookie = {}", Strings.dumpBytes( cookie ) );
                         }
 
-                        container.getAdDirSyncResponseControl().setCookie( cookie );
+                        container.getAdDirSyncControl().setCookie( cookie );
 
                         container.setGrammarEndAllowed( true );
                     }
@@ -214,9 +214,9 @@ public final class AdDirSyncResponseGram
 
 
     /**
-     * @return the singleton instance of the AdDirSyncResponseControlGrammar
+     * @return the singleton instance of the AdDirSyncControlGrammar
      */
-    public static Grammar<AdDirSyncResponseContainer> getInstance()
+    public static Grammar<AdDirSyncContainer> getInstance()
     {
         return INSTANCE;
     }

Copied: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncStatesEnum.java
(from r1587971, directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncStatesEnum.java?p2=directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncStatesEnum.java&p1=directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseStatesEnum.java&r1=1587971&r2=1588204&rev=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncResponseStatesEnum.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncStatesEnum.java
Thu Apr 17 10:43:40 2014
@@ -25,11 +25,11 @@ import org.apache.directory.api.asn1.ber
 
 
 /**
- * ASN.1 grammar constants of AdDirSyncResponse Control.
+ * ASN.1 grammar constants of AdDirSync Control.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public enum AdDirSyncResponseStatesEnum implements States
+public enum AdDirSyncStatesEnum implements States
 {
 
     /** The END_STATE */
@@ -39,7 +39,7 @@ public enum AdDirSyncResponseStatesEnum 
     START_STATE,
 
     /** sequence start state */
-    AD_DIR_SYNC_RESPONSE_SEQUENCE_STATE,
+    AD_DIR_SYNC_SEQUENCE_STATE,
 
     /** flag state */
     FLAG_STATE,
@@ -51,7 +51,7 @@ public enum AdDirSyncResponseStatesEnum 
     COOKIE_STATE,
 
     /** terminal state */
-    LAST_AD_DIR_SYNC_RESPONSE_STATE;
+    LAST_AD_DIR_SYNC_STATE;
 
     /**
      * Get the grammar name
@@ -61,7 +61,7 @@ public enum AdDirSyncResponseStatesEnum 
      */
     public String getGrammarName( int grammar )
     {
-        return "AD_DIR_SYNC_RESPONSE_GRAMMAR";
+        return "AD_DIR_SYNC_GRAMMAR";
     }
 
 
@@ -71,11 +71,11 @@ public enum AdDirSyncResponseStatesEnum 
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar<AdDirSyncResponseContainer> grammar )
+    public String getGrammarName( Grammar<AdDirSyncContainer> grammar )
     {
-        if ( grammar instanceof AdDirSyncResponseGrammar )
+        if ( grammar instanceof AdDirSyncGrammar )
         {
-            return "AD_DIR_SYNC_RESPONSE_GRAMMAR";
+            return "AD_DIR_SYNC_GRAMMAR";
         }
 
         return "UNKNOWN GRAMMAR";
@@ -90,7 +90,7 @@ public enum AdDirSyncResponseStatesEnum 
      */
     public String getState( int state )
     {
-        return ( ( state == END_STATE.ordinal() ) ? "AD_DIR_SYNC_RESPONSE_GRAMMAR" : this.name()
);
+        return ( ( state == END_STATE.ordinal() ) ? "AD_DIR_SYNC_GRAMMAR" : this.name() );
     }
 
 
@@ -106,7 +106,7 @@ public enum AdDirSyncResponseStatesEnum 
     /**
      * {@inheritDoc}
      */
-    public AdDirSyncResponseStatesEnum getStartState()
+    public AdDirSyncStatesEnum getStartState()
     {
         return START_STATE;
     }

Modified: directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java?rev=1588204&r1=1588203&r2=1588204&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
Thu Apr 17 10:43:40 2014
@@ -54,7 +54,7 @@ public class AdDirSyncControlTest extend
         bb.put( new byte[]
             {
                 0x30, 0x0C,
-                  0x02, 0x01, 0x00,  // parentFirst (false)
+                  0x02, 0x01, 0x01,  // flag (LDAP_DIRSYNC_OBJECT_SECURITY)
                   0x02, 0x01, 0x00,  // maxReturnLength (no limit)
                   0x04, 0x04, 'x', 'k', 'c', 'd' // the cookie 
         } );
@@ -65,16 +65,18 @@ public class AdDirSyncControlTest extend
 
         AdDirSync adDirSync = ( AdDirSync ) ( ( AdDirSyncDecorator ) decorator ).decode(
bb.array() );
 
-        assertEquals( 0, adDirSync.getParentFirst() );
+        assertEquals( AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY, adDirSync.getFlag() );
         assertEquals( 0, adDirSync.getMaxReturnLength() );
         assertEquals( "xkcd", Strings.utf8ToString( adDirSync.getCookie() ) );
 
         // test encoding
+        adDirSync.setParentFirst( 1 );
+        
         try
         {
             ByteBuffer buffer = ( ( AdDirSyncDecorator ) adDirSync ).encode( ByteBuffer
                 .allocate( ( ( AdDirSyncDecorator ) adDirSync ).computeLength() ) );
-            String expected = Strings.dumpBytes( bb.array() );
+            String expected = "0x30 0x0C 0x02 0x01 0x01 0x02 0x01 0x00 0x04 0x04 0x78 0x6B
0x63 0x64 ";
             String decoded = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
@@ -93,7 +95,7 @@ public class AdDirSyncControlTest extend
         bb.put( new byte[]
             {
                 0x30, 0x08,
-                  0x02, 0x01, 0x00,  // parentFirst (false)
+                  0x02, 0x01, 0x01,  // flag (LDAP_DIRSYNC_OBJECT_SECURITY)
                   0x02, 0x01, 0x00,  // maxReturnLength (no limit)
                   0x04, 0x00         // the cookie 
         } );
@@ -104,16 +106,18 @@ public class AdDirSyncControlTest extend
 
         AdDirSync adDirSync = ( AdDirSync ) ( ( AdDirSyncDecorator ) decorator ).decode(
bb.array() );
 
-        assertEquals( 0, adDirSync.getParentFirst() );
+        assertEquals( AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY, adDirSync.getFlag() );
         assertEquals( 0, adDirSync.getMaxReturnLength() );
         assertEquals( "", Strings.utf8ToString( adDirSync.getCookie() ) );
 
         // test encoding
+        adDirSync.setParentFirst( 1 );
+
         try
         {
             ByteBuffer buffer = ( ( AdDirSyncDecorator ) adDirSync ).encode( ByteBuffer
                 .allocate( ( ( AdDirSyncDecorator ) adDirSync ).computeLength() ) );
-            String expected = Strings.dumpBytes( bb.array() );
+            String expected = "0x30 0x08 0x02 0x01 0x01 0x02 0x01 0x00 0x04 0x00 ";
             String decoded = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }



Mime
View raw message