directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1420763 [2/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
Modified: directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Wed Dec 12 15:28:12 2012
@@ -32,10 +32,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.FilteringOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.OperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.i18n.I18n;
@@ -90,8 +90,7 @@ public class CollectiveAttributeIntercep
          */
         public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
         {
-            String[] retAttrs = operation.getReturningAttributesString();
-            addCollectiveAttributes( operation, entry, retAttrs );
+            addCollectiveAttributes( operation, entry );
 
             return true;
         }
@@ -165,14 +164,7 @@ public class CollectiveAttributeIntercep
         }
         
         // Adding the collective attributes if any
-        if ( ( lookupContext.getReturningAttributes() == null ) || ( lookupContext.getReturningAttributes().size() == 0 ) )
-        {
-            addCollectiveAttributes( lookupContext, result, SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
-        }
-        else
-        {
-            addCollectiveAttributes( lookupContext, result, lookupContext.getReturningAttributesString() );
-        }
+        addCollectiveAttributes( lookupContext, result );
 
         return result;
     }
@@ -346,12 +338,13 @@ public class CollectiveAttributeIntercep
      * @param opContext the context of the operation collective attributes
      * are added to
      * @param entry the entry to have the collective attributes injected
-     * @param retAttrs array or attribute type to be specifically included in the result entry(s)
      * @throws LdapException if there are problems accessing subentries
      */
-    private void addCollectiveAttributes( OperationContext opContext, Entry entry, String[] retAttrs )
+    private void addCollectiveAttributes( FilteringOperationContext opContext, Entry entry )
         throws LdapException
     {
+        CoreSession session = opContext.getSession();
+
         Attribute collectiveAttributeSubentries = ( ( ClonedServerEntry ) entry ).getOriginalEntry().get(
             COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
 
@@ -396,34 +389,6 @@ public class CollectiveAttributeIntercep
         }
 
         /*
-         * If no attributes are requested specifically
-         * then it means all user attributes are requested.
-         * So populate the array with all user attributes indicator: "*".
-         */
-        if ( retAttrs == null )
-        {
-            retAttrs = SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY;
-        }
-
-        /*
-         * Construct a set of requested attributes for easier tracking.
-         */
-        Set<String> retIdsSet = new HashSet<String>( retAttrs.length );
-
-        for ( String retAttr : retAttrs )
-        {
-            if ( retAttr.equals( SchemaConstants.ALL_USER_ATTRIBUTES )
-                || retAttr.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
-            {
-                retIdsSet.add( retAttr );
-            }
-            else
-            {
-                retIdsSet.add( schemaManager.lookupAttributeTypeRegistry( retAttr ).getOid() );
-            }
-        }
-
-        /*
          * For each collective subentry referenced by the entry we lookup the
          * attributes of the subentry and copy collective attributes from the
          * subentry into the entry.
@@ -431,7 +396,7 @@ public class CollectiveAttributeIntercep
         for ( Value<?> value : collectiveAttributeSubentries )
         {
             String subentryDnStr = value.getString();
-            Dn subentryDn = opContext.getSession().getDirectoryService().getDnFactory().create( subentryDnStr );
+            Dn subentryDn = session.getDirectoryService().getDnFactory().create( subentryDnStr );
 
             /*
              * TODO - Instead of hitting disk here can't we leverage the
@@ -440,7 +405,6 @@ public class CollectiveAttributeIntercep
              * time looking up this sub-entry.
              */
 
-            CoreSession session = opContext.getSession();
             LookupOperationContext lookupContext = new LookupOperationContext( session, subentryDn,
                 SchemaConstants.ALL_ATTRIBUTES_ARRAY );
             Entry subentry = session.getDirectoryService().getPartitionNexus().lookup( lookupContext );
@@ -450,6 +414,7 @@ public class CollectiveAttributeIntercep
                 AttributeType attributeType = attribute.getAttributeType();
                 String attrId = attributeType.getName();
 
+                // Skip the attributes which are not collectve
                 if ( !attributeType.isCollective() )
                 {
                     continue;
@@ -464,31 +429,11 @@ public class CollectiveAttributeIntercep
                     continue;
                 }
 
-                Set<AttributeType> allSuperTypes = getAllSuperTypes( attributeType );
-
-                for ( String retId : retIdsSet )
-                {
-                    if ( retId.equals( SchemaConstants.ALL_USER_ATTRIBUTES )
-                        || retId.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
-                    {
-                        continue;
-                    }
-
-                    AttributeType retType = schemaManager.lookupAttributeTypeRegistry( retId );
-
-                    if ( allSuperTypes.contains( retType ) )
-                    {
-                        retIdsSet.add( schemaManager.lookupAttributeTypeRegistry( attrId ).getOid() );
-                        break;
-                    }
-                }
-
                 /*
                  * If not all attributes or this collective attribute requested specifically
                  * then bypass the inclusion process.
                  */
-                if ( !( retIdsSet.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) || retIdsSet.contains( schemaManager
-                    .lookupAttributeTypeRegistry( attrId ).getOid() ) ) )
+                if ( !opContext.isAllUserAttributes() && !opContext.contains( schemaManager, attributeType ) )
                 {
                     continue;
                 }
@@ -516,23 +461,4 @@ public class CollectiveAttributeIntercep
             }
         }
     }
