directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r690985 [1/2] - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/schema/ mitosis/src/main/java/org/apache/directory/mitosis/operation/ mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/code...
Date Mon, 01 Sep 2008 14:53:51 GMT
Author: elecharny
Date: Mon Sep  1 07:53:50 2008
New Revision: 690985

URL: http://svn.apache.org/viewvc?rev=690985&view=rev
Log:
o Removed JNDI elements from Mitosis

Added:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationType.java
Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Mon Sep  1 07:53:50 2008
@@ -40,7 +40,6 @@
 import org.slf4j.LoggerFactory;
 
 import javax.naming.NamingException;
-//import javax.naming.directory.DirContext;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Mon Sep  1 07:53:50 2008
@@ -215,7 +215,7 @@
         this.schemaObjectHandlers[DIT_CONTENT_RULE_INDEX] = new MetaDitContentRuleHandler( registries, loader ); 
         this.schemaObjectHandlers[NAME_FORM_INDEX] = new MetaNameFormHandler( registries, loader ); 
 
-        this.subentryModifier = new SchemaSubentryModifier( dao );
+        this.subentryModifier = new SchemaSubentryModifier( registries, dao );
         this.parsers = new DescriptionParsers( registries, dao );
         
         OidRegistry oidRegistry = registries.getOidRegistry();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Mon Sep  1 07:53:50 2008
@@ -26,20 +26,20 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.utils.AttributesFactory;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.DITContentRule;
@@ -87,10 +87,21 @@
     
     private AttributesFactory factory = new AttributesFactory();
     private final SchemaPartitionDao dao;
+    
+    /** The server registries */
+    private Registries registries; 
 
     
-    public SchemaSubentryModifier( SchemaPartitionDao dao )
+    /**
+     * 
+     * Creates a new instance of SchemaSubentryModifier.
+     *
+     * @param registries The server registries
+     * @param dao
+     */
+    public SchemaSubentryModifier( Registries registries, SchemaPartitionDao dao )
     {
+        this.registries = registries;
         this.dao = dao;
     }
     
@@ -143,11 +154,9 @@
         String schemaName = getSchema( comparatorDescription );   
         LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn=" 
             + schemaName + ",ou=schema" );
-        Attributes attrs = getAttributes( comparatorDescription );
-        ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
-            opContext.getSession().getDirectoryService().getRegistries() );
+        Entry entry = getEntry( dn, comparatorDescription );
 
-        opContext.add( entry, BYPASS );
+        opContext.add( (ServerEntry)entry, BYPASS );
     }
     
     
@@ -156,11 +165,9 @@
         String schemaName = getSchema( normalizerDescription );
         LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn=" 
             + schemaName + ",ou=schema" );
-        Attributes attrs = getAttributes( normalizerDescription );
-        ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
-            opContext.getSession().getDirectoryService().getRegistries() );
+        Entry entry = getEntry( dn, normalizerDescription );
 
-        opContext.add( entry, BYPASS );
+        opContext.add( (ServerEntry)entry, BYPASS );
     }
     
     
@@ -169,10 +176,8 @@
         String schemaName = getSchema( syntaxCheckerDescription );
         LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn=" 
             + schemaName + ",ou=schema" );
-        Attributes attrs = getAttributes( syntaxCheckerDescription );
-        ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
-            opContext.getSession().getDirectoryService().getRegistries() );
-        opContext.add( entry, BYPASS );
+        Entry entry = getEntry( dn, syntaxCheckerDescription );
+        opContext.add( (ServerEntry)entry, BYPASS );
     }
     
     
@@ -222,49 +227,57 @@
     }
 
 
-    private Attributes getAttributes( ComparatorDescription comparatorDescription )
+    private Entry getEntry( LdapDN dn, ComparatorDescription comparatorDescription )
     {
-        AttributesImpl attributes = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, true );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaTop" );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaComparator" );
-        attributes.put( MetaSchemaConstants.M_OID_AT, comparatorDescription.getNumericOid() );
-        attributes.put( MetaSchemaConstants.M_FQCN_AT, comparatorDescription.getFqcn() );
+        Entry entry = new DefaultServerEntry( registries, dn );
+        
+        entry.put( SchemaConstants.OBJECT_CLASS_AT, 
+                    SchemaConstants.TOP_OC, 
+                    MetaSchemaConstants.META_TOP_OC,
+                    MetaSchemaConstants.META_COMPARATOR_OC );
+        
+        entry.put( MetaSchemaConstants.M_OID_AT, comparatorDescription.getNumericOid() );
+        entry.put( MetaSchemaConstants.M_FQCN_AT, comparatorDescription.getFqcn() );
 
         if ( comparatorDescription.getBytecode() != null )
         {
-            attributes.put( MetaSchemaConstants.M_BYTECODE_AT, 
+            entry.put( MetaSchemaConstants.M_BYTECODE_AT, 
                 Base64.decode( comparatorDescription.getBytecode().toCharArray() ) );
         }
         
         if ( comparatorDescription.getDescription() != null )
         {
-            attributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, comparatorDescription.getDescription() );
+            entry.put( MetaSchemaConstants.M_DESCRIPTION_AT, comparatorDescription.getDescription() );
         }
         
-        return attributes;
+        return entry;
     }
 
 
