You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/04/10 14:58:49 UTC
svn commit: r527116 - in
/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core:
authn/ authz/ collective/ event/ exception/ normalization/ operational/
schema/ subtree/ trigger/
Author: elecharny
Date: Tue Apr 10 05:58:48 2007
New Revision: 527116
URL: http://svn.apache.org/viewvc?view=rev&rev=527116
Log:
Reflected the modification of the add, modify, compare and delete
operation parameters in the services classes
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java Tue Apr 10 05:58:48 2007
@@ -41,9 +41,10 @@
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.BindServiceContext;
-import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.LdapJndiProperties;
@@ -199,29 +200,30 @@
}
- public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
if ( IS_DEBUG )
{
- log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '"
- + normName.getUpName() + "'" );
+ log.debug( "Adding the entry " +
+ AttributeUtils.toString( ((AddServiceContext)addContext).getEntry() ) +
+ " for DN = '" + addContext.getDn().getUpName() + "'" );
}
checkAuthenticated( MessageTypeEnum.ADD_REQUEST );
- next.add(normName, entry );
+ next.add( addContext );
}
- public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
if ( IS_DEBUG )
{
- log.debug( "Deleting name = '" + name.toString() + "'" );
+ log.debug( "Deleting name = '" + deleteContext.getDn().getUpName() + "'" );
}
checkAuthenticated( MessageTypeEnum.DEL_REQUEST );
- next.delete( name );
- invalidateAuthenticatorCaches( name );
+ next.delete( deleteContext );
+ invalidateAuthenticatorCaches( deleteContext.getDn() );
}
@@ -335,16 +337,18 @@
}
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
if ( IS_DEBUG )
{
- log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString( mods ) );
+ log.debug( "Modifying name = '" + modifyContext.getDn().getUpName() +
+ "', modifs = " + AttributeUtils.toString(
+ ((ModifyServiceContext)modifyContext).getMods() ) );
}
checkAuthenticated( MessageTypeEnum.MODIFY_REQUEST );
- next.modify( name, modOp, mods );
- invalidateAuthenticatorCaches( name );
+ next.modify( modifyContext );
+ invalidateAuthenticatorCaches( modifyContext.getDn() );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java Tue Apr 10 05:58:48 2007
@@ -30,8 +30,10 @@
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
+import org.apache.directory.server.core.interceptor.context.CompareServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
@@ -371,33 +373,37 @@
* -------------------------------------------------------------------------------
*/
- public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
// Access the principal requesting the operation, and bypass checks if it is the admin
Invocation invocation = InvocationStack.getInstance().peek();
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
+
+ Attributes entry = ((AddServiceContext)addContext).getEntry();
+ LdapDN name = addContext.getDn();
// bypass authz code if we are disabled
if ( !enabled )
{
- next.add( normName, entry );
+ next.add( addContext );
return;
}
// bypass authz code but manage caches if operation is performed by the admin
if ( isPrincipalAnAdministrator( principalDn ) )
{
- next.add( normName, entry );
- tupleCache.subentryAdded( normName.toNormName(), normName, entry );
- groupCache.groupAdded( normName.toNormName(), normName, entry );
+ next.add( addContext );
+ tupleCache.subentryAdded( name.getUpName(), name, entry );
+ groupCache.groupAdded( name.getUpName(), name, entry );
return;
}
// perform checks below here for all non-admin users
SubentryService subentryService = ( SubentryService ) chain.get( "subentryService" );
- Attributes subentryAttrs = subentryService.getSubentryAttributes( normName, entry );
+ Attributes subentryAttrs = subentryService.getSubentryAttributes( name, entry );
NamingEnumeration attrList = entry.getAll();
+
while ( attrList.hasMore() )
{
subentryAttrs.put( ( Attribute ) attrList.next() );
@@ -409,12 +415,12 @@
// Build the total collection of tuples to be considered for add rights
// NOTE: entryACI are NOT considered in adds (it would be a security breech)
- addPerscriptiveAciTuples( invocation.getProxy(), tuples, normName, subentryAttrs );
- addSubentryAciTuples( invocation.getProxy(), tuples, normName, subentryAttrs );
+ addPerscriptiveAciTuples( invocation.getProxy(), tuples, name, subentryAttrs );
+ addSubentryAciTuples( invocation.getProxy(), tuples, name, subentryAttrs );
// check if entry scope permission is granted
PartitionNexusProxy proxy = invocation.getProxy();
- engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), normName, null, null,
+ engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, null, null,
ADD_PERMS, tuples, subentryAttrs );
// now we must check if attribute type and value scope permission is granted
@@ -424,41 +430,43 @@
Attribute attr = ( Attribute ) attributeList.next();
for ( int ii = 0; ii < attr.size(); ii++ )
{
- engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), normName, attr
+ engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attr
.getID(), attr.get( ii ), ADD_PERMS, tuples, entry );
}
}
// if we've gotten this far then access has been granted
- next.add( normName, entry );
+ next.add( addContext );
// if the entry added is a subentry or a groupOf[Unique]Names we must
// update the ACITuple cache and the groups cache to keep them in sync
- tupleCache.subentryAdded( normName.toNormName(), normName, entry );
- groupCache.groupAdded( normName.toNormName(), normName, entry );
+ tupleCache.subentryAdded( name.getUpName(), name, entry );
+ groupCache.groupAdded( name.getUpName(), name, entry );
}
- public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
+
// Access the principal requesting the operation, and bypass checks if it is the admin
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes entry = proxy.lookup( new LookupServiceContext( name) , PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name ) , PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
// bypass authz code if we are disabled
if ( !enabled )
{
- next.delete( name );
+ next.delete( deleteContext );
return;
}
// bypass authz code but manage caches if operation is performed by the admin
if ( isPrincipalAnAdministrator( principalDn ) )
{
- next.delete( name );
+ next.delete( deleteContext );
tupleCache.subentryDeleted( name, entry );
groupCache.groupDeleted( name, entry );
return;
@@ -473,17 +481,21 @@
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, null, null,
REMOVE_PERMS, tuples, entry );
- next.delete( name );
+ next.delete( deleteContext );
tupleCache.subentryDeleted( name, entry );
groupCache.groupDeleted( name, entry );
}
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
// Access the principal requesting the operation, and bypass checks if it is the admin
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
+ LdapDN name = modifyContext.getDn();
+ int modOp = ((ModifyServiceContext)modifyContext).getModOp();
+ Attributes mods = ((ModifyServiceContext)modifyContext).getMods();
+
Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
@@ -491,14 +503,14 @@
// bypass authz code if we are disabled
if ( !enabled )
{
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
return;
}
// bypass authz code but manage caches if operation is performed by the admin
if ( isPrincipalAnAdministrator( principalDn ) )
{
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
tupleCache.subentryModified( name, modOp, mods, entry );
groupCache.groupModified( name, modOp, mods, entry );
return;
@@ -515,14 +527,17 @@
NamingEnumeration attrList = mods.getAll();
Collection<MicroOperation> perms = null;
+
switch ( modOp )
{
case ( DirContext.ADD_ATTRIBUTE ):
perms = ADD_PERMS;
break;
+
case ( DirContext.REMOVE_ATTRIBUTE ):
perms = REMOVE_PERMS;
break;
+
case ( DirContext.REPLACE_ATTRIBUTE ):
perms = REPLACE_PERMS;
break;
@@ -531,6 +546,7 @@
while ( attrList.hasMore() )
{
Attribute attr = ( Attribute ) attrList.next();
+
for ( int ii = 0; ii < attr.size(); ii++ )
{
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attr
@@ -538,7 +554,7 @@
}
}
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
tupleCache.subentryModified( name, modOp, mods, entry );
groupCache.groupModified( name, modOp, mods, entry );
}
@@ -994,18 +1010,26 @@
}
- public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
+ public boolean compare( NextInterceptor next, ServiceContext compareContext ) throws NamingException
{
+ CompareServiceContext ctx = (CompareServiceContext)compareContext;
+ LdapDN name = ctx.getDn();
+ String oid = ctx.getOid();
+ Object value = ctx.getValue();
+
// Access the principal requesting the operation, and bypass checks if it is the admin
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup(
+ new LookupServiceContext( name ),
+ PartitionNexusProxy.LOOKUP_BYPASS );
+
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
if ( isPrincipalAnAdministrator( principalDn ) || !enabled )
{
- return next.compare( name, oid, value );
+ return next.compare( compareContext );
}
Set userGroups = groupCache.getGroups( principalDn.toNormName() );
@@ -1019,7 +1043,7 @@
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, oid, value,
COMPARE_PERMS, tuples, entry );
- return next.compare( name, oid, value );
+ return next.compare( compareContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java Tue Apr 10 05:58:48 2007
@@ -150,11 +150,13 @@
// Lookup, search and list operations need to be handled using a filter
// and so we need access to the filter service.
- public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor nextInterceptor, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
+
if ( !enabled )
{
- nextInterceptor.delete( name );
+ nextInterceptor.delete( deleteContext );
return;
}
@@ -196,7 +198,7 @@
throw new LdapNoPermissionException( msg );
}
- nextInterceptor.delete( name );
+ nextInterceptor.delete( deleteContext );
}
@@ -228,23 +230,24 @@
* users to self access these resources. As far as we're concerned no one but
* the admin needs access.
*/
- public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+ public void modify( NextInterceptor nextInterceptor, ServiceContext modifyContext )
throws NamingException
{
if ( enabled )
{
- protectModifyAlterations( name );
- nextInterceptor.modify( name, modOp, attrs );
+ protectModifyAlterations( modifyContext.getDn() );
+ nextInterceptor.modify( modifyContext );
// update administrators if we change administrators group
- if ( name.toNormName().equals( ADMIN_GROUP_DN_NORMALIZED.toNormName() ) )
+ if ( modifyContext.getDn().getNormName().equals( ADMIN_GROUP_DN_NORMALIZED.toNormName() ) )
{
loadAdministrators();
}
+
return;
}
- nextInterceptor.modify( name, modOp, attrs );
+ nextInterceptor.modify( modifyContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java Tue Apr 10 05:58:48 2007
@@ -38,7 +38,9 @@
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
@@ -323,17 +325,18 @@
// Partial Schema Checking
// ------------------------------------------------------------------------
- public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
- collectiveAttributesSchemaChecker.checkAdd( normName, entry );
- super.add( next, normName, entry );
+ collectiveAttributesSchemaChecker.checkAdd( addContext.getDn(), ((AddServiceContext)addContext).getEntry() );
+ super.add( next, addContext );
}
- public void modify( NextInterceptor next, LdapDN normName, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
- collectiveAttributesSchemaChecker.checkModify( normName, modOp, mods );
- super.modify( next, normName, modOp, mods );
+ ModifyServiceContext ctx = (ModifyServiceContext)modifyContext;
+ collectiveAttributesSchemaChecker.checkModify( ctx.getDn(), ctx.getModOp(), ctx.getMods() );
+ super.modify( next, modifyContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java Tue Apr 10 05:58:48 2007
@@ -33,7 +33,10 @@
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.normalization.NormalizingVisitor;
@@ -230,16 +233,21 @@
}
- public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
- super.add( next, normName, entry );
- Set selecting = getSelectingSources( normName, entry );
+ super.add( next, addContext );
+ LdapDN name = addContext.getDn();
+ Attributes entry = ((AddServiceContext)addContext).getEntry();
+
+ Set selecting = getSelectingSources( name, entry );
+
if ( selecting.isEmpty() )
{
return;
}
Iterator list = selecting.iterator();
+
while ( list.hasNext() )
{
EventSourceRecord rec = ( EventSourceRecord ) list.next();
@@ -248,7 +256,7 @@
if ( listener instanceof NamespaceChangeListener )
{
NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener;
- Binding binding = new Binding( normName.getUpName(), entry, false );
+ Binding binding = new Binding( name.getUpName(), entry, false );
nclistener.objectAdded( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_ADDED, binding,
null, entry ) );
}
@@ -256,17 +264,20 @@
}
- public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
- super.delete( next, name );
+ super.delete( next, deleteContext );
Set selecting = getSelectingSources( name, entry );
+
if ( selecting.isEmpty() )
{
return;
}
Iterator list = selecting.iterator();
+
while ( list.hasNext() )
{
EventSourceRecord rec = ( EventSourceRecord ) list.next();
@@ -310,21 +321,24 @@
}
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
+ ModifyServiceContext ctx = (ModifyServiceContext)modifyContext;
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes oriEntry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
- super.modify( next, name, modOp, mods );
+ Attributes oriEntry = proxy.lookup( new LookupServiceContext( ctx.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
+ super.modify( next, modifyContext );
// package modifications in ModItem format for event delivery
- ModificationItemImpl[] modItems = new ModificationItemImpl[mods.size()];
- NamingEnumeration list = mods.getAll();
+ ModificationItemImpl[] modItems = new ModificationItemImpl[ctx.getMods().size()];
+ NamingEnumeration list = ctx.getMods().getAll();
+
for ( int ii = 0; ii < modItems.length; ii++ )
{
- modItems[ii] = new ModificationItemImpl( modOp, ( Attribute ) list.next() );
+ modItems[ii] = new ModificationItemImpl( ctx.getModOp(), ( Attribute ) list.next() );
}
- notifyOnModify( name, modItems, oriEntry );
+
+ notifyOnModify( ctx.getDn(), modItems, oriEntry );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java Tue Apr 10 05:58:48 2007
@@ -35,6 +35,7 @@
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
@@ -102,25 +103,27 @@
* In the pre-invocation state this interceptor method checks to see if the entry to be added already exists. If it
* does an exception is raised.
*/
- public void add( NextInterceptor nextInterceptor, LdapDN normName, Attributes entry )
+ public void add( NextInterceptor nextInterceptor, ServiceContext addContext )
throws NamingException
{
- if ( subschemSubentryDn.getNormName().equals( normName.getNormName() ) )
+ LdapDN name = addContext.getDn();
+
+ if ( subschemSubentryDn.getNormName().equals( name.getNormName() ) )
{
throw new LdapNameAlreadyBoundException(
"The global schema subentry cannot be added since it exists by default." );
}
// check if the entry already exists
- if ( nextInterceptor.hasEntry( new EntryServiceContext( normName ) ) )
+ if ( nextInterceptor.hasEntry( new EntryServiceContext( name ) ) )
{
- NamingException ne = new LdapNameAlreadyBoundException( normName.toString() + " already exists!" );
- ne.setResolvedName( new LdapDN( normName.getUpName() ) );
+ NamingException ne = new LdapNameAlreadyBoundException( name.getUpName() + " already exists!" );
+ ne.setResolvedName( new LdapDN( name.getUpName() ) );
throw ne;
}
- LdapDN parentDn = ( LdapDN ) normName.clone();
- parentDn.remove( normName.size() - 1 );
+ LdapDN parentDn = ( LdapDN ) name.clone();
+ parentDn.remove( name.size() - 1 );
// check if we're trying to add to a parent that is an alias
Attributes attrs = null;
@@ -138,16 +141,17 @@
}
Attribute objectClass = attrs.get( SchemaConstants.OBJECT_CLASS_AT );
+
if ( objectClass.contains( "alias" ) )
{
- String msg = "Attempt to add entry to alias '" + normName.getUpName() + "' not allowed.";
+ String msg = "Attempt to add entry to alias '" + name.getUpName() + "' not allowed.";
ResultCodeEnum rc = ResultCodeEnum.ALIAS_PROBLEM;
NamingException e = new LdapNamingException( msg, rc );
e.setResolvedName( new LdapDN( parentDn.getUpName() ) );
throw e;
}
- nextInterceptor.add( normName, entry );
+ nextInterceptor.add( addContext );
}
@@ -155,8 +159,10 @@
* Checks to make sure the entry being deleted exists, and has no children, otherwise throws the appropriate
* LdapException.
*/
- public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor nextInterceptor, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
+
if ( name.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
{
throw new LdapOperationNotSupportedException(
@@ -172,12 +178,14 @@
// check if entry to delete has children (only leaves can be deleted)
boolean hasChildren = false;
NamingEnumeration list = nextInterceptor.list( name );
+
if ( list.hasMore() )
{
hasChildren = true;
}
list.close();
+
if ( hasChildren )
{
LdapContextNotEmptyException e = new LdapContextNotEmptyException();
@@ -185,7 +193,7 @@
throw e;
}
- nextInterceptor.delete( name );
+ nextInterceptor.delete( deleteContext );
}
@@ -231,31 +239,34 @@
/**
* Checks to see the entry being modified exists, otherwise throws the appropriate LdapException.
*/
- public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+ public void modify( NextInterceptor nextInterceptor, ServiceContext modifyContext )
throws NamingException
{
+ ModifyServiceContext ctx = (ModifyServiceContext)modifyContext;
+
// check if entry to modify exists
String msg = "Attempt to modify non-existant entry: ";
// handle operations against the schema subentry in the schema service
// and never try to look it up in the nexus below
- if ( name.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
+ if ( ctx.getDn().getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
{
- nextInterceptor.modify( name, modOp, attrs );
+ nextInterceptor.modify( modifyContext );
return;
}
- assertHasEntry( nextInterceptor, msg, name );
+ assertHasEntry( nextInterceptor, msg, ctx.getDn() );
- Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
- NamingEnumeration attrIds = attrs.getIDs();
+ Attributes entry = nexus.lookup( new LookupServiceContext( ctx.getDn() ) );
+ NamingEnumeration attrIds = ctx.getMods().getIDs();
+
while ( attrIds.hasMore() )
{
String attrId = ( String ) attrIds.next();
- Attribute modAttr = attrs.get( attrId );
+ Attribute modAttr = ctx.getMods().get( attrId );
Attribute entryAttr = entry.get( attrId );
- if ( modOp == DirContext.ADD_ATTRIBUTE )
+ if ( ctx.getModOp() == DirContext.ADD_ATTRIBUTE )
{
if ( entryAttr != null )
{
@@ -270,7 +281,8 @@
}
}
}
- nextInterceptor.modify( name, modOp, attrs );
+
+ nextInterceptor.modify( modifyContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Tue Apr 10 05:58:48 2007
@@ -33,8 +33,6 @@
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.BindServiceContext;
-import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -110,26 +108,26 @@
// Normalize all Name based arguments for ContextPartition interface operations
// ------------------------------------------------------------------------
- public void add(NextInterceptor nextInterceptor, LdapDN name, Attributes attrs)
+ public void add(NextInterceptor nextInterceptor, ServiceContext addContext)
throws NamingException
{
- LdapDN normalized = LdapDN.normalize( name, attrNormalizers );
- nextInterceptor.add( normalized, attrs );
+ LdapDN.normalize( addContext.getDn(), attrNormalizers );
+ nextInterceptor.add( addContext );
}
- public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor nextInterceptor, ServiceContext deleteContext ) throws NamingException
{
- LdapDN normalized = LdapDN.normalize( name, attrNormalizers );
- nextInterceptor.delete( normalized );
+ LdapDN.normalize( deleteContext.getDn(), attrNormalizers );
+ nextInterceptor.delete( deleteContext );
}
- public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+ public void modify( NextInterceptor nextInterceptor, ServiceContext modifyContext )
throws NamingException
{
- LdapDN normalized = LdapDN.normalize( name, attrNormalizers );
- nextInterceptor.modify( normalized, modOp, attrs );
+ LdapDN.normalize( modifyContext.getDn(), attrNormalizers );
+ nextInterceptor.modify( modifyContext );
}
@@ -384,10 +382,10 @@
}
- public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
+ public boolean compare( NextInterceptor next, ServiceContext compareContext ) throws NamingException
{
- name = LdapDN.normalize( name, attrNormalizers );
- return next.compare( name, oid, value );
+ LdapDN.normalize( compareContext.getDn(), attrNormalizers );
+ return next.compare( compareContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Tue Apr 10 05:58:48 2007
@@ -26,7 +26,6 @@
import java.util.Map;
import java.util.Set;
-import javax.naming.Name;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -43,7 +42,9 @@
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
@@ -148,10 +149,11 @@
/**
* Adds extra operational attributes to the entry before it is added.
*/
- public void add(NextInterceptor nextInterceptor, LdapDN normName, Attributes entry)
+ public void add(NextInterceptor nextInterceptor, ServiceContext addContext )
throws NamingException
{
String principal = getPrincipal().getName();
+ Attributes entry = ((AddServiceContext)addContext).getEntry();
Attribute attribute = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT );
attribute.add( principal );
@@ -161,16 +163,16 @@
attribute.add( DateUtils.getGeneralizedTime() );
entry.put( attribute );
- nextInterceptor.add(normName, entry );
+ nextInterceptor.add( addContext );
}
- public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
+ public void modify( NextInterceptor nextInterceptor, ServiceContext modifyContext )
throws NamingException
{
- nextInterceptor.modify( name, modOp, attrs );
+ nextInterceptor.modify( modifyContext );
- if ( name.getNormName().equals( subschemaSubentryDn.getNormName() ) )
+ if ( modifyContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName() ) )
{
return;
}
@@ -185,7 +187,11 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
+ ModifyServiceContext newModify = new ModifyServiceContext(
+ modifyContext.getDn(),
+ DirContext.REPLACE_ATTRIBUTE,
+ attributes);
+ nexus.modify( newModify );
}
@@ -208,7 +214,11 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
+ ModifyServiceContext newModify = new ModifyServiceContext(
+ name,
+ DirContext.REPLACE_ATTRIBUTE,
+ attributes);
+ nexus.modify( newModify );
}
@@ -231,7 +241,12 @@
newDn.remove( name.size() - 1 );
newDn.add( newRn );
newDn.normalize( registry.getNormalizerMapping() );
- nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes );
+
+ ModifyServiceContext newModify = new ModifyServiceContext(
+ newDn,
+ DirContext.REPLACE_ATTRIBUTE,
+ attributes);
+ nexus.modify( newModify );
}
@@ -249,7 +264,11 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
+ ModifyServiceContext newModify = new ModifyServiceContext(
+ newParentName,
+ DirContext.REPLACE_ATTRIBUTE,
+ attributes);
+ nexus.modify( newModify );
}
@@ -268,7 +287,11 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
+ ModifyServiceContext newModify = new ModifyServiceContext(
+ newParentName,
+ DirContext.REPLACE_ATTRIBUTE,
+ attributes);
+ nexus.modify( newModify );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Tue Apr 10 05:58:48 2007
@@ -47,7 +47,9 @@
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
@@ -1162,8 +1164,12 @@
* current entry or is not added by a previous modification operation.
* @throws LdapSchemaViolationException Another schema violation occured.
*/
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
+ LdapDN name = modifyContext.getDn();
+ int modOp = ((ModifyServiceContext)modifyContext).getModOp();
+ Attributes mods = ((ModifyServiceContext)modifyContext).getMods();
+
Attributes entry = null;
// handle operations against the schema subentry in the schema service
@@ -1315,7 +1321,7 @@
return;
}
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
}
@@ -1837,16 +1843,19 @@
/**
* Check that all the attributes exist in the schema for this entry.
*/
- public void add( NextInterceptor next, LdapDN normName, Attributes attrs ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
- check( normName, attrs );
+ LdapDN name = addContext.getDn();
+ Attributes attrs = ((AddServiceContext)addContext).getEntry();
+
+ check( name, attrs );
- if ( normName.startsWith( schemaBaseDN ) )
+ if ( name.startsWith( schemaBaseDN ) )
{
- schemaManager.add( normName, attrs );
+ schemaManager.add( name, attrs );
}
- next.add( normName, attrs );
+ next.add( addContext );
}
@@ -1893,16 +1902,17 @@
}
- public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
- Attributes entry = nexus.lookup( new LookupServiceContext( normName ) );
+ LdapDN name = deleteContext.getDn();
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
- if ( normName.startsWith( schemaBaseDN ) )
+ if ( name.startsWith( schemaBaseDN ) )
{
- schemaManager.delete( normName, entry );
+ schemaManager.delete( name, entry );
}
- next.delete( normName );
+ next.delete( deleteContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Tue Apr 10 05:58:48 2007
@@ -28,6 +28,8 @@
import javax.naming.directory.Attributes;
import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
+import org.apache.directory.server.core.interceptor.context.DeleteServiceContext;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.schema.bootstrap.Schema;
@@ -133,7 +135,7 @@
Schema schema = dao.getSchema( obj.getSchema() );
LdapDN dn = getDn( obj );
Attributes attrs = factory.getAttributes( obj, schema );
- proxy.add( dn, attrs, BYPASS );
+ proxy.add( new AddServiceContext( dn, attrs ), BYPASS );
}
@@ -141,7 +143,7 @@
{
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = getDn( obj );
- proxy.delete( dn, BYPASS );
+ proxy.delete( new DeleteServiceContext( dn ), BYPASS );
}
@@ -151,7 +153,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( dn, BYPASS );
+ proxy.delete( new DeleteServiceContext( dn ), BYPASS );
}
@@ -161,7 +163,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( dn, BYPASS );
+ proxy.delete( new DeleteServiceContext( dn ), BYPASS );
}
@@ -171,7 +173,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( dn, BYPASS );
+ proxy.delete( new DeleteServiceContext( dn ), BYPASS );
}
@@ -182,7 +184,7 @@
LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( comparatorDescription );
- proxy.add( dn, attrs, BYPASS );
+ proxy.add( new AddServiceContext( dn, attrs ), BYPASS );
}
@@ -216,7 +218,7 @@
LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( normalizerDescription );
- proxy.add( dn, attrs, BYPASS );
+ proxy.add( new AddServiceContext( dn, attrs ), BYPASS );
}
@@ -250,7 +252,7 @@
LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( syntaxCheckerDescription );
- proxy.add( dn, attrs, BYPASS );
+ proxy.add( new AddServiceContext( dn, attrs ), BYPASS );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Tue Apr 10 05:58:48 2007
@@ -31,7 +31,10 @@
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -367,15 +370,18 @@
}
- public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
+ LdapDN name = addContext.getDn();
+ Attributes entry = ((AddServiceContext)addContext).getEntry();
+
Attribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
{
// get the name of the administrative point and its administrativeRole attributes
- LdapDN apName = ( LdapDN ) normName.clone();
- apName.remove( normName.size() - 1 );
+ LdapDN apName = ( LdapDN ) name.clone();
+ apName.remove( name.size() - 1 );
Attributes ap = nexus.lookup( new LookupServiceContext( apName ) );
Attribute administrativeRole = ap.get( "administrativeRole" );
@@ -398,7 +404,7 @@
*/
Subentry subentry = new Subentry();
subentry.setTypes( getSubentryTypes( entry ) );
- Attributes operational = getSubentryOperatationalAttributes( normName, subentry );
+ Attributes operational = getSubentryOperatationalAttributes( name, subentry );
/* ----------------------------------------------------------------
* Parse the subtreeSpecification of the subentry and add it to the
@@ -409,18 +415,20 @@
*/
String subtree = ( String ) entry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).get();
SubtreeSpecification ss;
+
try
{
ss = ssParser.parse( subtree );
}
catch ( Exception e )
{
- String msg = "Failed while parsing subtreeSpecification for " + normName.getUpName();
+ String msg = "Failed while parsing subtreeSpecification for " + name.getUpName();
log.warn( msg );
throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
}
- subentryCache.setSubentry( normName.toString(), ss, getSubentryTypes( entry ) );
- next.add(normName, entry );
+
+ subentryCache.setSubentry( name.getNormName(), ss, getSubentryTypes( entry ) );
+ next.add( addContext );
/* ----------------------------------------------------------------
* Find the baseDn for the subentry and use that to search the tree
@@ -440,6 +448,7 @@
{ "+", "*" } );
NamingEnumeration subentries = nexus.search( baseDn, factoryCfg.getEnvironment(), filter, controls );
+
while ( subentries.hasMore() )
{
SearchResult result = ( SearchResult ) subentries.next();
@@ -456,6 +465,7 @@
else
{
Iterator list = subentryCache.nameIterator();
+
while ( list.hasNext() )
{
String subentryDnStr = ( String ) list.next();
@@ -465,54 +475,65 @@
Subentry subentry = subentryCache.getSubentry( subentryDnStr );
SubtreeSpecification ss = subentry.getSubtreeSpecification();
- if ( evaluator.evaluate( ss, apDn, normName, entry ) )
+ if ( evaluator.evaluate( ss, apDn, name, entry ) )
{
Attribute operational;
if ( subentry.isAccessControlSubentry() )
{
operational = entry.get( AC_SUBENTRIES );
+
if ( operational == null )
{
operational = new AttributeImpl( AC_SUBENTRIES );
entry.put( operational );
}
+
operational.add( subentryDn.toString() );
}
+
if ( subentry.isSchemaSubentry() )
{
operational = entry.get( SCHEMA_SUBENTRY );
+
if ( operational == null )
{
operational = new AttributeImpl( SCHEMA_SUBENTRY );
entry.put( operational );
}
+
operational.add( subentryDn.toString() );
}
+
if ( subentry.isCollectiveSubentry() )
{
operational = entry.get( COLLECTIVE_ATTRIBUTE_SUBENTRIES );
+
if ( operational == null )
{
operational = new AttributeImpl( COLLECTIVE_ATTRIBUTE_SUBENTRIES );
entry.put( operational );
}
+
operational.add( subentryDn.toString() );
}
+
if ( subentry.isTriggerSubentry() )
{
operational = entry.get( TRIGGER_SUBENTRIES );
+
if ( operational == null )
{
operational = new AttributeImpl( TRIGGER_SUBENTRIES );
entry.put( operational );
}
+
operational.add( subentryDn.toString() );
}
}
}
- next.add(normName, entry );
+ next.add( addContext );
}
}
@@ -521,15 +542,16 @@
// Methods dealing subentry deletion
// -----------------------------------------------------------------------
- public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
{
SubtreeSpecification ss = subentryCache.removeSubentry( name.toNormName() ).getSubtreeSpecification();
- next.delete( name );
+ next.delete( deleteContext );
/* ----------------------------------------------------------------
* Find the baseDn for the subentry and use that to search the tree
@@ -551,6 +573,7 @@
{ "+", "*" } );
NamingEnumeration subentries = nexus.search( baseDn, factoryCfg.getEnvironment(), filter, controls );
+
while ( subentries.hasMore() )
{
SearchResult result = ( SearchResult ) subentries.next();
@@ -566,7 +589,7 @@
}
else
{
- next.delete( name );
+ next.delete( deleteContext );
}
}
@@ -958,8 +981,12 @@
}
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
+ LdapDN name = modifyContext.getDn();
+ int modOp = ((ModifyServiceContext)modifyContext).getModOp();
+ Attributes mods = ((ModifyServiceContext)modifyContext).getMods();
+
Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attributes oldEntry = (Attributes) entry.clone();
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
@@ -981,7 +1008,7 @@
}
subentryCache.setSubentry( name.toNormName(), ssNew, getSubentryTypes( entry, modOp, mods ) );
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
// search for all entries selected by the old SS and remove references to subentry
LdapDN apName = ( LdapDN ) name.clone();
@@ -994,6 +1021,7 @@
controls.setReturningAttributes( new String[]
{ "+", "*" } );
NamingEnumeration subentries = nexus.search( oldBaseDn, factoryCfg.getEnvironment(), filter, controls );
+
while ( subentries.hasMore() )
{
SearchResult result = ( SearchResult ) subentries.next();
@@ -1013,6 +1041,7 @@
LdapDN newBaseDn = ( LdapDN ) apName.clone();
newBaseDn.addAll( ssNew.getBase() );
subentries = nexus.search( newBaseDn, factoryCfg.getEnvironment(), filter, controls );
+
while ( subentries.hasMore() )
{
SearchResult result = ( SearchResult ) subentries.next();
@@ -1028,13 +1057,14 @@
}
else
{
- next.modify( name, modOp, mods );
+ next.modify( modifyContext );
if ( !AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
{
Attributes newEntry = nexus.lookup( new LookupServiceContext( name ) );
ModificationItemImpl[] subentriesOpAttrMods = getModsOnEntryModification(name, oldEntry, newEntry);
+
if ( subentriesOpAttrMods.length > 0)
{
nexus.modify(name, subentriesOpAttrMods);
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Tue Apr 10 05:58:48 2007
@@ -28,6 +28,8 @@
import javax.naming.directory.Attributes;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -49,9 +51,12 @@
init( modifiedEntryName, modifications );
}
- public ModifyStoredProcedureParameterInjector( Invocation invocation, LdapDN modifiedEntryName, int modOp, Attributes modifications ) throws NamingException
+ public ModifyStoredProcedureParameterInjector( Invocation invocation, ServiceContext modifyContext ) throws NamingException
{
super( invocation );
+ Attributes modifications = ((ModifyServiceContext)modifyContext).getMods();
+ int modOp = ((ModifyServiceContext)modifyContext).getModOp();
+
ModificationItemImpl[] mods = new ModificationItemImpl[ modifications.size() ];
NamingEnumeration modEnum = modifications.getAll();
int i = 0;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java Tue Apr 10 05:58:48 2007
@@ -40,7 +40,9 @@
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddServiceContext;
import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -232,12 +234,15 @@
this.enabled = true; // TODO: Get this from the configuration if needed.
}
- public void add( NextInterceptor next, LdapDN normName, Attributes addedEntry ) throws NamingException
+ public void add( NextInterceptor next, ServiceContext addContext ) throws NamingException
{
+ LdapDN name = addContext.getDn();
+ Attributes entry = ((AddServiceContext)addContext).getEntry();
+
// Bypass trigger handling if the service is disabled.
if ( !enabled )
{
- next.add( normName, addedEntry );
+ next.add( addContext );
return;
}
@@ -245,11 +250,12 @@
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( invocation, normName, addedEntry );
+ StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( invocation, name, entry );
// Gather Trigger Specifications which apply to the entry being deleted.
List triggerSpecs = new ArrayList();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, addedEntry );
+ addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, entry );
+
/**
* NOTE: We do not handle entryTriggerSpecs for ADD operation.
*/
@@ -257,72 +263,74 @@
// Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.ADD.
Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.ADD );
- next.add( normName, addedEntry );
- triggerSpecCache.subentryAdded( normName, addedEntry );
+ next.add( addContext );
+ triggerSpecCache.subentryAdded( name, entry );
// Fire AFTER Triggers.
List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
}
- public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
+ public void delete( NextInterceptor next, ServiceContext deleteContext ) throws NamingException
{
+ LdapDN name = deleteContext.getDn();
+
// Bypass trigger handling if the service is disabled.
if ( !enabled )
{
- next.delete( normName );
+ next.delete( deleteContext );
return;
}
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes deletedEntry = proxy.lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes deletedEntry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( invocation, normName );
+ StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( invocation, name );
// Gather Trigger Specifications which apply to the entry being deleted.
List triggerSpecs = new ArrayList();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, deletedEntry );
+ addPrescriptiveTriggerSpecs( triggerSpecs, proxy, name, deletedEntry );
addEntryTriggerSpecs( triggerSpecs, deletedEntry );
// Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.DELETE.
Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.DELETE );
- next.delete( normName );
- triggerSpecCache.subentryDeleted( normName, deletedEntry );
+ next.delete( deleteContext );
+ triggerSpecCache.subentryDeleted( name, deletedEntry );
// Fire AFTER Triggers.
List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
}
- public void modify( NextInterceptor next, LdapDN normName, int modOp, Attributes mods ) throws NamingException
+ public void modify( NextInterceptor next, ServiceContext modifyContext ) throws NamingException
{
// Bypass trigger handling if the service is disabled.
if ( !enabled )
{
- next.modify( normName, modOp, mods );
+ next.modify( modifyContext );
return;
}
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes modifiedEntry = proxy.lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes modifiedEntry = proxy.lookup( new LookupServiceContext( modifyContext.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
- StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, normName, modOp, mods );
+ StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, modifyContext );
// Gather Trigger Specifications which apply to the entry being modified.
List triggerSpecs = new ArrayList();
- addPrescriptiveTriggerSpecs( triggerSpecs, proxy, normName, modifiedEntry );
+ addPrescriptiveTriggerSpecs( triggerSpecs, proxy, modifyContext.getDn(), modifiedEntry );
addEntryTriggerSpecs( triggerSpecs, modifiedEntry );
// Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation = LdapOperation.MODIFY.
Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY );
- next.modify( normName, modOp, mods );
- triggerSpecCache.subentryModified( normName, modOp, mods, modifiedEntry );
+ next.modify( modifyContext );
+ triggerSpecCache.subentryModified( modifyContext, modifiedEntry );
// Fire AFTER Triggers.
List afterTriggerSpecs = ( List ) triggerMap.get( ActionTime.AFTER );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?view=diff&rev=527116&r1=527115&r2=527116
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Tue Apr 10 05:58:48 2007
@@ -38,6 +38,8 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -215,17 +217,17 @@
}
- public void subentryModified( LdapDN normName, int modOp, Attributes mods, Attributes entry ) throws NamingException
+ public void subentryModified( ServiceContext modifyContext, Attributes entry ) throws NamingException
{
if ( !hasPrescriptiveTrigger( entry ) )
{
return;
}
- if ( mods.get( PRESCRIPTIVE_TRIGGER_ATTR ) != null )
+ if ( ((ModifyServiceContext)modifyContext).getMods().get( PRESCRIPTIVE_TRIGGER_ATTR ) != null )
{
- subentryDeleted( normName, entry );
- subentryAdded( normName, entry );
+ subentryDeleted( modifyContext.getDn(), entry );
+ subentryAdded( modifyContext.getDn(), entry );
}
}