directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r529048 - in /directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis: operation/ operation/support/ service/
Date Sun, 15 Apr 2007 19:08:30 GMT
Author: elecharny
Date: Sun Apr 15 12:08:29 2007
New Revision: 529048

URL: http://svn.apache.org/viewvc?view=rev&rev=529048
Log:
Added a ListOperationContext
Switched from ServiceContext to OperationContext for every contexts, as suggested by Alex
Used opContext in arguments instead of xxxContext like listContext, lookupContext, etc.

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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -25,7 +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.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.name.LdapDN;
@@ -63,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyServiceContext( getName(), DirContext.ADD_ATTRIBUTE, attrs
) );
+        nexus.modify( new ModifyOperationContext( 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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -28,9 +28,10 @@
 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.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -84,7 +85,7 @@
         EntryUtil.createGlueEntries( nexus, normalizedName, false );
 
         // Replace the entry if an entry with the same name exists.
-        Attributes oldEntry = nexus.lookup( new LookupServiceContext( normalizedName ) );
+        Attributes oldEntry = nexus.lookup( new LookupOperationContext( normalizedName )
);
         
         if ( oldEntry != null )
         {
@@ -97,7 +98,7 @@
         // when we put a new one.
         entry.remove( NamespaceTools.getRdnAttribute( rdn ) );
         entry.put( NamespaceTools.getRdnAttribute( rdn ), NamespaceTools.getRdnValue( rdn
) );
-        nexus.add( new AddServiceContext( normalizedName, entry ) );
+        nexus.add( new AddOperationContext( normalizedName, entry ) );
     }
 
 
@@ -105,10 +106,10 @@
     private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, AttributeTypeRegistry
registry )
         throws NamingException
     {
-        NamingEnumeration<SearchResult> ne = nexus.list( normalizedName );
+        NamingEnumeration<SearchResult> ne = nexus.list( new ListOperationContext(
normalizedName ) );
         if ( !ne.hasMore() )
         {
-            nexus.delete( new DeleteServiceContext( normalizedName ) );
+            nexus.delete( new DeleteOperationContext( normalizedName ) );
             return;
         }
 
@@ -120,6 +121,6 @@
             recursiveDelete( nexus, dn, registry );
         }
         
-        nexus.delete( new DeleteServiceContext( normalizedName ) );
+        nexus.delete( new DeleteOperationContext( 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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -25,7 +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.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.name.LdapDN;
@@ -63,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyServiceContext( getName(), DirContext.REMOVE_ATTRIBUTE, attrs
) );
+        nexus.modify( new ModifyOperationContext( 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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -33,10 +33,10 @@
 import javax.naming.directory.SearchResult;
 
 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.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
@@ -158,11 +158,11 @@
      * sets {@link Constants#ENTRY_DELETED} to "false" to resurrect the
      * entry the modified attributes belong to.
      */
-    public Operation newModify( ServiceContext modifyContext )
+    public Operation newModify( OperationContext modifyContext )
     {
     	LdapDN name = modifyContext.getDn();
-    	int modOp = ((ModifyServiceContext)modifyContext).getModOp();
-    	Attributes mods = ((ModifyServiceContext)modifyContext).getMods();
+    	int modOp = ((ModifyOperationContext)modifyContext).getModOp();
+    	Attributes mods = ((ModifyOperationContext)modifyContext).getMods();
 
     	CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
@@ -332,9 +332,9 @@
      */
     private void checkBeforeAdd( LdapDN newEntryName ) throws NamingException
     {
-        if ( nexus.hasEntry( new EntryServiceContext( newEntryName ) ) )
+        if ( nexus.hasEntry( new EntryOperationContext( newEntryName ) ) )
         {
-            Attributes entry = nexus.lookup( new LookupServiceContext( newEntryName ) );
+            Attributes entry = nexus.lookup( new LookupOperationContext( newEntryName ) );
             Attribute deleted = entry.get( Constants.ENTRY_DELETED );
             Object value = deleted == null ? null : deleted.get();
 

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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -25,7 +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.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.name.LdapDN;
@@ -63,6 +63,6 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        nexus.modify( new ModifyServiceContext( getName(), DirContext.REPLACE_ATTRIBUTE,
attrs ) );
+        nexus.modify( new ModifyOperationContext( 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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -25,9 +25,9 @@
 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.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -44,7 +44,7 @@
     @SuppressWarnings("unchecked")
     public static boolean isEntryUpdatable( PartitionNexus nexus, LdapDN name, CSN newCSN
) throws NamingException
     {
-        Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
+        Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
 
         if ( entry == null )
         {
@@ -96,7 +96,7 @@
     {
         try
         {
-            if ( nexus.hasEntry( new EntryServiceContext( name ) ) )
+            if ( nexus.hasEntry( new EntryOperationContext( name ) ) )
             {
                 return;
             }
@@ -123,7 +123,7 @@
         entry.put( objectClassAttr );
 
         // And add it to the nexus.
-        nexus.add( new AddServiceContext( name, entry ) );
+        nexus.add( new AddOperationContext( 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=529048&r1=529047&r2=529048
==============================================================================
--- 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
Sun Apr 15 12:08:29 2007
@@ -56,11 +56,11 @@
 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.AddServiceContext;
-import org.apache.directory.server.core.interceptor.context.DeleteServiceContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameServiceContext;
-import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
-import org.apache.directory.server.core.interceptor.context.ServiceContext;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -359,9 +359,9 @@
             LdapDN name = it.next();
             try
             {
-                Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
+                Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
                 log.info( "Purge: " + name + " (" + entry + ')' );
-                nexus.delete( new DeleteServiceContext( name ) );
+                nexus.delete( new DeleteOperationContext( name ) );
             }
             catch ( NamingException ex )
             {
@@ -371,9 +371,9 @@
     }
 
 
-    public void add( NextInterceptor nextInterceptor, ServiceContext addContext ) throws
NamingException
+    public void add( NextInterceptor nextInterceptor, OperationContext addContext ) throws
NamingException
     {
-        Operation op = operationFactory.newAdd( addContext.getDn(), ((AddServiceContext)addContext).getEntry()
);
+        Operation op = operationFactory.newAdd( addContext.getDn(), ((AddOperationContext)addContext).getEntry()
);
         op.execute( nexus, store, attrRegistry );
     }
 
@@ -385,7 +385,7 @@
     }
 
 
-    public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext modifyContext ) throws NamingException
     {
         Operation op = operationFactory.newModify( modifyContext );
         op.execute( nexus, store, attrRegistry );
@@ -422,7 +422,7 @@
     }
 
 
-    public boolean hasEntry( NextInterceptor nextInterceptor, ServiceContext entryContext
) throws NamingException
+    public boolean hasEntry( NextInterceptor nextInterceptor, OperationContext entryContext
) throws NamingException
     {
         // Ask others first.
         boolean hasEntry = nextInterceptor.hasEntry( entryContext );
@@ -433,7 +433,7 @@
             // Check DELETED attribute.
             try
             {
-                Attributes entry = nextInterceptor.lookup( new LookupServiceContext( entryContext.getDn()
) );
+                Attributes entry = nextInterceptor.lookup( new LookupOperationContext( entryContext.getDn()
) );
                 hasEntry = !isDeleted( entry );
             }
             catch ( NameNotFoundException e )
@@ -447,9 +447,9 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext
) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, OperationContext lookupContext
) throws NamingException
     {
-        LookupServiceContext ctx = ((LookupServiceContext)lookupContext);
+        LookupOperationContext ctx = ((LookupOperationContext)lookupContext);
         
         if ( ctx.getAttrsId() != null )
         {
@@ -519,7 +519,7 @@
         if ( isDeleted( entry ) )
         {
             LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry:
" + name.getUpName() );
-            e.setResolvedName( nexus.getMatchedName( new GetMatchedNameServiceContext( name
) ) );
+            e.setResolvedName( nexus.getMatchedName( new GetMatchedNameOperationContext(
name ) ) );
             throw e;
         }
     }



Mime
View raw message