-
-
-    private Set<AttributeType> getAllSuperTypes( AttributeType id ) throws LdapException
-    {
-        Set<AttributeType> allSuperTypes = new HashSet<AttributeType>();
-        AttributeType superType = id;
-
-        while ( superType != null )
-        {
-            superType = superType.getSuperior();
-
-            if ( superType != null )
-            {
-                allSuperTypes.add( superType );
-            }
-        }
-
-        return allSuperTypes;
-    }
 }

Modified: directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Wed Dec 12 15:28:12 2012
@@ -282,8 +282,7 @@ public class EventInterceptor extends Ba
 
         // Get the modified entry
         CoreSession session = modifyContext.getSession();
-        LookupOperationContext lookupContext = new LookupOperationContext( session, modifyContext.getDn() );
-        lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext lookupContext = new LookupOperationContext( session, modifyContext.getDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
         Entry alteredEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         modifyContext.setAlteredEntry( alteredEntry );
@@ -367,8 +366,7 @@ public class EventInterceptor extends Ba
 
         // Get the modified entry
         CoreSession session = renameContext.getSession();
-        LookupOperationContext lookupContext = new LookupOperationContext( session, renameContext.getNewDn() );
-        lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext lookupContext = new LookupOperationContext( session, renameContext.getNewDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
         Entry alteredEntry = directoryService.getPartitionNexus().lookup( lookupContext );
         renameContext.setModifiedEntry( alteredEntry );

Modified: directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Dec 12 15:28:12 2012
@@ -160,8 +160,7 @@ public class ExceptionInterceptor extend
             try
             {
                 CoreSession session = addContext.getSession();
-                LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn );
-                lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+                LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
                 attrs = directoryService.getPartitionNexus().lookup( lookupContext );
             }
@@ -250,7 +249,7 @@ public class ExceptionInterceptor extend
 
         if ( dn.equals( subschemSubentryDn ) )
         {
-            Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, lookupContext.getReturningAttributesString() );
+            Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, lookupContext );
             serverEntry.setDn( dn );
 
             return serverEntry;

