geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1146536 - /geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
Date Thu, 14 Jul 2011 01:26:12 GMT
Author: xuhaihong
Date: Thu Jul 14 01:26:11 2011
New Revision: 1146536

URL: http://svn.apache.org/viewvc?rev=1146536&view=rev
Log:
Only bind the data source reference to the openejb global tree

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java?rev=1146536&r1=1146535&r2=1146536&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
Thu Jul 14 01:26:11 2011
@@ -21,15 +21,13 @@
 package org.apache.geronimo.openejb;
 
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
-import org.apache.geronimo.gjndi.FederatedContext;
-import org.apache.geronimo.j2ee.jndi.JndiKey;
-import org.apache.geronimo.j2ee.jndi.JndiScope;
+import javax.naming.Reference;
+
+import org.apache.geronimo.datasource.DataSourceService;
 import org.apache.openejb.SystemException;
 import org.apache.openejb.core.JndiFactory;
 import org.apache.xbean.naming.context.ImmutableFederatedContext;
@@ -84,29 +82,32 @@ public class XBeanJndiFactory implements
 
     public void addGlobals(Map<String, Object> globals) {
         for (Map.Entry<String, Object> entry: globals.entrySet()) {
-            //No need to bind/unbind the empty global/env context built in ApplicationJndi

-            if (entry.getKey().equals("global/env")) {
-                continue;
-            }
-            String name = "openejb/global/" + entry.getKey();
-            try {                
-                rootContext.bind(name, entry.getValue());
-            } catch (NamingException e) {
-                //??
+            if (entry.getValue() instanceof Reference) {
+                Reference ref = (Reference)entry.getValue();
+                if(ref.getClassName().equals(DataSourceService.class.getName())) {
+                    String name = "openejb/global/" + entry.getKey();
+                    try {
+                        rootContext.bind(name, entry.getValue());
+                    } catch (Exception ignore) {
+                        //??
+                    }
+                }
             }
         }
     }
 
     public void removeGlobals(Map<String, Object> globals) {
         for (Map.Entry<String, Object> entry: globals.entrySet()) {
-            if(entry.getKey().equals("global/env")) {
-                continue;
-            }
-            String name = "openejb/global/" + entry.getKey();
-            try {
-                rootContext.unbind(name);
-            } catch (NamingException e) {
-                //??
+            if (entry.getValue() instanceof Reference) {
+                Reference ref = (Reference)entry.getValue();
+                if(ref.getClassName().equals(DataSourceService.class.getName())) {
+                    String name = "openejb/global/" + entry.getKey();
+                    try {
+                        rootContext.unbind(name);
+                    } catch (NamingException e) {
+                        //??
+                    }
+                }
             }
         }
     }



Mime
View raw message