directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r662440 [8/8] - in /directory: apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/ apacheds/branches/bigbang/c...
Date Mon, 02 Jun 2008 14:00:26 GMT
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
Mon Jun  2 07:00:23 2008
@@ -26,9 +26,9 @@
 
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 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.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
@@ -95,20 +95,21 @@
     }
 
 
-    protected final void execute0( PartitionNexus nexus, ReplicationStore store, Registries
registries ) 
+    protected final void execute0( PartitionNexus nexus, ReplicationStore store, OperationContext
opContext ) 
         throws Exception
     {
-        if ( !EntryUtil.isEntryUpdatable( registries, nexus, name, getCSN() ) )
+        if ( ! EntryUtil.isEntryUpdatable( opContext, name, getCSN() ) )
         {
             return;
         }
-        EntryUtil.createGlueEntries( registries, nexus, name, true );
+        
+        EntryUtil.createGlueEntries( opContext, name, true );
 
-        execute1( nexus, registries );
+        execute1( nexus, opContext );
     }
 
 
-    protected abstract void execute1( PartitionNexus nexus, Registries registries ) throws
Exception;
+    protected abstract void execute1( PartitionNexus nexus, OperationContext opContext )
throws Exception;
 
 
     /**

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
Mon Jun  2 07:00:23 2008
@@ -21,12 +21,12 @@
 
 
 import org.apache.directory.mitosis.common.CSN;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+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.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -61,13 +61,15 @@
     }
 
 
-    protected void execute1( PartitionNexus nexus, Registries registries ) throws Exception
+    protected void execute1( PartitionNexus nexus, OperationContext opContext ) throws Exception
     {
-        ServerEntry serverEntry = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN
);
-        ServerAttribute attribute = getAttribute( registries.getAttributeTypeRegistry() );
+        DirectoryService ds = opContext.getSession().getDirectoryService();
+        ServerEntry serverEntry = ds.newEntry( LdapDN.EMPTY_LDAPDN );
+        ServerAttribute attribute = getAttribute( ds.getRegistries().getAttributeTypeRegistry()
);
         serverEntry.put( attribute );
-        List<Modification> items = ModifyOperationContext.createModItems( serverEntry,
ModificationOperation.REMOVE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry,

+            ModificationOperation.REMOVE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
+        nexus.modify( new ModifyOperationContext( opContext.getSession(), getName(), items
) );
     }
 }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Mon Jun  2 07:00:23 2008
@@ -26,7 +26,11 @@
 import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -39,6 +43,7 @@
 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.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
@@ -91,7 +96,11 @@
 
     /** The global registries */
     private Registries registries;
+    
+    
+    private DirectoryService ds;
 
+    
     public OperationFactory( DirectoryService directoryService, ReplicationConfiguration
cfg )
     {
         replicaId = cfg.getReplicaId();
@@ -100,6 +109,7 @@
         csnFactory = cfg.getCsnFactory();
         registries = directoryService.getRegistries();
         attributeRegistry = registries.getAttributeTypeRegistry();
+        this.ds = directoryService;
     }
 
 
@@ -271,8 +281,13 @@
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
         
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        CoreSession adminSession = new DefaultCoreSession( 
+            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), ds );
+
         EntryFilteringCursor cursor = nexus.search( 
-            new SearchOperationContext( registries, oldName, AliasDerefMode.DEREF_ALWAYS,
+            new SearchOperationContext( adminSession, oldName, AliasDerefMode.DEREF_ALWAYS,
                     new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
 
         while ( cursor.next() )
@@ -362,9 +377,14 @@
      */
     private void checkBeforeAdd( LdapDN newEntryName ) throws Exception
     {
-        if ( nexus.hasEntry( new EntryOperationContext( registries, newEntryName ) ) )
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        CoreSession adminSession = new DefaultCoreSession( 
+            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), ds );
+
+        if ( nexus.hasEntry( new EntryOperationContext( adminSession, newEntryName ) ) )
         {
-            ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, newEntryName
) );
+            ServerEntry entry = nexus.lookup( new LookupOperationContext( adminSession, newEntryName
) );
             EntryAttribute deleted = entry.get( Constants.ENTRY_DELETED );
             Object value = deleted == null ? null : deleted.get();
 

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
Mon Jun  2 07:00:23 2008
@@ -21,12 +21,12 @@
 
 
 import org.apache.directory.mitosis.common.CSN;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+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.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -63,13 +63,15 @@
     }
 
 
-    protected void execute1( PartitionNexus nexus, Registries registries ) throws Exception
+    protected void execute1( PartitionNexus nexus, OperationContext opContext ) throws Exception
     {
-        ServerEntry serverEntry = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN
);
-        ServerAttribute attribute = getAttribute( registries.getAttributeTypeRegistry() );
+        DirectoryService ds = opContext.getSession().getDirectoryService();
+        ServerEntry serverEntry = ds.newEntry( LdapDN.EMPTY_LDAPDN );
+        ServerAttribute attribute = getAttribute( ds.getRegistries().getAttributeTypeRegistry()
);
         serverEntry.put( attribute );
-        List<Modification> items = ModifyOperationContext.createModItems( serverEntry,
ModificationOperation.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry,

+            ModificationOperation.REPLACE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
+        nexus.modify( new ModifyOperationContext( opContext.getSession(), getName(), items
) );
     }
 }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
