directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1063958 - in /directory: apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ apacheds/trunk/server-integ/src/test/java/org/apac...
Date Thu, 27 Jan 2011 02:11:07 GMT
Author: akarasulu
Date: Thu Jan 27 02:11:06 2011
New Revision: 1063958

URL: http://svn.apache.org/viewvc?rev=1063958&view=rev
Log:
extracting interface for EntryChange control

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/SimpleEntryChange.java
      - copied, changed from r1063947, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
Modified:
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Thu Jan 27 02:11:06 2011
@@ -98,10 +98,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControlContainer;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControlDecoder;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecorator;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.*;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResults;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsContainer;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsDecoder;

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
Thu Jan 27 02:11:06 2011
@@ -32,6 +32,7 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.ldap.LdapSession;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
 import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.SimpleEntryChange;
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearch;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.AbandonListener;
@@ -109,7 +110,7 @@ public class PersistentSearchListener im
     {
         if ( psearchControl.isReturnECs() )
         {
-            EntryChange ecControl = new EntryChange();
+            EntryChange ecControl = new SimpleEntryChange();
             ecControl.setChangeType( type );
 
             if ( opContext.getChangeLogEvent() != null )

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
Thu Jan 27 02:11:06 2011
@@ -611,7 +611,7 @@ public class PersistentSearchIT extends 
                         }
                     }
                     
-                    result = new PSearchNotification( sresult, ( EntryChange ) ecControl.getDecorated()
);
+                    result = new PSearchNotification( sresult, (EntryChange) ecControl.getDecorated()
);
                     break;
                 }
                 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
Thu Jan 27 02:11:06 2011
@@ -95,13 +95,13 @@ public class EntryChangeDecorator extend
      */
     public EntryChangeDecorator()
     {
-        super( new EntryChange(), new EntryChangeDecoder() );
+        super( new SimpleEntryChange(), new EntryChangeDecoder() );
     }
 
 
     private EntryChange getEntryChange()
     {
-        return ( EntryChange ) getDecorated();
+        return (EntryChange) getDecorated();
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
Thu Jan 27 02:11:06 2011
@@ -113,7 +113,7 @@ public final class EntryChangeGrammar ex
                                 LOG.debug( "changeType = " + changeType );
                             }
 
-                            ( ( EntryChange ) entryChangeContainer.getEntryChangeDecorator().getDecorated()
)
+                            ( (EntryChange) entryChangeContainer.getEntryChangeDecorator().getDecorated()
)
                                     .setChangeType( changeType );
                             break;
 
@@ -159,7 +159,7 @@ public final class EntryChangeGrammar ex
             {
                 EntryChangeContainer entryChangeContainer = ( EntryChangeContainer ) container;
 
-                EntryChange entryChange = ( EntryChange ) entryChangeContainer
+                EntryChange entryChange = (EntryChange) entryChangeContainer
                         .getEntryChangeDecorator().getDecorated();
                 ChangeType changeType = entryChange.getChangeType();
 
@@ -214,7 +214,7 @@ public final class EntryChangeGrammar ex
                         LOG.debug( "changeNumber = " + changeNumber );
                     }
 
