incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r821187 - /incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
Date Fri, 02 Oct 2009 22:16:55 GMT
Author: dims
Date: Fri Oct  2 22:16:52 2009
New Revision: 821187

URL: http://svn.apache.org/viewvc?rev=821187&view=rev
Log:
When we DirectoryManager#getObjectInstance calls DirObjectFactory#getObjectInstance, we need
to return 
the object being passed in for simple ldap lookups to work properly. Unfortunately there is
some
disconnect in the javadocs. Please see:

http://java.sun.com/javase/6/docs/api/javax/naming/spi/DirObjectFactory.html#getObjectInstance%28java.lang.Object,%20javax.naming.Name,%20javax.naming.Context,%20java.util.Hashtable,%20javax.naming.directory.Attributes%29

http://java.sun.com/javase/6/docs/api/javax/naming/spi/DirectoryManager.html#getObjectInstance%28java.lang.Object,%20javax.naming.Name,%20javax.naming.Context,%20java.util.Hashtable,%20javax.naming.directory.Attributes%29


Modified:
    incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java

Modified: incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java?rev=821187&r1=821186&r2=821187&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
(original)
+++ incubator/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiObjectFactoryBuilder.java
Fri Oct  2 22:16:52 2009
@@ -18,8 +18,9 @@
  */
 package org.apache.aries.jndi;
 
-import java.util.Enumeration;
-import java.util.Hashtable;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
 
 import javax.naming.Context;
 import javax.naming.Name;
@@ -28,14 +29,14 @@
 import javax.naming.Reference;
 import javax.naming.Referenceable;
 import javax.naming.StringRefAddr;
+import javax.naming.directory.Attributes;
+import javax.naming.spi.DirObjectFactory;
 import javax.naming.spi.ObjectFactory;
 import javax.naming.spi.ObjectFactoryBuilder;
+import java.util.Enumeration;
+import java.util.Hashtable;
 
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-public class OSGiObjectFactoryBuilder implements ObjectFactoryBuilder, ObjectFactory {
+public class OSGiObjectFactoryBuilder implements ObjectFactoryBuilder, ObjectFactory, DirObjectFactory
{
     /**
      * The bundle context we use for accessing the SR
      */
@@ -225,4 +226,15 @@
 
         return result;
     }
+
+    /**
+     * when we get called by DirectoryManager#getObjectInstance if we can't find the object

+     * instance, we just need to return the passed in refInfo  
+     */
+    @Override
+    public Object getObjectInstance(Object refInfo, Name name, Context nameCtx, 
+                                    Hashtable<?, ?> environment, Attributes attrs)
throws Exception {
+        Object result = getObjectInstance(refInfo, name, nameCtx, environment);
+        return result == null ? refInfo : result;
+    }
 }
\ No newline at end of file



Mime
View raw message