Mon Jun  2 07:00:23 2008
@@ -22,13 +22,12 @@
 
 import javax.naming.NameNotFoundException;
 
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerEntry;
 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.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -42,10 +41,11 @@
 public class EntryUtil
 {
     @SuppressWarnings("unchecked")
-    public static boolean isEntryUpdatable( Registries registries, PartitionNexus nexus,
LdapDN name, CSN newCSN ) 
+    public static boolean isEntryUpdatable( OperationContext opContext, LdapDN name, CSN
newCSN ) 
         throws Exception
     {
-        ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name )
);
+        PartitionNexus nexus = opContext.getSession().getDirectoryService().getPartitionNexus();
+        ServerEntry entry = nexus.lookup( opContext.newLookupContext( name ) );
 
         if ( entry == null )
         {
@@ -85,29 +85,32 @@
     }
 
 
-    public static void createGlueEntries( Registries registries, PartitionNexus nexus, LdapDN
name, boolean includeLeaf )
+    public static void createGlueEntries( OperationContext opContext, LdapDN name, boolean
includeLeaf )
         throws Exception
     {
         assert name.size() > 0;
 
         for ( int i = name.size() - 1; i > 0; i-- )
         {
-            createGlueEntry( registries, nexus, ( LdapDN ) name.getSuffix( i ) );
+            createGlueEntry( opContext, ( LdapDN ) name.getSuffix( i ) );
         }
 
         if ( includeLeaf )
         {
-            createGlueEntry( registries, nexus, name );
+            createGlueEntry( opContext, name );
         }
     }
 
 
-    private static void createGlueEntry( Registries registries, PartitionNexus nexus, LdapDN
name ) 
+    private static void createGlueEntry( OperationContext opContext, LdapDN name ) 
         throws Exception
     {
+        DirectoryService ds = opContext.getSession().getDirectoryService();
+        PartitionNexus nexus = ds.getPartitionNexus();
+        
         try
         {
-            if ( nexus.hasEntry( new EntryOperationContext( registries, name ) ) )
+            if ( nexus.hasEntry( new EntryOperationContext( opContext.getSession(), name
) ) )
             {
                 return;
             }
@@ -119,7 +122,7 @@
         }
 
         // Create a glue entry.
-        ServerEntry entry = new DefaultServerEntry( registries, name );
+        ServerEntry entry = ds.newEntry( name );
         
         //// Add RDN attribute. 
         String rdn = name.get( name.size() - 1 );
@@ -131,7 +134,7 @@
         entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC
);
 
         // And add it to the nexus.
-        nexus.add( new AddOperationContext( registries, entry ) );
+        nexus.add( new AddOperationContext( opContext.getSession(), entry ) );
     }
 
 

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
Mon Jun  2 07:00:23 2008
@@ -32,7 +32,11 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
@@ -48,10 +52,12 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 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;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -345,8 +351,13 @@
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
         ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
 
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        CoreSession adminSession = 
+            new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG
), directoryService );
+
         EntryFilteringCursor cursor = nexus.search(
-            new SearchOperationContext( registries, contextName, AliasDerefMode.DEREF_ALWAYS,
filter, ctrl ) );
+            new SearchOperationContext( adminSession, contextName, AliasDerefMode.DEREF_ALWAYS,
filter, ctrl ) );
 
         List<LdapDN> names = new ArrayList<LdapDN>();
         
