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/05 18:55:32 UTC
svn commit: r525873 - in
/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core:
authn/ authz/ collective/ event/ exception/ interceptor/ normalization/
operational/ partition/ partition/impl/btree/ referral/ schema/ subtree/
tri...
Author: elecharny
Date: Thu Apr 5 09:55:31 2007
New Revision: 525873
URL: http://svn.apache.org/viewvc?view=rev&rev=525873
Log:
Modified the lookup method to take only a LookypServiceContxt as an argument. The direct consequence is that
we don't have anymore two methods for lookup, but only one.
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/authn/SimpleAuthenticator.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/collective/CollectiveAttributesSchemaChecker.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/interceptor/BaseInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/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/partition/AbstractPartition.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.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/subtree/SubentryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -41,6 +42,7 @@
import org.apache.directory.server.core.interceptor.Interceptor;
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.LookupServiceContext;
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;
@@ -48,6 +50,7 @@
import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.StringTools;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -305,29 +308,28 @@
}
- public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( NextInterceptor next, ServiceContext lookupContext ) throws NamingException
{
if ( IS_DEBUG )
{
- log.debug( "Lookup name = '" + dn.toString() + "', attributes = " + attrIds );
- }
-
- checkAuthenticated();
- return next.lookup( dn, attrIds );
- }
-
-
- public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
- {
- if ( IS_DEBUG )
- {
- log.debug( "Lookup name = '" + name.toString() + "'" );
+ LookupServiceContext ctx = (LookupServiceContext)lookupContext;
+
+ List<String> attrIds = ctx.getAttrsId();
+
+ if ( ( attrIds != null ) && ( attrIds.size() != 0 ) )
+ {
+ String attrs = StringTools.listToString( attrIds );
+ log.debug( "Lookup name = '" + ctx.getDn().getUpName() + "', attributes = " + attrs );
+ }
+ else
+ {
+ log.debug( "Lookup name = '" + ctx.getDn().getUpName() + "', no attributes " );
+ }
}
checkAuthenticated();
- return next.lookup( name );
+ return next.lookup( lookupContext );
}
-
private void invalidateAuthenticatorCaches( LdapDN principalDn )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Thu Apr 5 09:55:31 2007
@@ -34,6 +34,7 @@
import javax.naming.directory.Attributes;
import org.apache.commons.collections.map.LRUMap;
+import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerContext;
@@ -96,13 +97,15 @@
{
Set<String> c = new HashSet<String>();
c.add( "normalizationService" );
- c.add( "collectiveAttributeService" );
c.add( "authenticationService" );
+ c.add( "referralService" );
c.add( "authorizationService" );
c.add( "defaultAuthorizationService" );
+ c.add( "exceptionService" );
+ c.add( "operationalAttributeService" );
c.add( "schemaService" );
c.add( "subentryService" );
- c.add( "operationalAttributeService" );
+ c.add( "collectiveAttributeService" );
c.add( "eventService" );
c.add( TriggerService.SERVICE_NAME );
USERLOOKUP_BYPASS = Collections.unmodifiableCollection( c );
@@ -263,8 +266,10 @@
try
{
- userEntry = proxy.lookup( principalDn, new String[]
- { SchemaConstants.USER_PASSWORD_AT }, USERLOOKUP_BYPASS );
+ LookupServiceContext lookupContex = new LookupServiceContext( new String[] { SchemaConstants.USER_PASSWORD_AT } );
+ lookupContex.setDn( principalDn );
+
+ userEntry = proxy.lookup( lookupContex, USERLOOKUP_BYPASS );
if ( userEntry == null )
{
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -30,6 +30,8 @@
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.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.ServerContext;
@@ -242,7 +244,7 @@
{
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- entry = proxy.lookup( parentDn, PartitionNexusProxy.LOOKUP_BYPASS );
+ entry = proxy.lookup( new LookupServiceContext( parentDn), PartitionNexusProxy.LOOKUP_BYPASS );
}
Attribute subentries = AttributeUtils.getAttribute( entry, acSubentryType );
@@ -317,8 +319,8 @@
// will contain the subentryACI attributes that effect subentries
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- Attributes administrativeEntry = proxy.lookup( parentDn, new String[]
- { SUBENTRYACI_ATTR }, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes administrativeEntry = proxy.lookup( new LookupServiceContext( parentDn, new String[]
+ { SUBENTRYACI_ATTR }) , PartitionNexusProxy.LOOKUP_BYPASS );
Attribute subentryAci = administrativeEntry.get( SUBENTRYACI_ATTR );
if ( subentryAci == null )
@@ -441,7 +443,7 @@
// 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( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name) , PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
@@ -481,7 +483,7 @@
// 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( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
@@ -546,7 +548,7 @@
// 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( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
@@ -609,13 +611,21 @@
{
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes entry = proxy.lookup( 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 || name.toString().trim().equals( "" ) ) // no checks on the rootdse
+ if ( isPrincipalAnAdministrator( principalDn ) || !enabled || ( name.size() == 0 ) ) // no checks on the rootdse
{
- return next.hasEntry( name );
+ // No need to go down to the stack, if the dn is empty : it's the rootDSE, and it exists !
+ if ( name.size() == 0 )
+ {
+ return true;
+ }
+ else
+ {
+ return next.hasEntry( name );
+ }
}
Set userGroups = groupCache.getGroups( principalDn.toNormName() );
@@ -681,50 +691,30 @@
}
- public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( NextInterceptor next, ServiceContext lookupContext ) throws NamingException
{
Invocation invocation = InvocationStack.getInstance().peek();
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
- LdapDN principalDn = new LdapDN( principal.getName() );
+ LdapDN principalDn = principal.getJndiName();
principalDn.normalize( attrRegistry.getNormalizerMapping() );
if ( isPrincipalAnAdministrator( principalDn ) || !enabled )
{
- return next.lookup( dn, attrIds );
+ return next.lookup( lookupContext );
}
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes entry = proxy.lookup( dn, PartitionNexusProxy.LOOKUP_BYPASS );
- checkLookupAccess( principal, dn, entry );
- return next.lookup( dn, attrIds );
- }
-
-
- public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
- {
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- Attributes entry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
- LdapPrincipal user = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
- LdapDN principalDn = (LdapDN)user.getJndiName();
- principalDn.normalize( attrRegistry.getNormalizerMapping() );
-
- if ( isPrincipalAnAdministrator( principalDn ) || !enabled )
- {
- return next.lookup( name );
- }
-
- checkLookupAccess( user, name, entry );
- return next.lookup( name );
+ Attributes entry = proxy.lookup( lookupContext, PartitionNexusProxy.LOOKUP_BYPASS );
+ checkLookupAccess( principal, ((LookupServiceContext)lookupContext).getDn(), entry );
+ return next.lookup( lookupContext );
}
-
public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) 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();
- Attributes entry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
LdapDN newName = ( LdapDN ) name.clone();
@@ -797,7 +787,7 @@
// 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( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
LdapDN newName = ( LdapDN ) newParentName.clone();
@@ -833,7 +823,8 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryService,
// but after this service.
- Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ Attributes importedEntry = proxy.lookup( new LookupServiceContext( oriChildName ),
+ PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
// we need to construct an entry to represent it
@@ -893,7 +884,7 @@
// 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( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapDN newName = ( LdapDN ) newParentName.clone();
newName.add( oriChildName.get( oriChildName.size() - 1 ) );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
@@ -929,7 +920,8 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryService,
// but after this service.
- Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ Attributes importedEntry = proxy.lookup( new LookupServiceContext( oriChildName ),
+ PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
// we need to construct an entry to represent it
@@ -1005,7 +997,7 @@
// 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( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
LdapDN principalDn = principal.getJndiName();
@@ -1051,7 +1043,7 @@
// that but if permission is granted then short the process and return the dn
while ( matched.size() > 0 )
{
- entry = proxy.lookup( matched, PartitionNexusProxy.GETMATCHEDDN_BYPASS );
+ entry = proxy.lookup( new LookupServiceContext( matched ), PartitionNexusProxy.GETMATCHEDDN_BYPASS );
Set userGroups = groupCache.getGroups( principalDn.toString() );
Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( proxy, tuples, matched, entry );
@@ -1084,7 +1076,7 @@
* tests. If we hasPermission() returns false we immediately short the
* process and return false.
*/
- Attributes entry = invocation.getProxy().lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes entry = invocation.getProxy().lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
LdapDN userDn = ctx.getPrincipal().getJndiName();
Set userGroups = groupCache.getGroups( userDn.toNormName() );
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -41,6 +41,8 @@
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.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.ServerContext;
@@ -126,7 +128,7 @@
{
// read in the administrators and cache their normalized names
Set<String> newAdministrators = new HashSet<String>( 2 );
- Attributes adminGroup = nexus.lookup( ADMIN_GROUP_DN_NORMALIZED );
+ Attributes adminGroup = nexus.lookup( new LookupServiceContext( ADMIN_GROUP_DN_NORMALIZED ) );
if ( adminGroup == null )
{
@@ -414,28 +416,16 @@
}
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- Attributes attributes = nextInterceptor.lookup( name );
- if ( !enabled || attributes == null )
- {
- return attributes;
- }
-
- protectLookUp( name );
- return attributes;
- }
-
-
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
- {
- Attributes attributes = nextInterceptor.lookup( name, attrIds );
+ Attributes attributes = nextInterceptor.lookup( lookupContext );
+
if ( !enabled || attributes == null )
{
return attributes;
}
- protectLookUp( name );
+ protectLookUp( ((LookupServiceContext)lookupContext).getDn() );
return attributes;
}
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -38,6 +38,8 @@
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.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.partition.PartitionNexus;
@@ -112,7 +114,7 @@
*/
private void addCollectiveAttributes( LdapDN normName, Attributes entry, String[] retAttrs ) throws NamingException
{
- Attributes entryWithCAS = nexus.lookup( normName, new String[] { COLLECTIVE_ATTRIBUTE_SUBENTRIES } );
+ Attributes entryWithCAS = nexus.lookup( new LookupServiceContext( normName, new String[] { COLLECTIVE_ATTRIBUTE_SUBENTRIES } ) );
Attribute caSubentries = entryWithCAS.get( COLLECTIVE_ATTRIBUTE_SUBENTRIES );
/*
@@ -183,7 +185,7 @@
{
String subentryDnStr = ( String ) caSubentries.get( ii );
LdapDN subentryDn = new LdapDN( subentryDnStr );
- Attributes subentry = nexus.lookup( subentryDn );
+ Attributes subentry = nexus.lookup( new LookupServiceContext( subentryDn ) );
NamingEnumeration attrIds = subentry.getIDs();
while ( attrIds.hasMore() )
@@ -277,31 +279,26 @@
// ------------------------------------------------------------------------
// Interceptor Method Overrides
// ------------------------------------------------------------------------
-
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- Attributes result = nextInterceptor.lookup( name );
+ Attributes result = nextInterceptor.lookup( lookupContext );
if ( result == null )
{
return null;
}
- addCollectiveAttributes( name, result, new String[] { "*" } );
- return result;
- }
-
-
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
- {
- Attributes result = nextInterceptor.lookup( name, attrIds );
+ LookupServiceContext ctx = (LookupServiceContext)lookupContext;
- if ( result == null )
+ if ( ( ctx.getAttrsId() == null ) || ( ctx.getAttrsId().size() == 0 ) )
{
- return null;
+ addCollectiveAttributes( ctx.getDn(), result, new String[] { "*" } );
}
-
- addCollectiveAttributes( name, result, attrIds );
+ else
+ {
+ addCollectiveAttributes( ctx.getDn(), result, ctx.getAttrsIdArray() );
+ }
+
return result;
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Thu Apr 5 09:55:31 2007
@@ -26,6 +26,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -94,7 +95,7 @@
public void checkModify( LdapDN normName, ModificationItemImpl[] mods ) throws NamingException
{
- Attributes originalEntry = nexus.lookup( normName );
+ Attributes originalEntry = nexus.lookup( new LookupServiceContext( normName ) );
Attributes targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry );
Attribute targetObjectClasses = targetEntry.get( SchemaConstants.OBJECT_CLASS_AT );
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -33,6 +33,7 @@
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.LookupServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.normalization.NormalizingVisitor;
@@ -257,7 +258,7 @@
public void delete( NextInterceptor next, LdapDN name ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
super.delete( next, name );
Set selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
@@ -284,7 +285,7 @@
private void notifyOnModify( LdapDN name, ModificationItemImpl[] mods, Attributes oriEntry ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Set selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
{
@@ -313,7 +314,7 @@
{
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes oriEntry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes oriEntry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
super.modify( next, name, modOp, mods );
// package modifications in ModItem format for event delivery
@@ -331,7 +332,7 @@
{
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes oriEntry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes oriEntry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
super.modify( next, name, mods );
notifyOnModify( name, mods, oriEntry );
}
@@ -339,7 +340,7 @@
private void notifyOnNameChange( LdapDN oldName, LdapDN newName ) throws NamingException
{
- Attributes entry = nexus.lookup( newName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( newName ) );
Set selecting = getSelectingSources( oldName, entry );
if ( selecting.isEmpty() )
{
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -33,6 +33,8 @@
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.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.partition.Partition;
@@ -124,7 +126,7 @@
try
{
- attrs = nextInterceptor.lookup( parentDn );
+ attrs = nextInterceptor.lookup( new LookupServiceContext( parentDn ) );
}
catch ( Exception e )
{
@@ -206,37 +208,22 @@
/**
- * Checks to make sure the entry being looked up exists other wise throws the appropriate LdapException.
- */
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
- {
- if ( name.getNormName().equals( subschemSubentryDn.getNormName() ) )
- {
- return nexus.getRootDSE();
- }
-
- String msg = "Attempt to lookup non-existant entry: ";
- assertHasEntry( nextInterceptor, msg, name );
-
- return nextInterceptor.lookup( name );
- }
-
-
- /**
* Checks to see the base being searched exists, otherwise throws the appropriate LdapException.
*/
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- if ( name.getNormName().equals( subschemSubentryDn.getNormName() ) )
+ LookupServiceContext ctx = (LookupServiceContext)lookupContext;
+
+ if ( ctx.getDn().getNormName().equals( subschemSubentryDn.getNormName() ) )
{
return nexus.getRootDSE();
}
// check if entry to lookup exists
String msg = "Attempt to lookup non-existant entry: ";
- assertHasEntry( nextInterceptor, msg, name );
+ assertHasEntry( nextInterceptor, msg, ctx.getDn() );
- return nextInterceptor.lookup( name, attrIds );
+ return nextInterceptor.lookup( lookupContext );
}
@@ -259,7 +246,7 @@
assertHasEntry( nextInterceptor, msg, name );
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
NamingEnumeration attrIds = attrs.getIDs();
while ( attrIds.hasMore() )
{
@@ -304,7 +291,7 @@
assertHasEntry( nextInterceptor, msg, name );
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
for ( int ii = 0; ii < items.length; ii++ )
{
if ( items[ii].getModificationOp() == DirContext.ADD_ATTRIBUTE )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java Thu Apr 5 09:55:31 2007
@@ -153,18 +153,12 @@
}
- public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( NextInterceptor next, ServiceContext lookupContext ) throws NamingException
{
- return next.lookup( dn, attrIds );
+ return next.lookup( lookupContext );
}
-
- public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
- {
- return next.lookup( name );
- }
-
-
+
public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
{
next.modify( name, modOp, mods );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java Thu Apr 5 09:55:31 2007
@@ -198,15 +198,9 @@
/**
- * Filters {@link Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN)} call.
+ * Filters {@link Partition#lookup(ServiceContext)} call.
*/
- Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException;
-
-
- /**
- * Filters {@link Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[])} call.
- */
- Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException;
+ Attributes lookup( NextInterceptor next, ServiceContext lookupContext ) throws NamingException;
/**
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Thu Apr 5 09:55:31 2007
@@ -146,15 +146,9 @@
}
- public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor next, ServiceContext lookupContext ) throws NamingException
{
- return ( Attributes ) nexus.lookup( name ).clone();
- }
-
-
- public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
- {
- return ( Attributes ) nexus.lookup( dn, attrIds ).clone();
+ return ( Attributes ) nexus.lookup( lookupContext ).clone();
}
@@ -845,35 +839,14 @@
}
- public Attributes lookup( LdapDN name ) throws NamingException
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
- NextInterceptor next = entry.nextInterceptor;
- try
- {
- return head.lookup( next, name );
- }
- catch ( NamingException ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
Entry entry = getStartingEntry();
Interceptor head = entry.configuration.getInterceptor();
NextInterceptor next = entry.nextInterceptor;
try
{
- return head.lookup( next, dn, attrIds );
+ return head.lookup( next, lookupContext );
}
catch ( NamingException ne )
{
@@ -1280,35 +1253,14 @@
}
- public Attributes lookup( LdapDN name ) throws NamingException
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
-
- try
- {
- return interceptor.lookup( next.nextInterceptor, name );
- }
- catch ( NamingException ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
Entry next = getNextEntry();
Interceptor interceptor = next.configuration.getInterceptor();
try
{
- return interceptor.lookup( next.nextInterceptor, dn, attrIds );
+ return interceptor.lookup( next.nextInterceptor, lookupContext );
}
catch ( NamingException ne )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java Thu Apr 5 09:55:31 2007
@@ -126,15 +126,9 @@
/**
- * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
+ * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,ServiceContext)}.
*/
- Attributes lookup( LdapDN name ) throws NamingException;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String[])}.
- */
- Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
+ Attributes lookup( ServiceContext lookupContext ) throws NamingException;
/**
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -34,6 +34,7 @@
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.LookupServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
@@ -364,17 +365,10 @@
}
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- name = LdapDN.normalize( name, attrNormalizers );
- return nextInterceptor.lookup( name );
- }
-
-
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
- {
- name = LdapDN.normalize( name, attrNormalizers );
- return nextInterceptor.lookup( name, attrIds );
+ LdapDN.normalize( ((LookupServiceContext)lookupContext).getDn(), attrNormalizers );
+ return nextInterceptor.lookup( lookupContext );
}
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -22,6 +22,7 @@
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,6 +43,8 @@
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.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.partition.PartitionNexus;
@@ -269,27 +272,24 @@
}
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- Attributes result = nextInterceptor.lookup( name );
+ Attributes result = nextInterceptor.lookup( lookupContext );
+
if ( result == null )
{
return null;
}
- filter( result );
- return result;
- }
-
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
- {
- Attributes result = nextInterceptor.lookup( name, attrIds );
- if ( result == null )
+ if ( ((LookupServiceContext)lookupContext).getAttrsId() == null )
{
- return null;
+ filter( result );
}
-
- filter( name, result, attrIds );
+ else
+ {
+ filter( lookupContext, result );
+ }
+
return result;
}
@@ -352,18 +352,21 @@
}
- private void filter( Name dn, Attributes entry, String[] ids ) throws NamingException
+ private void filter( ServiceContext lookupContext, Attributes entry ) throws NamingException
{
+ LdapDN dn = ((LookupServiceContext)lookupContext).getDn();
+ List<String> ids = ((LookupServiceContext)lookupContext).getAttrsId();
+
// still need to protect against returning op attrs when ids is null
if ( ids == null )
{
- OperationalAttributeService.this.filter( entry );
+ filter( entry );
return;
}
if ( dn.size() == 0 )
{
- Set<String> idsSet = new HashSet<String>( ids.length );
+ Set<String> idsSet = new HashSet<String>( ids.size() );
for ( String id:ids )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Thu Apr 5 09:55:31 2007
@@ -32,6 +32,8 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -200,7 +202,7 @@
{
try
{
- return lookup( name ) != null;
+ return lookup( new LookupServiceContext( name ) ) != null;
}
catch ( NameNotFoundException e )
{
@@ -214,9 +216,10 @@
* with null <tt>attributeIds</tt> by default. Please override
* this method if there is more effective way for your implementation.
*/
- public Attributes lookup( LdapDN name ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
- return lookup( name, null );
+ return null;
+ //return lookup( lookupContext );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Apr 5 09:55:31 2007
@@ -45,6 +45,7 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
import org.apache.directory.server.core.interceptor.context.BindServiceContext;
+import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
import org.apache.directory.server.core.interceptor.context.ServiceContext;
import org.apache.directory.server.core.interceptor.context.UnbindServiceContext;
import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration;
@@ -474,7 +475,8 @@
}
AttributeType attrType = registry.lookup( oid );
- Attribute attr = partition.lookup( name ).get( attrType.getName() );
+
+ Attribute attr = partition.lookup( new LookupServiceContext( name ) ).get( attrType.getName() );
// complain if the attribute being compared does not exist in the entry
if ( attr == null )
@@ -878,40 +880,47 @@
/**
- * @see Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN)
- */
- public Attributes lookup( LdapDN dn ) throws NamingException
- {
- if ( dn.size() == 0 )
- {
- return ( Attributes ) rootDSE.clone();
- }
-
- Partition backend = getBackend( dn );
- return backend.lookup( dn );
- }
-
-
- /**
* @see Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[])
*/
- public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
+ LookupServiceContext ctx = (LookupServiceContext)lookupContext;
+ LdapDN dn = ctx.getDn();
+
if ( dn.size() == 0 )
{
Attributes retval = new AttributesImpl();
NamingEnumeration list = rootDSE.getIDs();
- while ( list.hasMore() )
+
+ if ( ctx.getAttrsId() != null )
{
- String id = ( String ) list.next();
- Attribute attr = rootDSE.get( id );
- retval.put( ( Attribute ) attr.clone() );
+ while ( list.hasMore() )
+ {
+ String id = ( String ) list.next();
+
+ if ( ctx.getAttrsId().contains( id ) )
+ {
+ Attribute attr = rootDSE.get( id );
+ retval.put( ( Attribute ) attr.clone() );
+ }
+ }
}
+ else
+ {
+ while ( list.hasMore() )
+ {
+ String id = ( String ) list.next();
+
+ Attribute attr = rootDSE.get( id );
+ retval.put( ( Attribute ) attr.clone() );
+ }
+ }
+
return retval;
}
Partition backend = getBackend( dn );
- return backend.lookup( dn, attrIds );
+ return backend.lookup( ctx );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Thu Apr 5 09:55:31 2007
@@ -192,27 +192,15 @@
* Looks up an entry by distinguished/absolute name. This is a simplified
* version of the search operation used to point read an entry used for
* convenience.
+ *
+ * Depending on the context parameters, we my look for a simple entry,
+ * or for a restricted set of attributes for this entry
*
- * @param name the normalized distinguished name of the object to lookup
+ * @param lookupContext The context containing the parameters
* @return an Attributes object representing the entry
* @throws NamingException if there are any problems
*/
- Attributes lookup( LdapDN name ) throws NamingException;
-
-
- /**
- * Looks up an entry by distinguished/absolute name. This is a simplified
- * version of the search operation used to point read an entry used for
- * convenience with a set of attributes to return. If the attributes is
- * null or empty, the returned entry will contain all attributes.
- *
- * @param name the normalized distinguished name of the object to lookup
- * @param attrIds the set of attributes to return
- * @return an Attributes object representing the entry
- * @throws NamingException if there are any problems
- */
- Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
-
+ Attributes lookup( ServiceContext lookupContext ) throws NamingException;
/**
* Fast operation to check and see if a particular entry exists.
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Thu Apr 5 09:55:31 2007
@@ -498,51 +498,27 @@
}
- public Attributes lookup( LdapDN name ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
- return lookup( name, ( Collection ) null );
+ return lookup( lookupContext, ( Collection ) null );
}
- public Attributes lookup( LdapDN name, Collection bypass ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext, Collection bypass ) throws NamingException
{
ensureStarted();
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation( this, caller, "lookup", new Object[]
- { name }, bypass ) );
+ { lookupContext }, bypass ) );
try
{
- return this.configuration.getInterceptorChain().lookup( name );
+ return this.configuration.getInterceptorChain().lookup( lookupContext );
}
finally
{
stack.pop();
}
}
-
-
- public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
- {
- return lookup( dn, attrIds, null );
- }
-
-
- public Attributes lookup( LdapDN dn, String[] attrIds, Collection bypass ) throws NamingException
- {
- ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "lookup", new Object[]
- { dn, attrIds }, bypass ) );
- try
- {
- return this.configuration.getInterceptorChain().lookup( dn, attrIds );
- }
- finally
- {
- stack.pop();
- }
- }
-
public boolean hasEntry( LdapDN name ) throws NamingException
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Thu Apr 5 09:55:31 2007
@@ -34,6 +34,8 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
import org.apache.directory.server.core.enumeration.SearchResultEnumeration;
+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.Partition;
import org.apache.directory.server.core.partition.Oid;
import org.apache.directory.server.core.partition.impl.btree.gui.PartitionViewer;
@@ -432,25 +434,22 @@
}
- public Attributes lookup( LdapDN dn ) throws NamingException
+ public Attributes lookup( ServiceContext lookupContext ) throws NamingException
{
- return lookup( getEntryId( dn.getNormName() ) );
- }
-
+ LookupServiceContext ctx = (LookupServiceContext)lookupContext;
+
+ Attributes entry = lookup( getEntryId( ctx.getDn().getNormName() ) );
- public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
- {
- if ( attrIds == null || attrIds.length == 0 )
+ if ( ( ctx.getAttrsId() == null ) || ( ctx.getAttrsId().size() == 0 ) )
{
- return lookup( dn );
+ return entry;
}
- Attributes entry = lookup( dn );
Attributes retval = new AttributesImpl();
- for ( int ii = 0; ii < attrIds.length; ii++ )
+ for ( String attrId:ctx.getAttrsId() )
{
- Attribute attr = entry.get( attrIds[ii] );
+ Attribute attr = entry.get( attrId );
if ( attr != null )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=525873&r1=525872&r2=525873
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Thu Apr 5 09:55:31 2007
@@ -46,6 +46,7 @@
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.LookupServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -284,7 +285,7 @@
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
AttributeType refsType = attrRegistry.lookup( oidRegistry.getOid( REF_ATTR ) );
Attribute refs = AttributeUtils.getAttribute( referral, refsType );
doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
@@ -321,7 +322,7 @@
return next.compare( normName, oid, value );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
@@ -370,7 +371,7 @@
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
}
@@ -435,7 +436,7 @@
}
else if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -502,7 +503,7 @@
}
else if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -573,7 +574,7 @@
}
if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -687,7 +688,7 @@
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
}
@@ -791,7 +792,7 @@
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
}
@@ -920,7 +921,7 @@
{
if ( lut.isReferral( base ) )
{
- Attributes referral = invocation.getProxy().lookup( base, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( base ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
}
@@ -931,7 +932,7 @@
return next.search( base, env, filter, controls );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
throw new IllegalStateException( "Should never get here: shutting up compiler" );
@@ -940,7 +941,7 @@
{
if ( lut.isReferral( base ) )
{
- Attributes referral = invocation.getProxy().lookup( base, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( base ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
}
@@ -953,7 +954,7 @@
return new ReferralHandlingEnumeration( srfe, lut, attrRegistry, nexus, controls.getSearchScope(), true );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupServiceContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
throw new IllegalStateException( "Should never get here: shutting up compiler" );
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -47,6 +47,8 @@
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.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.partition.PartitionNexus;
@@ -778,7 +780,7 @@
// look up cn=schemaModifications,ou=schema and get values for the
// modifiers and creators operational information
- Attributes modificationAttributes = nexus.lookup( schemaModificationAttributesDN );
+ Attributes modificationAttributes = nexus.lookup( new LookupServiceContext( schemaModificationAttributesDN ) );
if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATE_TIMESTAMP_AT ) )
{
@@ -826,20 +828,9 @@
/**
* Search for an entry, using its DN. Binary attributes and ObjectClass attribute are removed.
*/
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, ServiceContext lookupContext ) throws NamingException
{
- Attributes result = nextInterceptor.lookup( name );
- filterBinaryAttributes( result );
- filterObjectClass( result );
- return result;
- }
-
- /**
- *
- */
- public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
- {
- Attributes result = nextInterceptor.lookup( name, attrIds );
+ Attributes result = nextInterceptor.lookup( lookupContext );
if ( result == null )
{
@@ -1098,9 +1089,11 @@
private void alterObjectClasses( Attribute objectClassAttr ) throws NamingException
{
Set<String> objectClasses = new HashSet<String>();
+ Set<String> objectClassesUP = new HashSet<String>();
// Init the objectClass list with 'top'
objectClasses.add( SchemaConstants.TOP_OC );
+ objectClassesUP.add( SchemaConstants.TOP_OC );
// Construct the new list of ObjectClasses
NamingEnumeration ocList = objectClassAttr.getAll();
@@ -1118,6 +1111,7 @@
if ( !objectClasses.contains( ocLowerName ) )
{
objectClasses.add( ocLowerName );
+ objectClassesUP.add( ocName );
}
List<ObjectClass> ocSuperiors = superiors.get( objectClass.getOid() );
@@ -1129,6 +1123,7 @@
if ( !objectClasses.contains( oc.getName().toLowerCase() ) )
{
objectClasses.add( oc.getName() );
+ objectClassesUP.add( oc.getName() );
}
}
}
@@ -1138,7 +1133,7 @@
// Now, reset the ObjectClass attribute and put the new list into it
objectClassAttr.clear();
- for ( String attribute:objectClasses )
+ for ( String attribute:objectClassesUP )
{
objectClassAttr.add( attribute );
}
@@ -1179,7 +1174,7 @@
}
else
{
- entry = nexus.lookup( name );
+ entry = nexus.lookup( new LookupServiceContext( name ) );
}
Attributes targetEntry = SchemaUtils.getTargetEntry( modOp, mods, entry );
@@ -1327,7 +1322,7 @@
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn )
throws NamingException
{
- Attributes entry = nexus.lookup( oriChildName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( oriChildName ) );
if ( oriChildName.startsWith( schemaBaseDN ) )
{
@@ -1340,7 +1335,7 @@
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException
{
- Attributes entry = nexus.lookup( oriChildName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( oriChildName ) );
if ( oriChildName.startsWith( schemaBaseDN ) )
{
@@ -1353,7 +1348,7 @@
public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
if ( name.startsWith( schemaBaseDN ) )
{
@@ -1377,7 +1372,7 @@
}
else
{
- entry = nexus.lookup( name );
+ entry = nexus.lookup( new LookupServiceContext( name ) );
}
// First, we get the entry from the backend. If it does not exist, then we throw an exception
@@ -1900,7 +1895,7 @@
public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
{
- Attributes entry = nexus.lookup( normName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( normName ) );
if ( normName.startsWith( schemaBaseDN ) )
{
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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -31,6 +31,7 @@
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.LookupServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -375,7 +376,7 @@
// get the name of the administrative point and its administrativeRole attributes
LdapDN apName = ( LdapDN ) normName.clone();
apName.remove( normName.size() - 1 );
- Attributes ap = nexus.lookup( apName );
+ Attributes ap = nexus.lookup( new LookupServiceContext( apName ) );
Attribute administrativeRole = ap.get( "administrativeRole" );
// check that administrativeRole has something valid in it for us
@@ -522,7 +523,7 @@
public void delete( NextInterceptor next, LdapDN name ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
@@ -674,7 +675,7 @@
public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
@@ -745,7 +746,7 @@
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn )
throws NamingException
{
- Attributes entry = nexus.lookup( oriChildName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( oriChildName ) );
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
@@ -816,7 +817,7 @@
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException
{
- Attributes entry = nexus.lookup( oriChildName );
+ Attributes entry = nexus.lookup( new LookupServiceContext( oriChildName ) );
Attribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
@@ -959,7 +960,7 @@
public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attributes oldEntry = (Attributes) entry.clone();
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
@@ -1031,7 +1032,7 @@
if ( !AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
{
- Attributes newEntry = nexus.lookup( name );
+ Attributes newEntry = nexus.lookup( new LookupServiceContext( name ) );
ModificationItemImpl[] subentriesOpAttrMods = getModsOnEntryModification(name, oldEntry, newEntry);
if ( subentriesOpAttrMods.length > 0)
@@ -1045,7 +1046,7 @@
public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
{
- Attributes entry = nexus.lookup( name );
+ Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
Attributes oldEntry = (Attributes) entry.clone();
Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
boolean isSubtreeSpecificationModification = false;
@@ -1128,7 +1129,7 @@
if ( !AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
{
- Attributes newEntry = nexus.lookup( name );
+ Attributes newEntry = nexus.lookup( new LookupServiceContext( name ) );
ModificationItemImpl[] subentriesOpAttrMods = getModsOnEntryModification(name, oldEntry, newEntry);
if ( subentriesOpAttrMods.length > 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=525873&r1=525872&r2=525873
==============================================================================
--- 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 Thu Apr 5 09:55:31 2007
@@ -40,6 +40,7 @@
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.LookupServiceContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -130,7 +131,7 @@
{
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- entry = proxy.lookup( parentDn, PartitionNexusProxy.LOOKUP_BYPASS );
+ entry = proxy.lookup( new LookupServiceContext( parentDn ), PartitionNexusProxy.LOOKUP_BYPASS );
}
Attribute subentries = entry.get( TRIGGER_SUBENTRIES_ATTR );
@@ -276,7 +277,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes deletedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes deletedEntry = proxy.lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( invocation, normName );
@@ -308,7 +309,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes modifiedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes modifiedEntry = proxy.lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, normName, modOp, mods );
@@ -341,7 +342,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes modifiedEntry = proxy.lookup( normName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes modifiedEntry = proxy.lookup( new LookupServiceContext( normName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, normName, mods );
@@ -374,7 +375,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes renamedEntry = proxy.lookup( name, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes renamedEntry = proxy.lookup( new LookupServiceContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
@@ -417,7 +418,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes movedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes movedEntry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
@@ -442,7 +443,7 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryService,
// but after this service.
- Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ Attributes importedEntry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
// we need to construct an entry to represent it
@@ -490,7 +491,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes movedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes movedEntry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
@@ -515,7 +516,7 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryService,
// but after this service.
- Attributes importedEntry = proxy.lookup( oriChildName, PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+ Attributes importedEntry = proxy.lookup( new LookupServiceContext( oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
// we need to construct an entry to represent it