directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 55888 - in incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve: jndi jndi/ibs schema schema/bootstrap
Date Thu, 28 Oct 2004 19:39:53 GMT
Author: akarasulu
Date: Thu Oct 28 12:39:53 2004
New Revision: 55888

Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/GlobalOidRegistry.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapOidRegistry.java
Log:
Changes ...

 o found a little bug in the OID registries and fixed it
 o made operational attribute filtering use the schema now to determine
   if an attribute is returned by checking the USAGE on the attributeType



Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
Thu Oct 28 12:39:53 2004
@@ -235,14 +235,12 @@
         provider.addInterceptor( interceptor, state );
 
         /*
-         * Create and add the Eve scheam service interceptor to both the
-         * before and after interceptor chains.
+         * Create and add the Eve schema service interceptor to before chain.
          */
         state = new InvocationStateEnum[]{
-            InvocationStateEnum.PREINVOCATION,
-            InvocationStateEnum.POSTINVOCATION
+            InvocationStateEnum.PREINVOCATION
         };
-        interceptor = new SchemaService( root, globalRegistries );
+        interceptor = new SchemaService( root, globalRegistries, filterService );
         provider.addInterceptor( interceptor, state );
 
         /*

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
Thu Oct 28 12:39:53 2004
@@ -20,6 +20,7 @@
 import javax.naming.Name;
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
 import javax.naming.directory.*;
 
 import org.apache.eve.RootNexus;
@@ -29,8 +30,11 @@
 import org.apache.eve.jndi.BaseInterceptor;
 import org.apache.eve.jndi.InvocationStateEnum;
 import org.apache.eve.schema.GlobalRegistries;
+import org.apache.eve.schema.AttributeTypeRegistry;
 
 import org.apache.ldap.common.util.DateUtils;
+import org.apache.ldap.common.schema.AttributeType;
+import org.apache.ldap.common.schema.UsageEnum;
 
 
 /**
@@ -48,6 +52,7 @@
     private final SearchResultFilter SEARCH_FILTER = new SearchResultFilter()
     {
         public boolean accept( DbSearchResult result, SearchControls controls )
+            throws NamingException
         {
             if ( controls.getReturningAttributes() == null )
             {
@@ -60,7 +65,7 @@
     /** the lookup filter to register with filter service */
     private final LookupFilter LOOKUP_FILTER = new LookupFilter()
     {
-        public void filter( Name dn, Attributes entry )
+        public void filter( Name dn, Attributes entry ) throws NamingException
         {
             OperationalAttributeService.this.filter( entry );
         }
@@ -76,9 +81,8 @@
     /** the root nexus of the system */
     private final RootNexus nexus;
     /** a service used to filter search and lookup operations */
-    private FilterService filteringService;
-    /** the global schema object registries */
-    private final GlobalRegistries globalRegistries;
+    private final FilterService filteringService;
+    private final AttributeTypeRegistry registry;
 
 
     /**
@@ -97,11 +101,11 @@
             throw new NullPointerException( "the nexus cannot be null" );
         }
 
-        this.globalRegistries = globalRegistries;
-        if ( this.globalRegistries == null )
+        if ( globalRegistries == null )
         {
             throw new NullPointerException( "the global registries cannot be null" );
         }
+        this.registry = globalRegistries.getAttributeTypeRegistry();
 
         this.filteringService = filteringService;
         if ( this.filteringService == null )
@@ -254,12 +258,20 @@
      * @param attributes the resultant attributes to filter
      * @return true always
      */
-    private boolean filter( Attributes attributes )
+    private boolean filter( Attributes attributes ) throws NamingException
     {
-        attributes.remove( "creatorsName" );
-        attributes.remove( "modifiersName" );
-        attributes.remove( "createTimestamp" );
-        attributes.remove( "modifyTimestamp" );
+        NamingEnumeration list = attributes.getIDs();
+
+        while ( list.hasMore() )
+        {
+            String attrId = ( String ) list.next();
+            AttributeType type = registry.lookup( attrId );
+
+            if ( type.getUsage() != UsageEnum.USERAPPLICATIONS )
+            {
+                attributes.remove( attrId );
+            }
+        }
         return true;
     }
 

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
Thu Oct 28 12:39:53 2004
@@ -32,6 +32,7 @@
 {
     /** the root nexus to all database partitions */
     private final RootNexus nexus;
+    private FilterService filterService;
     /** the global schema object registries */
     private final GlobalRegistries globalRegistries;
 
@@ -41,8 +42,10 @@
      *
      * @param nexus the root nexus to access all database partitions
      * @param globalRegistries the global schema object registries
+     * @param filterService
      */
-    public SchemaService( RootNexus nexus, GlobalRegistries globalRegistries )
+    public SchemaService( RootNexus nexus, GlobalRegistries globalRegistries,
+                          FilterService filterService )
     {
         this.nexus = nexus;
         if ( this.nexus == null )
@@ -54,6 +57,12 @@
         if ( this.globalRegistries == null )
         {
             throw new NullPointerException( "the global registries cannot be null" );
+        }
+
+        this.filterService = filterService;
+        if ( this.filterService == null )
+        {
+            throw new NullPointerException( "the filter service cannot be null" );
         }
     }
 }

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/GlobalOidRegistry.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/GlobalOidRegistry.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/GlobalOidRegistry.java
Thu Oct 28 12:39:53 2004
@@ -170,7 +170,9 @@
      */
     public boolean hasOid( String name )
     {
-        return this.byName.contains( name ) || this.byOid.contains( name );
+        return this.byName.containsKey( name ) ||
+               this.byOid.containsKey( name )  ||
+               this.bootstrap.hasOid( name );
     }
 
 

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapOidRegistry.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapOidRegistry.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapOidRegistry.java
Thu Oct 28 12:39:53 2004
@@ -105,7 +105,7 @@
      */
     public boolean hasOid( String name )
     {
-        return this.byName.contains( name ) || this.byOid.contains( name );
+        return this.byName.containsKey( name ) || this.byOid.containsKey( name );
     }
 
 

Mime
View raw message