-                    EntryChange entryChange = ( EntryChange ) entryChangeContainer
+                    EntryChange entryChange = (EntryChange) entryChangeContainer
                             .getEntryChangeDecorator().getDecorated();
                     entryChange.setChangeNumber( changeNumber );
 

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/SimpleEntryChange.java
(from r1063947, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/SimpleEntryChange.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/SimpleEntryChange.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java&r1=1063947&r2=1063958&rev=1063958&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/SimpleEntryChange.java
Thu Jan 27 02:11:06 2011
@@ -26,58 +26,12 @@ import org.apache.directory.shared.ldap.
 
 
 /**
- * A response control that may be returned by Persistent Search entry responses.
- * It contains addition change information to describe the exact change that
- * occurred to an entry. The exact details of this control are covered in section
- * 5 of this (yes) expired draft: <a
- * href="http://www3.ietf.org/proceedings/01aug/I-D/draft-ietf-ldapext-psearch-03.txt">
- * Persistent Search Draft v03</a> which is printed out below for convenience:
- * 
- * <pre>
- *    5.  Entry Change Notification Control
- *    
- *    This control provides additional information about the change the caused
- *    a particular entry to be returned as the result of a persistent search.
- *    The controlType is &quot;2.16.840.1.113730.3.4.7&quot;.  If the client set
the
- *    returnECs boolean to TRUE in the PersistentSearch control, servers MUST
- *    include an EntryChangeNotification control in the Controls portion of
- *    each SearchResultEntry that is returned due to an entry being added,
- *    deleted, or modified.
- *    
- *               EntryChangeNotification ::= SEQUENCE 
- *               {
- *                         changeType ENUMERATED 
- *                         {
- *                                 add             (1),
- *                                 delete          (2),
- *                                 modify          (4),
- *                                 modDN           (8)
- *                         },
- *                         previousDN   LDAPDN OPTIONAL,     -- modifyDN ops. only
- *                         changeNumber INTEGER OPTIONAL     -- if supported
- *               }
- *    
- *    changeType indicates what LDAP operation caused the entry to be
- *    returned.
- *    
- *    previousDN is present only for modifyDN operations and gives the Dn of
- *    the entry before it was renamed and/or moved.  Servers MUST include this
- *    optional field only when returning change notifications as a result of
- *    modifyDN operations.
- * 
- *    changeNumber is the change number [CHANGELOG] assigned by a server for
- *    the change.  If a server supports an LDAP Change Log it SHOULD include
- *    this field.
- * </pre>
- * 
+ * A simple implementation of the EntryChange response control.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryChange extends BasicControlImpl
+public class SimpleEntryChange extends BasicControlImpl implements EntryChange
 {
-    public static final int UNDEFINED_CHANGE_NUMBER = -1;
-
-    /** The EntryChange control */
-    public static final String OID = "2.16.840.1.113730.3.4.7";
 
     private ChangeType changeType = ChangeType.ADD;
 
@@ -92,26 +46,18 @@ public class EntryChange extends BasicCo
      * Creates a new instance of EntryChangeControl.
      *
      */
-    public EntryChange()
+    public SimpleEntryChange()
     {
         super( OID );
     }
 
 
-    /**
-     * @return The ChangeType
-     */
     public ChangeType getChangeType()
     {
         return changeType;
     }
 
 
-    /**
-     * Set the ChangeType
-     *
-     * @param changeType Add, Delete; Modify or ModifyDN
-     */
     public void setChangeType( ChangeType changeType )
     {
         this.changeType = changeType;
@@ -124,7 +70,7 @@ public class EntryChange extends BasicCo
     }
 
 
-    public void setPreviousDn( Dn previousDn )
+    public void setPreviousDn(Dn previousDn)
     {
         this.previousDn = previousDn;
     }
@@ -145,6 +91,8 @@ public class EntryChange extends BasicCo
     /**
      * {@inheritDoc}
      */
+    @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
+    @Override
     public boolean equals( Object o )
     {
         if ( !super.equals( o ) )
@@ -154,9 +102,9 @@ public class EntryChange extends BasicCo
 
         EntryChange otherControl = ( EntryChange ) o;
 
-        return ( changeNumber == otherControl.changeNumber ) &&
-             ( changeType == otherControl.changeType ) &&
-             ( previousDn.equals( otherControl.previousDn ) );
+        return ( changeNumber == otherControl.getChangeNumber() ) &&
+             ( changeType == otherControl.getChangeType() ) &&
+             ( previousDn.equals( otherControl.getPreviousDn() ) );
     }
 
     

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java?rev=1063958&r1=1063957&r2=1063958&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
Thu Jan 27 02:11:06 2011
@@ -31,10 +31,7 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecoder;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecorator;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.*;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
@@ -82,7 +79,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChange entryChange = ( EntryChange ) container.getEntryChangeDecorator().getDecorated();
+        EntryChange entryChange = (EntryChange) container.getEntryChangeDecorator().getDecorated();
         assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
         assertEquals( "a=b", entryChange.getPreviousDn().toString() );
         assertEquals( 16, entryChange.getChangeNumber() );
@@ -122,7 +119,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChange entryChange = ( EntryChange ) container.getEntryChangeDecorator().getDecorated();
+        EntryChange entryChange = (EntryChange) container.getEntryChangeDecorator().getDecorated();
         assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
         assertEquals( "a=b", entryChange.getPreviousDn().toString() );
         assertEquals( 5124095576030430L, entryChange.getChangeNumber() );
@@ -161,7 +158,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChange entryChange = ( EntryChange ) container.getEntryChangeDecorator().getDecorated();
+        EntryChange entryChange = (EntryChange) container.getEntryChangeDecorator().getDecorated();
         assertEquals( ChangeType.ADD, entryChange.getChangeType() );
         assertNull( entryChange.getPreviousDn() );
         assertEquals( 16, entryChange.getChangeNumber() );
@@ -239,7 +236,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChange entryChange = ( EntryChange ) container.getEntryChangeDecorator().getDecorated();
+        EntryChange entryChange = (EntryChange) container.getEntryChangeDecorator().getDecorated();
         assertEquals( ChangeType.ADD, entryChange.getChangeType() );
         assertNull( entryChange.getPreviousDn() );
         assertEquals( EntryChangeDecorator.UNDEFINED_CHANGE_NUMBER, entryChange.getChangeNumber()
);
@@ -349,10 +346,10 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeDecorator decorator = new EntryChangeDecorator();
-        EntryChange entry = ( EntryChange ) decorator.getDecorated();
-        entry.setChangeType( ChangeType.MODDN );
-        entry.setChangeNumber( 16 );
-        entry.setPreviousDn( new Dn( "a=b" ) );
+        EntryChange entryChange = (EntryChange) decorator.getDecorated();
+        entryChange.setChangeType( ChangeType.MODDN );
+        entryChange.setChangeNumber( 16 );
+        entryChange.setPreviousDn( new Dn( "a=b" ) );
         bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
         String decoded = Strings.dumpBytes( bb.array() );
         assertEquals( expected, decoded );
@@ -387,11 +384,11 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeDecorator decorator = new EntryChangeDecorator();
-        EntryChange entry = ( EntryChange ) decorator.getDecorated();
+        EntryChange entryChange = (EntryChange) decorator.getDecorated();
 
-        entry.setChangeType( ChangeType.MODDN );
-        entry.setChangeNumber( 5124095576030430L );
-        entry.setPreviousDn( new Dn( "a=b" ) );
+        entryChange.setChangeType( ChangeType.MODDN );
+        entryChange.setChangeNumber( 5124095576030430L );
+        entryChange.setPreviousDn( new Dn( "a=b" ) );
         bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
         String decoded = Strings.dumpBytes(bb.array());
         assertEquals( expected, decoded );



Mime
View raw message