directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1420763 [1/2] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/entry/ core-api/src/main/java/org/apache/directory/server/core/api/filte...
Date Wed, 12 Dec 2012 15:28:32 GMT
Author: elecharny
Date: Wed Dec 12 15:28:12 2012
New Revision: 1420763

URL: http://svn.apache.org/viewvc?rev=1420763&view=rev
Log:
o We don't anymore pass a set of Attributes to a search/list/lookup operation, but only a lost of Strings
o Many fixes if the ServerEntryUtils.filterContent() method : we can now filter Lookup operations correctly (DIRSERVER-1777)
o Removed useless calls to getOperationContex() when the field is accessible in the class
o Completely reviewed the way we create instances of SearchOperationContext/LookupOperationContext/ListOperationContext, especially the way we handle the list of returning attributes
o Removed dead code
o Added a test to demonstrate that DIRSERVER-1777 is fixed
o Fixed bugs in SchemaService, and removed useless code
o Fixed many bugs in the handling of CollectiveAttributes
o We don't any more filter attributes in the SchemaInterceptor
o Resolved some Maven dependency issues, when some module is using test classes from another module
o Removed useless attribute filtering in AbstractBTreePartition
o Added the CoreSession and DirectoryService instances in some jdbm-partition tests, in order to be able to search

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/FilteringOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
    directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
    directory/apacheds/trunk/jdbm-partition/pom.xml
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
    directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
    directory/apacheds/trunk/xdbm-partition/pom.xml
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java Wed Dec 12 15:28:12 2012
@@ -45,7 +45,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.UnbindRequest;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 
 
 /**
@@ -734,26 +733,7 @@ public interface CoreSession
      * @throws Exception if there are failures while listing children
      */
     EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException;
-
-
-    /**
-     * An optimized search operation using one level search scope which 
-     * applies size and time limit constraints and returns all the children 
-     * of an entry specified by distinguished name if thes limits are not
-     * violated.  This is equivalent to a search operation with one level 
-     * scope using the <code>(objectClass=*)</code> filter.
-     *
-     * @param dn the distinguished name of the entry to list the children of
-     * @param aliasDerefMode the alias dereferencing mode used
-     * @param returningAttributes the attributes to return
-     * @param sizeLimit the upper bound to the number of entries to return
-     * @param timeLimit the upper bound to the amount of time before 
-     * terminating the search
-     * @throws Exception if there are failures while listing children
-     */
-    EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException;
+        String... returningAttributes ) throws LdapException;
 
 
     /**
@@ -792,22 +772,7 @@ public interface CoreSession
      * @throws Exception if there are failures while listing children
      */
     EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException;
-
-
-    /**
-     * Searches the directory using a specified search scope and filter.
-     *
-     * @param dn the distinguished name of the entry to list the children of
-     * @param aliasDerefMode the alias dereferencing mode used
-     * @param returningAttributes the attributes to return
-     * @param sizeLimit the upper bound to the number of entries to return
-     * @param timeLimit the upper bound to the amount of time before 
-     * terminating the search
-     * @throws Exception if there are failures while listing children
-     */
-    EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException;
+        String... returningAttributes ) throws LdapException;
 
 
     EntryFilteringCursor search( SearchRequest searchRequest ) throws LdapException;

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java Wed Dec 12 15:28:12 2012
@@ -53,7 +53,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.model.schema.UsageEnum;
 import org.apache.directory.shared.util.EmptyEnumeration;
 import org.apache.directory.shared.util.Strings;
 
