directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r527127 - in /directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis: operation/ operation/support/ service/
Date Tue, 10 Apr 2007 13:06:53 GMT
Author: elecharny
Date: Tue Apr 10 06:06:52 2007
New Revision: 527127

URL: http://svn.apache.org/viewvc?view=rev&rev=527127
Log:
Modified mitosis accordingly to the Interceptor interface changes :
we now have a ServiceContext parameter for many operations

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/AddEntryOperation.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/operation/support/EntryUtil.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=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -62,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( getName(), DirContext.ADD_ATTRIBUTE, attrs );
+        nexus.modify( new ModifyServiceContext( getName(), DirContext.ADD_ATTRIBUTE, attrs
) );
     }
 }

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?view=diff&rev=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -28,6 +28,8 @@
 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.interceptor.context.AddServiceContext;
+import org.apache.directory.server.core.interceptor.context.DeleteServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -95,7 +97,7 @@
         // when we put a new one.
         entry.remove( NamespaceTools.getRdnAttribute( rdn ) );
         entry.put( NamespaceTools.getRdnAttribute( rdn ), NamespaceTools.getRdnValue( rdn
) );
-        nexus.add( normalizedName, entry );
+        nexus.add( new AddServiceContext( normalizedName, entry ) );
     }
 
 
@@ -106,7 +108,7 @@
         NamingEnumeration<SearchResult> ne = nexus.list( normalizedName );
         if ( !ne.hasMore() )
         {
-            nexus.delete( normalizedName );
+            nexus.delete( new DeleteServiceContext( normalizedName ) );
             return;
         }
 
@@ -118,6 +120,6 @@
             recursiveDelete( nexus, dn, registry );
         }
         
-        nexus.delete( normalizedName );
+        nexus.delete( new DeleteServiceContext( normalizedName ) );
     }
 }

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=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -62,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( getName(), DirContext.REMOVE_ATTRIBUTE, attrs );
+        nexus.modify( new ModifyServiceContext( getName(), DirContext.REMOVE_ATTRIBUTE, attrs
) );
     }
 }

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=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -35,6 +35,8 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
@@ -156,23 +158,28 @@
      * sets {@link Constants#ENTRY_DELETED} to "false" to resurrect the
      * entry the modified attributes belong to.
      */
-    public Operation newModify( LdapDN normalizedName, int modOp, Attributes attributes )
+    public Operation newModify( ServiceContext modifyContext )
     {
-        CSN csn = newCSN();
+    	LdapDN name = modifyContext.getDn();
+    	int modOp = ((ModifyServiceContext)modifyContext).getModOp();
+    	Attributes mods = ((ModifyServiceContext)modifyContext).getMods();
+
+    	CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
-        NamingEnumeration e = attributes.getAll();
+        NamingEnumeration e = mods.getAll();
+        
         // Transform into multiple {@link AttributeOperation}s.
         while ( e.hasMoreElements() )
         {
             Attribute attr = ( Attribute ) e.nextElement();
-            result.add( newModify( csn, normalizedName, modOp, attr ) );
+            result.add( newModify( csn, name, modOp, attr ) );
         }
 
         // Resurrect the entry in case it is deleted.
-        result.add( new ReplaceAttributeOperation( csn, normalizedName, new AttributeImpl(
Constants.ENTRY_DELETED,
+        result.add( new ReplaceAttributeOperation( csn, name, new AttributeImpl( Constants.ENTRY_DELETED,
             "false" ) ) );
 
-        return addDefaultOperations( result, null, normalizedName );
+        return addDefaultOperations( result, null, name );
     }
 
 

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=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -62,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( getName(), DirContext.REPLACE_ATTRIBUTE, attrs );
+        nexus.modify( new ModifyServiceContext( getName(), DirContext.REPLACE_ATTRIBUTE,
attrs ) );
     }
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?view=diff&rev=527127&r1=527126&r2=527127
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
Tue Apr 10 06:06:52 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -122,7 +123,7 @@
         entry.put( objectClassAttr );
 
         // And add it to the nexus.
-        nexus.add( name, entry );
+        nexus.add( new AddServiceContext( name, entry ) );
     }
 
 

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=527127&r1=527126&r2=527127
==============================================================================
--- 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
Tue Apr 10 06:06:52 2007
@@ -56,7 +56,8 @@
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
+import org.apache.directory.server.core.interceptor.context.DeleteServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
@@ -359,7 +360,7 @@
             {
                 Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
                 log.info( "Purge: " + name + " (" + entry + ')' );
-                nexus.delete( name );
+                nexus.delete( new DeleteServiceContext( name ) );
             }
             catch ( NamingException ex )
             {
@@ -369,9 +370,9 @@
     }
 
 
-    public void add( NextInterceptor nextInterceptor, LdapDN normalizedName, Attributes entry
) throws NamingException
+    public void add( NextInterceptor nextInterceptor, ServiceContext addContext ) throws
NamingException
     {
-        Operation op = operationFactory.newAdd( normalizedName, entry );
+        Operation op = operationFactory.newAdd( addContext.getDn(), ((AddServiceContext)addContext).getEntry()
);
         op.execute( nexus, store, attrRegistry );
     }
 
@@ -383,9 +384,9 @@
     }
 
 
-    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes attrs )
throws NamingException
+    public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
     {
-        Operation op = operationFactory.newModify( name, modOp, attrs );
+        Operation op = operationFactory.newModify( modifyContext );
         op.execute( nexus, store, attrRegistry );
     }
 



Mime
View raw message