aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1412097 - /aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
Date Wed, 21 Nov 2012 13:50:19 GMT
Author: mnuttall
Date: Wed Nov 21 13:50:19 2012
New Revision: 1412097

URL: http://svn.apache.org/viewvc?rev=1412097&view=rev
Log:
Aries-822: getObjectInstanceViaContextDotObjectFactories does not take an attrs argument and
so the effect is the same as not honouring JAVA.NAMING.FACTORY.OBJECT

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

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java?rev=1412097&r1=1412096&r2=1412097&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
(original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
Wed Nov 21 13:50:19 2012
@@ -33,6 +33,8 @@ import javax.naming.RefAddr;
 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;
 
@@ -111,7 +113,7 @@ public class ObjectFactoryHelper impleme
 
         return (result == null) ? obj : result;
     }
-    
+ 
     /*
      * Attempt to obtain an Object instance via the java.naming.factory.object property
      */
@@ -120,6 +122,18 @@ public class ObjectFactoryHelper impleme
             Context nameCtx,
             Hashtable<?, ?> environment) throws Exception
     {
+    	return getObjectInstanceViaContextDotObjectFactories(obj, name, nameCtx, environment,
null);
+    }
+    
+    /*
+     * Attempt to obtain an Object instance via the java.naming.factory.object property
+     */
+    protected Object getObjectInstanceViaContextDotObjectFactories(Object obj,
+            Name name,
+            Context nameCtx,
+            Hashtable<?, ?> environment,
+            Attributes attrs) throws Exception
+    {
     	Object result = null;
     	String factories = (String) environment.get(Context.OBJECT_FACTORIES);
 		if (factories != null && factories.length() > 0) {
@@ -141,11 +155,22 @@ public class ObjectFactoryHelper impleme
 				}
 				logger.log(Level.FINE, "cand=" + cand + " factory=" + factory);
 				if (factory != null) {
-					result = factory.getObjectInstance(obj, name, nameCtx, environment);
+					if(factory instanceof DirObjectFactory)
+					{
+						logger.log(Level.FINE, "its a DirObjectFactory");
+						final DirObjectFactory dirFactory = (DirObjectFactory) factory;
+						result = dirFactory.getObjectInstance(obj, name, nameCtx, environment, attrs);
+					}
+					else
+					{
+						logger.log(Level.FINE, "its an ObjectFactory");
+						result = factory.getObjectInstance(obj, name, nameCtx, environment);
+					}
 				}
 				if (result != null && result != obj) break;
 			}
 		}
+		logger.log(Level.FINE, "result = " + result);
 		return (result == null) ? obj : result;
     }
 



Mime
View raw message