directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r155380 - in incubator/directory/apacheds/trunk/core/src: main/java/org/apache/ldap/server/RootNexus.java main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java test/org/apache/ldap/server/jndi/RootDSETest.java
Date Sat, 26 Feb 2005 03:35:22 GMT
Author: akarasulu
Date: Fri Feb 25 19:35:20 2005
New Revision: 155380

URL: http://svn.apache.org/viewcvs?view=rev&rev=155380
Log:
changes ...

 o corrected a few issues with handling the RootDSE
     - note that you must explicitly ask for the operational attributes and
       only get those you ask for
     - added an objectClass top and extensibleObject; really there is no 
       structural objectClass for the RootDSE so I used top and extensibleObject
       to enable it to have any attribute incase it falls prey to schema 
       checking
     - corrected tests on RootDSE since now objectClass will be returned because
       it is not operational when no attributes are specified
 o modified OperationalAttributeService to take RootDSE into account when 
   filtering attributes out 
 o added the supportedLDAPVersion attribute to the RootDSE


Modified:
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java
    incubator/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java?view=diff&r1=155379&r2=155380
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/RootNexus.java
Fri Feb 25 19:35:20 2005
@@ -94,6 +94,15 @@
         attr.add( "cn=schema,ou=system" );
         rootDSE.put( attr );
 
+        attr = new LockableAttributeImpl( "supportedLDAPVersion" );
+        rootDSE.put( attr );
+        attr.add( "3" );
+
+        attr = new LockableAttributeImpl( "objectClass" );
+        rootDSE.put( attr );
+        attr.add( "top" );
+        attr.add( "extensibleObject" );
+
         attr = new LockableAttributeImpl( NAMINGCTXS_ATTR );
         rootDSE.put( attr );
 

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java?view=diff&r1=155379&r2=155380
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ibs/OperationalAttributeService.java
Fri Feb 25 19:35:20 2005
@@ -34,6 +34,8 @@
 import org.apache.ldap.server.schema.AttributeTypeRegistry;
 import org.apache.ldap.server.schema.GlobalRegistries;
 
+import java.util.HashSet;
+
 
 /**
  * An interceptor based service which manages the creation and modification of
@@ -75,6 +77,28 @@
             {
                 OperationalAttributeService.this.filter( entry );
                 return;
+            }
+
+            if ( dn.size() == 0 )
+            {
+                HashSet idsSet = new HashSet( ids.length );
+
+                for ( int ii = 0; ii < ids.length; ii++ )
+                {
+                    idsSet.add( ids[ii].toLowerCase() );
+                }
+
+                NamingEnumeration list = entry.getIDs();
+
+                while ( list.hasMore() )
+                {
+                    String attrId = ( ( String ) list.nextElement() ).toLowerCase();
+
+                    if ( ! idsSet.contains( attrId ) )
+                    {
+                        entry.remove( attrId );
+                    }
+                }
             }
 
             // do nothing past here since this explicity specifies which

Modified: incubator/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java?view=diff&r1=155379&r2=155380
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java
Fri Feb 25 19:35:20 2005
@@ -130,7 +130,9 @@
 
         DirContext ctx = ( DirContext ) initCtx.lookup( "" );
         Attributes attributes = ctx.getAttributes( "" );
-        assertEquals( 0, attributes.size() );
+
+        // Added some objectClass attributes to the rootDSE
+        assertEquals( 1, attributes.size() );
     }
 
 
@@ -151,9 +153,8 @@
         assertNotNull( initCtx );
 
         DirContext ctx = ( DirContext ) initCtx.lookup( "" );
-        Attributes attributes = ctx.getAttributes( "",
-                new String[]{ "namingContexts", "vendorName" });
-        assertEquals( 3, attributes.size() );
+        Attributes attributes = ctx.getAttributes( "", new String[]{ "namingContexts", "vendorName"
});
+        assertEquals( 2, attributes.size() );
         assertEquals( "Apache Software Foundation", attributes.get( "vendorName" ).get()
);
         assertTrue( attributes.get( "namingContexts" ).contains( "ou=system" ) );
     }



Mime
View raw message