You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/07/19 18:10:49 UTC

svn commit: r965544 - in /directory: apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/ apacheds/branches/...

Author: elecharny
Date: Mon Jul 19 16:10:48 2010
New Revision: 965544

URL: http://svn.apache.org/viewvc?rev=965544&view=rev
Log:
o Added a modify( DN, Modification... ) method in the LdapConnection for convenience
o Migrated the CollectiveAttributeServiceIT test to use the API
o Added a test for addition of collective subentry without a collectiveAttribute
o Fixed a bug in the reverted which was failing to store a revert addition of a collective subentry
o Refactored/cleaned the CollectiveAttributeInterceptor class
o Added errors in apacheds I18n
o Removed the tests in the apacheds I18n module : they were useless and caused some issues with the property files used
o Small improvement in the DefaultEntry.hasObjectClass() method : avoiding a lookup in the schemaManager

Removed:
    directory/apacheds/branches/apacheds-subtree/i18n/src/test/java/org/apache/directory/server/i18n/
    directory/apacheds/branches/apacheds-subtree/i18n/src/test/resources/org/apache/directory/server/i18n/
Modified:
    directory/apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
    directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
    directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/branches/apacheds-subtree/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
    directory/apacheds/branches/apacheds-subtree/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
    directory/shared/branches/shared-subtree/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java

Modified: directory/apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/branches/apacheds-subtree/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java Mon Jul 19 16:10:48 2010
@@ -540,6 +540,33 @@ public class LdapCoreSessionConnection i
     /**
      * {@inheritDoc}
      */
