You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/11/08 01:34:24 UTC

svn commit: rev 56885 - in incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi: . ibs

Author: akarasulu
Date: Sun Nov  7 16:34:24 2004
New Revision: 56885

Modified:
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveContextFactory.java
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
Log:
some fixes to the eve cntext factory

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveContextFactory.java
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveContextFactory.java	(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/EveContextFactory.java	Sun Nov  7 16:34:24 2004
@@ -32,6 +32,7 @@
 import org.apache.ldap.common.schema.AttributeType;
 import org.apache.ldap.common.schema.Normalizer;
 import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.common.util.DateUtils;
 import org.apache.ldap.common.ldif.LdifIterator;
@@ -42,6 +43,7 @@
 import org.apache.eve.RootNexus;
 import org.apache.eve.SystemPartition;
 import org.apache.eve.ApplicationPartition;
+import org.apache.eve.exception.EveNamingException;
 import org.apache.eve.jndi.ibs.*;
 import org.apache.eve.db.*;
 import org.apache.eve.db.jdbm.JdbmDatabase;
@@ -442,7 +444,7 @@
      * subdirectory immediately under the Eve working directory base.
      *
      * @param eveWkdir the base Eve working directory
-     * @throws NamingException if there are problems creating and starting these
+     * @throws javax.naming.NamingException if there are problems creating and starting these
      * new application partitions
      */
     private void startUpAppPartitions( String eveWkdir ) throws NamingException
@@ -526,9 +528,27 @@
             // add the nexus context entry
             // ----------------------------------------------------------------
 
-            Attributes rootEntry = ( Attributes ) initialEnv.get(
-                    ATTRIBUTES_BASE_ENV + names[ii] );
-            partition.add( suffix, normSuffix, rootEntry );
+            Attributes rootAttrs;
+            Object rootEntry = initialEnv.get( ATTRIBUTES_BASE_ENV + names[ii] );
+
+            if ( rootEntry instanceof String )
+            {
+                rootAttrs = new LockableAttributesImpl();
+                String ldif = ( ( String ) rootEntry ).trim().replace( '*', '\n' );
+                ( new LdifParserImpl() ).parse( rootAttrs, ldif );
+            }
+            else if ( rootEntry instanceof Attributes )
+            {
+                rootAttrs = ( Attributes ) rootEntry;
+            }
+            else
+            {
+                throw new EveNamingException( "The root entry env property was"
+                        + " not of an expected type!",
+                        ResultCodeEnum.OTHER );
+            }
+
+            partition.add( suffix, normSuffix, rootAttrs );
         }
     }
 

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java	(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java	Sun Nov  7 16:34:24 2004
@@ -150,6 +150,12 @@
         {
             LdapContext ctx = ( LdapContext ) invocation.getContextStack().peek();
             Attributes attributes = ( Attributes ) invocation.getReturnValue();
+
+            if ( attributes == null )
+            {
+                return;
+            }
+
             Attributes retval = ( Attributes ) attributes.clone();
             filter( ctx, dn, retval, ids );
             invocation.setReturnValue( retval );