directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1063594 - in /directory: apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/ apacheds/trunk/protocol-ldap/src/main/java/org/apache/dire...
Date Wed, 26 Jan 2011 03:39:14 GMT
Author: akarasulu
Date: Wed Jan 26 03:39:13 2011
New Revision: 1063594

URL: http://svn.apache.org/viewvc?rev=1063594&view=rev
Log:
using decorator pattern with EntryChange Control

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java
  (contents, props changed)
      - copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
  (contents, props changed)
      - copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlDecoder.java
Modified:
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.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/controls/ControlEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.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=1063594&r1=1063593&r2=1063594&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
Wed Jan 26 03:39:13 2011
@@ -98,9 +98,10 @@ 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.EntryChangeControl;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecorator;
 import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecoder;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControlContainer;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControlDecoder;
@@ -181,7 +182,7 @@ public abstract class ServerContext impl
     static
     {
         ADS_CONTROLS.put( Cascade.OID, ControlEnum.CASCADE_CONTROL );
-        ADS_CONTROLS.put( EntryChangeControl.CONTROL_OID, ControlEnum.ENTRY_CHANGE_CONTROL
);
+        ADS_CONTROLS.put( EntryChange.OID, ControlEnum.ENTRY_CHANGE_CONTROL );
         ADS_CONTROLS.put( ManageDsaIT.OID, ControlEnum.MANAGE_DSA_IT_CONTROL );
         ADS_CONTROLS.put( PagedResultsControl.CONTROL_OID, ControlEnum.PAGED_RESULTS_CONTROL
);
         ADS_CONTROLS.put( PasswordPolicyRequestControl.CONTROL_OID, ControlEnum.PASSWORD_POLICY_REQUEST_CONTROL
);
@@ -391,10 +392,10 @@ public abstract class ServerContext impl
                 break;
 
             case ENTRY_CHANGE_CONTROL:
-                control = new EntryChangeControl();
-                Asn1Decoder entryChangeControlDecoder = new EntryChangeControlDecoder();
+                control = new EntryChangeDecorator();
+                Asn1Decoder entryChangeControlDecoder = new EntryChangeDecoder();
                 EntryChangeControlContainer entryChangeControlContainer = new EntryChangeControlContainer();
-                entryChangeControlContainer.setEntryChangeControl( ( EntryChangeControl )
control );
+                entryChangeControlContainer.setEntryChangeControl( ( EntryChangeDecorator
) control );
                 ByteBuffer bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length
);
                 bb.put( jndiControl.getEncodedValue() ).flip();
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1063594&r1=1063593&r2=1063594&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Wed Jan 26 03:39:13 2011
@@ -59,6 +59,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.controls.Cascade;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.SingletonCursor;
 import org.apache.directory.shared.ldap.model.exception.*;