@@ -373,9 +384,9 @@
             try
             {
                 name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
-                ServerEntry entry = nexus.lookup( new LookupOperationContext( registries,
name ) );
+                ServerEntry entry = nexus.lookup( new LookupOperationContext( adminSession,
name ) );
                 LOG.info( "[Replica-{}] Purge: " + name + " (" + entry + ')', configuration.getReplicaId()
);
-                nexus.delete( new DeleteOperationContext( registries, name ) );
+                nexus.delete( new DeleteOperationContext( adminSession, name ) );
             }
             catch ( NamingException ex )
             {
@@ -445,7 +456,8 @@
             // Check DELETED attribute.
             try
             {
-                ServerEntry entry = nextInterceptor.lookup( new LookupOperationContext( registries,
entryContext.getDn() ) );
+                ServerEntry entry = nextInterceptor.lookup( new LookupOperationContext( entryContext.getSession(),

+                    entryContext.getDn() ) );
                 hasEntry = !isDeleted( entry );
             }
             catch ( NameNotFoundException e )
@@ -487,7 +499,7 @@
         }
 
         ClonedServerEntry entry = nextInterceptor.lookup( lookupContext );
-        ensureNotDeleted( lookupContext.getDn(), entry );
+        ensureNotDeleted( lookupContext, entry );
         return entry;
     }
 
@@ -497,7 +509,7 @@
     {
     	EntryFilteringCursor cursor = nextInterceptor.search(
 	            new SearchOperationContext(
-	                registries, opContext.getDn(), opContext.getAliasDerefMode(),
+	                opContext.getSession(), opContext.getDn(), opContext.getAliasDerefMode(),
 	                new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ),
 	                new SearchControls() ) );
 
@@ -521,19 +533,21 @@
             searchControls.setReturningAttributes( newAttrIds );
         }
 
-    	EntryFilteringCursor cursor = nextInterceptor.search( new SearchOperationContext( registries,

+    	EntryFilteringCursor cursor = nextInterceptor.search( new SearchOperationContext( opContext.getSession(),

     	    opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(), searchControls
) );
     	cursor.addEntryFilter( Constants.DELETED_ENTRIES_FILTER );
     	return cursor;
     }
 
 
-    private void ensureNotDeleted( LdapDN name, ServerEntry entry ) throws Exception 
+    private void ensureNotDeleted( OperationContext opContext, ServerEntry entry ) throws
Exception 
     {
         if ( isDeleted( entry ) )
         {
-            LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry:
" + name.getUpName() );
-            e.setResolvedName( nexus.getMatchedName( new GetMatchedNameOperationContext(
registries, name ) ) );
+            LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry:
" 
+                + opContext.getDn().getUpName() );
+            e.setResolvedName( nexus.getMatchedName( 
+                new GetMatchedNameOperationContext( opContext.getSession(), opContext.getDn()
) ) );
             throw e;
         }
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
Mon Jun  2 07:00:23 2008
@@ -42,9 +42,14 @@
 import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
+import org.apache.directory.server.core.authn.LdapPrincipal;
 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.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -378,8 +383,15 @@
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
+
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( ctx.getDirectoryService().getRegistries()
+            .getAttributeTypeRegistry().getNormalizerMapping() );
+        CoreSession adminSession = new DefaultCoreSession( 
+            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), ctx.getDirectoryService()
);
+
         EntryFilteringCursor cursor = ctx.getDirectoryService().getPartitionNexus().search(
-            new SearchOperationContext( ctx.getDirectoryService().getRegistries(), contextName,
+            new SearchOperationContext( adminSession, contextName,
                 AliasDerefMode.DEREF_ALWAYS, new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID
), ctrl ) );
 
         try

Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/MultiBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/MultiBaseSearch.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/MultiBaseSearch.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/MultiBaseSearch.java
Mon Jun  2 07:00:23 2008
@@ -17,11 +17,12 @@
  *  under the License. 
  *  
  */
-
 package org.apache.directory.server.dns.store.jndi;
 
 
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.dns.DnsException;
 import org.apache.directory.server.dns.messages.QuestionRecord;
 import org.apache.directory.server.dns.messages.ResourceRecord;
@@ -31,6 +32,7 @@
 import org.apache.directory.server.protocol.shared.catalog.Catalog;
 import org.apache.directory.server.protocol.shared.catalog.GetCatalog;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,7 +65,8 @@
         this.directoryService = directoryService;
         try
         {
-            DirContext ctx = directoryService.getJndiContext(catalogBaseDn);
+            CoreSession session = directoryService.getSession();
+            DirContext ctx = new ServerLdapContext( directoryService, session, new LdapDN(
catalogBaseDn ) );
             //noinspection unchecked
             catalog = new DnsCatalog( ( Map<String, Object> ) new GetCatalog().execute(
ctx, null ) );
         }