-    private Attributes getAttributes( NormalizerDescription normalizerDescription )
+    private Entry getEntry( LdapDN dn, NormalizerDescription normalizerDescription )
     {
-        AttributesImpl attributes = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, true );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaTop" );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaNormalizer" );
-        attributes.put( MetaSchemaConstants.M_OID_AT, normalizerDescription.getNumericOid() );
-        attributes.put( MetaSchemaConstants.M_FQCN_AT, normalizerDescription.getFqcn() );
+        Entry entry = new DefaultServerEntry( registries, dn );
+
+        entry.put( SchemaConstants.OBJECT_CLASS_AT, 
+            SchemaConstants.TOP_OC, 
+            MetaSchemaConstants.META_TOP_OC,
+            MetaSchemaConstants.META_NORMALIZER_OC );
+        
+        entry.put( MetaSchemaConstants.M_OID_AT, normalizerDescription.getNumericOid() );
+        entry.put( MetaSchemaConstants.M_FQCN_AT, normalizerDescription.getFqcn() );
 
         if ( normalizerDescription.getBytecode() != null )
         {
-            attributes.put( MetaSchemaConstants.M_BYTECODE_AT, 
+            entry.put( MetaSchemaConstants.M_BYTECODE_AT, 
                 Base64.decode( normalizerDescription.getBytecode().toCharArray() ) );
         }
         
         if ( normalizerDescription.getDescription() != null )
         {
-            attributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, normalizerDescription.getDescription() );
+            entry.put( MetaSchemaConstants.M_DESCRIPTION_AT, normalizerDescription.getDescription() );
         }
         
-        return attributes;
+        return entry;
     }
 
 
@@ -279,25 +292,29 @@
     }
     
     