Modified: directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Dec 12 15:28:12 2012
@@ -646,7 +646,7 @@ public class OperationalAttributeInterce
                 if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
                 {
                     // If it's not in the list of returning attribute, remove it
-                    if ( !lookupContext.contains( schemaManager, attributeType.getOid() ) )
+                    if ( !lookupContext.contains( schemaManager, attributeType ) )
                     {
                         removedAttributes.add( attributeType );
                     }
@@ -689,7 +689,7 @@ public class OperationalAttributeInterce
                 AttributeType attributeType = attribute.getAttributeType();
 
                 // If it's not in the list of returning attribute, remove it
-                if ( !lookupContext.contains( schemaManager, attributeType.getOid() ) )
+                if ( !lookupContext.contains( schemaManager, attributeType ) )
                 {
                     removedAttributes.add( attributeType );
                 }

Modified: directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Wed Dec 12 15:28:12 2012
@@ -321,8 +321,8 @@ public class ReferralInterceptor extends
         // TODO: this can be spare, as we already have the altered entry
         // into the opContext, but for an unknow reason, this will fail
         // on eferral tests...
-        LookupOperationContext lookupContext = new LookupOperationContext( modifyContext.getSession(), dn );
-        lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext lookupContext = 
+            new LookupOperationContext( modifyContext.getSession(), dn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
         Entry newEntry = nexus.lookup( lookupContext );
 
@@ -408,9 +408,7 @@ public class ReferralInterceptor extends
         {
             // Update the referralManager
             LookupOperationContext lookupContext = new LookupOperationContext( renameContext.getSession(),
-                renameContext
-                    .getNewDn() );
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+                renameContext.getNewDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
             Entry newEntry = nexus.lookup( lookupContext );
 

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Dec 12 15:28:12 2012
@@ -22,7 +22,6 @@ package org.apache.directory.server.core
 
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -378,116 +377,6 @@ public class SchemaInterceptor extends B
     }
 
 
-    /**
-     * Remove all unknown attributes from the searchControls, to avoid an exception.
-     *
-     * RFC 2251 states that :
-     * " Attributes MUST be named at most once in the list, and are returned "
-     * " at most once in an entry. "
-     * " If there are attribute descriptions in "
-     * " the list which are not recognized, they are ignored by the server."
-     *
-     * @param searchContext The SearchControls we will filter
-     */
-    // This will suppress PMD.EmptyCatchBlock warnings in this method
-    @SuppressWarnings("PMD.EmptyCatchBlock")
-    private void filterAttributesToReturn( SearchOperationContext searchContext ) throws LdapException
-    {
-        String[] attributes = searchContext.getReturningAttributesString();
-
-        if ( ( attributes == null ) || ( attributes.length == 0 ) )
-        {
-            // We have no attributes, that means "*" (all users attributes)
-            //searchContext.setReturningAttributes( SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
-            return;
-        }
-
-        Map<String, String> filteredAttrs = new HashMap<String, String>();
-        boolean hasNoAttribute = false;
-        boolean hasAttributes = false;
-
-        for ( String attribute : attributes )
-        {
-            // Skip special attributes
-            if ( ( SchemaConstants.ALL_USER_ATTRIBUTES.equals( attribute ) )
-                || ( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES.equals( attribute ) )
-                || ( SchemaConstants.NO_ATTRIBUTE.equals( attribute ) ) )
-            {
-                if ( !filteredAttrs.containsKey( attribute ) )
-                {
-                    filteredAttrs.put( attribute, attribute );
-                }
-
-                if ( SchemaConstants.NO_ATTRIBUTE.equals( attribute ) )
-                {
-                    hasNoAttribute = true;
-                }
-                else
-                {
-                    hasAttributes = true;
-                }
-
-                continue;
-            }
-
-            try
-            {
-                // Check that the attribute is declared
-                if ( schemaManager.getAttributeTypeRegistry().contains( attribute ) )
-                {
-                    String oid = schemaManager.getAttributeTypeRegistry().getOidByName( attribute );
-
-                    // The attribute must be an AttributeType
-                    if ( schemaManager.getAttributeTypeRegistry().contains( oid ) && !filteredAttrs.containsKey( oid ) )
-                    {
-                        // Ok, we can add the attribute to the list of filtered attributes
-                        filteredAttrs.put( oid, attribute );
-                    }
-                }
-
-                hasAttributes = true;
-            }
-            catch ( Exception ne )
-            {
-                /* Do nothing, the attribute does not exist */
-            }
-        }
-
-        // Treat a special case : if we have an attribute and "1.1", then discard "1.1"
-        if ( hasAttributes && hasNoAttribute )
-        {
-            filteredAttrs.remove( SchemaConstants.NO_ATTRIBUTE );
-        }
-
-        // If we still have the same attribute number, then we can just get out the method
-        if ( filteredAttrs.size() == attributes.length )
-        {
-            return;
-        }
-
-        // Deal with the special case where the attribute list is now empty
-        if ( filteredAttrs.size() == 0 )
-        {
-            // We just have to pass the special 1.1 attribute,
-            // as we don't want to return any attribute
-            searchContext.setReturningAttributes( SchemaConstants.NO_ATTRIBUTE_ARRAY );
-            return;
-        }
-
-        // Some attributes have been removed. let's modify the searchControl
-        String[] newAttributesList = new String[filteredAttrs.size()];
-
-        int pos = 0;
-
-        for ( Map.Entry<String, String> entry : filteredAttrs.entrySet() )
-        {
-            newAttributesList[pos++] = entry.getValue();
-        }
-
-        searchContext.setReturningAttributes( newAttributesList );
-    }
-
-
     private Value<?> convert( AttributeType attributeType, Value<?> value ) throws LdapException
     {
         if ( attributeType.getSyntax().isHumanReadable() )
@@ -1483,14 +1372,6 @@ public class SchemaInterceptor extends B
         Dn base = searchContext.getDn();
         ExprNode filter = searchContext.getFilter();
 
-        // We have to eliminate bad attributes from the request, accordingly
-        // to RFC 2251, chap. 4.5.1. Basically, all unknown attributes are removed
-        // from the list
-        if ( searchContext.getReturningAttributesString() != null )
-        {
-            filterAttributesToReturn( searchContext );
-        }
-
         // We also have to check the H/R flag for the filter attributes
         checkFilter( filter );
 
@@ -1550,7 +1431,7 @@ public class SchemaInterceptor extends B
                 {
                     // call.setBypass( true );
                     Entry serverEntry = SchemaService.getSubschemaEntry( directoryService,
-                        searchContext.getReturningAttributesString() );
+                        searchContext );
                     serverEntry.setDn( base );
                     return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
                 }
@@ -1568,7 +1449,7 @@ public class SchemaInterceptor extends B
                 {
                     // call.setBypass( true );
                     Entry serverEntry = SchemaService.getSubschemaEntry( directoryService,
-                        searchContext.getReturningAttributesString() );
+                        searchContext );
                     serverEntry.setDn( base );
                     EntryFilteringCursor cursor = new BaseEntryFilteringCursor(
                         new SingletonCursor<Entry>( serverEntry ), searchContext );

Modified: directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Dec 12 15:28:12 2012
@@ -448,8 +448,8 @@ public class SubentryInterceptor extends
     private void checkAdministrativeRole( OperationContext opContext, Dn apDn ) throws LdapException
     {
         CoreSession session = opContext.getSession();
-        LookupOperationContext lookupContext = new LookupOperationContext( session, apDn );
-        lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext lookupContext = new LookupOperationContext( session, apDn,
+            SchemaConstants.ALL_ATTRIBUTES_ARRAY);
 
         Entry administrationPoint = directoryService.getPartitionNexus().lookup( lookupContext );
 

Modified: directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java Wed Dec 12 15:28:12 2012
@@ -112,8 +112,8 @@ public abstract class AbstractStoredProc
             Dn ldapCtxName = ldapCtxParam.getCtxName();
 
             CoreSession session = opContext.getSession();
-            LookupOperationContext lookupContext = new LookupOperationContext( session, ldapCtxName );
-            lookupContext.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = 
+                new LookupOperationContext( session, ldapCtxName, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
             return session.getDirectoryService().getPartitionNexus().lookup( lookupContext );
         }

Modified: directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Wed Dec 12 15:28:12 2012
@@ -139,8 +139,8 @@ public class TriggerInterceptor extends 
             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 );
 
             entry = directoryService.getPartitionNexus().lookup( lookupContext );
         }

Modified: directory/apacheds/trunk/jdbm-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/pom.xml?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/pom.xml (original)
+++ directory/apacheds/trunk/jdbm-partition/pom.xml Wed Dec 12 15:28:12 2012
@@ -47,6 +47,13 @@
     
     <dependency>
       <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-core-avl</artifactId>
     </dependency>
     

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Wed Dec 12 15:28:12 2012
@@ -33,6 +33,11 @@ import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockCoreSession;
+import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.xdbm.Index;
@@ -80,6 +85,8 @@ public class JdbmStoreTest
 
     File wkdir;
     JdbmPartition store;
+    CoreSession session;
+    
     private static SchemaManager schemaManager = null;
     private static LdifSchemaLoader loader;
     private static Dn EXAMPLE_COM;
@@ -160,6 +167,11 @@ public class JdbmStoreTest
         store.initialize();
 
         StoreUtils.loadExampleData( store, schemaManager );
+        
+        DirectoryService directoryService = new MockDirectoryService();
+        directoryService.setSchemaManager( schemaManager );
+        session = new MockCoreSession( new LdapPrincipal(), directoryService );
+
         LOG.debug( "Created new store" );
     }
 