@@ -82,7 +85,8 @@
         {
             GetRecords getRecords = new GetRecords( question );
             String baseDn = catalog.getBaseDn( question.getDomainName() );
-            DirContext dirContext = directoryService.getJndiContext( baseDn );
+            CoreSession session = directoryService.getSession();
+            DirContext dirContext = new ServerLdapContext( directoryService, session, new
LdapDN( baseDn ) );
             return getRecords.execute( dirContext, null );
         }
         catch ( LdapNameNotFoundException lnnfe )
@@ -104,6 +108,4 @@
         }
 
     }
-
-
 }

Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/SingleBaseSearch.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/SingleBaseSearch.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/store/jndi/SingleBaseSearch.java
Mon Jun  2 07:00:23 2008
@@ -25,13 +25,16 @@
 
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.dns.DnsException;
 import org.apache.directory.server.dns.messages.QuestionRecord;
 import org.apache.directory.server.dns.messages.ResourceRecord;
 import org.apache.directory.server.dns.messages.ResponseCode;
 import org.apache.directory.server.dns.store.jndi.operations.GetRecords;
 import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,7 +60,8 @@
     {
         try
         {
-            ctx = directoryService.getJndiContext( searchBaseDn );
+            CoreSession session = directoryService.getSession();
+            ctx = new ServerLdapContext( directoryService, session, new LdapDN( searchBaseDn
) );
         } catch ( Exception e )
         {
             throw new ServiceConfigurationException( "Can't get context at" + searchBaseDn,
e );

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java
Mon Jun  2 07:00:23 2008
@@ -505,6 +505,7 @@
         return subject;
     }
     
+    
     private PrincipalStoreEntry findPrincipal( LdapServer ldapServer, GetPrincipal getPrincipal
) throws Exception
     {
         if ( ctx == null )
@@ -513,7 +514,9 @@
             {
                 LdapPrincipal principal = new LdapPrincipal(
                         new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN ), AuthenticationLevel.SIMPLE
);
-                ctx = ldapServer.getDirectoryService().getJndiContext( principal, ldapServer.getSearchBaseDn()
);
+                
+                ctx = new ServerLdapContext( ldapServer.getDirectoryService(), principal,

+                    new LdapDN( ldapServer.getSearchBaseDn() ) );
             }
             catch ( NamingException ne )
             {

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
Mon Jun  2 07:00:23 2008
@@ -32,7 +32,9 @@
 import javax.swing.JFrame;
 
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.partition.Partition;
@@ -43,6 +45,7 @@
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.server.ldap.gui.SessionsFrame;
+import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.extended.LaunchDiagnosticUiRequest;
@@ -97,7 +100,11 @@
             requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
 
             PartitionNexus nexus = service.getPartitionNexus();
-            Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext(
service.getRegistries() ) );
+            LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            adminDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
+            LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG
);
+            CoreSession session = service.getSession( principal );
+            Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext(
session ) );
             int launchedWindowCount = 0;
             
             while ( list.hasNext() )

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
Mon Jun  2 07:00:23 2008
@@ -35,6 +35,7 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.sp.StoredProcEngine;
@@ -100,7 +101,8 @@
         StoredProcedure spBean = decodeBean( req.getPayload() );
         
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
-        ServerEntry spUnit = manager.findStoredProcUnit( ctx, procedure, ctx.getService().getRegistries()
);
+        CoreSession coreSession = ctx.getService().getSession( ctx.getPrincipal() );
+        ServerEntry spUnit = manager.findStoredProcUnit( coreSession, procedure );
         StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
         
         List<Object> valueList = new ArrayList<Object>( spBean.getParameters().size()
);
@@ -123,7 +125,7 @@
         
         Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
         
-        Object response = engine.invokeProcedure( ctx, procedure, values );
+        Object response = engine.invokeProcedure( coreSession, procedure, values );
         
         byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response
);
         ( ( ExtendedResponse )( req.getResultResponse() ) ).setResponse( serializedResponse
);

Modified: directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
(original)
+++ directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
Mon Jun  2 07:00:23 2008
@@ -23,9 +23,11 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
 import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
@@ -403,9 +405,9 @@
         dn.normalize( reg.getNormalizerMapping() );
         
         LdapPrincipal admin = new LdapPrincipal( dn, AuthenticationLevel.STRONG );
