directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r528834 - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/interceptor/ main/java/org/apache/directory/server/core/interceptor/context/ main/java/org/apache/directory/server/core/jndi/ main/java/org/apache/d...
Date Sat, 14 Apr 2007 16:37:19 GMT
Author: elecharny
Date: Sat Apr 14 09:37:17 2007
New Revision: 528834

URL: http://svn.apache.org/viewvc?view=rev&rev=528834
Log:
Added the RemoveContextPartitionServiceContext, and modified the interceptors

Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionServiceContext.java
Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
Sat Apr 14 09:37:17 2007
@@ -196,9 +196,9 @@
     }
 
 
-    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException
     {
-        next.removeContextPartition( suffix );
+        next.removeContextPartition( removeContextPartition );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
Sat Apr 14 09:37:17 2007
@@ -149,9 +149,9 @@
 
 
     /**
-     * Filters {@link PartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN)}
call.
+     * Filters {@link PartitionNexus#removeContextPartition( ServiceContext )} call.
      */
-    void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException;
+    void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException;
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Sat Apr 14 09:37:17 2007
@@ -185,9 +185,9 @@
         }
 
 
-        public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws
NamingException
+        public void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException
         {
-            nexus.removeContextPartition( suffix );
+            nexus.removeContextPartition( removeContextPartition );
         }
 
 
@@ -651,14 +651,14 @@
     }
 
 
-    public void removeContextPartition( LdapDN suffix ) throws NamingException
+    public void removeContextPartition( ServiceContext removeContextPartition ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
         try
         {
-            head.removeContextPartition( next, suffix );
+            head.removeContextPartition( next, removeContextPartition );
         }
         catch ( NamingException ne )
         {
@@ -1393,14 +1393,14 @@
                 }
 
 
-                public void removeContextPartition( LdapDN suffix ) throws NamingException
+                public void removeContextPartition( ServiceContext removeContextPartition
) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.removeContextPartition( next.nextInterceptor, suffix
);
+                        interceptor.removeContextPartition( next.nextInterceptor, removeContextPartition
);
                     }
                     catch ( NamingException ne )
                     {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
Sat Apr 14 09:37:17 2007
@@ -81,9 +81,9 @@
 
 
     /**
-     * Calls the next interceptor's {@link PartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN)}.
+     * Calls the next interceptor's {@link PartitionNexus#removeContextPartition( ServiceContext
)}.
      */
-    void removeContextPartition( LdapDN suffix ) throws NamingException;
+    void removeContextPartition( ServiceContext removeContextPartition ) throws NamingException;
 
 
     /**

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionServiceContext.java?view=auto&rev=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionServiceContext.java
(added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionServiceContext.java
Sat Apr 14 09:37:17 2007
@@ -0,0 +1,57 @@
+/*
+ *  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.server.core.interceptor.context;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+/**
+ * A RemoveContextPartition context used for Interceptors. It contains all the informations
+ * needed for the removeContextPartition operation, and used by all the interceptors
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RemoveContextPartitionServiceContext  extends AbstractServiceContext
+{
+    /**
+     * Creates a new instance of RemoveContextPartitionServiceContext.
+     */
+    public RemoveContextPartitionServiceContext()
+    {
+    }
+    
+    /**
+     * Creates a new instance of RemoveContextPartitionServiceContext.
+     *
+     * @param entryDn The Entry DN from which the partition should be removed
+     */
+    public RemoveContextPartitionServiceContext( LdapDN dn )
+    {
+        super( dn );
+    }
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return "RemoveContextPartitionServiceContext for DN '" + getDn().getUpName() + "'";
+    }
+}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
Sat Apr 14 09:37:17 2007
@@ -37,6 +37,7 @@
 import org.apache.directory.server.core.configuration.StartupConfiguration;
 import org.apache.directory.server.core.configuration.SyncConfiguration;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionServiceContext;
+import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -134,7 +135,8 @@
         {
             Context ctx = service.getJndiContext( principalDn, principal, credential, authentication,
"" );
             PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, service );
