directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r530865 - in /directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis: operation/ service/
Date Fri, 20 Apr 2007 17:45:27 GMT
Author: elecharny
Date: Fri Apr 20 10:45:26 2007
New Revision: 530865

URL: http://svn.apache.org/viewvc?view=rev&rev=530865
Log:
Used the new ModifyOperationContext

Modified:
    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/DeleteAttributeOperation.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/ReplicationService.java

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?view=diff&rev=530865&r1=530864&r2=530865
==============================================================================
--- 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
Fri Apr 20 10:45:26 2007
@@ -28,6 +28,7 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -63,6 +64,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyOperationContext( getName(), DirContext.ADD_ATTRIBUTE, attrs
) );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE
);
+        nexus.modify( new ModifyOperationContext( getName(), items ) );
     }
 }

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?view=diff&rev=530865&r1=530864&r2=530865
==============================================================================
--- 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
Fri Apr 20 10:45:26 2007
@@ -28,6 +28,7 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -63,6 +64,8 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyOperationContext( getName(), DirContext.REMOVE_ATTRIBUTE,
attrs ) );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE
);
+
+        nexus.modify( new ModifyOperationContext( getName(), items ) );
     }
 }

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?view=diff&rev=530865&r1=530864&r2=530865
==============================================================================
--- 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
Fri Apr 20 10:45:26 2007
@@ -158,44 +158,15 @@
      * sets {@link Constants#ENTRY_DELETED} to "false" to resurrect the
      * entry the modified attributes belong to.
      */
-    public Operation newModify( OperationContext modifyContext )
+    public Operation newModify( OperationContext opContext )
     {
-    	LdapDN name = modifyContext.getDn();
-    	int modOp = ((ModifyOperationContext)modifyContext).getModOp();
-    	Attributes mods = ((ModifyOperationContext)modifyContext).getMods();
+        ModificationItemImpl[] items = ((ModifyOperationContext)opContext).getModItems();
+        LdapDN normalizedName = opContext.getDn();
 
-    	CSN csn = newCSN();
-        CompositeOperation result = new CompositeOperation( csn );
-        NamingEnumeration e = mods.getAll();
-        
-        // Transform into multiple {@link AttributeOperation}s.
-        while ( e.hasMoreElements() )
-        {
-            Attribute attr = ( Attribute ) e.nextElement();
-            result.add( newModify( csn, name, modOp, attr ) );
-        }
-
-        // Resurrect the entry in case it is deleted.
-        result.add( new ReplaceAttributeOperation( csn, name, new AttributeImpl( Constants.ENTRY_DELETED,
-            "false" ) ) );
-
-        return addDefaultOperations( result, null, name );
-    }
-
-
-    /**
-     * Returns a new {@link Operation} that performs "modify" operation.
-     * 
-     * @return a {@link CompositeOperation} that consists of one or more
-     * {@link AttributeOperation}s and one additional operation that
-     * sets {@link Constants#ENTRY_DELETED} to "false" to resurrect the
-     * entry the modified attributes belong to.
-     */
-    public Operation newModify( LdapDN normalizedName, ModificationItemImpl[] items )
-    {
         CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
-        final int length = items.length;
+        int length = items.length;
+        
         // Transform into multiple {@link AttributeOperation}s.
         for ( int i = 0; i < length; i++ )
         {

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?view=diff&rev=530865&r1=530864&r2=530865
==============================================================================
--- 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
Fri Apr 20 10:45:26 2007
@@ -28,6 +28,7 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -63,6 +64,8 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyOperationContext( getName(), DirContext.REPLACE_ATTRIBUTE,
attrs ) );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE
);
+
+        nexus.modify( new ModifyOperationContext( getName(), items ) );
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=530865&r1=530864&r2=530865
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
Fri Apr 20 10:45:26 2007
@@ -70,7 +70,6 @@
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.filter.LoggingFilter;
@@ -388,13 +387,6 @@
     public void modify( NextInterceptor next, OperationContext modifyContext ) throws NamingException
     {
         Operation op = operationFactory.newModify( modifyContext );
-        op.execute( nexus, store, attrRegistry );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] items )
throws NamingException
-    {
-        Operation op = operationFactory.newModify( name, items );
         op.execute( nexus, store, attrRegistry );
     }
 



Mime
View raw message