-        
-        
-        DirContext root = directoryService.getJndiContext( admin );
+        CoreSession session = directoryService.getSession( admin );
+        DirContext root = new ServerLdapContext( directoryService, session, new LdapDN()
);
+
         ensureLdifFileBase( root );
 
         // if ldif directory is a file try to load it

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
Mon Jun  2 07:00:23 2008
@@ -17,9 +17,9 @@
  *  under the License. 
  *  
  */
-
 package org.apache.directory.shared.ldap.trigger;
 
+
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -57,6 +57,7 @@
             return name + " \"" + ctxName.getUpName() + "\"";
         }
     }
+
     
     public static class Generic_OPERATION_PRINCIPAL extends StoredProcedureParameter
     {
@@ -73,6 +74,7 @@
         }
     }
 
+    
     protected final String name;
 
 
@@ -148,6 +150,7 @@
         }
     }
     
+    
     public static class Modify_MODIFICATION extends StoredProcedureParameter
     {
         private static Modify_MODIFICATION instance = new Modify_MODIFICATION( "$modification"
);
@@ -163,6 +166,7 @@
         }
     }
     
+    
     public static class Modify_OLD_ENTRY extends StoredProcedureParameter
     {
         private static Modify_OLD_ENTRY instance = new Modify_OLD_ENTRY( "$oldEntry" );
@@ -178,6 +182,7 @@
         }
     }
     
+    
     public static class Modify_NEW_ENTRY extends StoredProcedureParameter
     {
         private static Modify_NEW_ENTRY instance = new Modify_NEW_ENTRY( "$newEntry" );
@@ -193,6 +198,7 @@
         }
     }
 
+    
     public static class Add_ENTRY extends StoredProcedureParameter
     {
         private static Add_ENTRY instance = new Add_ENTRY( "$entry" );
@@ -208,6 +214,7 @@
         }
     }
     
+    
     public static class Add_ATTRIBUTES extends StoredProcedureParameter
     {
         private static Add_ATTRIBUTES instance = new Add_ATTRIBUTES( "$attributes" );
@@ -223,6 +230,7 @@
         }
     }
 
+    
     public static class Delete_NAME extends StoredProcedureParameter
     {
         private static Delete_NAME instance = new Delete_NAME( "$name" );
@@ -238,6 +246,7 @@
         }
     }
     
+    
     public static class Delete_DELETED_ENTRY extends StoredProcedureParameter
     {
         private static Delete_DELETED_ENTRY instance = new Delete_DELETED_ENTRY( "$deletedEntry"
);
@@ -253,6 +262,7 @@
         }
     }
 
+    
     public static class ModifyDN_ENTRY extends StoredProcedureParameter
     {
         private static ModifyDN_ENTRY instance = new ModifyDN_ENTRY( "$entry" );
@@ -268,6 +278,7 @@
         }
     }
     
+    
     public static class ModifyDN_NEW_RDN extends StoredProcedureParameter
     {
         private static ModifyDN_NEW_RDN instance = new ModifyDN_NEW_RDN( "$newrdn" );
@@ -283,6 +294,7 @@
         }
     }
     
+    
     public static class ModifyDN_DELETE_OLD_RDN extends StoredProcedureParameter
     {
         private static ModifyDN_DELETE_OLD_RDN instance = new ModifyDN_DELETE_OLD_RDN( "$deleteoldrdn"
);
@@ -298,6 +310,7 @@
         }
     }
     
+    
     public static class ModifyDN_NEW_SUPERIOR extends StoredProcedureParameter
     {
         private static ModifyDN_NEW_SUPERIOR instance = new ModifyDN_NEW_SUPERIOR( "$newSuperior"
);
@@ -313,6 +326,7 @@
         }
     }
     
+    
     public static class ModifyDN_OLD_RDN extends StoredProcedureParameter
     {
         private static ModifyDN_OLD_RDN instance = new ModifyDN_OLD_RDN( "$oldRDN" );
@@ -328,6 +342,7 @@
         }
     }
     
+    
     public static class ModifyDN_OLD_SUPERIOR_DN extends StoredProcedureParameter
     {
         private static ModifyDN_OLD_SUPERIOR_DN instance = new ModifyDN_OLD_SUPERIOR_DN(
"$oldRDN" );
@@ -343,6 +358,7 @@
         }
     }
     
+    
     public static class ModifyDN_NEW_DN extends StoredProcedureParameter
     {
         private static ModifyDN_NEW_DN instance = new ModifyDN_NEW_DN( "$oldRDN" );
@@ -357,6 +373,4 @@
             return instance;
         }
     }
-    
-    
 }



Mime
View raw message