+    public ModifyResponse modify( DN dn, Modification... modifications ) throws LdapException
+    {
+        ModifyResponse resp = new ModifyResponse();
+        resp.setLdapResult( getDefaultResult() );
+
+        try
+        {
+            List<Modification> mods = new ArrayList<Modification>();
+
+            for ( Modification modification : modifications )
+            {
+                mods.add( modification );
+            }
+            session.modify( dn, mods );
+        }
+        catch ( Exception e )
+        {
+            resp.getLdapResult().setResultCode( ResultCodeEnum.getResultCode( e ) );
+        }
+
+        return resp;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public ModifyResponse modify( Entry entry, ModificationOperation modOp ) throws LdapException
     {
         ModifyResponse resp = new ModifyResponse();

Modified: directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java Mon Jul 19 16:10:48 2010
@@ -25,27 +25,36 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.AddResponse;
+import org.apache.directory.ldap.client.api.message.ModifyResponse;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
 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.cursor.Cursor;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.entry.DefaultModification;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.ldif.LdapLdifException;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -58,9 +67,12 @@ import org.junit.runner.RunWith;
 @RunWith ( FrameworkRunner.class )
 public class CollectiveAttributeServiceIT extends AbstractLdapTestUnit
 {
-    private Attributes getTestEntry( String cn ) throws LdapLdifException, LdapException
+    private static LdapConnection connection;
+    
+    private Entry getTestEntry( String dn, String cn ) throws LdapLdifException, LdapException
     {
-        Attributes subentry = LdifUtils.createAttributes( 
+        Entry subentry = LdifUtils.createEntry( 
+            new DN( dn ), 
             "objectClass: top",
             "objectClass: person",
             "cn", cn ,
@@ -70,9 +82,10 @@ public class CollectiveAttributeServiceI
     }
 
 
-    private Attributes getTestSubentry()  throws LdapLdifException, LdapException
+    private Entry getTestSubentry( String dn )  throws LdapLdifException, LdapException
     {
-        Attributes subentry = LdifUtils.createAttributes( 
+        Entry subentry = LdifUtils.createEntry( 
+            new DN( dn ),
             "objectClass: top",
             "objectClass: subentry",
             "objectClass: collectiveAttributeSubentry",
@@ -84,9 +97,10 @@ public class CollectiveAttributeServiceI
     }
 
 
-    private Attributes getTestSubentry2() throws LdapLdifException, LdapException
+    private Entry getTestSubentry2( String dn ) throws LdapLdifException, LdapException
     {
-        Attributes subentry = LdifUtils.createAttributes( 
+        Entry subentry = LdifUtils.createEntry( 
+            new DN( dn ),
             "objectClass: top",
             "objectClass: subentry",
             "objectClass: collectiveAttributeSubentry",
@@ -98,9 +112,10 @@ public class CollectiveAttributeServiceI
     }
 
 
-    private Attributes getTestSubentry3() throws LdapLdifException, LdapException
+    private Entry getTestSubentry3( String dn ) throws LdapLdifException, LdapException
     {
-        Attributes subentry = LdifUtils.createAttributes( 
+        Entry subentry = LdifUtils.createEntry( 
+            new DN( dn ),
             "objectClass: top",
             "objectClass: subentry",
             "objectClass: collectiveAttributeSubentry",
@@ -114,64 +129,90 @@ public class CollectiveAttributeServiceI
 
     private void addAdministrativeRole( String role ) throws Exception
     {
-        Attribute attribute = new BasicAttribute( "administrativeRole" );
-        attribute.add( role );
-        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attribute );
-        getSystemContext( service ).modifyAttributes( "", new ModificationItem[] { item } );
+        EntryAttribute attribute = new DefaultEntryAttribute( "administrativeRole", role );
+        
+        connection.modify( new DN( "ou=system" ), new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attribute ) );
     }
 
 
-    private Map<String, Attributes> getAllEntries() throws Exception
+    private Map<String, Entry> getAllEntries() throws Exception
     {
-        Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
-        SearchControls controls = new SearchControls();
-        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        controls.setReturningAttributes( new String[]
-            { "+", "*" } );
-        NamingEnumeration<SearchResult> results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
+        Map<String, Entry> resultMap = new HashMap<String, Entry>();
+
+        Cursor<SearchResponse> cursor = 
+            connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+", "*" );
         
-        while ( results.hasMore() )
+        while ( cursor.next() )
         {
-            SearchResult result = results.next();
-            resultMap.put( result.getName(), result.getAttributes() );
+            SearchResponse result = cursor.get();
+            
+            if ( result instanceof SearchResultEntry )
+            {
+                Entry entry = ((SearchResultEntry)result).getEntry();
+                resultMap.put( entry.getDn().getName(), entry );
+            }
         }
+
         return resultMap;
     }
 
 
-    private Map<String, Attributes> getAllEntriesRestrictAttributes() throws Exception
+    private Map<String, Entry> getAllEntriesRestrictAttributes() throws Exception
     {
-        Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
-        SearchControls controls = new SearchControls();
-        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        controls.setReturningAttributes( new String[]
-            { "cn" } );
-        NamingEnumeration<SearchResult> results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
-        while ( results.hasMore() )
+        Map<String, Entry> resultMap = new HashMap<String, Entry>();
+
+        Cursor<SearchResponse> cursor = 
+            connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );
+        
+        while ( cursor.next() )
         {
-            SearchResult result = results.next();
-            resultMap.put( result.getName(), result.getAttributes() );
+            SearchResponse result = cursor.get();
+            
+            if ( result instanceof SearchResultEntry )
+            {
+                Entry entry = ((SearchResultEntry)result).getEntry();
+                resultMap.put( entry.getDn().getName(), entry );
+            }
         }
+
         return resultMap;
     }
     
     
-    private Map<String, Attributes> getAllEntriesCollectiveAttributesOnly() throws Exception
+    private Map<String, Entry> getAllEntriesCollectiveAttributesOnly() throws Exception
     {
-        Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
-        SearchControls controls = new SearchControls();
-        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        controls.setReturningAttributes( new String[]
-                                                    { "c-ou", "c-st" } );
-        NamingEnumeration<SearchResult> results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
+        Map<String, Entry> resultMap = new HashMap<String, Entry>();
+
+        Cursor<SearchResponse> cursor = 
+            connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "c-ou", "c-st" );
         
-        while ( results.hasMore() )
+        while ( cursor.next() )
         {
-            SearchResult result = results.next();
-            resultMap.put( result.getName(), result.getAttributes() );
+            SearchResponse result = cursor.get();
+            
+            if ( result instanceof SearchResultEntry )
+            {
+                Entry entry = ((SearchResultEntry)result).getEntry();
+                resultMap.put( entry.getDn().getName(), entry );
+            }
         }
+
         return resultMap;
     }
+
+    
+    @Before
+    public void init() throws Exception
+    {
+        connection = IntegrationUtils.getAdminConnection( service );
+    }
+    
+
+    @After
+    public void shutdown() throws Exception
+    {
+        connection.close();
+    }
     
 
     @Test
@@ -180,25 +221,27 @@ public class CollectiveAttributeServiceI
         // -------------------------------------------------------------------
         // Setup the collective attribute specific administration point
         // -------------------------------------------------------------------
-
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
+        Entry subentry = getTestSubentry( "cn=testsubentry,ou=system" );
+        connection.add( subentry );
 
         // -------------------------------------------------------------------
         // test an entry that should show the collective attribute c-ou
         // -------------------------------------------------------------------
 
-        Attributes attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
-        Attribute c_ou = attributes.get( "c-ou" );
+        SearchResponse response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+        Entry entry = ((SearchResultEntry)response).getEntry();
+        EntryAttribute c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
-        assertEquals( "configuration", c_ou.get() );
+        assertEquals( "configuration", c_ou.getString() );
 
         // -------------------------------------------------------------------
         // test an entry that should not show the collective attribute
         // -------------------------------------------------------------------
 
-        attributes = getSystemContext( service ).getAttributes( "ou=users" );
-        c_ou = attributes.get( "c-ou" );
+        response = connection.lookup( "ou=users,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
         assertNull( "the c-ou collective attribute should not be present", c_ou );
 
         // -------------------------------------------------------------------
@@ -211,65 +254,77 @@ public class CollectiveAttributeServiceI
         getSystemContext( service ).modifyAttributes( "ou=services,ou=configuration", items );
 
         // entry should not show the c-ou collective attribute anymore
-        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
-        c_ou = attributes.get( "c-ou" );
+        response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
+
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
 
         // now add more collective subentries - the c-ou should still not show due to exclusions
-        getSystemContext( service ).createSubcontext( "cn=testsubentry2", getTestSubentry2() );
+        Entry subentry2 = getTestSubentry2( "cn=testsubentry2,ou=system" );
+        connection.add( subentry2 );
+
+        response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
 
-        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
-        c_ou = attributes.get( "c-ou" );
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
 
         // entries without the collectiveExclusion should still show both values of c-ou
-        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
-        c_ou = attributes.get( "c-ou" );
+        response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
+
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
         assertTrue( c_ou.contains( "configuration2" ) );
 
         // request the collective attribute specifically
+        response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "c-ou" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
         
-        attributes = getSystemContext( service ).getAttributes(
-                "ou=interceptors,ou=configuration", new String[] { "c-ou" } );
-        c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
         assertTrue( c_ou.contains( "configuration2" ) );
         
         // unspecify the collective attribute in the returning attribute list
+        response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "objectClass" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
 
-        attributes = getSystemContext( service ).getAttributes(
-                "ou=interceptors,ou=configuration", new String[] { "objectClass" } );
-        c_ou = attributes.get( "c-ou" );
         assertNull( "a collective c-ou attribute should not be present", c_ou );
         
         // -------------------------------------------------------------------
         // now add the subentry for the c-st collective attribute
         // -------------------------------------------------------------------
 
-        getSystemContext( service ).createSubcontext( "cn=testsubentry3", getTestSubentry3() );
+        connection.add( getTestSubentry3( "cn=testsubentry3,ou=system" ) );
 
         // the new attribute c-st should appear in the node with the c-ou exclusion
-        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
-        Attribute c_st = attributes.get( "c-st" );
+        response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        EntryAttribute c_st = entry.get( "c-st" );
+
         assertNotNull( "a collective c-st attribute should be present", c_st );
         assertTrue( c_st.contains( "FL" ) );
 
         // in node without exclusions both values of c-ou should appear with c-st value
-        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
-        c_ou = attributes.get( "c-ou" );
+        response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
+
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
         assertTrue( c_ou.contains( "configuration2" ) );
-        c_st = attributes.get( "c-st" );
+        
+        c_st = entry.get( "c-st" );
         assertNotNull( "a collective c-st attribute should be present", c_st );
         assertTrue( c_st.contains( "FL" ) );
 
@@ -283,13 +338,17 @@ public class CollectiveAttributeServiceI
         getSystemContext( service ).modifyAttributes( "ou=interceptors,ou=configuration", items );
 
         // none of the attributes should appear any longer
-        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
-        c_ou = attributes.get( "c-ou" );
+        response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
+        entry = ((SearchResultEntry)response).getEntry();
+        c_ou = entry.get( "c-ou" );
+
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
-        c_st = attributes.get( "c-st" );
+
+        c_st = entry.get( "c-st" );
+        
         if ( c_st != null )
         {
             assertEquals( "the c-st collective attribute should not be present", 0, c_st.size() );
@@ -305,17 +364,17 @@ public class CollectiveAttributeServiceI
         // -------------------------------------------------------------------
 
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
+        connection.add( getTestSubentry( "cn=testsubentry,ou=system" ) );
 
         // -------------------------------------------------------------------
         // test an entry that should show the collective attribute c-ou
         // -------------------------------------------------------------------
 
-        Map<String, Attributes> entries = getAllEntries();
-        Attributes attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        Attribute c_ou = attributes.get( "c-ou" );
+        Map<String, Entry> entries = getAllEntries();
+        Entry entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        EntryAttribute c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
-        assertEquals( "configuration", c_ou.get() );
+        assertEquals( "configuration", c_ou.getString() );
 
         
         // ------------------------------------------------------------------
@@ -324,18 +383,18 @@ public class CollectiveAttributeServiceI
         // ------------------------------------------------------------------
         
         entries = getAllEntriesCollectiveAttributesOnly();
-        attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
-        assertEquals( "configuration", c_ou.get() );   
+        assertEquals( "configuration", c_ou.getString() );   
         
         
         // -------------------------------------------------------------------
         // test an entry that should not show the collective attribute
         // -------------------------------------------------------------------
 
-        attributes = entries.get( "ou=users,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=users,ou=system" );
+        c_ou = entry.get( "c-ou" );
         assertNull( "the c-ou collective attribute should not be present", c_ou );
 
         // -------------------------------------------------------------------
@@ -349,27 +408,29 @@ public class CollectiveAttributeServiceI
         entries = getAllEntries();
 
         // entry should not show the c-ou collective attribute anymore
-        attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
+        
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
 
         // now add more collective subentries - the c-ou should still not show due to exclusions
-        getSystemContext( service ).createSubcontext( "cn=testsubentry2", getTestSubentry2() );
+        connection.add( getTestSubentry2( "cn=testsubentry2,ou=system" ) );
         entries = getAllEntries();
 
-        attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
+        
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
 
         // entries without the collectiveExclusion should still show both values of c-ou
-        attributes = entries.get( "ou=interceptors,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=interceptors,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
         assertTrue( c_ou.contains( "configuration2" ) );
@@ -378,22 +439,22 @@ public class CollectiveAttributeServiceI
         // now add the subentry for the c-st collective attribute
         // -------------------------------------------------------------------
 
-        getSystemContext( service ).createSubcontext( "cn=testsubentry3", getTestSubentry3() );
+        connection.add( getTestSubentry3( "cn=testsubentry3,ou=system" ) );
         entries = getAllEntries();
 
         // the new attribute c-st should appear in the node with the c-ou exclusion
-        attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        Attribute c_st = attributes.get( "c-st" );
+        entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        EntryAttribute c_st = entry.get( "c-st" );
         assertNotNull( "a collective c-st attribute should be present", c_st );
         assertTrue( c_st.contains( "FL" ) );
 
         // in node without exclusions both values of c-ou should appear with c-st value
-        attributes = entries.get( "ou=interceptors,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=interceptors,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
         assertTrue( c_ou.contains( "configuration2" ) );
-        c_st = attributes.get( "c-st" );
+        c_st = entry.get( "c-st" );
         assertNotNull( "a collective c-st attribute should be present", c_st );
         assertTrue( c_st.contains( "FL" ) );
 
@@ -408,13 +469,16 @@ public class CollectiveAttributeServiceI
         entries = getAllEntries();
 
         // none of the attributes should appear any longer
-        attributes = entries.get( "ou=interceptors,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
+        entry = entries.get( "ou=interceptors,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
+        
         if ( c_ou != null )
         {
             assertEquals( "the c-ou collective attribute should not be present", 0, c_ou.size() );
         }
-        c_st = attributes.get( "c-st" );
+        
+        c_st = entry.get( "c-st" );
+        
         if ( c_st != null )
         {
             assertEquals( "the c-st collective attribute should not be present", 0, c_st.size() );
@@ -427,71 +491,41 @@ public class CollectiveAttributeServiceI
         entries = getAllEntriesRestrictAttributes();
 
         // we should no longer see collective attributes with restricted return attribs
-        attributes = entries.get( "ou=services,ou=configuration,ou=system" );
-        c_st = attributes.get( "c-st" );
+        entry = entries.get( "ou=services,ou=configuration,ou=system" );
+        c_st = entry.get( "c-st" );
         assertNull( "a collective c-st attribute should NOT be present", c_st );
 
-        attributes = entries.get( "ou=partitions,ou=configuration,ou=system" );
-        c_ou = attributes.get( "c-ou" );
-        c_st = attributes.get( "c-st" );
+        entry = entries.get( "ou=partitions,ou=configuration,ou=system" );
+        c_ou = entry.get( "c-ou" );
+        c_st = entry.get( "c-st" );
         assertNull( c_ou );
         assertNull( c_st );
     }
     
     
     @Test
-    public void testAddRegularEntryWithCollectiveAttribute() throws LdapException
+    public void testAddRegularEntryWithCollectiveAttribute() throws Exception
     {
-        Attributes entry = getTestEntry( "Ersin Er" );
+        Entry entry = getTestEntry( "cn=Ersin Er,ou=system", "Ersin Er" );
         entry.put( "c-l", "Turkiye" );
         
-        try
-        {
-            getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
-            fail( "Entry addition with collective attribute should have failed." );
-        }
-        catch ( Exception e )
-        {
-            // Intended execution point
-        }
+        AddResponse response = connection.add( entry );
+        
+        assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, response.getLdapResult().getResultCode() );
     }
     
     
     @Test
     public void testModifyRegularEntryAddingCollectiveAttribute() throws Exception
     {
-        Attributes entry = getTestEntry( "Ersin Er" );
-        getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
-        Attributes changeSet = new BasicAttributes( "c-l", "Turkiye", true );
-        try
-        {
-            
-            getSystemContext( service ).modifyAttributes( "cn=Ersin Er", DirContext.ADD_ATTRIBUTE, changeSet );
-            fail( "Collective attribute addition to non-collectiveAttributeSubentry should have failed." );
-        }
-        catch ( NamingException e )
-        {
-            // Intended execution point
-        }
-    }
-    
-    
-    @Test
-    public void testModifyRegularEntryAddingCollectiveAttribute2() throws Exception
-    {
-        Attributes entry = getTestEntry( "Ersin Er" );
-        getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
-        Attribute change = new BasicAttribute( "c-l", "Turkiye");
-        ModificationItem mod = new ModificationItem(DirContext.ADD_ATTRIBUTE, change);
-        try
-        {
-            getSystemContext( service ).modifyAttributes( "cn=Ersin Er", new ModificationItem[] { mod } );
-            fail( "Collective attribute addition to non-collectiveAttributeSubentry should have failed." );
-        }
-        catch ( NamingException e )
-        {
-            // Intended execution point
-        }
+        Entry entry = getTestEntry( "cn=Ersin Er,ou=system", "Ersin Er" );
+        connection.add( entry );
+        
+        ModifyResponse response = connection.modify( new DN( "cn=Ersin Er,ou=system" ), 
+            new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, 
+                new DefaultEntryAttribute( "c-l", "Turkiye" ) ) );
+        
+        assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, response.getLdapResult().getResultCode() );
     }
     
     
@@ -501,16 +535,17 @@ public class CollectiveAttributeServiceI
         // -------------------------------------------------------------------
         // Setup the collective attribute specific administration point
         // -------------------------------------------------------------------
-    
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
+        Entry subentry = getTestSubentry( "cn=testsubentry,ou=system" );
+        connection.add( subentry );
     
         // request the collective attribute's super type specifically
-        Attributes attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration",
-            new String[] { "ou" } );
-        Attribute c_ou = attributes.get( "c-ou" );
+        SearchResponse response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
+        
+        Entry entry = ((SearchResultEntry)response).getEntry();
+        
+        EntryAttribute c_ou = entry.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
     }
-    
 }

Modified: directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-subtree/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java Mon Jul 19 16:10:48 2010
@@ -331,7 +331,6 @@ public class SubentryServiceIT extends A
     }
 
 
-    @Test
     /**
      * Add a subentry under AP-A. 
      * The following entries must be modified :
@@ -356,6 +355,7 @@ public class SubentryServiceIT extends A
      *     
      * Then suppress the subentry under AP-B
      */
+    @Test
     public void testSubentryAdd() throws Exception
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( service );
@@ -812,6 +812,7 @@ public class SubentryServiceIT extends A
 
         Attributes configuration = results.get( "ou=configuration,ou=system" );
         Attribute collectiveAttributeSubentries = configuration.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+        
         if ( collectiveAttributeSubentries != null )
         {
             assertEquals( "ou=configuration,ou=system should not be marked", 0, collectiveAttributeSubentries.size() );
@@ -819,6 +820,7 @@ public class SubentryServiceIT extends A
 
         Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
         collectiveAttributeSubentries = interceptors.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+        
         if ( collectiveAttributeSubentries != null )
         {
             assertEquals( "ou=interceptors,ou=configuration,ou=system should not be marked", 0, collectiveAttributeSubentries
@@ -827,6 +829,7 @@ public class SubentryServiceIT extends A
 
         Attributes partitions = results.get( "ou=partitions,ou=configuration,ou=system" );
         collectiveAttributeSubentries = partitions.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+        
         if ( collectiveAttributeSubentries != null )
         {
             assertEquals( "ou=partitions,ou=configuration,ou=system should not be marked", 0, collectiveAttributeSubentries.size() );
@@ -834,6 +837,7 @@ public class SubentryServiceIT extends A
 
         Attributes services = results.get( "ou=services,ou=configuration,ou=system" );
         collectiveAttributeSubentries = services.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+        
         if ( collectiveAttributeSubentries != null )
         {
             assertEquals( "ou=services,ou=configuration,ou=system should not be marked", 0, collectiveAttributeSubentries.size() );

Modified: directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Mon Jul 19 16:10:48 2010
@@ -38,6 +38,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -165,12 +166,15 @@ public class ChangeLogInterceptor extend
         forward.setDn( deleteContext.getDn() );
         
         Entry reverseEntry = new DefaultEntry( serverEntry.getDn() );
+        
+        boolean isCollectiveSubentry = serverEntry.hasObjectClass( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC );
 
         for ( EntryAttribute attribute : serverEntry )
         {
             // filter collective attributes, they can't be added by the revert operation
             AttributeType at = schemaService.getSchemaManager().getAttributeTypeRegistry().lookup( attribute.getId() );
-            if ( !at.isCollective() )
+            
+            if ( !at.isCollective() || isCollectiveSubentry )
             {
                 reverseEntry.add( attribute.clone() );
             }

Modified: directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-subtree/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Mon Jul 19 16:10:48 2010
@@ -38,7 +38,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
-import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
@@ -55,6 +54,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -68,11 +69,14 @@ import org.apache.directory.shared.ldap.
  */
 public class CollectiveAttributeInterceptor extends BaseInterceptor
 {
+    /** The LoggerFactory used by this Interceptor */
+    private static Logger LOG = LoggerFactory.getLogger( CollectiveAttributeInterceptor.class );
+
     /** The SchemaManager instance */
     private SchemaManager schemaManager;
-
-    /** The nexus instance */
-    private PartitionNexus nexus;
+    
+    /** The ObjectClass AttributeType */
+    private static AttributeType OBJECT_CLASS_AT;
 
     /** The CollectiveAttributeSubentries AttributeType */
     private static AttributeType COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT;
@@ -93,6 +97,103 @@ public class CollectiveAttributeIntercep
             return true;
         }
     };
+    //-------------------------------------------------------------------------------------
+    // Initialization
+    //-------------------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public void init( DirectoryService directoryService ) throws LdapException
+    {
+        super.init( directoryService );
+        schemaManager = directoryService.getSchemaManager();
+        
+        // Load some AttributeType
+        COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+        COLLECTIVE_EXCLUSIONS_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+        
+        LOG.debug( "CollectiveAttriute interceptor initilaized" );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Interceptor Method Overrides
+    // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+    {
+        checkAdd( addContext.getDn(), addContext.getEntry() );
+
+        next.add( addContext );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
+        throws LdapException
+    {
+        EntryFilteringCursor cursor = nextInterceptor.list( listContext );
+        
+        cursor.addEntryFilter( SEARCH_FILTER );
+        
+        return cursor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Entry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws LdapException
+    {
+        Entry result = nextInterceptor.lookup( lookupContext );
+
+        if ( result == null )
+        {
+            return null;
+        }
+
+        // Adding the collective attributes if any
+        if ( ( lookupContext.getAttrsId() == null ) || ( lookupContext.getAttrsId().size() == 0 ) )
+        {
+            addCollectiveAttributes( lookupContext, result, SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
+        }
+        else
+        {
+            addCollectiveAttributes( lookupContext, result, lookupContext.getAttrsIdArray() );
+        }
+
+        return result;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+    {
+        checkModify( modifyContext );
+
+        next.modify( modifyContext );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
+        throws LdapException
+    {
+        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+        
+        cursor.addEntryFilter( SEARCH_FILTER );
+
+        return cursor;
+    }
 
 
     //-------------------------------------------------------------------------------------
@@ -109,7 +210,18 @@ public class CollectiveAttributeIntercep
     {
         if ( entry.hasObjectClass( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
         {
-            return;
+            // This is a collectiveAttribute subentry. It must have at least one collective
+            // attribute
+            for ( EntryAttribute attribute : entry )
+            {
+                if ( attribute.getAttributeType().isCollective() )
+                {
+                    return;
+                }
+            }
+            
+            LOG.info( "A CollectiveAttribute subentry *should* have at least one collectiveAttribute" );
+            throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT ) );
         }
 
         if ( containsAnyCollectiveAttributes( entry ) )
@@ -117,42 +229,47 @@ public class CollectiveAttributeIntercep
             /*
              * TODO: Replace the Exception and the ResultCodeEnum with the correct ones.
              */
-            throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_241 ) );
+            LOG.info( "Cannot add the entry {} : it contains some CollectiveAttributes and is not a collective subentry",
+                entry );
+            throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY ) );
         }
     }
 
     
+    /**
+     * Check that we can modify an entry
+     */
     private void checkModify( ModifyOperationContext modifyContext ) throws LdapException
     {
         List<Modification> mods = modifyContext.getModItems();
         Entry originalEntry = modifyContext.getEntry();
         Entry targetEntry = ( Entry ) SchemaUtils.getTargetEntry( mods, originalEntry );
 
-        EntryAttribute targetObjectClasses = targetEntry.get( SchemaConstants.OBJECT_CLASS_AT );
-
-        if ( targetObjectClasses == null )
-        {
-            // This is not allowed 
-            throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err(
-                I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS, originalEntry.getDn() ) );
-        }
-
-        if ( targetObjectClasses.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
+        // If the modified entry contains the CollectiveAttributeSubentry, then the modification
+        // is accepted, no matter what
+        if ( targetEntry.contains( OBJECT_CLASS_AT, SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
         {
             return;
         }
 
-        if ( addsAnyCollectiveAttributes( mods ) )
+        // Check that we don't add any collectve attribute, this is not allowed on normal entries
+        if ( hasCollectiveAttributes( mods ) )
         {
             /*
              * TODO: Replace the Exception and the ResultCodeEnum with the correct ones.
              */
-            throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_242 ) );
+            LOG.info( "Cannot modify the entry {} : it contains some CollectiveAttributes and is not a collective subentry",
+                targetEntry );
+            throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_242 ) );
         }
     }
 
     
-    private boolean addsAnyCollectiveAttributes( List<Modification> mods ) throws LdapException
+    /**
+     * Check that we have a CollectiveAttribute in the modifications. (CollectiveAttributes
+     * are those with a name starting with 'c-').
+     */
+    private boolean hasCollectiveAttributes( List<Modification> mods ) throws LdapException
     {
         for ( Modification mod : mods )
         {
@@ -160,6 +277,7 @@ public class CollectiveAttributeIntercep
             EntryAttribute attr = mod.getAttribute();
             AttributeType attrType = attr.getAttributeType();
 
+            // Defensive programming. Very unlikely to happen here...
             if ( attrType == null )
             {
                 try
@@ -174,13 +292,14 @@ public class CollectiveAttributeIntercep
 
             ModificationOperation modOp = mod.getOperation();
 
-            if ( ( ( modOp == ModificationOperation.ADD_ATTRIBUTE ) || ( modOp == ModificationOperation.REPLACE_ATTRIBUTE ) )
-                && attrType.isCollective() )
+            // If the AT is collective and we don't try to remove it, then we can return.
+            if ( attrType.isCollective() && ( modOp != ModificationOperation.REMOVE_ATTRIBUTE ) )
             {
                 return true;
             }
         }
 
+        // No collective attrbute found
         return false;
     }
 
@@ -204,20 +323,6 @@ public class CollectiveAttributeIntercep
     }
 
     
-    //-------------------------------------------------------------------------------------
-    // Initialization
-    //-------------------------------------------------------------------------------------
-    public void init( DirectoryService directoryService ) throws LdapException
-    {
-        super.init( directoryService );
-        schemaManager = directoryService.getSchemaManager();
-        nexus = directoryService.getPartitionNexus();
-        
-        COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
-        COLLECTIVE_EXCLUSIONS_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
-    }
-
-
     /**
      * Adds the set of collective attributes requested in the returning attribute list
      * and contained in subentries referenced by the entry. Excludes collective
@@ -412,67 +517,4 @@ public class CollectiveAttributeIntercep
 
         return allSuperTypes;
     }
-
-
-    // ------------------------------------------------------------------------
-    // Interceptor Method Overrides
-    // ------------------------------------------------------------------------
-    /**
-     * {@inheritDoc}
-     */
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
-    {
-        checkAdd( addContext.getDn(), addContext.getEntry() );
-
-        next.add( addContext );
-    }
-
-
-    public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
-        throws LdapException
-    {
-        EntryFilteringCursor cursor = nextInterceptor.list( listContext );
-        cursor.addEntryFilter( SEARCH_FILTER );
-        
-        return cursor;
-    }
-
-
-    public Entry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws LdapException
-    {
-        Entry result = nextInterceptor.lookup( lookupContext );
-
-        if ( result == null )
-        {
-            return null;
-        }
-
-        if ( ( lookupContext.getAttrsId() == null ) || ( lookupContext.getAttrsId().size() == 0 ) )
-        {
-            addCollectiveAttributes( lookupContext, result, SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
-        }
-        else
-        {
-            addCollectiveAttributes( lookupContext, result, lookupContext.getAttrsIdArray() );
-        }
-
-        return result;
-    }
-
-
-    public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
-    {
-        checkModify( modifyContext );
-
-        next.modify( modifyContext );
-    }
-
-
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
-        throws LdapException
-    {
-        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
-        cursor.addEntryFilter( SEARCH_FILTER );
-        return cursor;
-    }
 }

Modified: directory/apacheds/branches/apacheds-subtree/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original)
+++ directory/apacheds/branches/apacheds-subtree/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Mon Jul 19 16:10:48 2010
@@ -274,7 +274,7 @@ public enum I18n
     ERR_238("ERR_238"),
     ERR_239("ERR_239"),
     ERR_240("ERR_240"),
-    ERR_241("ERR_241"),
+    ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY("ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY"),
     ERR_242("ERR_242"),
     ERR_243("ERR_243"),
     ERR_244("ERR_244"),
@@ -290,7 +290,7 @@ public enum I18n
     ERR_254_ADD_EXISTING_VALUE("ERR_254_ADD_EXISTING_VALUE"),
     ERR_255("ERR_255"),
     ERR_256_NO_SUCH_OBJECT("ERR_256_NO_SUCH_OBJECT"),
-    //ERR_257("ERR_257"), --> ERR_250
+    ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT("ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT"),
     ERR_258("ERR_258"),
     ERR_259("ERR_259"),
     ERR_260("ERR_260"),
@@ -768,8 +768,8 @@ public enum I18n
     ERR_732("ERR_732"),
     ERR_733("ERR_733");
 
-    private final static ResourceBundle errBundle = ResourceBundle
-        .getBundle( "org/apache/directory/server/i18n/errors" );
+    private static ResourceBundle errBundle = ResourceBundle
+                .getBundle( "org.apache.directory.server.i18n.errors" );
 
     private final static ResourceBundle msgBundle = ResourceBundle
         .getBundle( "org/apache/directory/server/i18n/messages" );

Modified: directory/apacheds/branches/apacheds-subtree/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-subtree/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-subtree/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties (original)
+++ directory/apacheds/branches/apacheds-subtree/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties Mon Jul 19 16:10:48 2010
@@ -262,7 +262,7 @@ ERR_237=The underlying changelog store d
 ERR_238=The underlying changelog store does not support searching through it's tags
 ERR_239=revision must be greater than or equal to 0
 ERR_240=revision must be less than or equal to the current revision
-ERR_241=Collective attributes cannot be stored in non-collectiveAttributeSubentries
+ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY=Collective attributes cannot be stored in non-collectiveAttributeSubentries
 ERR_242=Cannot operate on collective attributes in non-collectiveAttributeSubentries
 ERR_243=Negation has no child: {0}
 ERR_244=Unrecognized branch node operator: {0}
@@ -278,7 +278,7 @@ ERR_253=Can not allow the deletion of th
 ERR_254_ADD_EXISTING_VALUE=Trying to add existing value ''{0}'' to attribute {1}
 ERR_255=Can not allow the renaming of the subschemaSubentry ({0}) for the global schema: it is fixed at {1}
 ERR_256_NO_SUCH_OBJECT=Entry {0} does not exist!
-#ERR_257=Entry {0} already exists!
+ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT=A CollectiveAttribute Subentry must have at least one collective Attribute
 ERR_258=Can not allow the move of the subschemaSubentry ({0}) for the global schema\: it is fixed at {1} 
 ERR_259=Attempt to search under non-existant entry\:  
 ERR_260=Unknown assertion type: {0}

Modified: directory/shared/branches/shared-subtree/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-subtree/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java?rev=965544&r1=965543&r2=965544&view=diff
==============================================================================
--- directory/shared/branches/shared-subtree/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java (original)
+++ directory/shared/branches/shared-subtree/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java Mon Jul 19 16:10:48 2010
@@ -2803,7 +2803,7 @@ public class DefaultEntry implements Ent
     {
         if ( schemaManager != null )
         {
-            return contains( OBJECT_CLASS_AT.getOid(), objectClass );
+            return contains( OBJECT_CLASS_AT, objectClass );
 
         }
         else