@@ -73,7 +74,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControl;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
@@ -175,7 +175,7 @@ public class DefaultPartitionNexus exten
 
         // Add the supported controls
         rootDSE.put( SchemaConstants.SUPPORTED_CONTROL_AT, PersistentSearchControl.CONTROL_OID,
-            EntryChangeControl.CONTROL_OID, SubentriesControl.CONTROL_OID, ManageDsaIT.OID,
+            EntryChange.OID, SubentriesControl.CONTROL_OID, ManageDsaIT.OID,
             Cascade.OID, PagedResultsControl.CONTROL_OID,
             // Replication controls
             SyncDoneValueControl.CONTROL_OID, SyncInfoValueControl.CONTROL_OID, SyncRequestValueControl.CONTROL_OID,

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1063594&r1=1063593&r2=1063594&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Wed Jan 26 03:39:13 2011
@@ -66,7 +66,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControl;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
@@ -236,7 +236,7 @@ public class LdapServer extends Director
 
         this.supportedControls = new HashSet<String>();
         this.supportedControls.add( PersistentSearchControl.CONTROL_OID );
-        this.supportedControls.add( EntryChangeControl.CONTROL_OID );
+        this.supportedControls.add( EntryChange.OID );
         this.supportedControls.add( SubentriesControl.CONTROL_OID );
         this.supportedControls.add( ManageDsaIT.OID );
         this.supportedControls.add( Cascade.OID );

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=1063594&r1=1063593&r2=1063594&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
Wed Jan 26 03:39:13 2011
@@ -31,7 +31,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.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.EntryChangeControl;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecorator;
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.*;
@@ -106,7 +106,7 @@ public class PersistentSearchListener im
     {
         if ( control.isReturnECs() )
         {
-            EntryChangeControl ecControl = new EntryChangeControl();
+            EntryChangeDecorator ecControl = new EntryChangeDecorator();
             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=1063594&r1=1063593&r2=1063594&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
Wed Jan 26 03:39:13 2011
@@ -51,8 +51,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControl;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
+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.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
@@ -584,7 +585,7 @@ public class PersistentSearchIT extends 
                 LOG.debug( "PSearchListener is ready and about to issue persistent search
request." );
                 list = ctx.search( "", "objectClass=*", null );
                 LOG.debug( "PSearchListener search request returned." );
-                EntryChangeControl ecControl = null;
+                EntryChangeDecorator ecControl = null;
 
                 while ( list.hasMore() )
                 {
@@ -601,10 +602,10 @@ public class PersistentSearchIT extends 
                             for ( javax.naming.ldap.Control control : controls )
                             {
                                 if ( control.getID().equals(
-                                    EntryChangeControl.CONTROL_OID ) )
+                                    EntryChange.OID ) )
                                 {
-                                    EntryChangeControlDecoder decoder = new EntryChangeControlDecoder();
-                                    ecControl = ( EntryChangeControl ) decoder.decode( control.getEncodedValue(),
new EntryChangeControl() );
+                                    EntryChangeDecoder decoder = new EntryChangeDecoder();
+                                    ecControl = ( EntryChangeDecorator ) decoder.decode(
control.getEncodedValue(), new EntryChangeDecorator() );
                                 }
                             }
                         }
@@ -631,10 +632,10 @@ public class PersistentSearchIT extends 
     class PSearchNotification extends SearchResult
     {
         private static final long serialVersionUID = 1L;
-        final EntryChangeControl control;
+        final EntryChangeDecorator control;
 
 
-        public PSearchNotification(SearchResult result, EntryChangeControl control)
+        public PSearchNotification(SearchResult result, EntryChangeDecorator control)
         {
             super( result.getName(), result.getClassName(), result.getObject(), result.getAttributes(),
result
                 .isRelative() );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java?rev=1063594&r1=1063593&r2=1063594&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
Wed Jan 26 03:39:13 2011
@@ -25,7 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControl;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControl;
+import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
@@ -39,7 +39,7 @@ import org.apache.directory.shared.ldap.
 public enum ControlEnum
 {
     CASCADE_CONTROL( Cascade.OID ),
-    ENTRY_CHANGE_CONTROL( EntryChangeControl.CONTROL_OID ),
+    ENTRY_CHANGE_CONTROL( EntryChange.OID ),
     MANAGE_DSA_IT_CONTROL( ManageDsaIT.OID ),
     PAGED_RESULTS_CONTROL( PagedResultsControl.CONTROL_OID ),
     PASSWORD_POLICY_REQUEST_CONTROL( PasswordPolicyRequestControl.CONTROL_OID ),

Added: 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/EntryChange.java?rev=1063594&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChange.java
Wed Jan 26 03:39:13 2011
@@ -0,0 +1,187 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.entryChange;
+
+
+import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
+import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
+import org.apache.directory.shared.ldap.model.name.Dn;
+
+
+/**
+ * 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>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EntryChange extends BasicControlImpl
+{
+    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;
+
+    private long changeNumber = UNDEFINED_CHANGE_NUMBER;
+
+    /** The previous Dn */
+    private Dn previousDn = null;
+
+
+    /**
+     *
+     * Creates a new instance of EntryChangeControl.
+     *
+     */
+    public EntryChange()
+    {
+        super( "" );
+    }
+
+
+    /**
+     * @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;
+    }
+
+
+    public Dn getPreviousDn()
+    {
+        return previousDn;
+    }
+
+
+    public void setPreviousDn( Dn previousDn )
+    {
+        this.previousDn = previousDn;
+    }
+
+
+    public long getChangeNumber()
+    {
+        return changeNumber;
+    }
+
+
+    public void setChangeNumber( long changeNumber )
+    {
+        this.changeNumber = changeNumber;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        EntryChange otherControl = ( EntryChange ) o;
+
+        return ( changeNumber == otherControl.changeNumber ) &&
+             ( changeType == otherControl.changeType ) &&
+             ( previousDn.equals( otherControl.previousDn ) );
+    }
+
+    
+    /**
+     * Return a String representing this EntryChangeControl.
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    Entry Change Control\n" );
+        sb.append( "        oid : " ).append( getOid() ).append( '\n' );
+        sb.append( "        critical : " ).append( isCritical() ).append( '\n' );
+        sb.append( "        changeType   : '" ).append( changeType ).append( "'\n" );
+        sb.append( "        previousDN   : '" ).append( previousDn ).append( "'\n" );
+
+        if ( changeNumber == UNDEFINED_CHANGE_NUMBER )
+        {
+            sb.append( "        changeNumber : '" ).append( "UNDEFINED" ).append( "'\n" );
+        }
+        else
+        {
+            sb.append( "        changeNumber : '" ).append( changeNumber ).append( "'\n"
);
+        }
+
+        return sb.toString();
+    }
+}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java?rev=1063594&r1=1063593&r2=1063594&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java
Wed Jan 26 03:39:13 2011
@@ -29,7 +29,7 @@ import org.apache.directory.shared.asn1.
 public class EntryChangeControlContainer extends AbstractContainer
 {
     /** EntryChangeControl */
-    private EntryChangeControl control;
+    private EntryChangeDecorator control;
 
 
     /**
@@ -48,7 +48,7 @@ public class EntryChangeControlContainer
     /**
      * @return Returns the EntryChangeControl.
      */
-    public EntryChangeControl getEntryChangeControl()
+    public EntryChangeDecorator getEntryChangeControl()
     {
         return control;
     }
@@ -60,7 +60,7 @@ public class EntryChangeControlContainer
      * 
      * @param control the EntryChangeControl to set.
      */
-    public void setEntryChangeControl( EntryChangeControl control )
+    public void setEntryChangeControl( EntryChangeDecorator control )
     {
         this.control = control;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java
(from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlDecoder.java&r1=1063551&r2=1063594&rev=1063594&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java
Wed Jan 26 03:39:13 2011
@@ -34,7 +34,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryChangeControlDecoder extends Asn1Decoder implements ControlDecoder
+public class EntryChangeDecoder extends Asn1Decoder implements ControlDecoder
 {
     /** An instance of this decoder */
     private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -54,7 +54,7 @@ public class EntryChangeControlDecoder e
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( (EntryChangeControl)control );
+        container.setEntryChangeControl( (EntryChangeDecorator )control );
         decoder.decode( bb, container );
         return container.getEntryChangeControl();
     }

Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
(from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.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?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java&r1=1063551&r2=1063594&rev=1063594&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
Wed Jan 26 03:39:13 2011
@@ -80,10 +80,8 @@ import org.apache.directory.shared.util.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryChangeControl extends AbstractControl
+public class EntryChangeDecorator extends AbstractControl
 {
-    /** The EntryChange control */
-    public static final String CONTROL_OID = "2.16.840.1.113730.3.4.7";
 
     public static final int UNDEFINED_CHANGE_NUMBER = -1;
 
@@ -106,11 +104,11 @@ public class EntryChangeControl extends 
      * Creates a new instance of EntryChangeControl.
      *
      */
-    public EntryChangeControl()
+    public EntryChangeDecorator()
     {
-        super( CONTROL_OID );
+        super( EntryChange.OID );
 
-        decoder = new EntryChangeControlDecoder();
+        decoder = new EntryChangeDecoder();
     }
 
 
@@ -286,7 +284,7 @@ public class EntryChangeControl extends 
             return false;
         }
 
-        EntryChangeControl otherControl = ( EntryChangeControl ) o;
+        EntryChangeDecorator otherControl = ( EntryChangeDecorator ) o;
 
         return ( changeNumber == otherControl.changeNumber ) &&
              ( changeType == otherControl.changeType ) &&

Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1063594&r1=1063593&r2=1063594&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
Wed Jan 26 03:39:13 2011
@@ -31,9 +31,9 @@ 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.EntryChangeControl;
+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.EntryChangeControlContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlDecoder;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
@@ -55,7 +55,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlSuccess()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0D );
         bb.put( new byte[]
             { 
@@ -69,7 +69,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -81,7 +81,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChangeControl entryChange = container.getEntryChangeControl();
+        EntryChangeDecorator entryChange = container.getEntryChangeControl();
         assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
         assertEquals( "a=b", entryChange.getPreviousDn().toString() );
         assertEquals( 16, entryChange.getChangeNumber() );
@@ -94,7 +94,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlSuccessLongChangeNumber()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x13 );
         bb.put( new byte[]
             { 
@@ -109,7 +109,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -121,7 +121,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChangeControl entryChange = container.getEntryChangeControl();
+        EntryChangeDecorator entryChange = container.getEntryChangeControl();
         assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
         assertEquals( "a=b", entryChange.getPreviousDn().toString() );
         assertEquals( 5124095576030430L, entryChange.getChangeNumber() );
@@ -134,7 +134,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlWithADDAndChangeNumber()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x08 );
         bb.put( new byte[]
             { 
@@ -148,7 +148,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -160,7 +160,7 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChangeControl entryChange = container.getEntryChangeControl();
+        EntryChangeDecorator entryChange = container.getEntryChangeControl();
         assertEquals( ChangeType.ADD, entryChange.getChangeType() );
         assertNull( entryChange.getPreviousDn() );
         assertEquals( 16, entryChange.getChangeNumber() );
@@ -174,7 +174,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlWithADDAndPreviousDNBad()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x0D );
         bb.put( new byte[]
             { 
@@ -190,7 +190,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -213,7 +213,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlWithADD()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x05 );
         bb.put( new byte[]
             { 
@@ -226,7 +226,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -238,10 +238,10 @@ public class EntryChangeControlTest
             fail( de.getMessage() );
         }
 
-        EntryChangeControl entryChange = container.getEntryChangeControl();
+        EntryChangeDecorator entryChange = container.getEntryChangeControl();
         assertEquals( ChangeType.ADD, entryChange.getChangeType() );
         assertNull( entryChange.getPreviousDn() );
-        assertEquals( EntryChangeControl.UNDEFINED_CHANGE_NUMBER, entryChange.getChangeNumber()
);
+        assertEquals( EntryChangeDecorator.UNDEFINED_CHANGE_NUMBER, entryChange.getChangeNumber()
);
     }
 
 
@@ -252,7 +252,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlWithWrongChangeType()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x05 );
         bb.put( new byte[]
             { 
@@ -265,7 +265,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -288,7 +288,7 @@ public class EntryChangeControlTest
     @Test
     public void testDecodeEntryChangeControlWithWrongChangeNumber()
     {
-        Asn1Decoder decoder = new EntryChangeControlDecoder();
+        Asn1Decoder decoder = new EntryChangeDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 0x1C );
         bb.put( new byte[]
             { 
@@ -304,7 +304,7 @@ public class EntryChangeControlTest
         bb.flip();
 
         EntryChangeControlContainer container = new EntryChangeControlContainer();
-        container.setEntryChangeControl( new EntryChangeControl() );
+        container.setEntryChangeControl( new EntryChangeDecorator() );
         
         try
         {
@@ -347,7 +347,7 @@ public class EntryChangeControlTest
         String expected = Strings.dumpBytes(bb.array());
         bb.flip();
 
-        EntryChangeControl entry = new EntryChangeControl();
+        EntryChangeDecorator entry = new EntryChangeDecorator();
         entry.setChangeType( ChangeType.MODDN );
         entry.setChangeNumber( 16 );
         entry.setPreviousDn( new Dn( "a=b" ) );
@@ -384,7 +384,7 @@ public class EntryChangeControlTest
         String expected = Strings.dumpBytes(bb.array());
         bb.flip();
 
-        EntryChangeControl entry = new EntryChangeControl();
+        EntryChangeDecorator entry = new EntryChangeDecorator();
         entry.setChangeType( ChangeType.MODDN );
         entry.setChangeNumber( 5124095576030430L );
         entry.setPreviousDn( new Dn( "a=b" ) );



Mime
View raw message