@@ -583,7 +595,7 @@ public class JdbmStoreTest
         store.rename( dn, rdn, true, null );
 
         dn = new Dn( schemaManager, "sn=James,ou=Engineering,o=Good Times Co." );
-        Entry renamed = store.lookup( new LookupOperationContext( null, dn ) );
+        Entry renamed = store.lookup( new LookupOperationContext( session, dn ) );
         assertNotNull( renamed );
         assertEquals( "James", renamed.getDn().getRdn().getValue().getString() );
     }

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java Wed Dec 12 15:28:12 2012
@@ -232,8 +232,7 @@ public class SingleFileLdifPartitionTest
 
     private void assertExists( SingleFileLdifPartition partition, Entry entry ) throws LdapException
     {
-        LookupOperationContext opCtx = new LookupOperationContext( mockSession );
-        opCtx.setReturningAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+        LookupOperationContext opCtx = new LookupOperationContext( mockSession, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
         opCtx.setDn( entry.getDn() );
 
         Entry fetched = partition.lookup( opCtx );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java Wed Dec 12 15:28:12 2012
@@ -20,9 +20,6 @@
 package org.apache.directory.server.ldap.handlers.bind.cramMD5;
 
 
-import java.util.HashSet;
-import java.util.Set;
-
 import javax.naming.Context;
 import javax.security.sasl.AuthorizeCallback;
 
@@ -42,8 +39,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 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;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -83,11 +78,7 @@ public class CramMd5CallbackHandler exte
         try
         {
             ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
-            Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
 
-            AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager()
-                .lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
-            returningAttributes.add( new AttributeTypeOptions( passwordAT ) );
             bindDn = ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
 
             Dn baseDn = new Dn( bindDn );
@@ -97,7 +88,7 @@ public class CramMd5CallbackHandler exte
                 SearchScope.SUBTREE,
                 filter,
                 AliasDerefMode.DEREF_ALWAYS,
-                returningAttributes );
+                SchemaConstants.USER_PASSWORD_AT );
 
             cursor.beforeFirst();
 
@@ -116,7 +107,7 @@ public class CramMd5CallbackHandler exte
 
             cursor.close();
 
-            return entry.get( passwordAT );
+            return entry.get( SchemaConstants.USER_PASSWORD_AT );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java Wed Dec 12 15:28:12 2012
@@ -20,9 +20,6 @@
 package org.apache.directory.server.ldap.handlers.bind.digestMD5;
 
 
-import java.util.HashSet;
-import java.util.Set;
-
 import javax.naming.Context;
 import javax.security.sasl.AuthorizeCallback;
 
@@ -42,8 +39,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 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;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -84,11 +79,6 @@ public class DigestMd5CallbackHandler ex
         try
         {
             ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
-            Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
-
-            AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager()
-                .lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
-            returningAttributes.add( new AttributeTypeOptions( passwordAT ) );
             bindDn = ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
 
             Dn baseDn = new Dn( bindDn );
@@ -98,7 +88,7 @@ public class DigestMd5CallbackHandler ex
                 SearchScope.SUBTREE,
                 filter,
                 AliasDerefMode.DEREF_ALWAYS,
-                returningAttributes );
+                SchemaConstants.USER_PASSWORD_AT );
 
             cursor.beforeFirst();
 