-            proxy.removeContextPartition( ( ( RemovePartitionConfiguration ) cfg ).getSuffix()
);
+            proxy.removeContextPartition( 
+                new RemoveContextPartitionServiceContext( ( ( RemovePartitionConfiguration
) cfg ).getSuffix() ) );
         }
         else if ( service == null )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
Sat Apr 14 09:37:17 2007
@@ -404,9 +404,9 @@
     }
 
 
-    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException
     {
-        suffix = LdapDN.normalize( suffix, attrNormalizers );
-        next.removeContextPartition( suffix );
+        LdapDN.normalize( removeContextPartition.getDn(), attrNormalizers );
+        next.removeContextPartition( removeContextPartition );
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Sat Apr 14 09:37:17 2007
@@ -48,6 +48,7 @@
 import org.apache.directory.server.core.interceptor.context.CompareServiceContext;
 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.RemoveContextPartitionServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
@@ -409,9 +410,10 @@
         while ( suffixes.hasNext() )
         {
             String suffix = suffixes.next();
+            
             try
             {
-                removeContextPartition( new LdapDN( suffix ) );
+                removeContextPartition( new RemoveContextPartitionServiceContext( new LdapDN(
suffix ) ) );
             }
             catch ( NamingException e )
             {
@@ -557,10 +559,11 @@
     }
 
 
-    public synchronized void removeContextPartition( LdapDN suffix ) throws NamingException
+    public synchronized void removeContextPartition( ServiceContext removeContextPartition
) throws NamingException
     {
-        String key = suffix.toString();
+        String key = removeContextPartition.getDn().getNormName();
         Partition partition = partitions.get( key );
+        
         if ( partition == null )
         {
             throw new NameNotFoundException( "No partition with suffix: " + key );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
Sat Apr 14 09:37:17 2007
@@ -199,7 +199,7 @@
     public abstract void addContextPartition( ServiceContext addContextPartitionContext )
throws NamingException;
 
 
-    public abstract void removeContextPartition( LdapDN suffix ) throws NamingException;
+    public abstract void removeContextPartition( ServiceContext removeContextPartition )
throws NamingException;
 
 
     public abstract Partition getSystemPartition();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
Sat Apr 14 09:37:17 2007
@@ -726,21 +726,21 @@
     }
 
 
-    public void removeContextPartition( LdapDN suffix ) throws NamingException
+    public void removeContextPartition( ServiceContext removeContextPartition ) throws NamingException
     {
-        removeContextPartition( suffix, null );
+        removeContextPartition( removeContextPartition, null );
     }
 
 
-    public void removeContextPartition( LdapDN suffix, Collection bypass ) throws NamingException
+    public void removeContextPartition( ServiceContext removeContextPartition, Collection
bypass ) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
         stack.push( new Invocation( this, caller, "removeContextPartition", new Object[]
-            { suffix }, bypass ) );
+            { removeContextPartition }, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().removeContextPartition( suffix );
+            this.configuration.getInterceptorChain().removeContextPartition( removeContextPartition
);
         }
         finally
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
Sat Apr 14 09:37:17 2007
@@ -882,15 +882,20 @@
     }
 
 
-    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException
     {
         // remove referrals immediately before removing the partition
         Invocation invocation = InvocationStack.getInstance().peek();
-        NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(),
getControls(),
+        NamingEnumeration list = invocation.getProxy().search( 
+            removeContextPartition.getDn(), 
+            env, 
+            getReferralFilter(), 
+            getControls(),
             SEARCH_BYPASS );
-        deleteReferrals( list, suffix );
+        
+        deleteReferrals( list, removeContextPartition.getDn() );
 
-        next.removeContextPartition( suffix );
+        next.removeContextPartition( removeContextPartition );
     }
 
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=528834&r1=528833&r2=528834
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Sat Apr 14 09:37:17 2007
@@ -325,10 +325,10 @@
         }
 
 
-        public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws
NamingException
+        public void removeContextPartition( NextInterceptor next, ServiceContext removeContextPartition
) throws NamingException
         {
             interceptors.add( this );
-            next.removeContextPartition( suffix );
+            next.removeContextPartition( removeContextPartition );
         }
 
 



Mime
View raw message