-    private Attributes getAttributes( SyntaxCheckerDescription syntaxCheckerDescription )
+    private Entry getEntry( LdapDN dn, SyntaxCheckerDescription syntaxCheckerDescription )
     {
-        AttributesImpl attributes = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, true );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaTop" );
-        attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "metaSyntaxChecker" );
-        attributes.put( MetaSchemaConstants.M_OID_AT, syntaxCheckerDescription.getNumericOid() );
-        attributes.put( MetaSchemaConstants.M_FQCN_AT, syntaxCheckerDescription.getFqcn() );
+        Entry entry = new DefaultServerEntry( registries, dn );
+        
+        entry.put( SchemaConstants.OBJECT_CLASS_AT, 
+            SchemaConstants.TOP_OC, 
+            MetaSchemaConstants.META_TOP_OC,
+            MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
+
+        entry.put( MetaSchemaConstants.M_OID_AT, syntaxCheckerDescription.getNumericOid() );
+        entry.put( MetaSchemaConstants.M_FQCN_AT, syntaxCheckerDescription.getFqcn() );
 
         if ( syntaxCheckerDescription.getBytecode() != null )
         {
-            attributes.put( MetaSchemaConstants.M_BYTECODE_AT, 
+            entry.put( MetaSchemaConstants.M_BYTECODE_AT, 
                 Base64.decode( syntaxCheckerDescription.getBytecode().toCharArray() ) );
         }
         
         if ( syntaxCheckerDescription.getDescription() != null )
         {
-            attributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, syntaxCheckerDescription.getDescription() );
+            entry.put( MetaSchemaConstants.M_DESCRIPTION_AT, syntaxCheckerDescription.getDescription() );
         }
         
-        return attributes;
+        return entry;
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java Mon Sep  1 07:53:50 2008
@@ -23,10 +23,11 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -41,33 +42,62 @@
  */
 public class AddAttributeOperation extends AttributeOperation
 {
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
     private static final long serialVersionUID = 7373124294791982297L;
 
 
     /**
-     * Creates a new operation that adds the specified attribute.
+     * Creates a new operation that adds the specified attribute. This 
+     * constructor will not be visible out of this package, as it is 
+     * only used for the deserialization process.
      * 
      * @param attribute an attribute to add
      */
-    public AddAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
+    /** No qualifier*/ AddAttributeOperation( Registries registries )
     {
-        super( csn, name, attribute );
+        super( registries, OperationType.ADD_ATTRIBUTE );
     }
 
-
-    public String toString()
+    
+    /**
+     * Creates a new operation that adds the specified attribute.
+     * 
+     * @param attribute an attribute to add
+     */
+    public AddAttributeOperation( Registries registries, CSN csn, LdapDN name, EntryAttribute attribute )
     {
-        return super.toString() + ".add( " + getAttributeString() + " )";
+        super( registries, OperationType.ADD_ATTRIBUTE, csn, name, attribute );
     }
 
 
+    /**
+     * Inject the modified attribute into the server.
+     * 
+     * @param nexus the partition which will be modified
+     * @param coreSession the current session
+     */
     protected void execute1( PartitionNexus nexus, CoreSession coreSession ) throws Exception
     {
         DirectoryService ds = coreSession.getDirectoryService();
         ServerEntry serverEntry = ds.newEntry( LdapDN.EMPTY_LDAPDN );
-        ServerAttribute attribute = getAttribute( ds.getRegistries().getAttributeTypeRegistry() );
+        EntryAttribute attribute = getAttribute();
         serverEntry.put( attribute );
         List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.ADD_ATTRIBUTE );
-        nexus.modify( new ModifyOperationContext( coreSession, getName(), items ) );
+        nexus.modify( new ModifyOperationContext( coreSession, getDn(), items ) );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return super.toString() + ".add( " + getAttribute() + " )";
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java Mon Sep  1 07:53:50 2008
@@ -20,15 +20,12 @@
 package org.apache.directory.mitosis.operation;
 
 
-import javax.naming.directory.Attributes;
-
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -36,6 +33,7 @@
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -46,54 +44,83 @@
  */
 public class AddEntryOperation extends Operation
 {
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
     private static final long serialVersionUID = 2294492811671880570L;
 
     /** The entry to add */
-    private final Attributes entry;
-    
-    /** The entry's dn */
-    private final LdapDN dn;
+    private Entry entry;
 
 
     /**
+     * Creates a new operation that adds the specified entry. This 
+     * constructor will not be visible out of this package, as it is 
+     * only used for the deserialization process.
+     * 
+     * @param registries the registries instance
+     */
+    public AddEntryOperation( Registries registries )
+    {
+        super( registries, OperationType.ADD_ENTRY );
+    }
+    
+    
+    /**
      * Creates a new instance.
      * 
      * @param entry an entry
      */
-    public AddEntryOperation( CSN csn, ServerEntry entry )
+    public AddEntryOperation( Registries registries, CSN csn, ServerEntry entry )
     {
-        super( csn );
+        super( registries, OperationType.ADD_ENTRY, csn );
 
         assert entry != null;
 
-        this.entry = ServerEntryUtils.toAttributesImpl( entry );
-        this.dn = entry.getDn();
+        this.entry = entry;
     }
 
 
+    /**
+     * Inject the entry into the local server
+     * 
+     * @param nexus the local partition to update
+     * @param store not used... Just for inheritence sake.
+     * @param coreSession the current session
+     */
     protected void execute0( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession )
         throws Exception
     {
-        Registries registries = coreSession.getDirectoryService().getRegistries();
-        
-        if ( ! EntryUtil.isEntryUpdatable( coreSession, dn, getCSN() ) )
+        if ( ! EntryUtil.isEntryUpdatable( coreSession, entry.getDn(), getCSN() ) )
         {
             return;
         }
         
-        EntryUtil.createGlueEntries( coreSession, dn, false );
+        EntryUtil.createGlueEntries( coreSession, entry.getDn(), false );
 
         // Replace the entry if an entry with the same name exists.
-        if ( nexus.lookup( new LookupOperationContext( coreSession, dn ) ) != null )
+        if ( nexus.lookup( new LookupOperationContext( coreSession, entry.getDn() ) ) != null )
         {
-            recursiveDelete( nexus, dn, coreSession );
+            recursiveDelete( nexus, entry.getDn(), coreSession );
         }
 
-        nexus.add( new AddOperationContext( coreSession, 
-            ServerEntryUtils.toServerEntry( entry, dn, registries ) ) );
+        nexus.add( new AddOperationContext( coreSession, (ServerEntry)entry ) );
     }
 
 
+    /**
+     * 
+     * TODO recursiveDelete.
+     *
+     * @param nexus
+     * @param normalizedName
+     * @param coreSession
+     * @throws Exception
+     */
     @SuppressWarnings("unchecked")
     private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, CoreSession coreSession )
         throws Exception
@@ -118,9 +145,32 @@
         nexus.delete( new DeleteOperationContext( coreSession, normalizedName ) );
     }
 
+    
+    /**
+     * Set the Entry to add into this AddEntry instance.
+     *
+     * @param entry the entry to add
+     */
+    public void setEntry( Entry entry )
+    {
+        this.entry = entry;
+    }
+
 
+    /**
+     * @return the operation's entry
+     */
+    public Entry getEntry()
+    {
+        return entry;
+    }
+
+    
+    /**
+     * @see Object#toString()
+     */
     public String toString()
     {
-        return super.toString() + ": [" + dn + "].new( " + entry + " )";
+        return super.toString() + ": [" + entry.getDn() + "].new( " + entry + " )";
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java Mon Sep  1 07:53:50 2008
@@ -20,15 +20,10 @@
 package org.apache.directory.mitosis.operation;
 
 
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.InvalidAttributeIdentifierException;
-
 import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
@@ -42,89 +37,102 @@
  */
 public abstract class AttributeOperation extends Operation
 {
-    private final LdapDN name;
-    private final Attribute attribute;
-    private transient ServerAttribute serverAttribute;
+    /** The attribute's DN */
+    protected LdapDN dn;
+    
+    /** The attribute */
+    protected EntryAttribute attribute;
 
 
     /**
+     * Create a new instance of AttributeOperation. This constructor should not
+     * be visible out of this package, as it's only used for deserialization.
+     * 
+     * @param registries The server registries
+     * @param operationType The operation type 
+     */
+    /* No qualifier*/ AttributeOperation( Registries registries, OperationType operationType )
+    {
+        super( registries, operationType );
+    }
+    
+    
+    /**
      * Create a new operation that affects an entry with the specified name.
      * 
-     * @param csn
-     * @param name the normalized name of an entry 
-     * @param serverAttribute an attribute to modify
+     * @param registries the server registries
+     * @param operationType The operation's type
+     * @param csn the operation's CSN
+     * @param dn the normalized name of an entry 
+     * @param attribute an attribute to modify
      */
-    public AttributeOperation( CSN csn, LdapDN name, ServerAttribute serverAttribute )
+    public AttributeOperation( Registries registries, OperationType operationType, CSN csn, 
+        LdapDN dn, EntryAttribute attribute )
     {
-        super( csn );
+        super( registries, operationType, csn );
 
-        assert name != null;
-        assert serverAttribute != null;
+        assert dn != null;
+        assert attribute != null;
 
-        this.name = name;
-        this.serverAttribute = (ServerAttribute)serverAttribute.clone();
-        this.attribute = ServerEntryUtils.toAttributeImpl( this.serverAttribute );
+        this.dn = dn;
+        this.attribute = attribute.clone();
     }
 
 
     /**
-     * Returns the attribute to modify.
+     * @return the name of an entry this operation will affect.
      */
-    public ServerAttribute getAttribute( AttributeTypeRegistry atRegistry ) throws InvalidAttributeIdentifierException, NamingException
+    public LdapDN getDn()
     {
-        if ( serverAttribute != null )
-        {
-            return ( ServerAttribute ) serverAttribute.clone();
-        }
-        else
-        {
-            Attribute attr = (Attribute)attribute.clone();
-            
-            serverAttribute = ServerEntryUtils.toServerAttribute( attr, atRegistry.lookup( attr.getID() ) );
-            return (ServerAttribute)serverAttribute.clone();
-        }
+        return ( LdapDN ) dn.clone();
     }
 
 
     /**
-     * Returns the name of an entry this operation will affect.
+     * Check that we can apply the modification, and create the associated entry, if
+     * it does not exists locally.
+     * 
+     * @param nexus The partition to update
+     * @param store the replication storage
+     * @param coreSession the current session
      */
-    public LdapDN getName()
-    {
-        return ( LdapDN ) name.clone();
-    }
-
-
     protected final void execute0( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession ) 
         throws Exception
     {
-        if ( ! EntryUtil.isEntryUpdatable( coreSession, name, getCSN() ) )
+        if ( ! EntryUtil.isEntryUpdatable( coreSession, dn, getCSN() ) )
         {
             return;
         }
         
-        EntryUtil.createGlueEntries( coreSession, name, true );
+        EntryUtil.createGlueEntries( coreSession, dn, true );
 
         execute1( nexus, coreSession );
     }
 
 
+    /**
+     * Apply the requested modification locally
+     *
+     * @param nexus The partition on which the operation is applied
+     * @param coreSession the current session
+     * @throws Exception 
+     */
     protected abstract void execute1( PartitionNexus nexus, CoreSession coreSession ) throws Exception;
 
 
     /**
-     * Returns the attribute to modify.
+     * @return Returns the attribute to modify
      */
-    public String getAttributeString()
+    public EntryAttribute getAttribute()
     {
-        return attribute.toString();
+        return attribute;
     }
 
     /**
-     * Returns string representation of this operation.
+     * @see Object#toString()
      */
     public String toString()
     {
-        return super.toString() + ": [" + name.toString() + ']';
+        return super.toString() + ": [" + dn + ']';
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java Mon Sep  1 07:53:50 2008
@@ -28,8 +28,10 @@
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 
 import javax.naming.Name;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -43,8 +45,19 @@
  */
 public class CompositeOperation extends Operation
 {
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
     private static final long serialVersionUID = 6252675003841951356L;
 
+    
+    /**
+     * A dummy replication store, used 
+     */
     private static final ReplicationStore DUMMY_STORE = new ReplicationStore()
     {
 
@@ -138,26 +151,60 @@
     private final List<Operation> children = new ArrayList<Operation>();
 
 
-    public CompositeOperation( CSN csn )
+    /**
+     * Creates a new instance of CompositeOperation. This should not be called
+     * outside of this package.
+     *
+     * @param registries The server registries
+     */
+    /* No qualifier */ CompositeOperation( Registries registries )
+    {
+        super( registries, OperationType.COMPOSITE_OPERATION );
+    }
+
+
+    /**
+     * Creates a new instance of CompositeOperation.
+     *
+     * @param registries The server registries
+     * @param csn the operation CSN
+     */
+    public CompositeOperation( Registries registries, CSN csn )
     {
-        super( csn );
+        super( registries, OperationType.COMPOSITE_OPERATION, csn );
     }
 
 
+    /**
+     * Add a new operation to this composite operation
+     *
+     * @param op The added operation
+     */
     public void add( Operation op )
     {
         assert op != null;
-        assert op.getCSN().equals( this.getCSN() );
+        assert op.getCSN().equals( csn );
+        
         children.add( op );
     }
 
 
+    /**
+     * Remove all the inner operations.
+     */
     public void clear()
     {
         children.clear();
     }
 
 
+    /**
+     * Apply the replication on each internal operation.
+     * 
+     * @param nexus the partition on which the modification will be done
+     * @param store the replication store
+     * @param coreSession the current session
+     */
     protected void execute0( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession ) 
         throws Exception
     {
@@ -166,8 +213,29 @@
             op.execute( nexus, DUMMY_STORE, coreSession );
         }
     }
+    
+    
+    /**
+     * @return the number of included operations
+     */
+    public int size()
+    {
+        return children.size();
+    }
+    
+    
+    /**
+     * @return The list of all included operations
+     */
+    public List<Operation> getChildren()
+    {
+        return children;
+    }
 
 
+    /**
+     * @see Object#toString()
+     */
     public String toString()
     {
         return children.toString();

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java Mon Sep  1 07:53:50 2008
@@ -27,6 +27,8 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -41,35 +43,64 @@
  */
 public class DeleteAttributeOperation extends AttributeOperation
 {
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
     private static final long serialVersionUID = -131557844165710365L;
 
 
     /**
-     * Creates a new operation that deletes the specified attribute.
+     * Creates a new operation that deletes the specified attribute. This 
+     * constructor will not be visible out of this package, as it is 
+     * only used for the deserialization process.
      * 
      * @param attribute an attribute to delete
      */
-    public DeleteAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
+    /** No qualifier*/ DeleteAttributeOperation( Registries registries )
     {
-        super( csn, name, attribute );
+        super( registries, OperationType.DELETE_ATTRIBUTE );
     }
 
-
-    public String toString()
+    
+    /**
+     * Creates a new operation that deletes the specified attribute.
+     * 
+     * @param attribute an attribute to delete
+     */
+    public DeleteAttributeOperation( Registries registries, CSN csn, LdapDN name, ServerAttribute attribute )
     {
-        return super.toString() + ".delete( " + getAttributeString() + " )";
+        super( registries, OperationType.DELETE_ATTRIBUTE, csn, name, attribute );
     }
 
 
+    /**
+     * Inject the modified attribute into the server.
+     * 
+     * @param nexus the partition which will be modified
+     * @param coreSession the current session
+     */
     protected void execute1( PartitionNexus nexus, CoreSession coreSession ) throws Exception
     {
         DirectoryService ds = coreSession.getDirectoryService();
         ServerEntry serverEntry = ds.newEntry( LdapDN.EMPTY_LDAPDN );
-        ServerAttribute attribute = getAttribute( ds.getRegistries().getAttributeTypeRegistry() );
+        EntryAttribute attribute = getAttribute();
         serverEntry.put( attribute );
         List<Modification> items = ModifyOperationContext.createModItems( serverEntry, 
             ModificationOperation.REMOVE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( coreSession, getName(), items ) );
+        nexus.modify( new ModifyOperationContext( coreSession, getDn(), items ) );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return super.toString() + ".delete( " + getAttribute() + " )";
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java Mon Sep  1 07:53:50 2008
@@ -20,17 +20,26 @@
 package org.apache.directory.mitosis.operation;
 
 
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 
+import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
 
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.Constants;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.LdapDNSerializer;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 
 /**
@@ -50,7 +59,7 @@
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Operation implements Serializable
+public class Operation implements Externalizable
 {
     /**
      * Declares the Serial Version Uid.
@@ -62,19 +71,45 @@
     private static final long serialVersionUID = 1L;
 
     /** The entry CSN */
-    private CSN csn;
+    protected CSN csn;
+    
+    /** The operation type */
+    protected OperationType operationType;
+    
+    /** A reference on the server registries */
+    protected Registries registries;
 
 
     /**
      * Creates a new instance of Operation, for the entry which
+     * csn is given as a parameter. This constructor is not visible
+     * out of this package, as it's only used for the deserialization 
+     * process.
+     *
+     * @param registries the server registries
+     * @param operationType the operation type
+     */
+    /* no qualifier */ Operation( Registries registries, OperationType operationType )
+    {
+        this.registries = registries;
+        this.operationType = operationType;
+    }
+
+    
+    /**
+     * Creates a new instance of Operation, for the entry which
      * csn is given as a parameter.
      *
+     * @param registries the server registries
+     * @param operationType the operation type
      * @param csn The entry's csn.
      */
-    public Operation( CSN csn )
+    protected Operation( Registries registries, OperationType operationType, CSN csn )
     {
         assert csn != null;
+        this.registries = registries;
         this.csn = csn;
+        this.operationType = operationType;
     }
 
 
@@ -88,16 +123,11 @@
 
 
     /**
-     * @return the CSN for this operation
-     */
-    public String toString()
-    {
-        return csn.toString();
-    }
-
-
-    /**
-     * Executes this operation on the specified nexus.
+     * Replicates this operation on the specified nexus.
+     * 
+     * @param nexus the partition nexus
+     * @param store the replication store
+     * @param coreSession the current session
      */
     public final void execute( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession ) 
         throws Exception
@@ -109,10 +139,245 @@
         }
     }
 
-    @SuppressWarnings("unused")
+    /**
+     * Not supported. We should neve call this method directly.
+     * 
+     * @param nexus the partition nexus
+     * @param store the replication store
+     * @param coreSession the current session
+     * @throws Exception
+     */
     protected void execute0( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession ) 
         throws Exception
     {
         throw new OperationNotSupportedException( nexus.getSuffixDn().toString() );
     }
+
+    
+    /**
+     * Deserialize an Attribute Operation
+     *
+     * @param in the stream from which we will read an AttributeOperation
+     * @param registries the server registries
+     * @param operation the operation we will feed
+     * @return an AttributeOperation
+     * @throws ClassNotFoundException 
+     * @throws IOException
+     */
+    private static Operation readAttributeOperation( ObjectInput in, Registries registries, 
+        Operation operation ) throws ClassNotFoundException, IOException
+    {
+        AttributeOperation attributeOperation = (AttributeOperation)operation;
+        // Read the DN
+        LdapDN dn = LdapDNSerializer.deserialize( in );
+        
+        // Read the Attribute ID
+        String id = in.readUTF();
+        
+        try
+        {
+            // Get the AttributeType
+            AttributeType at = registries.getAttributeTypeRegistry().lookup( id );
+            
+            // Deserialize the attribute
+            DefaultServerAttribute attribute = new DefaultServerAttribute( id, at );
+            attribute.deserialize( in );
+            
+            // Store the read data into the operation 
+            attributeOperation.dn = dn;
+            attributeOperation.attribute = attribute; 
+                
+            return operation;
+        }
+        catch ( NamingException ne )
+        {
+            throw new IOException( "Cannot find the '" + id + "' attributeType" ); 
+        }
+    }
+    
+    
+    /**
+     * Deserialize an operation. This is a recursive method, as we may have 
+     * composite operations.
+     *
+     * @param registries The server registries
+     * @param in the stream wrom which we will read an operation
+     * @return an operation
+     * @throws ClassNotFoundException
+     * @throws IOException
+     */
+    public static Operation deserialize( Registries registries, ObjectInput in ) throws ClassNotFoundException, IOException
+    {
+        // Read the operation type
+        int opTypeValue = in.readInt();
+        OperationType opType = OperationType.get( opTypeValue );
+        
+        // Read the CSN
+        CSN csn = (CSN)in.readObject();
+        
+        Operation operation = null;
+
+        switch ( opType )
+        {
+            case ADD_ATTRIBUTE :
+                // Create a new AddAttribute operation
+                operation = new AddAttributeOperation( registries );
+                
+                // Set the CSN
+                operation.csn = csn;
+                
+                // Read it
+                readAttributeOperation( in, registries, operation );
+                
+                return operation;
+                
+            case DELETE_ATTRIBUTE :
+                // Create a new DeleteAttribute operation
+                operation = new DeleteAttributeOperation( registries );
+                
+                // Set the CSN
+                operation.csn = csn;
+                
+                // Read it
+                readAttributeOperation( in, registries, operation );
+                
+                return operation;
+        
+            case REPLACE_ATTRIBUTE :
+                // Create a new ReplaceAttribute operation
+                operation = new ReplaceAttributeOperation( registries );
+                
+                // Set the CSN
+                operation.csn = csn;
+                
+                // Read it
+                readAttributeOperation( in, registries, operation );
+                
+                return operation;
+        
+            case ADD_ENTRY :
+                // Create a new AddEntry operation
+                operation = new AddEntryOperation( registries );
+                
+                // Set the CSN
+                operation.csn = csn;
+                
+                DefaultServerEntry entry = new DefaultServerEntry( registries );
+                entry.deserialize( in );
+                ((AddEntryOperation)operation).setEntry( entry );
+                
+                return operation;
+        
+            case COMPOSITE_OPERATION :
+                // Create a new Composite operation
+                operation = new CompositeOperation( registries );
+                
+                // Set the CSN
+                operation.csn = csn;
+
+                // Read the number of operations to deserialize
+                int nbOperations = in.readInt();
+                
+                for ( int i = 0; i < nbOperations; i++ )
+                {
+                    Operation child = deserialize( registries, in );
+                    child.csn = csn;
+                    ((CompositeOperation)operation).add( child );
+                }
+            
+                return operation;
+            
+            default :
+                throw new IOException( "Cannot read the unkown operation" );
+        }
+    }
+    
+
+    /**
+     * Serialize an operation. This is a recursive method, as an operation
+     * can be composite.
+     *
+     * @param operation the operation to serialize
+     * @param out the stream into which the resulting serialized operation will be stored
+     * @throws ClassNotFoundException
+     * @throws IOException
+     */
+    public static void serialize( Operation operation, ObjectOutput out ) throws ClassNotFoundException, IOException
+    {
+        OperationType opType = operation.operationType;
+        
+        // Write the operation type
+        out.writeInt( opType.ordinal() );
+        
+        // Write the CSN
+        out.writeObject( operation.csn );
+        
+        switch ( opType )
+        {
+            case REPLACE_ATTRIBUTE :
+            case DELETE_ATTRIBUTE :
+            case ADD_ATTRIBUTE :
+                AttributeOperation attrOp = (AttributeOperation)operation;
+                
+                // Write the DN
+                LdapDNSerializer.serialize( attrOp.dn, out );
+                
+                // Write the attribute ID
+                out.writeUTF( ((AttributeOperation)operation).attribute.getId() );
+                
+                // Write the attribute
+                DefaultServerAttribute attr = (DefaultServerAttribute)(attrOp.attribute);
+                attr.serialize( out );
+                return;
+                
+            case ADD_ENTRY :
+                ((DefaultServerEntry)((AddEntryOperation)operation).getEntry()).serialize( out );
+                return;
+                
+            case COMPOSITE_OPERATION :
+                out.writeInt( ((CompositeOperation)operation).size() );
+                
+                // Loop on all the operations
+                for ( Operation child:((CompositeOperation)operation).getChildren() )
+                {
+                    serialize( child, out );
+                }
+                
+                return;
+        }
+    }
+    
+    
+    /**
+     * Read the CSN from an input stream
+     * 
+     * @param in the input stream
+     * @throws ClassNotFoundException if the read object is not a CSN
+     * @throws IOException if we can't read from the input stream
+     */
+    public void readExternal( ObjectInput in ) throws ClassNotFoundException, IOException
+    {
+        csn = (CSN)in.readObject();
+    }
+    
+    
+    /**
+     * Write the CSN to an output stream
+     * 
+     * @param out the output stream in which the CSN is written
+     * @throws IOException if we can't write to the stream
+     */
+    public void writeExternal( ObjectOutput out) throws IOException
+    {
+        out.writeObject( csn );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return csn.toString();
+    }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java Mon Sep  1 07:53:50 2008
@@ -27,6 +27,8 @@
 import java.io.ObjectOutputStream;
 import java.io.ObjectStreamConstants;
 
+import org.apache.directory.server.schema.registries.Registries;
+
 
 /**
  * Encodes {@link Operation}s to <tt>byte[]</tt> and vice versa so an
@@ -51,7 +53,7 @@
         {
             ObjectOutputStream out = new ObjectOutputStream( bout );
             out.useProtocolVersion( ObjectStreamConstants.PROTOCOL_VERSION_2 );
-            out.writeObject( op );
+            Operation.serialize( op, out );
             out.flush();
             out.close();
         }
@@ -59,6 +61,11 @@
         {
             throw ( InternalError ) new InternalError().initCause( e );
         }
+        catch ( ClassNotFoundException cnfe )
+        {
+            throw ( InternalError ) new InternalError().initCause( cnfe );
+        }
+        
         return bout.toByteArray();
     }
 
@@ -66,14 +73,14 @@
     /**
      * Transforms the specified byte array into an {@link Operation}.
      */
-    public Operation decode( byte[] data )
+    public Operation decode( Registries registries, byte[] data )
     {
         ObjectInputStream in;
         
         try
         {
             in = new ObjectInputStream( new ByteArrayInputStream( data ) );
-            return ( Operation ) in.readObject();
+            return Operation.deserialize( registries, in );
         }
         catch ( IOException e )
         {

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Mon Sep  1 07:53:50 2008
@@ -143,7 +143,7 @@
         // MODIFY operation)
         cloneEntry.put( Constants.ENTRY_CSN, csn.toOctetString() );
 
-        return new AddEntryOperation( csn, cloneEntry );
+        return new AddEntryOperation( registries, csn, cloneEntry );
     }
 
 
@@ -155,10 +155,10 @@
     public Operation newDelete( LdapDN normalizedName ) throws NamingException
     {
         CSN csn = newCSN();
-        CompositeOperation result = new CompositeOperation( csn );
+        CompositeOperation result = new CompositeOperation( registries, csn );
 
         // Transform into replace operation.
-        result.add( new ReplaceAttributeOperation( csn, normalizedName, 
+        result.add( new ReplaceAttributeOperation( registries, csn, normalizedName, 
             new DefaultServerAttribute( 
                 Constants.ENTRY_DELETED, 
                 attributeRegistry.lookup( Constants.ENTRY_DELETED ),
@@ -182,7 +182,7 @@
         LdapDN normalizedName = opContext.getDn();
 
         CSN csn = newCSN();
-        CompositeOperation result = new CompositeOperation( csn );
+        CompositeOperation result = new CompositeOperation( registries, csn );
         
         // Transform into multiple {@link AttributeOperation}s.
         for ( Modification item:items )
@@ -198,6 +198,7 @@
         // Resurrect the entry in case it is deleted.
         result.add( 
             new ReplaceAttributeOperation( 
+                registries, 
                 csn, 
                 normalizedName, 
                 new DefaultServerAttribute( 
@@ -220,13 +221,13 @@
         switch ( modOp )
         {
             case ADD_ATTRIBUTE:
-                return new AddAttributeOperation( csn, normalizedName, attribute );
+                return new AddAttributeOperation( registries, csn, normalizedName, attribute );
             
             case REPLACE_ATTRIBUTE:
-                return new ReplaceAttributeOperation( csn, normalizedName, attribute );
+                return new ReplaceAttributeOperation( registries, csn, normalizedName, attribute );
             
             case REMOVE_ATTRIBUTE:
-                return new DeleteAttributeOperation( csn, normalizedName, attribute );
+                return new DeleteAttributeOperation( registries, csn, normalizedName, attribute );
             
             default:
                 throw new IllegalArgumentException( "Unknown modOp: " + modOp );
@@ -272,7 +273,7 @@
     {
         // Prepare to create composite operations
         CSN csn = newCSN();
-        CompositeOperation result = new CompositeOperation( csn );
+        CompositeOperation result = new CompositeOperation( registries, csn );
 
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
@@ -298,6 +299,7 @@
             // Delete the old entry
             result.add( 
                 new ReplaceAttributeOperation( 
+                    registries, 
                     csn, 
                     oldEntryName, 
                     new DefaultServerAttribute( 
@@ -410,6 +412,7 @@
     {
         result.add( 
             new ReplaceAttributeOperation( 
+                registries, 
                 csn, 
                 normalizedName, 
                 new DefaultServerAttribute( 

Added: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationType.java?rev=690985&view=auto
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationType.java (added)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationType.java Mon Sep  1 07:53:50 2008
@@ -0,0 +1,106 @@
+/*
+ *  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.mitosis.operation;
+
+
+/**
+ * 
+ * An enum used to determinate the operation type when deserializing
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum OperationType
+{
+    /** The Add Entry operation */
+    ADD_ENTRY(0), 
+
+    /** The Add Attribute operation */
+    ADD_ATTRIBUTE(1), 
+
+    /** The Delete Attribute operation */
+    DELETE_ATTRIBUTE(2),
+    
+    /** The Replace Attribute operation */
+    REPLACE_ATTRIBUTE(3),
+    
+    /** The composite operation */
+    COMPOSITE_OPERATION(4);
+    
+    /** The associated integer values */
+    private static final int ADD_ENTRY_VALUE = 0;
+    private static final int ADD_ATTRIBUTE_VALUE = 1;
+    private static final int DELETE_ATTRIBUTE_VALUE = 2;
+    private static final int REPLACE_ATTRIBUTE_VALUE = 3;
+    private static final int COMPOSITE_OPERATION_VALUE = 4;
+
+    
+    /** The inner value */
+    private int value;
+    
+    
+    /**
+     * Creates a new instance of OperationType.
+     *
+     * @param value the inner value
+     */
+    private OperationType( int value )
+    {
+        this.value = value;
+    }
+
+    
+    /**
+     * @return the associated integer value
+     */
+    public int getValue()
+    {
+        return value;
+    }
+    
+    
+    /**
+     * Get the associated OperationType from an integer value
+     *
+     * @param value The integer value of an operation type
+     * @return the associated operation type
+     */
+    public static OperationType get( int value )
+    {
+        switch ( value )
+        {
+            case ADD_ENTRY_VALUE :
+                return ADD_ENTRY;
+                
+            case ADD_ATTRIBUTE_VALUE :
+                return ADD_ATTRIBUTE;
+                
+            case DELETE_ATTRIBUTE_VALUE :
+                return DELETE_ATTRIBUTE;
+                
+            case REPLACE_ATTRIBUTE_VALUE :
+                return REPLACE_ATTRIBUTE;
+                
+            case COMPOSITE_OPERATION_VALUE :
+                default :
+                return COMPOSITE_OPERATION;
+        }
+    }
+}

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java Mon Sep  1 07:53:50 2008
@@ -27,6 +27,8 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -41,37 +43,66 @@
  */
 public class ReplaceAttributeOperation extends AttributeOperation
 {
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
     private static final long serialVersionUID = -6573196586521610472L;
 
 
     /**
-     * Creates a new operation that replaces the specified attribute.
+     * Creates a new operation that replaces the specified attribute. This 
+     * constructor will not be visible out of this package, as it is 
+     * only used for the deserialization process.
      * 
      * @param attribute an attribute to replace
-     * @param csn ??
-     * @param name ??
      */
-    public ReplaceAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
+    /** No qualifier*/ ReplaceAttributeOperation( Registries registries )
     {
-        super( csn, name, attribute );
+        super( registries, OperationType.REPLACE_ATTRIBUTE );
     }
 
-
-    public String toString()
+    
+    /**
+     * Creates a new operation that replaces the specified attribute.
+     * 
+     * @param attribute an attribute to replace
+     * @param csn The operation CSN
+     * @param dn The associated DN
+     */
+    public ReplaceAttributeOperation( Registries registries, CSN csn, LdapDN dn, ServerAttribute attribute )
     {
-        return super.toString() + ".replace( " + getAttributeString() + " )";
+        super( registries, OperationType.REPLACE_ATTRIBUTE, csn, dn, attribute );
     }
 
 
+    /**
+     * Inject the modified attribute into the server.
+     * 
+     * @param nexus the partition which will be modified
+     * @param coreSession the current session
+     */
     protected void execute1( PartitionNexus nexus, CoreSession coreSession ) throws Exception
     {
         DirectoryService ds = coreSession.getDirectoryService();
         ServerEntry serverEntry = ds.newEntry( LdapDN.EMPTY_LDAPDN );
-        ServerAttribute attribute = getAttribute( ds.getRegistries().getAttributeTypeRegistry() );
+        EntryAttribute attribute = getAttribute();
         serverEntry.put( attribute );
         List<Modification> items = ModifyOperationContext.createModItems( serverEntry, 
             ModificationOperation.REPLACE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( coreSession, getName(), items ) );
+        nexus.modify( new ModifyOperationContext( coreSession, getDn(), items ) );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return super.toString() + ".replace( " + getAttribute() + " )";
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderException;
@@ -87,7 +88,9 @@
             try
             {
                 in.limit( in.position() + bodyLength );
-                out.write( decodeBody( sequence, bodyLength, in ) );
+                
+                Registries registries = (Registries)session.getAttribute( "registries" );
+                out.write( decodeBody( registries, sequence, bodyLength, in ) );
                 return OK;
             }
             finally
@@ -101,5 +104,5 @@
     }
 
 
-    protected abstract BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception;
+    protected abstract BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception;
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesAckMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderException;
@@ -47,7 +48,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
     {
         if ( responseCode != Constants.OK )
         {

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -37,7 +38,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
     {
         return new BeginLogEntriesMessage( sequence );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesAckMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -36,7 +37,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
     {
         return new EndLogEntriesAckMessage( sequence, responseCode );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -37,7 +38,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
     {
         return new EndLogEntriesMessage( sequence );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.LogEntryAckMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -36,7 +37,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
     {
         return new LogEntryAckMessage( sequence, responseCode );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -24,6 +24,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.LogEntryMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
@@ -40,12 +41,12 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
     {
         byte[] src = new byte[in.remaining()];
         in.get( src );
 
-        return new LogEntryMessage( sequence, operationCodec.decode( src ) );
+        return new LogEntryMessage( sequence, operationCodec.decode( registries, src ) );
     }
 
 

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.LoginAckMessage;
+import org.apache.directory.server.schema.registries.Registries;
 
 
 public class LoginAckMessageDecoder extends ResponseMessageDecoder
@@ -42,7 +43,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, int responseCode, ByteBuffer in ) throws Exception
     {
         return new LoginAckMessage( sequence, responseCode, in.getString( utf8decoder ) );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.mitosis.service.protocol.Constants;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
+import org.apache.directory.server.schema.registries.Registries;
 
 
 public class LoginMessageDecoder extends BaseMessageDecoder
@@ -43,7 +44,7 @@
     }
 
 
-    protected BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception
+    protected BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
     {
         return new LoginMessage( sequence, in.getString( utf8decoder ) );
     }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java Mon Sep  1 07:53:50 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.mina.common.ByteBuffer;
 
 
@@ -33,13 +34,13 @@
     }
 
 
-    protected final BaseMessage decodeBody( int sequence, int bodyLength, ByteBuffer in ) throws Exception
+    protected final BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, ByteBuffer in ) throws Exception
     {
-        return decodeBody( sequence, bodyLength, in.getInt(), in );
+        return decodeBody( registries, sequence, bodyLength, in.getInt(), in );
     }
 
 
-    protected abstract BaseMessage decodeBody( int sequence, int bodyLength, int responseCode, ByteBuffer in )
+    protected abstract BaseMessage decodeBody( Registries registries, int sequence, int bodyLength, int responseCode, ByteBuffer in )
         throws Exception;
 
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java Mon Sep  1 07:53:50 2008
@@ -48,6 +48,7 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -154,7 +155,7 @@
             }
             else if ( message instanceof BeginLogEntriesAckMessage )
             {
-                onBeginLogEntriesAck( ctx, ( BeginLogEntriesAckMessage ) message );
+                onBeginLogEntriesAck( ctx.getDirectoryService().getRegistries(), ctx, ( BeginLogEntriesAckMessage ) message );
             }
             else if ( message instanceof EndLogEntriesAckMessage )
             {
@@ -297,7 +298,7 @@
     }
 
 
-    private void onBeginLogEntriesAck( ReplicationContext ctx, BeginLogEntriesAckMessage message )
+    private void onBeginLogEntriesAck( Registries registries, ReplicationContext ctx, BeginLogEntriesAckMessage message )
         throws Exception
     {
         // Start transaction only when the server says OK.
@@ -334,7 +335,7 @@
             {
                 SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
                     + "] Starting a partial replication log transfer." );
-                sendReplicationLogs( ctx, myPV, yourUV );
+                sendReplicationLogs( registries, ctx, myPV, yourUV );
             }
         }
         finally
@@ -433,7 +434,7 @@
                 LdapDN dn = entry.getDn();
                 dn.normalize( ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry()
                     .getNormalizerMapping() );
-                Operation op = new AddEntryOperation( csn, entry );
+                Operation op = new AddEntryOperation( ctx.getDirectoryService().getRegistries(), csn, entry );
 
                 // Send a LogEntry message for the entry.
                 writeTimeLimitedMessage( ctx, new LogEntryMessage( ctx.getNextSequence(), op ) );
@@ -447,7 +448,7 @@
 
 
     @SuppressWarnings("unchecked")
-    private void sendReplicationLogs( ReplicationContext ctx, CSNVector myPV, CSNVector yourUV )
+    private void sendReplicationLogs( Registries registries, ReplicationContext ctx, CSNVector myPV, CSNVector yourUV )
     {
         for ( String replicaId : myPV.getReplicaIds() )
         {
@@ -468,7 +469,7 @@
         {
             while ( logIt.next() )
             {
-                Operation op = logIt.getOperation();
+                Operation op = logIt.getOperation( registries );
                 writeTimeLimitedMessage( ctx, new LogEntryMessage( ctx.getNextSequence(), op ) );
             }
         }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java Mon Sep  1 07:53:50 2008
@@ -23,6 +23,7 @@
 import java.sql.ResultSet;
 
 import org.apache.directory.mitosis.operation.Operation;
+import org.apache.directory.server.schema.registries.Registries;
 
 /**
  * Iterates a set of {@link Operation}s, which is a result of a query on 
@@ -48,5 +49,5 @@
     /**
      * Returns the {@link Operation} on the current iterator position.
      */
-    Operation getOperation();
+    Operation getOperation( Registries registries );
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java?rev=690985&r1=690984&r2=690985&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java Mon Sep  1 07:53:50 2008
@@ -31,6 +31,7 @@
 import org.apache.directory.mitosis.operation.OperationCodec;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStoreException;
+import org.apache.directory.server.schema.registries.Registries;
 
 
 class DerbyReplicationLogIterator implements ReplicationLogIterator
@@ -85,11 +86,11 @@
     }
 
 
-    public Operation getOperation()
+    public Operation getOperation( Registries registries )
     {
         try
         {
-            return codec.decode( rs.getBytes( 4 ) );
+            return codec.decode( registries, rs.getBytes( 4 ) );
         }
         catch ( Exception e )
         {



Mime
View raw message