@@ -117,7 +107,7 @@ public class DigestMd5CallbackHandler ex
 
             cursor.close();
 
-            return entry.get( passwordAT );
+            return entry.get( SchemaConstants.USER_PASSWORD_AT );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java Wed Dec 12 15:28:12 2012
@@ -22,13 +22,12 @@ package org.apache.directory.server.ldap
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.lang.StringUtils;
 import org.apache.directory.ldap.client.api.ConnectionClosedEventListener;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.future.SearchFuture;
@@ -88,6 +87,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.util.StringConstants;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -148,9 +148,6 @@ public class ReplicationConsumerImpl imp
     /** The (entrtyUuid=*) filter */
     private static final PresenceNode ENTRY_UUID_PRESENCE_FILTER = new PresenceNode( SchemaConstants.ENTRY_UUID_AT );
 
-    /** The set used for search attributes, containing only the entryUuid AT */
-    private static final Set<AttributeTypeOptions> ENTRY_UUID_ATOP_SET = new HashSet<AttributeTypeOptions>();
-
     private Modification cookieMod;
     
     private Modification ridMod;
@@ -187,8 +184,6 @@ public class ReplicationConsumerImpl imp
         REPL_COOKIE_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ADS_REPL_COOKIE );
         RID_AT_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ADS_DS_REPLICA_ID );
         
