You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/06/02 16:00:26 UTC
svn commit: r662440 [7/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...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java Mon Jun 2 07:00:23 2008
@@ -17,46 +17,50 @@
* under the License.
*
*/
-
package org.apache.directory.server.core.trigger;
+
import java.util.Map;
import javax.naming.NamingException;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
+
public class AddStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
{
private LdapDN addedEntryName;
private ServerEntry addedEntry;
- public AddStoredProcedureParameterInjector( Invocation invocation, LdapDN addedEntryName, ServerEntry addedEntry )
+
+ public AddStoredProcedureParameterInjector( OperationContext opContext, LdapDN addedEntryName,
+ ServerEntry addedEntry )
{
- super( invocation );
+ super( opContext );
this.addedEntryName = addedEntryName;
this.addedEntry = addedEntry;
Map<Class<?>, MicroInjector> injectors = super.getInjectors();
injectors.put( StoredProcedureParameter.Add_ENTRY.class, $entryInjector );
injectors.put( StoredProcedureParameter.Add_ATTRIBUTES.class, $attributesInjector );
}
+
MicroInjector $entryInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( addedEntryName.getUpName() );
}
};
+
MicroInjector $attributesInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
return addedEntry.clone();
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Mon Jun 2 07:00:23 2008
@@ -17,7 +17,6 @@
* under the License.
*
*/
-
package org.apache.directory.server.core.trigger;
@@ -25,11 +24,11 @@
import javax.naming.NamingException;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
@@ -38,12 +37,14 @@
{
private LdapDN deletedEntryName;
private ServerEntry deletedEntry;
+
- public DeleteStoredProcedureParameterInjector( Registries registries, Invocation invocation, LdapDN deletedEntryName ) throws Exception
+ public DeleteStoredProcedureParameterInjector( OperationContext opContext, LdapDN deletedEntryName )
+ throws Exception
{
- super( invocation );
+ super( opContext );
this.deletedEntryName = deletedEntryName;
- this.deletedEntry = getDeletedEntry( registries );
+ this.deletedEntry = getDeletedEntry( opContext );
Map<Class<?>, MicroInjector> injectors = super.getInjectors();
injectors.put( StoredProcedureParameter.Delete_NAME.class, $nameInjector );
injectors.put( StoredProcedureParameter.Delete_DELETED_ENTRY.class, $deletedEntryInjector );
@@ -51,7 +52,7 @@
MicroInjector $nameInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
{
// Return a safe copy constructed with user provided name.
return new LdapDN( deletedEntryName.getUpName() );
@@ -60,20 +61,23 @@
MicroInjector $deletedEntryInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
return deletedEntry;
}
};
- private ServerEntry getDeletedEntry( Registries registries ) throws Exception
+
+ private ClonedServerEntry getDeletedEntry( OperationContext opContext ) throws Exception
{
- PartitionNexusProxy proxy = getInvocation().getProxy();
/**
* Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
* especially subentry related ones like "triggerExecutionSubentries".
*/
- ServerEntry deletedEntry = proxy.lookup( new LookupOperationContext( registries, deletedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(), deletedEntryName );
+ lookupContext.setByPassed( ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ ClonedServerEntry deletedEntry = opContext.getSession().getDirectoryService()
+ .getOperationManager().lookup( lookupContext );
return deletedEntry;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java Mon Jun 2 07:00:23 2008
@@ -20,8 +20,7 @@
package org.apache.directory.server.core.trigger;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
@@ -40,10 +39,10 @@
private LdapDN oldDN;
private LdapDN newDN;
- public ModifyDNStoredProcedureParameterInjector( Invocation invocation, boolean deleteOldRn,
+ public ModifyDNStoredProcedureParameterInjector( OperationContext opContext, boolean deleteOldRn,
LdapDN oldRDN, Rdn newRDN, LdapDN oldSuperiorDN, LdapDN newSuperiorDN, LdapDN oldDN, LdapDN newDN)
{
- super( invocation );
+ super( opContext );
this.deleteOldRn = deleteOldRn;
this.oldRDN = oldRDN;
this.newRDN = newRDN;
@@ -67,7 +66,7 @@
*/
MicroInjector $entryInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( oldDN.getUpName() );
@@ -79,7 +78,7 @@
*/
MicroInjector $newrdnInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( newRDN.getUpName() );
@@ -91,7 +90,7 @@
*/
MicroInjector $deleteoldrdnInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return deleteOldRn;
@@ -103,7 +102,7 @@
*/
MicroInjector $newSuperiorInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( newSuperiorDN.getUpName() );
@@ -115,7 +114,7 @@
*/
MicroInjector $oldRDNInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( oldRDN.getUpName() );
@@ -127,7 +126,7 @@
*/
MicroInjector $oldSuperiorDNInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( oldSuperiorDN.getUpName() );
@@ -139,7 +138,7 @@
*/
MicroInjector $newDNInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( newDN.getUpName() );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Mon Jun 2 07:00:23 2008
@@ -17,25 +17,25 @@
* under the License.
*
*/
-
package org.apache.directory.server.core.trigger;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.naming.NamingException;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
+
public class ModifyStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
{
private LdapDN modifiedEntryName;
@@ -43,12 +43,12 @@
private ServerEntry oldEntry;
- public ModifyStoredProcedureParameterInjector( Invocation invocation, ModifyOperationContext opContext ) throws Exception
+ public ModifyStoredProcedureParameterInjector( ModifyOperationContext opContext ) throws Exception
{
- super( invocation );
+ super( opContext );
modifiedEntryName = opContext.getDn();
modifications = opContext.getModItems();
- this.oldEntry = getEntry( opContext.getRegistries() );
+ this.oldEntry = getEntry( opContext );
Map<Class<?>, MicroInjector> injectors = super.getInjectors();
injectors.put( StoredProcedureParameter.Modify_OBJECT.class, $objectInjector );
injectors.put( StoredProcedureParameter.Modify_MODIFICATION.class, $modificationInjector );
@@ -56,18 +56,20 @@
injectors.put( StoredProcedureParameter.Modify_NEW_ENTRY.class, $newEntryInjector );
}
+
MicroInjector $objectInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
return new LdapDN( modifiedEntryName.getUpName() );
}
};
+
MicroInjector $modificationInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
List<Modification> newMods = new ArrayList<Modification>();
@@ -80,30 +82,31 @@
}
};
+
MicroInjector $oldEntryInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
return oldEntry;
}
};
+
MicroInjector $newEntryInjector = new MicroInjector()
{
- public Object inject( Registries registries, StoredProcedureParameter param ) throws Exception
+ public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
{
- return getEntry( registries );
+ return getEntry( opContext );
}
};
- private ServerEntry getEntry( Registries registries ) throws Exception
+
+ private ClonedServerEntry getEntry( OperationContext opContext ) throws Exception
{
- PartitionNexusProxy proxy = getInvocation().getProxy();
/**
* Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
* especially subentry related ones like "triggerExecutionSubentries".
*/
- return proxy.lookup( new LookupOperationContext( registries, modifiedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ return opContext.lookup( modifiedEntryName, ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
}
-
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java Mon Jun 2 07:00:23 2008
@@ -19,17 +19,15 @@
*/
package org.apache.directory.server.core.trigger;
-import java.security.Principal;
import javax.naming.InvalidNameException;
import javax.naming.NamingException;
import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.jndi.ServerContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.shared.ldap.name.LdapDN;
+
public class SimpleTriggerExecutionAuthorizer implements TriggerExecutionAuthorizer
{
private static LdapDN adminName;
@@ -47,13 +45,9 @@
}
}
- public boolean hasPermission() throws NamingException
+ public boolean hasPermission( OperationContext opContext ) throws NamingException
{
- Invocation invocation = InvocationStack.getInstance().peek();
- Principal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
- LdapDN principalName = new LdapDN( principal.getName() );
-
+ LdapDN principalName = opContext.getSession().getEffectivePrincipal().getJndiName();
return principalName.equals( adminName );
}
-
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java Mon Jun 2 07:00:23 2008
@@ -17,20 +17,29 @@
* under the License.
*
*/
-
package org.apache.directory.server.core.trigger;
+
import java.util.List;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
+
+/**
+ * TODO - can we get some documentation on this?
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public interface StoredProcedureParameterInjector
{
- List<Object> getArgumentsToInject( Registries registries, List<StoredProcedureParameter> parameterList ) throws Exception;
+ List<Object> getArgumentsToInject( OperationContext opContext,
+ List<StoredProcedureParameter> parameterList ) throws Exception;
+
public interface MicroInjector
{
- Object inject( Registries registries, StoredProcedureParameter param ) throws Exception;
+ Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception;
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerExecutionAuthorizer.java Mon Jun 2 07:00:23 2008
@@ -19,9 +19,11 @@
*/
package org.apache.directory.server.core.trigger;
-import javax.naming.NamingException;
+
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+
public interface TriggerExecutionAuthorizer
{
- boolean hasPermission() throws NamingException;
+ boolean hasPermission( OperationContext opContext ) throws Exception;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Mon Jun 2 07:00:23 2008
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
@@ -32,18 +33,15 @@
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.invocation.Invocation;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.sp.StoredProcEngine;
import org.apache.directory.server.core.sp.StoredProcEngineConfig;
import org.apache.directory.server.core.sp.StoredProcExecutionManager;
import org.apache.directory.server.core.sp.java.JavaStoredProcEngineConfig;
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-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.entry.Value;
@@ -90,9 +88,6 @@
/** a normalizing Trigger Specification parser */
private TriggerSpecificationParser triggerParser;
- /** the global registries */
- private Registries registries;
-
/** */
private InterceptorChain chain;
@@ -119,7 +114,7 @@
* @throws Exception if there are problems accessing attribute values
* @param proxy the partition nexus proxy
*/
- private void addPrescriptiveTriggerSpecs( List<TriggerSpecification> triggerSpecs, PartitionNexusProxy proxy,
+ private void addPrescriptiveTriggerSpecs( OperationContext opContext, List<TriggerSpecification> triggerSpecs,
LdapDN dn, ServerEntry entry ) throws Exception
{
@@ -136,7 +131,10 @@
{
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- entry = proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS );
+
+ LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(), parentDn );
+ lookupContext.setByPassed( ByPassConstants.LOOKUP_BYPASS );
+ entry = opContext.getSession().getDirectoryService().getOperationManager().lookup( lookupContext );
}
EntryAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
@@ -232,7 +230,6 @@
public void init( DirectoryService directoryService ) throws Exception
{
super.init( directoryService );
- registries = directoryService.getRegistries();
triggerSpecCache = new TriggerSpecCache( directoryService );
final AttributeTypeRegistry attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
@@ -258,6 +255,7 @@
this.enabled = true; // TODO: Get this from the configuration if needed.
}
+
public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
{
LdapDN name = addContext.getDn();
@@ -271,29 +269,28 @@
}
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( invocation, name, entry );
+ StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( addContext, name, entry );
// Gather Trigger Specifications which apply to the entry being added.
List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, entry );
+ addPrescriptiveTriggerSpecs( addContext, triggerSpecs, name, entry );
/**
* NOTE: We do not handle entryTriggerSpecs for ADD operation.
*/
- Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.ADD );
+ Map<ActionTime, List<TriggerSpecification>> triggerMap
+ = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.ADD );
next.add( addContext );
triggerSpecCache.subentryAdded( name, entry );
// Fire AFTER Triggers.
List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
- executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( addContext, afterTriggerSpecs, injector );
}
+
public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws Exception
{
LdapDN name = deleteContext.getDn();
@@ -306,28 +303,27 @@
}
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry deletedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
+ ClonedServerEntry deletedEntry = deleteContext.lookup( name , ByPassConstants.LOOKUP_BYPASS );
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( registries, invocation, name );
+ StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( deleteContext, name );
// Gather Trigger Specifications which apply to the entry being deleted.
List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, deletedEntry );
+ addPrescriptiveTriggerSpecs( deleteContext, triggerSpecs, name, deletedEntry );
addEntryTriggerSpecs( triggerSpecs, deletedEntry );
- Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.DELETE );
+ Map<ActionTime, List<TriggerSpecification>> triggerMap =
+ getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.DELETE );
next.delete( deleteContext );
triggerSpecCache.subentryDeleted( name, deletedEntry );
// Fire AFTER Triggers.
List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
- executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( deleteContext, afterTriggerSpecs, injector );
}
+
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
{
// Bypass trigger handling if the service is disabled.
@@ -340,16 +336,13 @@
LdapDN normName = opContext.getDn();
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry modifiedEntry = proxy.lookup( new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS );
+ ClonedServerEntry modifiedEntry = opContext.lookup( normName, ByPassConstants.LOOKUP_BYPASS );
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, opContext );
+ StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( opContext );
// Gather Trigger Specifications which apply to the entry being modified.
List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, modifiedEntry );
+ addPrescriptiveTriggerSpecs( opContext, triggerSpecs, normName, modifiedEntry );
addEntryTriggerSpecs( triggerSpecs, modifiedEntry );
Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY );
@@ -359,7 +352,7 @@
// Fire AFTER Triggers.
List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
- executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( opContext, afterTriggerSpecs, injector );
}
@@ -377,11 +370,7 @@
}
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry renamedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
-
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
+ ClonedServerEntry renamedEntry = renameContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
LdapDN oldSuperiorDN = ( LdapDN ) name.clone();
@@ -392,43 +381,42 @@
newDN.add( newRdn );
StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
- invocation, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
+ renameContext, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
// Gather Trigger Specifications which apply to the entry being renamed.
List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, renamedEntry );
+ addPrescriptiveTriggerSpecs( renameContext, triggerSpecs, name, renamedEntry );
addEntryTriggerSpecs( triggerSpecs, renamedEntry );
- Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFYDN_RENAME );
+ Map<ActionTime, List<TriggerSpecification>> triggerMap =
+ getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFYDN_RENAME );
next.rename( renameContext );
triggerSpecCache.subentryRenamed( name, newDN );
// Fire AFTER Triggers.
List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER );
- executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( renameContext, afterTriggerSpecs, injector );
}
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws Exception
+
+ public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
+ throws Exception
{
- LdapDN oriChildName = moveAndRenameContext.getDn();
- LdapDN parent = moveAndRenameContext.getParent();
- Rdn newRdn = moveAndRenameContext.getNewRdn();
- boolean deleteOldRn = moveAndRenameContext.getDelOldDn();
+ LdapDN oriChildName = opContext.getDn();
+ LdapDN parent = opContext.getParent();
+ Rdn newRdn = opContext.getNewRdn();
+ boolean deleteOldRn = opContext.getDelOldDn();
// Bypass trigger handling if the service is disabled.
if ( !enabled )
{
- next.moveAndRename( moveAndRenameContext );
+ next.moveAndRename( opContext );
return;
}
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
-
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
+ ClonedServerEntry movedEntry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
LdapDN oldSuperiorDN = ( LdapDN ) oriChildName.clone();
@@ -439,11 +427,11 @@
newDN.add( newRdn.getUpName() );
StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
- invocation, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
+ opContext, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
// Gather Trigger Specifications which apply to the entry being exported.
List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( exportTriggerSpecs, proxy, oriChildName, movedEntry );
+ addPrescriptiveTriggerSpecs( opContext, exportTriggerSpecs, oriChildName, movedEntry );
addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
// Get the entry again without operational attributes
@@ -451,7 +439,8 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryInterceptor,
// but after this service.
- ServerEntry importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ ClonedServerEntry importedEntry = opContext.lookup( oriChildName,
+ ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
@@ -469,41 +458,39 @@
// Gather Trigger Specifications which apply to the entry being imported.
// Note: Entry Trigger Specifications are not valid for Import.
List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry );
+ addPrescriptiveTriggerSpecs( opContext, importTriggerSpecs, newDN, fakeImportedEntry );
- Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
+ Map<ActionTime, List<TriggerSpecification>> exportTriggerMap =
+ getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
- Map<ActionTime, List<TriggerSpecification>> importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
+ Map<ActionTime, List<TriggerSpecification>> importTriggerMap =
+ getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
- next.moveAndRename( moveAndRenameContext );
+ next.moveAndRename( opContext );
triggerSpecCache.subentryRenamed( oldDN, newDN );
// Fire AFTER Triggers.
List<TriggerSpecification> afterExportTriggerSpecs = exportTriggerMap.get( ActionTime.AFTER );
List<TriggerSpecification> afterImportTriggerSpecs = importTriggerMap.get( ActionTime.AFTER );
- executeTriggers( afterExportTriggerSpecs, injector, callerRootCtx );
- executeTriggers( afterImportTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( opContext, afterExportTriggerSpecs, injector );
+ executeTriggers( opContext, afterImportTriggerSpecs, injector );
}
- public void move( NextInterceptor next, MoveOperationContext moveContext ) throws Exception
+ public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
{
// Bypass trigger handling if the service is disabled.
if ( !enabled )
{
- next.move( moveContext );
+ next.move( opContext );
return;
}
- LdapDN oriChildName = moveContext.getDn();
- LdapDN newParentName = moveContext.getParent();
+ LdapDN oriChildName = opContext.getDn();
+ LdapDN newParentName = opContext.getParent();
// Gather supplementary data.
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
-
- ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
+ ClonedServerEntry movedEntry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
Rdn newRDN = new Rdn( oriChildName.getRdn().getUpName() );
@@ -515,11 +502,11 @@
newDN.add( newRDN.getUpName() );
StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
- invocation, false, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
+ opContext, false, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
// Gather Trigger Specifications which apply to the entry being exported.
List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( exportTriggerSpecs, proxy, oriChildName, movedEntry );
+ addPrescriptiveTriggerSpecs( opContext, exportTriggerSpecs, oriChildName, movedEntry );
addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
// Get the entry again without operational attributes
@@ -527,7 +514,8 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryInterceptor,
// but after this service.
- ServerEntry importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ ClonedServerEntry importedEntry = opContext.lookup( oriChildName,
+ ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
@@ -545,40 +533,42 @@
// Gather Trigger Specifications which apply to the entry being imported.
// Note: Entry Trigger Specifications are not valid for Import.
List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
- addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry );
+ addPrescriptiveTriggerSpecs( opContext, importTriggerSpecs, newDN, fakeImportedEntry );
Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
Map<ActionTime, List<TriggerSpecification>> importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT );
- next.move( moveContext );
+ next.move( opContext );
triggerSpecCache.subentryRenamed( oldDN, newDN );
// Fire AFTER Triggers.
List<TriggerSpecification> afterExportTriggerSpecs = exportTriggerMap.get( ActionTime.AFTER );
List<TriggerSpecification> afterImportTriggerSpecs = importTriggerMap.get( ActionTime.AFTER );
- executeTriggers( afterExportTriggerSpecs, injector, callerRootCtx );
- executeTriggers( afterImportTriggerSpecs, injector, callerRootCtx );
+ executeTriggers( opContext, afterExportTriggerSpecs, injector );
+ executeTriggers( opContext, afterImportTriggerSpecs, injector );
}
////////////////////////////////////////////////////////////////////////////
// Utility Methods
////////////////////////////////////////////////////////////////////////////
- private Object executeTriggers( List<TriggerSpecification> triggerSpecs, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws Exception
+
+ private Object executeTriggers( OperationContext opContext, List<TriggerSpecification> triggerSpecs,
+ StoredProcedureParameterInjector injector ) throws Exception
{
Object result = null;
for ( TriggerSpecification triggerSpec : triggerSpecs )
{
// TODO: Replace the Authorization Code with a REAL one.
- if ( triggerExecutionAuthorizer.hasPermission() )
+ if ( triggerExecutionAuthorizer.hasPermission( opContext ) )
{
/**
* If there is only one Trigger to be executed, this assignment
* will make sense (as in INSTEADOF search Triggers).
*/
- result = executeTrigger( triggerSpec, injector, callerRootCtx );
+ result = executeTrigger( opContext, triggerSpec, injector );
}
}
@@ -589,16 +579,17 @@
return result;
}
- private Object executeTrigger( TriggerSpecification tsec, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws Exception
+ private Object executeTrigger( OperationContext opContext, TriggerSpecification tsec,
+ StoredProcedureParameterInjector injector ) throws Exception
{
List<Object> returnValues = new ArrayList<Object>();
List<SPSpec> spSpecs = tsec.getSPSpecs();
for ( SPSpec spSpec : spSpecs )
{
List<Object> arguments = new ArrayList<Object>();
- arguments.addAll( injector.getArgumentsToInject( registries, spSpec.getParameters() ) );
+ arguments.addAll( injector.getArgumentsToInject( opContext, spSpec.getParameters() ) );
Object[] values = arguments.toArray();
- Object returnValue = executeProcedure( callerRootCtx, spSpec.getName(), values );
+ Object returnValue = executeProcedure( opContext, spSpec.getName(), values );
returnValues.add( returnValue );
}
@@ -606,14 +597,14 @@
}
- private Object executeProcedure( ServerLdapContext ctx, String procedure, Object[] values ) throws Exception
+ private Object executeProcedure( OperationContext opContext, String procedure, Object[] values ) throws Exception
{
try
{
- ServerEntry spUnit = manager.findStoredProcUnit( ctx, procedure, registries );
+ ServerEntry spUnit = manager.findStoredProcUnit( opContext.getSession(), procedure );
StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
- return engine.invokeProcedure( ctx, procedure, values );
+ return engine.invokeProcedure( opContext.getSession(), procedure, values );
}
catch ( Exception e )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Mon Jun 2 07:00:23 2008
@@ -21,7 +21,11 @@
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.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;
@@ -29,7 +33,7 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
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;
@@ -97,11 +101,11 @@
return registry.getNormalizerMapping();
}
});
- initialize( directoryService.getRegistries() );
+ initialize( directoryService );
}
- private void initialize( Registries registries ) throws Exception
+ private void initialize( DirectoryService directoryService ) throws Exception
{
// search all naming contexts for trigger subentenries
// generate TriggerSpecification arrays for each subentry
@@ -116,8 +120,13 @@
new ClientStringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- EntryFilteringCursor results =
- nexus.search( new SearchOperationContext( registries, baseDn, AliasDerefMode.DEREF_ALWAYS, filter, ctls ) );
+
+ LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+ adminDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ CoreSession adminSession = new DefaultCoreSession(
+ new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
+ EntryFilteringCursor results = nexus.search( new SearchOperationContext(
+ adminSession, baseDn, AliasDerefMode.DEREF_ALWAYS, filter, ctls ) );
while ( results.next() )
{
@@ -131,7 +140,8 @@
continue;
}
- LdapDN normSubentryName = subentryDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ LdapDN normSubentryName = subentryDn.normalize( directoryService.getRegistries()
+ .getAttributeTypeRegistry().getNormalizerMapping() );
subentryAdded( normSubentryName, resultEntry );
}
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Mon Jun 2 07:00:23 2008
@@ -20,6 +20,8 @@
package org.apache.directory.server.core.authz.support;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.OperationManager;
@@ -27,17 +29,33 @@
import org.apache.directory.server.core.changelog.ChangeLog;
import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.cursor.CursorIterator;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
+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.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.jndi.DeadContext;
+import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.schema.SchemaOperationControl;
import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.schema.registries.Registries;
@@ -51,6 +69,7 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import javax.naming.NamingException;
+import javax.naming.ldap.Control;
import javax.naming.ldap.LdapContext;
import java.io.File;
import java.util.ArrayList;
@@ -170,15 +189,18 @@
null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
}
- class MockProxy extends PartitionNexusProxy
+
+ class MockProxy implements OperationContext
{
final int count;
+ final CoreSession session;
- public MockProxy(int count) throws Exception
+ public MockProxy( int count ) throws Exception
{
- super( new DeadContext(), new MockDirectoryService() );
this.count = count;
+ this.session = new DefaultCoreSession( new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ),
+ new MockDirectoryService( count ) );
}
@@ -193,10 +215,185 @@
{
return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
}
+
+
+ public void addRequestControl( Control requestControl )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void addRequestControls( Control[] requestControls )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void addResponseControl( Control responseControl )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public Collection<String> getByPassed()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public LdapDN getDn()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public String getName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Control getRequestControl( String numericOid )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Control getResponseControl( String numericOid )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public int getResponseControlCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+
+ public Control[] getResponseControls()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public CoreSession getSession()
+ {
+ return session;
+ }
+
+
+ public boolean hasBypass()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean hasRequestControl( String numericOid )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean hasRequestControls()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean hasResponseControl( String numericOid )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean hasResponseControls()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isBypassed( String interceptorName )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isCollateralOperation()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public ClonedServerEntry lookup( LdapDN dn, Collection<String> bypass ) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public LookupOperationContext newLookupContext( LdapDN dn )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void setByPassed( Collection<String> byPassed )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void setCollateralOperation( boolean collateralOperation )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public void setDn( LdapDN dn )
+ {
+ // TODO Auto-generated method stub
+
+ }
}
class MockDirectoryService implements DirectoryService
{
+ int count;
+
+
+ public MockDirectoryService( int count )
+ {
+ this.count = count;
+ }
+
public Hashtable<String, Object> getEnvironment()
{
return null;
@@ -309,31 +506,6 @@
}
- public LdapContext getJndiContext( String baseName ) throws NamingException
- {
- return null;
- }
-
-
- public LdapContext getJndiContext( LdapPrincipal principal ) throws NamingException
- {
- return null;
- }
-
-
- public LdapContext getJndiContext( LdapPrincipal principal, String dn ) throws NamingException
- {
- return null;
- }
-
-
- public LdapContext getJndiContext( LdapDN principalDn, String principal, byte[] credential,
- String authentication, String baseName ) throws NamingException
- {
- return null;
- }
-
-
public void setInstanceId( String instanceId )
{
@@ -514,9 +686,120 @@
public OperationManager getOperationManager()
{
+ return new MockOperationManager( count );
+ }
+
+
+ public CoreSession getSession() throws Exception
+ {
+ return null;
+ }
+
+
+ public CoreSession getSession( LdapPrincipal principal ) throws Exception
+ {
+ return null;
+ }
+
+
+ public CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication ) throws Exception
+ {
+ return null;
+ }
+ }
+
+
+ class MockOperationManager implements OperationManager
+ {
+ int count;
+
+ public MockOperationManager( int count )
+ {
+ this.count = count;
+ }
+
+ public void add( AddOperationContext opContext ) throws Exception
+ {
+ }
+
+
+ public void bind( BindOperationContext opContext ) throws Exception
+ {
+ }
+
+
+ public boolean compare( CompareOperationContext opContext ) throws Exception
+ {
+ return false;
+ }
+
+
+ public void delete( DeleteOperationContext opContext ) throws Exception
+ {
+ }
+
+ public LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
+ {
+ return null;
+ }
+
+ public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
+ {
+ return null;
+ }
+
+ public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
+ {
+ return null;
+ }
+
+ public boolean hasEntry( EntryOperationContext opContext ) throws Exception
+ {
+ return false;
+ }
+
+ public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
+ {
return null;
}
+
+ public Iterator<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
+ {
+ return null;
+ }
+
+ public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
+ {
+ return null;
+ }
+
+ public void modify( ModifyOperationContext opContext ) throws Exception
+ {
+ }
+
+ public void move( MoveOperationContext opContext ) throws Exception
+ {
+ }
+
+ public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
+ {
+ }
+
+ public void rename( RenameOperationContext opContext ) throws Exception
+ {
+ }
+
+ public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
+ {
+ return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
+ }
+
+
+ public void unbind( UnbindOperationContext opContext ) throws Exception
+ {
+ }
}
+
class BogusCursor implements Cursor<ServerEntry>
{
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Mon Jun 2 07:00:23 2008
@@ -21,25 +21,26 @@
import junit.framework.TestCase;
+
+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.OperationManager;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.changelog.ChangeLog;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.jndi.DeadContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.schema.SchemaOperationControl;
import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.name.LdapDN;
-import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.ldap.LdapContext;
import java.io.File;
@@ -95,15 +96,15 @@
public void testNoBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup" );
- InvocationStack.getInstance().push( i );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext( ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -120,15 +121,16 @@
public void testSingleBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", Collections.singleton( "0" ) );
- InvocationStack.getInstance().push( i );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
+ opContext.setByPassed( Collections.singleton( "0" ) );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext( ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -145,18 +147,19 @@
public void testAdjacentDoubleBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
Set<String> bypass = new HashSet<String>();
bypass.add( "0" );
bypass.add( "1" );
- Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
- InvocationStack.getInstance().push( i );
+ opContext.setByPassed( bypass );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext( ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -173,18 +176,19 @@
public void testFrontAndBackDoubleBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
Set<String> bypass = new HashSet<String>();
bypass.add( "0" );
bypass.add( "4" );
- Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
- InvocationStack.getInstance().push( i );
+ opContext.setByPassed( bypass );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext( ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -200,18 +204,19 @@
public void testDoubleBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
Set<String> bypass = new HashSet<String>();
bypass.add( "1" );
bypass.add( "3" );
- Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
- InvocationStack.getInstance().push( i );
+ opContext.setByPassed( bypass );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext( ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -227,15 +232,16 @@
public void testCompleteBypass() throws Exception
{
LdapDN dn = new LdapDN( "ou=system" );
- Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
- PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", PartitionNexusProxy.BYPASS_ALL_COLLECTION );
- InvocationStack.getInstance().push( i );
+ DefaultCoreSession session = new DefaultCoreSession(
+ new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
+ LookupOperationContext opContext = new LookupOperationContext( session, dn );
+ opContext.setByPassed( ByPassConstants.BYPASS_ALL_COLLECTION );
+ InvocationStack.getInstance().push( opContext );
try
{
- chain.lookup( new LookupOperationContext(ds.getRegistries(), dn ) );
+ chain.lookup( opContext );
}
catch ( Exception e )
{
@@ -558,5 +564,23 @@
{
return null;
}
+
+
+ public CoreSession getSession() throws Exception
+ {
+ return null;
+ }
+
+
+ public CoreSession getSession( LdapPrincipal principal ) throws Exception
+ {
+ return null;
+ }
+
+
+ public CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication ) throws Exception
+ {
+ return null;
+ }
}
}
Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Mon Jun 2 07:00:23 2008
@@ -36,9 +36,6 @@
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.invocation.Invocation;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.normalization.NormalizationInterceptor;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.referral.ReferralInterceptor;
@@ -161,7 +158,7 @@
entry.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName );
entry.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
- entry.put( getKeyAttribute( addContext.getRegistries(), keys ) );
+ entry.put( getKeyAttribute( addContext.getSession().getDirectoryService().getRegistries(), keys ) );
log.debug( "Adding modified entry '{}' for DN '{}'.", entry, normName
.getUpName() );
@@ -289,22 +286,16 @@
{
LdapDN principalDn = modContext.getDn();
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- ClonedServerEntry userEntry;
-
- LookupOperationContext lookupContext =
- new LookupOperationContext( modContext.getRegistries(),
- new String[]
- {
- SchemaConstants.OBJECT_CLASS_AT,
- KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
- KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
- } );
+ LookupOperationContext lookupContext = modContext.newLookupContext( principalDn );
+ lookupContext.setByPassed( USERLOOKUP_BYPASS );
+ lookupContext.setAttrsId( new String[]
+ {
+ SchemaConstants.OBJECT_CLASS_AT,
+ KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
+ KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
+ } );
- lookupContext.setDn( principalDn );
-
- userEntry = proxy.lookup( lookupContext, USERLOOKUP_BYPASS );
+ ClonedServerEntry userEntry = modContext.lookup( lookupContext );
if ( userEntry == null )
{
@@ -376,7 +367,8 @@
newModsList.add( mod );
}
- AttributeTypeRegistry atRegistry = modContext.getRegistries().getAttributeTypeRegistry();
+ AttributeTypeRegistry atRegistry = modContext.getSession()
+ .getDirectoryService().getRegistries().getAttributeTypeRegistry();
// Add our modification items.
newModsList.add(
@@ -394,9 +386,9 @@
atRegistry.lookup( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
Integer.toString( kvno ) ) ) );
- ServerAttribute attribute = getKeyAttribute( modContext.getRegistries(), keys );
- newModsList.add(
- new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );
+ ServerAttribute attribute = getKeyAttribute( modContext.getSession()
+ .getDirectoryService().getRegistries(), keys );
+ newModsList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );
modContext.setModItems( newModsList );
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java Mon Jun 2 07:00:23 2008
@@ -27,7 +27,9 @@
import javax.naming.directory.DirContext;
import javax.security.auth.kerberos.KerberosPrincipal;
+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.kerberos.shared.store.operations.AddPrincipal;
import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
@@ -37,6 +39,7 @@
import org.apache.directory.server.protocol.shared.catalog.Catalog;
import org.apache.directory.server.protocol.shared.catalog.GetCatalog;
import org.apache.directory.server.protocol.shared.store.ContextOperation;
+import org.apache.directory.shared.ldap.name.LdapDN;
/**
@@ -60,7 +63,8 @@
this.directoryService = directoryService;
try
{
- DirContext ctx = directoryService.getJndiContext(catalogBaseDn);
+ CoreSession session = directoryService.getSession();
+ DirContext ctx = new ServerLdapContext( directoryService, session, new LdapDN( catalogBaseDn ) );
catalog = new KerberosCatalog( ( Map ) execute( ctx, new GetCatalog() ) );
}
catch ( Exception e )
@@ -148,7 +152,7 @@
private DirContext getDirContext( String name ) throws Exception
{
- return directoryService.getJndiContext(catalog.getBaseDn( name ));
+ CoreSession session = directoryService.getSession();
+ return new ServerLdapContext( directoryService, session, new LdapDN( catalog.getBaseDn( name ) ) );
}
-
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java Mon Jun 2 07:00:23 2008
@@ -17,17 +17,19 @@
* under the License.
*
*/
-
package org.apache.directory.server.kerberos.shared.store;
+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.kerberos.shared.store.operations.AddPrincipal;
import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
import org.apache.directory.server.kerberos.shared.store.operations.GetAllPrincipals;
import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
+import org.apache.directory.shared.ldap.name.LdapDN;
import javax.naming.directory.DirContext;
import javax.security.auth.kerberos.KerberosPrincipal;
@@ -49,7 +51,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);
@@ -86,6 +89,4 @@
{
return ( String ) new ChangePassword( principal, newPassword ).execute( ctx, null );
}
-
-
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.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,12 +61,13 @@
}
- 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.ADD_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/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java Mon Jun 2 07:00:23 2008
@@ -33,6 +33,7 @@
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.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.name.LdapDN;
@@ -70,47 +71,51 @@
}
- protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
+ protected void execute0( PartitionNexus nexus, ReplicationStore store, OperationContext opContext )
throws Exception
{
- if ( !EntryUtil.isEntryUpdatable( registries, nexus, dn, getCSN() ) )
+ Registries registries = opContext.getSession().getDirectoryService().getRegistries();
+
+ if ( ! EntryUtil.isEntryUpdatable( opContext, dn, getCSN() ) )
{
return;
}
- EntryUtil.createGlueEntries( registries, nexus, dn, false );
+ EntryUtil.createGlueEntries( opContext, dn, false );
// Replace the entry if an entry with the same name exists.
- if ( nexus.lookup( new LookupOperationContext( registries, dn ) ) != null )
+ if ( nexus.lookup( new LookupOperationContext( opContext.getSession(), dn ) ) != null )
{
- recursiveDelete( nexus, dn, registries );
+ recursiveDelete( nexus, dn, opContext );
}
- nexus.add( new AddOperationContext( registries, ServerEntryUtils.toServerEntry( entry, dn, registries ) ) );
+ nexus.add( new AddOperationContext( opContext.getSession(),
+ ServerEntryUtils.toServerEntry( entry, dn, registries ) ) );
}
@SuppressWarnings("unchecked")
- private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, Registries registries )
+ private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, OperationContext opContext )
throws Exception
{
- EntryFilteringCursor cursor = nexus.list( new ListOperationContext( registries, normalizedName ) );
+ EntryFilteringCursor cursor = nexus.list( new ListOperationContext( opContext.getSession(), normalizedName ) );
if ( !cursor.available() )
{
- nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
+ nexus.delete( new DeleteOperationContext( opContext.getSession(), normalizedName ) );
return;
}
+ Registries registries = opContext.getSession().getDirectoryService().getRegistries();
while ( cursor.next() )
{
ClonedServerEntry sr = cursor.get();
LdapDN dn = sr.getDn();
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- recursiveDelete( nexus, dn, registries );
+ recursiveDelete( nexus, dn, opContext );
}
- nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
+ nexus.delete( new DeleteOperationContext( opContext.getSession(), normalizedName ) );
}