@@ -742,17 +741,17 @@ public class ServerEntryUtils
     {
         boolean typesOnly = operationContext.isTypesOnly();
 
-        boolean returnAll = ( operationContext.getReturningAttributes() == null ||
-            ( operationContext.isAllOperationalAttributes() && operationContext.isAllUserAttributes() ) )
+        boolean returnAll = ( operationContext.isAllOperationalAttributes() && operationContext.isAllUserAttributes() )
             && ( !typesOnly );
-
+        
         if ( returnAll )
         {
             return;
         }
-
+        
         Entry originalEntry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
 
+        // First, remove all the attributes if we have the NoAtribute flag set to true
         if ( operationContext.isNoAttributes() )
         {
             for ( Attribute attribute : originalEntry.getAttributes() )
@@ -763,29 +762,27 @@ public class ServerEntryUtils
 
             return;
         }
-
+        
+        SchemaManager schemaManager = operationContext.getSession().getDirectoryService().getSchemaManager();
+        
+        // If the user has requested all the User attributes ('*') only, we filter the entry's attribute to keep only
+        // the USER attributes, plus the Operational attributes in the returning list 
         if ( operationContext.isAllUserAttributes() )
         {
             for ( Attribute attribute : originalEntry.getAttributes() )
             {
                 AttributeType attributeType = attribute.getAttributeType();
-                boolean isNotRequested = true;
 
-                for ( AttributeTypeOptions attrOptions : operationContext.getReturningAttributes() )
+                if ( attributeType.isOperational() )
                 {
-                    if ( attrOptions.getAttributeType().equals( attributeType ) ||
-                        attrOptions.getAttributeType().isAncestorOf( attributeType ) )
+                    if ( !operationContext.contains( schemaManager, attributeType ) )
                     {
-                        isNotRequested = false;
-                        break;
+                        entry.removeAttributes( attributeType );
+                    }
+                    else if ( typesOnly )
+                    {
+                        entry.get( attributeType ).clear();
                     }
-                }
-
-                boolean isNotUserAttribute = attributeType.getUsage() != UsageEnum.USER_APPLICATIONS;
-
-                if ( isNotRequested && isNotUserAttribute )
-                {
-                    entry.removeAttributes( attributeType );
                 }
                 else if ( typesOnly )
                 {
@@ -796,28 +793,25 @@ public class ServerEntryUtils
             return;
         }
 
+        // If the user has requested all the Operational attributes ('+') only, we filter the entry's attribute to keep only
+        // the OPERATIONAL attributes, plus the User attributes in the returning list 
         if ( operationContext.isAllOperationalAttributes() )
         {
             for ( Attribute attribute : originalEntry.getAttributes() )
             {
                 AttributeType attributeType = attribute.getAttributeType();
-                boolean isNotRequested = true;
 
-                for ( AttributeTypeOptions attrOptions : operationContext.getReturningAttributes() )
+
+                if ( attributeType.isUser() )
                 {
-                    if ( attrOptions.getAttributeType().equals( attributeType ) ||
-                        attrOptions.getAttributeType().isAncestorOf( attributeType ) )
+                    if ( !operationContext.contains( schemaManager, attributeType ) )
                     {
-                        isNotRequested = false;
-                        break;
+                        entry.removeAttributes( attributeType );
+                    }
+                    else if ( typesOnly )
+                    {
+                        entry.get( attributeType ).clear();
                     }
-                }
-
-                boolean isUserAttribute = attributeType.getUsage() == UsageEnum.USER_APPLICATIONS;
-
-                if ( isNotRequested && isUserAttribute )
-                {
-                    entry.removeAttributes( attributeType );
                 }
                 else if ( typesOnly )
                 {
@@ -828,10 +822,15 @@ public class ServerEntryUtils
             return;
         }
 
+        // Last, not least, check if the attributes are in the returning list
         if ( operationContext.getReturningAttributes() != null )
         {
             for ( Attribute attribute : originalEntry.getAttributes() )
             {
+                if ( !operationContext.contains( schemaManager, attribute.getAttributeType() ) )
+                {
+                    entry.removeAttributes( attribute.getAttributeType() );
+                }
                 AttributeType attributeType = attribute.getAttributeType();
                 boolean isNotRequested = true;
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java Wed Dec 12 15:28:12 2012
@@ -145,7 +145,7 @@ public class BaseEntryFilteringCursor ex
      */
     public boolean isAbandoned()
     {
-        return getOperationContext().isAbandoned();
+        return operationContext.isAbandoned();
     }
 
 
@@ -154,7 +154,7 @@ public class BaseEntryFilteringCursor ex
      */
     public void setAbandoned( boolean abandoned )
     {
-        getOperationContext().setAbandoned( abandoned );
+        operationContext.setAbandoned( abandoned );
 
         if ( abandoned )
         {
@@ -296,7 +296,7 @@ public class BaseEntryFilteringCursor ex
      */
     public boolean first() throws Exception
     {
-        if ( getOperationContext().isAbandoned() )
+        if ( operationContext.isAbandoned() )
         {
             log.info( "Cursor has been abandoned." );
             close();
@@ -337,7 +337,7 @@ public class BaseEntryFilteringCursor ex
      */
     public boolean last() throws Exception
     {
-        if ( getOperationContext().isAbandoned() )
+        if ( operationContext.isAbandoned() )
         {
             log.info( "Cursor has been abandoned." );
             close();
@@ -355,7 +355,7 @@ public class BaseEntryFilteringCursor ex
      */
     public boolean next() throws Exception
     {
-        if ( getOperationContext().isAbandoned() )
+        if ( operationContext.isAbandoned() )
         {
             log.info( "Cursor has been abandoned." );
             close();
@@ -366,8 +366,6 @@ public class BaseEntryFilteringCursor ex
 
         outer: while ( wrapped.next() )
         {
-            boolean accepted = true;
-
             Entry tempEntry = wrapped.get();
 
             if ( tempEntry == null )
@@ -396,15 +394,15 @@ public class BaseEntryFilteringCursor ex
             if ( filters.isEmpty() )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+                ServerEntryUtils.filterContents( prefetched, operationContext );
                 
                 return true;
             }
 
-            if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( getOperationContext(), tempResult ) )
+            if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( operationContext, tempResult ) )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+                ServerEntryUtils.filterContents( prefetched, operationContext );
 
                 return true;
             }
@@ -413,7 +411,7 @@ public class BaseEntryFilteringCursor ex
             for ( EntryFilter filter : filters )
             {
                 // if a filter rejects then short and continue with outer loop
-                if ( !filter.accept( getOperationContext(), tempResult ) )
+                if ( !filter.accept( operationContext, tempResult ) )
                 {
                     continue outer;
                 }
@@ -423,7 +421,7 @@ public class BaseEntryFilteringCursor ex
              * Here the entry has been accepted by all filters.
              */
             prefetched = tempResult;
-            ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+            ServerEntryUtils.filterContents( prefetched, operationContext );
 
             return true;
         }
@@ -439,7 +437,7 @@ public class BaseEntryFilteringCursor ex
      */
     public boolean previous() throws Exception
     {
-        if ( getOperationContext().isAbandoned() )
+        if ( operationContext.isAbandoned() )
         {
             log.info( "Cursor has been abandoned." );
             close();
@@ -450,7 +448,6 @@ public class BaseEntryFilteringCursor ex
 
         outer: while ( wrapped.previous() )
         {
-            boolean accepted = true;
             Entry entry = wrapped.get();
 
             if ( entry == null )
@@ -471,15 +468,15 @@ public class BaseEntryFilteringCursor ex
             if ( filters.isEmpty() )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+                ServerEntryUtils.filterContents( prefetched, operationContext );
 
                 return true;
             }
 
-            if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( getOperationContext(), tempResult ) )
+            if ( ( filters.size() == 1 ) && filters.get( 0 ).accept( operationContext, tempResult ) )
             {
                 prefetched = tempResult;
-                ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+                ServerEntryUtils.filterContents( prefetched, operationContext );
 
                 return true;
             }
@@ -489,7 +486,7 @@ public class BaseEntryFilteringCursor ex
             for ( EntryFilter filter : filters )
             {
                 // if a filter rejects then short and continue with outer loop
-                if ( !filter.accept( getOperationContext(), tempResult ) )
+                if ( !filter.accept( operationContext, tempResult ) )
                 {
                     continue outer;
                 }
@@ -499,7 +496,7 @@ public class BaseEntryFilteringCursor ex
              * Here the entry has been accepted by all filters.
              */
             prefetched = tempResult;
-            ServerEntryUtils.filterContents( prefetched, getOperationContext() );
+            ServerEntryUtils.filterContents( prefetched, operationContext );
 
             return true;
         }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java Wed Dec 12 15:28:12 2012
@@ -441,13 +441,13 @@ public class CursorList extends Abstract
 
     public boolean isAbandoned()
     {
-        return getOperationContext().isAbandoned();
+        return searchContext.isAbandoned();
     }
 
 
     public void setAbandoned( boolean abandoned )
     {
-        getOperationContext().setAbandoned( abandoned );
+        searchContext.setAbandoned( abandoned );
 
         if ( abandoned )
         {

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java Wed Dec 12 15:28:12 2012
@@ -365,9 +365,9 @@ public abstract class AbstractOperationC
     /**
      * {@inheritDoc}
      */
-    public LookupOperationContext newLookupContext( Dn dn )
+    public LookupOperationContext newLookupContext( Dn dn, String... attributes )
     {
-        LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
+        LookupOperationContext lookupContext = new LookupOperationContext( session, dn, attributes );
         setup( lookupContext );
 
         return lookupContext;

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/FilteringOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/FilteringOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/FilteringOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/FilteringOperationContext.java Wed Dec 12 15:28:12 2012
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.api.interceptor.context;
 
 
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -35,7 +34,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.model.schema.UsageEnum;
-import org.apache.directory.shared.util.StringConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,9 +49,6 @@ public abstract class FilteringOperation
     /** The LoggerFactory used by this Interceptor */
     protected static Logger LOG = LoggerFactory.getLogger( FilteringOperationContext.class );
 
-    private static final String[] EMPTY = new String[]
-        {};
-
     /** A set containing the returning attributeTypesOptions */
     protected Set<AttributeTypeOptions> returningAttributes;
 
@@ -80,7 +75,8 @@ public abstract class FilteringOperation
      */
     public FilteringOperationContext( CoreSession session )
     {
-        super( session );
+        // Default to All User Attributes if we don't have any attributes
+        this( session, SchemaConstants.ALL_USER_ATTRIBUTES );
     }
 
 
@@ -91,7 +87,8 @@ public abstract class FilteringOperation
      */
     public FilteringOperationContext( CoreSession session, Dn dn )
     {
-        super( session, dn );
+        // Default to All User Attributes if we don't have any attributes
+        this( session, dn, SchemaConstants.ALL_USER_ATTRIBUTES );
     }
 
 
@@ -100,9 +97,10 @@ public abstract class FilteringOperation
      * Creates a new instance of LookupOperationContext.
      *
      */
-    public FilteringOperationContext( CoreSession session, Set<AttributeTypeOptions> returningAttributes )
+    public FilteringOperationContext( CoreSession session, String... returningAttributes )
     {
         super( session );
+        
         setReturningAttributes( returningAttributes );
     }
 
@@ -112,9 +110,10 @@ public abstract class FilteringOperation
      * Creates a new instance of LookupOperationContext.
      *
      */
-    public FilteringOperationContext( CoreSession session, Dn dn, Set<AttributeTypeOptions> returningAttributes )
+    public FilteringOperationContext( CoreSession session, Dn dn, String... returningAttributes )
     {
         super( session, dn );
+        
         setReturningAttributes( returningAttributes );
     }
 
@@ -199,221 +198,176 @@ public abstract class FilteringOperation
         {
             AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( attribute );
             
-            if ( ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) && isAllUserAttributes() )
-            {
-                return true;
-            }
-
-            if ( ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS ) && isAllOperationalAttributes() )
-            {
-                return true;
-            }
-
-            AttributeTypeOptions attributeTypeOption = new AttributeTypeOptions( attributeType );
-            
-            boolean present = returningAttributes.contains( attributeTypeOption );
-            
-            return present;
+            return contains( schemaManager, attributeType );
         }
         catch ( LdapException le )
         {
             return false;
         }
     }
-
-
+    
+    
     /**
-     * @param returningAttributes the returningAttributes to set
+     * Tells if an attribute is present in the list of attribute to return
+     * 
+     * @param attributeType The attributeType we are looking for
+     * @return true if the attribute is present
      */
-    public void setReturningAttributes( Set<AttributeTypeOptions> returningAttributes )
+    public boolean contains( SchemaManager schemaManager, AttributeType attributeType )
     {
-        this.returningAttributes = returningAttributes;
+        if ( isNoAttributes() )
+        {
+            return false;
+        }
+        
+        if ( ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) && allUserAttributes )
+        {
+            return true;
+        }
+
+        if ( ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS ) && allOperationalAttributes )
+        {
+            return true;
+        }
+
+        // Loop on the returningAttribute, as we have two conditions to check
+        if ( returningAttributes == null )
+        {
+            return false;
+        }
+        
+        for ( AttributeTypeOptions attributeTypeOptions : returningAttributes )
+        {
+            if ( attributeTypeOptions.getAttributeType().equals( attributeType ) ||
+                attributeTypeOptions.getAttributeType().isAncestorOf( attributeType ) )
+            {
+                return true;
+            }
+        }
+        
+        return false;
     }
-    
-    
-    public void setReturningAttributes( String... attributesIds ) throws LdapException
+
+
+    protected void setReturningAttributes( String... attributeIds )
     {
-        if ( ( attributesIds != null ) && ( attributesIds.length != 0 ) )
+        if ( ( attributeIds != null ) && ( attributeIds.length != 0 ) && ( attributeIds[0] != null ) )
         {
+            // We have something in the list
+            // first, ignore all the unkown AT and convert the strings to 
+            // AttributeTypeOptions
             returningAttributes = new HashSet<AttributeTypeOptions>();
             Set<String> attributesString = new HashSet<String>();
-            int nbInvalid = 0;
             
-            for ( String returnAttribute : attributesIds )
-            {
-                if ( returnAttribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
-                {
-                    noAttributes = true;
-                    continue;
-                }
+            Set<AttributeTypeOptions> collectedAttributes = collectAttributeTypes( attributeIds );
 
-                if ( returnAttribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
-                {
-                    allOperationalAttributes = true;
-                    continue;
-                }
-
-                if ( returnAttribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
-                {
-                    allUserAttributes = true;
-                    continue;
-                }
-
-                try
-                {
-                    String id = SchemaUtils.stripOptions( returnAttribute );
-                    Set<String> options = SchemaUtils.getOptions( returnAttribute );
-
-                    AttributeType attributeType = session.getDirectoryService()
-                        .getSchemaManager().lookupAttributeTypeRegistry( id );
-                    AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );
-
-                    returningAttributes.add( attrOptions );
-                    attributesString.add( attributeType.getOid() );
-                }
-                catch ( LdapNoSuchAttributeException nsae )
-                {
-                    LOG.warn( "Requested attribute {} does not exist in the schema, it will be ignored",
-                        returnAttribute );
-                    // Unknown attributes should be silently ignored, as RFC 2251 states
-                    nbInvalid++;
-                }
-            }
-
-            // reset the noAttribute flag if it is already set cause that will be ignored if any other AT is requested
-            if ( isNoAttributes() && 
-                ( isAllUserAttributes() || 
-                  isAllOperationalAttributes() || 
-                  ( ( returningAttributes != null ) && ( returningAttributes.size() > 0 ) ) ) )
+            // If we have valid, '*' or '+' attributes, we can get rid of the NoAttributes flag
+            if ( ( collectedAttributes.size() > 0 ) || allUserAttributes || allOperationalAttributes )
             {
                 noAttributes = false;
             }
+
+            // Now, loop on the list of attributes, and remove all the USER attributes if
+            // we have the '*' attribute, and remove all the OPERATIONAL attributes if we
+            // have the '+' attribute
+            if ( collectedAttributes.size() > 0 )
+            {
+                for ( AttributeTypeOptions attributeTypeOption : collectedAttributes )
+                {
+                    if ( attributeTypeOption.getAttributeType().isUser() && !allUserAttributes )
+                    {
+                        // We can add the AttributeType in the list of returningAttributeTypes
+                        returningAttributes.add( attributeTypeOption );
+                        attributesString.add( attributeTypeOption.getAttributeType().getOid() );
+                    }
+                    
+                    if ( attributeTypeOption.getAttributeType().isOperational() && !allOperationalAttributes )
+                    {
+                        // We can add the AttributeType in the list of returningAttributeTypes
+                        returningAttributes.add( attributeTypeOption );
+                        attributesString.add( attributeTypeOption.getAttributeType().getOid() );
+                    }
+                }
+            }
             
             if ( attributesString.size() > 0 )
             {
+                // We have some valid attributes, lt's convert it to String
                 returningAttributesString = attributesString.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
             }
-            else if ( nbInvalid > 0 )
+            else 
             {
+                // No valid attributes remaining, that means they were all invalid
                 returningAttributesString = ArrayUtils.EMPTY_STRING_ARRAY;
-            }
-            else
-            {
-                String[] ret = new String[3];
-                
-                int nbElem = 0;
-                
-                if ( isNoAttributes() )
-                {
-                    ret[nbElem++] = SchemaConstants.NO_ATTRIBUTE;
-                }
-                
-                if ( isAllOperationalAttributes() )
-                {
-                    ret[nbElem++] = SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES;
-                }
-                
-                if ( isAllUserAttributes() )
-                {
-                    ret[nbElem++] = SchemaConstants.ALL_USER_ATTRIBUTES;
-                }
-                
-                if ( nbElem == 0 )
-                {
-                    returningAttributesString = new String[]{ SchemaConstants.ALL_USER_ATTRIBUTES };
-                    allUserAttributes = true;
-                }
-                else
-                {
-                    returningAttributesString = new String[nbElem];
-                    System.arraycopy( ret, 0, returningAttributesString, 0, nbElem );
-                }
-            }
+            } 
+        }
+        else
+        {
+            // Nothing in the list : default to '*'
+            allUserAttributes = true;
+            returningAttributesString = ArrayUtils.EMPTY_STRING_ARRAY;
         }
     }
-
-
     
     
-    public void addReturningAttributes( String... attributesIds ) throws LdapException
+    private Set<AttributeTypeOptions> collectAttributeTypes( String... attributesIds )
     {
-        if ( ( attributesIds != null ) && ( attributesIds.length != 0 ) )
+        Set<AttributeTypeOptions> collectedAttributes = new HashSet<AttributeTypeOptions>();
+        
+        if ( ( attributesIds != null ) && ( attributesIds.length != 0 ) ) 
         {
-            Set<String> attributesString = new HashSet<String>();
-            int nbInvalid = 0;
-            
             for ( String returnAttribute : attributesIds )
             {
+                if ( returnAttribute == null )
+                {
+                    continue;
+                }
+                
                 if ( returnAttribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
                 {
                     noAttributes = true;
-                    attributesString.add( SchemaConstants.NO_ATTRIBUTE );
                     continue;
                 }
-
+    
                 if ( returnAttribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
                 {
                     allOperationalAttributes = true;
-                    attributesString.add( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
                     continue;
                 }
-
+    
                 if ( returnAttribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
                 {
                     allUserAttributes = true;
-                    attributesString.add( SchemaConstants.ALL_USER_ATTRIBUTES );
                     continue;
                 }
-
+    
                 try
                 {
                     String id = SchemaUtils.stripOptions( returnAttribute );
                     Set<String> options = SchemaUtils.getOptions( returnAttribute );
-
+    
                     AttributeType attributeType = session.getDirectoryService()
                         .getSchemaManager().lookupAttributeTypeRegistry( id );
                     AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );
-
-                    returningAttributes.add( attrOptions );
-                    
-                    attributesString.add( attributeType.getOid() );
+    
+                    collectedAttributes.add( attrOptions );
                 }
                 catch ( LdapNoSuchAttributeException nsae )
                 {
                     LOG.warn( "Requested attribute {} does not exist in the schema, it will be ignored",
                         returnAttribute );
                     // Unknown attributes should be silently ignored, as RFC 2251 states
-                    nbInvalid++;
                 }
-            }
-
-            // reset the noAttribute flag if it is already set cause that will be ignored if any other AT is requested
-            if ( isNoAttributes() && ( isAllUserAttributes() || isAllOperationalAttributes() || ( !returningAttributes.isEmpty() ) ) )
-            {
-                noAttributes = false;
-            }
-            
-            if ( attributesString.size() > 0 )
-            {
-                returningAttributesString = attributesString.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
-            }
-            else if ( nbInvalid > 0 )
-            {
-                returningAttributesString = ArrayUtils.EMPTY_STRING_ARRAY;
-            }
-            else
-            {
-                returningAttributesString = new String[]{ SchemaConstants.ALL_USER_ATTRIBUTES };
-                allUserAttributes = true;
+                catch ( LdapException le )
+                {
+                    LOG.warn( "Requested attribute {} does not exist in the schema, it will be ignored",
+                        returnAttribute );
+                    // Unknown attributes should be silently ignored, as RFC 2251 states
+                }
             }
         }
-    }
-
-
-    protected void setReturningAttributes( Collection<String> attributesIds )
-        throws LdapException
-    {
-        setReturningAttributes( attributesIds.toArray( StringConstants.EMPTY_STRINGS ) );
+        
+        return collectedAttributes;
     }
 
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java Wed Dec 12 15:28:12 2012
@@ -19,13 +19,9 @@
  */
 package org.apache.directory.server.core.api.interceptor.context;
 
-
-import java.util.Set;
-
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 
 
 /**
@@ -74,7 +70,7 @@ public class ListOperationContext extend
      * @param aliasDerefMode the alias dereferencing mode to use
      * @param returningAttributes the attributes to return
      */
-    public ListOperationContext( CoreSession session, Dn dn, Set<AttributeTypeOptions> returningAttributes )
+    public ListOperationContext( CoreSession session, Dn dn, String... returningAttributes )
     {
         super( session, dn, returningAttributes );
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java Wed Dec 12 15:28:12 2012
@@ -20,13 +20,9 @@
 package org.apache.directory.server.core.api.interceptor.context;
 
 
-import java.util.Set;
-
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.OperationEnum;
-import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 
 
 /**
@@ -79,60 +75,8 @@ public class LookupOperationContext exte
      */
     public LookupOperationContext( CoreSession session, String... returningAttributes )
     {
-        super( session );
-        
-        try
-        {
-            setReturningAttributes( returningAttributes );
-        }
-        catch ( LdapException le )
-        {
-            LOG.error( le.getMessage() );
-        }
-
-        if ( session != null )
-        {
-            setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
-        }
-    }
-
-    
-
-
-    /**
-     * 
-     * Creates a new instance of LookupOperationContext.
-     *
-     */
-    public LookupOperationContext( CoreSession session, Set<AttributeTypeOptions> returningAttributes )
-    {
         super( session, returningAttributes );
-
-        if ( session != null )
-        {
-            setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
-        }
-    }
-
-
-    /**
-     * 
-     * Creates a new instance of LookupOperationContext.
-     *
-     */
-    public LookupOperationContext( CoreSession session, Dn dn, String... returningAttributes )
-    {
-        super( session, dn );
         
-        try
-        {
-            setReturningAttributes( returningAttributes );
-        }
-        catch ( LdapException le )
-        {
-            LOG.error( le.getMessage() );
-        }
-
         if ( session != null )
         {
             setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
@@ -145,10 +89,10 @@ public class LookupOperationContext exte
      * Creates a new instance of LookupOperationContext.
      *
      */
-    public LookupOperationContext( CoreSession session, Dn dn, Set<AttributeTypeOptions> returningAttributes )
+    public LookupOperationContext( CoreSession session, Dn dn, String... returningAttributes )
     {
         super( session, dn, returningAttributes );
-
+        
         if ( session != null )
         {
             setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java Wed Dec 12 15:28:12 2012
@@ -242,7 +242,7 @@ public interface OperationContext
     // -----------------------------------------------------------------------
     // Utility Factory Methods to Create New OperationContexts
     // -----------------------------------------------------------------------
-    LookupOperationContext newLookupContext( Dn dn );
+    LookupOperationContext newLookupContext( Dn dn, String... attributes );
 
 
     Entry lookup( LookupOperationContext lookupContext ) throws LdapException;

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java Wed Dec 12 15:28:12 2012
@@ -20,24 +20,18 @@
 package org.apache.directory.server.core.api.interceptor.context;
 
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
-import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.filter.ExprNode;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.model.message.SearchRequest;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
+import org.apache.directory.shared.util.StringConstants;
 
 
 /**
@@ -75,14 +69,13 @@ public class SearchOperationContext exte
      */
     public SearchOperationContext( CoreSession session, SearchRequest searchRequest ) throws LdapException
     {
-        super( session );
+        super( session, searchRequest.getBase(), searchRequest.getAttributes().toArray( StringConstants.EMPTY_STRINGS ) );
 
         if ( session != null )
         {
             setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
         }
 
-        this.dn = searchRequest.getBase();
         this.filter = searchRequest.getFilter();
         this.abandoned = searchRequest.isAbandoned();
         this.aliasDerefMode = searchRequest.getDerefAliases();
@@ -93,19 +86,6 @@ public class SearchOperationContext exte
         this.timeLimit = searchRequest.getTimeLimit();
         this.typesOnly = searchRequest.getTypesOnly();
 
-        List<String> ats = searchRequest.getAttributes();
-
-        // section 4.5.1.8 of RFC 4511
-        //1. An empty list with no attributes requests the return of all user attributes.
-        if ( ats.isEmpty() )
-        {
-            ats = new ArrayList<String>();
-            ats.add( SchemaConstants.ALL_USER_ATTRIBUTES );
-            ats = Collections.unmodifiableList( ats );
-        }
-
-        setReturningAttributes( ats );
-
         throwReferral = !requestControls.containsKey( ManageDsaIT.OID );
     }
 
@@ -120,7 +100,7 @@ public class SearchOperationContext exte
     public SearchOperationContext( CoreSession session, Dn dn, ExprNode filter, SearchControls searchControls )
         throws LdapException
     {
-        super( session, dn );
+        super( session, dn, searchControls.getReturningAttributes() );
         this.filter = filter;
         scope = SearchScope.getSearchScope( searchControls.getSearchScope() );
         timeLimit = searchControls.getTimeLimit();
@@ -131,15 +111,6 @@ public class SearchOperationContext exte
         {
             setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
         }
-
-        if ( searchControls.getReturningAttributes() != null )
-        {
-            setReturningAttributes( searchControls.getReturningAttributes() );
-        }
-        else
-        {
-            setReturningAttributes( SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
-        }
     }
 
 
@@ -154,7 +125,7 @@ public class SearchOperationContext exte
      * @param returningAttributes the attributes to return
      */
     public SearchOperationContext( CoreSession session, Dn dn, SearchScope scope,
-        ExprNode filter, Set<AttributeTypeOptions> returningAttributes )
+        ExprNode filter, String... returningAttributes )
     {
         super( session, dn, returningAttributes );
         super.setScope( scope );

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java Wed Dec 12 15:28:12 2012
@@ -22,14 +22,11 @@ package org.apache.directory.server.core
 
 import static org.apache.directory.shared.ldap.model.message.SearchScope.ONELEVEL;
 
-import java.util.Set;
-
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 
 
 /**
@@ -86,7 +83,7 @@ public abstract class SearchingOperation
      * @param returningAttributes The list of attributes to return
      * @throws LdapException
      */
-    public SearchingOperationContext( CoreSession session, Dn dn, Set<AttributeTypeOptions> returningAttributes )
+    public SearchingOperationContext( CoreSession session, Dn dn, String... returningAttributes )
     {
         super( session, dn, returningAttributes );
     }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/sp/StoredProcExecutionManager.java Wed Dec 12 15:28:12 2012
@@ -20,9 +20,7 @@
 package org.apache.directory.server.core.api.sp;
 
 
-import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 
 import javax.naming.directory.SearchControls;
 
@@ -40,7 +38,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 
 
 /**
@@ -51,8 +48,6 @@ import org.apache.directory.shared.ldap.
  */
 public class StoredProcExecutionManager
 {
-    private final static Set<AttributeTypeOptions> EMPTY_ATTRIBS = Collections.emptySet();
-
     private final String storedProcContainer;
 
     private final List<StoredProcEngineConfig> storedProcEngineConfigs;
@@ -94,7 +89,8 @@ public class StoredProcExecutionManager
             new StringValue( storeProcUnitNamAT, spUnitName ) );
         Dn dn = session.getDirectoryService().getDnFactory().create( storedProcContainer );
         EntryFilteringCursor results = session.search( dn, SearchScope.SUBTREE, filter,
-            AliasDerefMode.DEREF_ALWAYS, EMPTY_ATTRIBS );
+            AliasDerefMode.DEREF_ALWAYS );
+        
         if ( results.first() )
         {
             Entry entry = results.get();

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java Wed Dec 12 15:28:12 2012
@@ -73,7 +73,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.util.Strings;
 
 
@@ -455,7 +454,7 @@ public class MockCoreSession implements 
      * @see org.apache.directory.server.core.CoreSession#list(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.message.AliasDerefMode, java.util.Set)
      */
     public EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException
+        String... returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
@@ -466,23 +465,6 @@ public class MockCoreSession implements 
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.CoreSession#list(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.message.AliasDerefMode, java.util.Set, int, int)
-     */
-    public EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
-    {
-        OperationManager operationManager = directoryService.getOperationManager();
-
-        ListOperationContext listContext = new ListOperationContext( this, dn, returningAttributes );
-        listContext.setSizeLimit( sizeLimit );
-        listContext.setTimeLimit( timeLimit );
-        listContext.setAliasDerefMode( aliasDerefMode );
-
-        return operationManager.list( listContext );
-    }
-
-
     /**
      * {@inheritDoc} 
      */
@@ -769,8 +751,7 @@ public class MockCoreSession implements 
             throw new LdapInvalidSearchFilterException( pe.getMessage() );
         }
 
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
-            null );
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode, (String)null );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
         setReferralHandling( searchContext, ignoreReferrals );
 
@@ -782,7 +763,7 @@ public class MockCoreSession implements 
      * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.filter.SearchScope, org.apache.directory.shared.ldap.model.filter.ExprNode, org.apache.directory.shared.ldap.model.message.AliasDerefMode, java.util.Set)
      */
     public EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException
+        String... returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
@@ -793,23 +774,6 @@ public class MockCoreSession implements 
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.filter.SearchScope, org.apache.directory.shared.ldap.model.filter.ExprNode, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set, int, int)
-     */
-    public EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
-    {
-        OperationManager operationManager = directoryService.getOperationManager();
-
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
-        searchContext.setSizeLimit( sizeLimit );
-        searchContext.setTimeLimit( timeLimit );
-        searchContext.setAliasDerefMode( aliasDerefMode );
-
-        return operationManager.search( searchContext );
-    }
-
-
     public boolean isAnonymous()
     {
         return Strings.isEmpty( getEffectivePrincipal().getName() );

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java Wed Dec 12 15:28:12 2012
@@ -146,7 +146,7 @@ public class MockOperation implements Op
     }
 
 
-    public LookupOperationContext newLookupContext( Dn dn )
+    public LookupOperationContext newLookupContext( Dn dn, String... attributes )
     {
         return null;
     }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Wed Dec 12 15:28:12 2012
@@ -32,9 +32,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -226,30 +224,16 @@ public class LookupIT extends AbstractLd
     @Test
     public void testLookupWithAttrs() throws Exception
     {
-        EntryCursor cursor = connection.search( "cn=test,ou=system", "(ObjectClass=*)",SearchScope.SUBTREE, "name" );
-        
-        while ( cursor.next() )
-        {
-            Entry entry = cursor.get();
-            assertNotNull( entry );
-            assertEquals( 2, entry.size() );
-            assertEquals( "test", entry.get( "cn" ).getString() );
-            assertEquals( "sn_test", entry.get( "sn" ).getString() );
-            assertFalse( entry.containsAttribute( "objectClass" ) );
-        }
-        
-        cursor.close();
-
-        //Entry entry = connection.lookup( "cn=test,ou=system", "name" );
-        //assertNotNull( entry );
+        Entry entry = connection.lookup( "cn=test,ou=system", "name" );
+        assertNotNull( entry );
 
         // We should have 2 attributes
-        //assertEquals( 2, entry.size() );
+        assertEquals( 2, entry.size() );
 
         // Check that all the user attributes are present
-        //assertEquals( "test", entry.get( "cn" ).getString() );
-        //assertEquals( "sn_test", entry.get( "sn" ).getString() );
-        //assertFalse( entry.containsAttribute( "objectClass" ) );
+        assertEquals( "test", entry.get( "cn" ).getString() );
+        assertEquals( "sn_test", entry.get( "sn" ).getString() );
+        assertFalse( entry.containsAttribute( "objectClass" ) );
     }
 
 

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java Wed Dec 12 15:28:12 2012
@@ -74,7 +74,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.util.Strings;
 
 
@@ -477,7 +476,7 @@ public class DefaultCoreSession implemen
      * @see org.apache.directory.server.core.CoreSession#list(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.message.AliasDerefMode, java.util.Set)
      */
     public EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException
+        String... returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
@@ -488,23 +487,6 @@ public class DefaultCoreSession implemen
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.CoreSession#list(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set, int, int)
-     */
-    public EntryFilteringCursor list( Dn dn, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
-    {
-        OperationManager operationManager = directoryService.getOperationManager();
-
-        ListOperationContext listContext = new ListOperationContext( this, dn, returningAttributes );
-        listContext.setSizeLimit( sizeLimit );
-        listContext.setTimeLimit( timeLimit );
-        listContext.setAliasDerefMode( aliasDerefMode );
-
-        return operationManager.list( listContext );
-    }
-
-
     /**
      * {@inheritDoc}
      */
@@ -802,7 +784,7 @@ public class DefaultCoreSession implemen
         }
 
         SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
-            null );
+            (String)null );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
         setReferralHandling( searchContext, ignoreReferrals );
 
@@ -814,29 +796,12 @@ public class DefaultCoreSession implemen
      * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.filter.SearchScope, org.apache.directory.shared.ldap.model.filter.ExprNode, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set)
      */
     public EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes ) throws LdapException
-    {
-        OperationManager operationManager = directoryService.getOperationManager();
-
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
-        searchContext.setAliasDerefMode( aliasDerefMode );
-
-        return operationManager.search( searchContext );
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.filter.SearchScope, org.apache.directory.shared.ldap.model.filter.ExprNode, org.apache.directory.shared.ldap.model.message.AliasDerefMode, java.util.Set, int, int)
-     */
-    public EntryFilteringCursor search( Dn dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
-        Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
+        String... returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
         SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setAliasDerefMode( aliasDerefMode );
-        searchContext.setSizeLimit( sizeLimit );
-        searchContext.setTimeLimit( timeLimit );
 
         return operationManager.search( searchContext );
     }

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SchemaService.java Wed Dec 12 15:28:12 2012
@@ -25,6 +25,7 @@ import java.util.Set;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.interceptor.context.FilteringOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -47,7 +48,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.shared.ldap.model.schema.registries.NormalizerRegistry;
-import org.apache.directory.shared.util.StringConstants;
 
 
 /**
@@ -340,21 +340,28 @@ public class SchemaService
     /**
      * {@inheritDoc}
      */
-    public static Entry getSubschemaEntry( DirectoryService directoryService, String[] ids ) throws LdapException
+    public static Entry getSubschemaEntry( DirectoryService directoryService, FilteringOperationContext operationContext ) throws LdapException
     {
-        if ( ids == null )
-        {
-            ids = StringConstants.EMPTY_STRINGS;
-        }
-
         SchemaManager schemaManager = directoryService.getSchemaManager();
 
         Set<String> setOids = new HashSet<String>();
         Entry attrs = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
-        boolean returnAllOperationalAttributes = false;
-        boolean returnAllUserAttributes = false;
-        boolean returnNoAttribute = false;
+        boolean returnAllOperationalAttributes = operationContext.isAllOperationalAttributes();
+        boolean returnAllUserAttributes = operationContext.isAllUserAttributes();
+        boolean returnNoAttribute = operationContext.isNoAttributes();
+        
+        String[] oids = operationContext.getReturningAttributesString();
         
+        if ( ( ( oids == null ) || ( oids.length == 0 ) ) && !returnAllOperationalAttributes && !returnAllUserAttributes && returnNoAttribute )
+        {
+            return attrs;
+        }
+        
+        for ( String oid : oids )
+        {
+            setOids.add( oid );
+        }
+
         synchronized ( schemaSubentrLock )
         {
             // ---------------------------------------------------------------
@@ -403,33 +410,6 @@ public class SchemaService
             // ---------------------------------------------------------------
             // Prep Work: Transform the attributes to their OID counterpart
             // ---------------------------------------------------------------
-            for ( String id : ids )
-            {
-                // Check whether the set contains a plus, and use it below to include all
-                // operational attributes.  Due to RFC 3673, and issue DIREVE-228 in JIRA
-                if ( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES.equals( id ) )
-                {
-                    returnAllOperationalAttributes = true;
-                }
-                else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals( id ) )
-                {
-                    returnAllUserAttributes = true;
-                }
-                else if ( SchemaConstants.NO_ATTRIBUTE.equals( id ) )
-                {
-                    returnNoAttribute = true;
-                }
-                else
-                {
-                    setOids.add( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
-                }
-            }
-
-            if ( returnNoAttribute && !returnAllOperationalAttributes && !returnAllUserAttributes && setOids.size() == 0 )
-            {
-                return attrs;
-            }
-
             if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.COMPARATORS_AT_OID ) )
             {
                 addAttribute( attrs, SchemaConstants.COMPARATORS_AT );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed Dec 12 15:28:12 2012
@@ -1277,11 +1277,9 @@ public class DefaultDirectoryService imp
         }
 
         // load the last stored valid CSN value
-        LookupOperationContext loc = new LookupOperationContext( getAdminSession() );
-        loc.setDn( systemPartition.getSuffixDn() );
-
-        // get back all the attributes
-        loc.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext loc = new LookupOperationContext( getAdminSession(), systemPartition.getSuffixDn(),
+            SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        
         Entry entry = systemPartition.lookup( loc );
 
         Attribute cntextCsnAt = entry.get( SchemaConstants.CONTEXT_CSN_AT );

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Wed Dec 12 15:28:12 2012
@@ -264,13 +264,10 @@ public class KeyDerivationInterceptor ex
     {
         Dn principalDn = modContext.getDn();
 
-        LookupOperationContext lookupContext = modContext.newLookupContext( principalDn );
-        lookupContext.setReturningAttributes( new String[]
-            {
+        LookupOperationContext lookupContext = modContext.newLookupContext( principalDn,
                 SchemaConstants.OBJECT_CLASS_AT,
                 KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
-                KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
-        } );
+                KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
 
         Entry userEntry = directoryService.getPartitionNexus().lookup( lookupContext );
 

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Wed Dec 12 15:28:12 2012
@@ -505,8 +505,8 @@ public class AuthenticationInterceptor e
         // load the user entry again if ppolicy is enabled, cause the authenticator might have modified the entry
         if( policyConfig != null )
         {
-            LookupOperationContext lookupContext = new LookupOperationContext( adminSession, bindContext.getDn() );
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = new LookupOperationContext( adminSession, bindContext.getDn(),
+                    SchemaConstants.ALL_ATTRIBUTES_ARRAY );
             userEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         }
         
@@ -1010,8 +1010,8 @@ public class AuthenticationInterceptor e
                 
                 invalidateAuthenticatorCaches( modifyContext.getDn() );
                 
-                LookupOperationContext lookupContext = new LookupOperationContext( adminSession, modifyContext.getDn() );
-                lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+                LookupOperationContext lookupContext = new LookupOperationContext( adminSession, modifyContext.getDn(),
+                    SchemaConstants.ALL_ATTRIBUTES_ARRAY );
                 entry = directoryService.getPartitionNexus().lookup( lookupContext );
                 
                 if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Wed Dec 12 15:28:12 2012
@@ -236,12 +236,10 @@ public class SimpleAuthenticator extends
              * cannot use lookup() yet.  This is a very special
              * case where we cannot rely on the bindContext to perform a new
              * sub operation.
+             * We request all the attributes
              */
             LookupOperationContext lookupContext = new LookupOperationContext( getDirectoryService().getAdminSession(),
-                bindContext.getDn() );
-
-            // OP attributes required for ppolicy
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_USER_ATTRIBUTES, SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
+                bindContext.getDn(), SchemaConstants.ALL_USER_ATTRIBUTES, SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
 
             userEntry = getDirectoryService().getPartitionNexus().lookup( lookupContext );
 

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed Dec 12 15:28:12 2012
@@ -378,8 +378,7 @@ public class AciAuthorizationInterceptor
         {
             Dn parentDn = dn.getParent();
             CoreSession session = opContext.getSession();
-            LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn );
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
             originalEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         }

Modified: directory/apacheds/trunk/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed Dec 12 15:28:12 2012
@@ -389,8 +389,7 @@ public class ChangeLogInterceptor extend
         else
         {
             CoreSession session = opContext.getSession();
-            LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = new LookupOperationContext( session, dn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
             serverEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         }
 



Mime
View raw message