-        ENTRY_UUID_ATOP_SET.add( new AttributeTypeOptions( ENTRY_UUID_AT ) );
-
         Attribute cookieAttr = new DefaultAttribute( REPL_COOKIE_AT );
         cookieMod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, cookieAttr );
 
@@ -1146,11 +1141,10 @@ public class ReplicationConsumerImpl imp
 
     private void modify( Entry remoteEntry, int rid ) throws Exception
     {
-        LookupOperationContext lookupCtx = new LookupOperationContext( session, remoteEntry.getDn() );
-        lookupCtx.setReturningAttributes( config.getAttributes() );
-        
-        // this is needed to compare some of the operational attributes received from the server
-        lookupCtx.addReturningAttributes( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
+        String[] attributes = computeAttributes( config.getAttributes(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
+
+        LookupOperationContext lookupCtx = 
+            new LookupOperationContext( session, remoteEntry.getDn(), attributes );
         
         lookupCtx.setSyncreplLookup( true );
         
@@ -1220,6 +1214,41 @@ public class ReplicationConsumerImpl imp
         operationManager.modify( modifyContext );
     }
 
+    
+    /**
+     * Create a new list combining a list and a newly added attribute
+     */
+    private String[] computeAttributes( String[] attributes, String addedAttribute )
+    {
+        if ( attributes != null )
+        {
+            if ( addedAttribute != null )
+            {
+                String[] combinedAttributes = new String[ attributes.length + 1 ];
+                
+                System.arraycopy( attributes, 0, combinedAttributes, 0, attributes.length );
+                combinedAttributes[attributes.length] = addedAttribute;
+                
+                return combinedAttributes;
+            }
+            else
+            {
+                return attributes;
+            }
+        }
+        else
+        {
+            if ( addedAttribute != null )
+            {
+                return new String[]{ addedAttribute };
+            }
+            else
+            {
+                return StringConstants.EMPTY_STRINGS;
+            }
+        }
+    }
+    
 
     /**
      * deletes the entries having the UUID given in the list
@@ -1329,7 +1358,7 @@ public class ReplicationConsumerImpl imp
 
         LOG.debug( "selecting entries to be deleted using filter {}", filter.toString() );
         EntryFilteringCursor cursor = session.search( dn, SearchScope.SUBTREE, filter,
-            AliasDerefMode.NEVER_DEREF_ALIASES, ENTRY_UUID_ATOP_SET );
+            AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.ENTRY_UUID_AT );
         cursor.beforeFirst();
         
         while ( cursor.next() )
@@ -1411,7 +1440,7 @@ public class ReplicationConsumerImpl imp
             if ( cursor == null )
             {
                 cursor = session.search( rootDn, SearchScope.ONELEVEL, ENTRY_UUID_PRESENCE_FILTER,
-                    AliasDerefMode.NEVER_DEREF_ALIASES, ENTRY_UUID_ATOP_SET );
+                    AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.ENTRY_UUID_AT );
                 cursor.beforeFirst();
                 LOG.debug( "putting cursor for {}", rootDn.getName() );
                 cursorMap.put( rootDn, cursor );

Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java Wed Dec 12 15:28:12 2012
@@ -24,7 +24,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -133,6 +132,7 @@ public class ApacheDsService
     private GeneralizedTimeSyntaxChecker timeChecker = new GeneralizedTimeSyntaxChecker();
 
     private static final Map<String, AttributeTypeOptions> MANDATORY_ENTRY_ATOP_MAP = new HashMap<String, AttributeTypeOptions>();
+    private static String[] MANDATORY_ENTRY_ATOP_AT;
 
     private boolean isConfigPartitionFirstExtraction = false;
 
@@ -329,6 +329,15 @@ public class ApacheDsService
 
         AttributeType createdTimeAt = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATE_TIMESTAMP_AT );
         MANDATORY_ENTRY_ATOP_MAP.put( createdTimeAt.getName(), new AttributeTypeOptions( createdTimeAt ) );
+        
+        MANDATORY_ENTRY_ATOP_AT = new String[MANDATORY_ENTRY_ATOP_MAP.size()];
+        
+        int pos = 0;
+        
+        for ( AttributeTypeOptions attributeTypeOptions : MANDATORY_ENTRY_ATOP_MAP.values() )
+        {
+            MANDATORY_ENTRY_ATOP_AT[pos++] = attributeTypeOptions.getAttributeType().getName();
+        }
 
         if ( isConfigPartitionFirstExtraction )
         {
@@ -661,7 +670,7 @@ public class ApacheDsService
         ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
 
         EntryFilteringCursor cursor = session.search( partition.getSuffixDn(), SearchScope.SUBTREE, filter,
-            AliasDerefMode.NEVER_DEREF_ALIASES, new HashSet<AttributeTypeOptions>( MANDATORY_ENTRY_ATOP_MAP.values() ) );
+            AliasDerefMode.NEVER_DEREF_ALIASES, MANDATORY_ENTRY_ATOP_AT );
         cursor.beforeFirst();
 
         List<Modification> mods = new ArrayList<Modification>();

Modified: directory/apacheds/trunk/xdbm-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/pom.xml?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/pom.xml (original)
+++ directory/apacheds/trunk/xdbm-partition/pom.xml Wed Dec 12 15:28:12 2012
@@ -46,6 +46,13 @@
       <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-core-api</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
     
     <dependency>
       <groupId>${project.groupId}</groupId>

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Wed Dec 12 15:28:12 2012
@@ -1095,86 +1095,6 @@ public abstract class AbstractBTreeParti
         
         ServerEntryUtils.filterContents( entry, lookupContext );
 
-        // Remove all the attributes if the NO_ATTRIBUTE flag is set and there is no requested attribute
-        if ( lookupContext.isNoAttributes()
-            && ( ( lookupContext.getReturningAttributes() == null ) || lookupContext.getReturningAttributes().size() == 0 ) )
-        {
-            entry.clear();
-
-            return entry;
-        }
-
-        if ( lookupContext.isAllUserAttributes() )
-        {
-            if ( lookupContext.isAllOperationalAttributes() )
-            {
-                return entry;
-            }
-            else
-            {
-                for ( Attribute attribute : ( ( ( ClonedServerEntry ) entry ).getOriginalEntry() ).getAttributes() )
-                {
-                    AttributeType attributeType = attribute.getAttributeType();
-                    String oid = attributeType.getOid();
-
-                    if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
-                    {
-                        if ( !lookupContext.contains( schemaManager, oid ) )
-                        {
-                            entry.removeAttributes( attributeType );
-                        }
-                    }
-                }
-            }
-        }
-        else
-        {
-            if ( lookupContext.isAllOperationalAttributes() )
-            {
-                for ( Attribute attribute : ( ( ( ClonedServerEntry ) entry ).getOriginalEntry() ).getAttributes() )
-                {
-                    AttributeType attributeType = attribute.getAttributeType();
-                    String oid = attributeType.getOid();
-
-                    if ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS )
-                    {
-                        if ( !lookupContext.contains( schemaManager, oid ) )
-                        {
-                            entry.removeAttributes( attributeType );
-                        }
-                    }
-                }
-            }
-            else
-            {
-                if ( ( lookupContext.getReturningAttributes() == null ) || ( lookupContext.getReturningAttributes().size() == 0 ) )
-                {
-                    for ( Attribute attribute : ( ( ( ClonedServerEntry ) entry ).getOriginalEntry() ).getAttributes() )
-                    {
-                        AttributeType attributeType = attribute.getAttributeType();
-
-                        if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
-                        {
-                            entry.removeAttributes( attributeType );
-                        }
-                    }
-                }
-                else
-                {
-                    for ( Attribute attribute : ( ( ( ClonedServerEntry ) entry ).getOriginalEntry() ).getAttributes() )
-                    {
-                        AttributeType attributeType = attribute.getAttributeType();
-                        String oid = attributeType.getOid();
-
-                        if ( !lookupContext.contains( schemaManager, oid ) )
-                        {
-                            entry.removeAttributes( attributeType );
-                        }
-                    }
-                }
-            }
-        }
-
         return entry;
     }
 

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java Wed Dec 12 15:28:12 2012
@@ -23,6 +23,8 @@ package org.apache.directory.server.xdbm
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
@@ -36,6 +38,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.ExprNode;
+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.SchemaManager;
 
 
@@ -50,6 +54,8 @@ public class AbstractCursorTest
     protected CursorBuilder cursorBuilder;
     protected Store store;
     protected static SchemaManager schemaManager;
+    protected DirectoryService directoryService;;
+    protected CoreSession session;
 
 
     /**
@@ -102,8 +108,10 @@ public class AbstractCursorTest
         searchResult.setResultSet( resultSet );
         searchResult.setEvaluator( evaluator );
 
-        SearchingOperationContext operationContext = new SearchOperationContext( null );
-
+        // We want all the user attributes plus the entryUUID
+        SearchingOperationContext operationContext = 
+            new SearchOperationContext( session, Dn.ROOT_DSE, SearchScope.ONELEVEL, null, "*", "EntryUUID" );
+        
         return new BaseEntryFilteringCursor( new EntryCursorAdaptor( ( AbstractBTreePartition ) store, searchResult ),
             operationContext );
     }

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Wed Dec 12 15:28:12 2012
@@ -28,6 +28,9 @@ import static org.junit.Assert.fail;
 import java.io.File;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockCoreSession;
+import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.xdbm.StoreUtils;
@@ -127,12 +130,13 @@ public class AndCursorTest extends Abstr
         ( ( Partition ) store ).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
         ( ( Partition ) store ).initialize();
 
-        ( ( Partition ) store ).initialize();
-
         StoreUtils.loadExampleData( store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
+        directoryService = new MockDirectoryService();
+        directoryService.setSchemaManager( schemaManager );
+        session = new MockCoreSession( new LdapPrincipal(), directoryService );
 
         LOG.debug( "Created new store" );
     }

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Wed Dec 12 15:28:12 2012
@@ -30,6 +30,9 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockCoreSession;
+import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.xdbm.StoreUtils;
@@ -140,6 +143,10 @@ public class NestedFilterTest extends Ab
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
         optimizer = new DefaultOptimizer( store );
 
+        directoryService = new MockDirectoryService();
+        directoryService.setSchemaManager( schemaManager );
+        session = new MockCoreSession( new LdapPrincipal(), directoryService );
+
         LOG.debug( "Created new store" );
     }
 

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Wed Dec 12 15:28:12 2012
@@ -30,6 +30,9 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockCoreSession;
+import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -135,12 +138,13 @@ public class NotCursorTest extends Abstr
         ( ( Partition ) store ).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
         ( ( Partition ) store ).initialize();
 
-        ( ( Partition ) store ).initialize();
-
         StoreUtils.loadExampleData( store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
+        directoryService = new MockDirectoryService();
+        directoryService.setSchemaManager( schemaManager );
+        session = new MockCoreSession( new LdapPrincipal(), directoryService );
 
         LOG.debug( "Created new store" );
     }

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java?rev=1420763&r1=1420762&r2=1420763&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java Wed Dec 12 15:28:12 2012
@@ -30,6 +30,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockCoreSession;
+import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -136,12 +139,13 @@ public class OrCursorTest extends Abstra
         ( ( Partition ) store ).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
         ( ( Partition ) store ).initialize();
 
-        ( ( Partition ) store ).initialize();
-
         StoreUtils.loadExampleData( store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
+        directoryService = new MockDirectoryService();
+        directoryService.setSchemaManager( schemaManager );
+        session = new MockCoreSession( new LdapPrincipal(), directoryService );
 
         LOG.debug( "Created new store" );
     }



Mime
View raw message