[jboss-cvs] JBossAS SVN: r77155 - projects/ejb3/trunk/core/src/main/java/org/jboss/injection.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 18 08:44:20 EDT 2008


Author: wolfc
Date: 2008-08-18 08:44:19 -0400 (Mon, 18 Aug 2008)
New Revision: 77155

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java
Log:
EJBTHREE-1465: corrected usage of mapped name instead of enc name

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java	2008-08-18 12:43:40 UTC (rev 77154)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/ResourceHandler.java	2008-08-18 12:44:19 UTC (rev 77155)
@@ -114,7 +114,8 @@
          if (container.getEncInjectors().containsKey(encName))
             continue;
 
-         if (envRef.getMappedName() == null || envRef.getMappedName().equals(""))
+         String mappedName = envRef.getMappedName();
+         if (mappedName == null || mappedName.length() == 0)
          {
             if (envRef.getResUrl() != null)
             {
@@ -127,54 +128,57 @@
                   throw new RuntimeException(e);
                }
             }
-            else if (UserTransaction.class.getName().equals(envRef.getType()))
-            {
-               final InjectionContainer ic = container;
-               InjectorFactory<?> factory = new InjectorFactory<UserTransactionPropertyInjector>()
+            else {
+               if (UserTransaction.class.getName().equals(envRef.getType()))
                {
-                  public UserTransactionPropertyInjector create(BeanProperty property)
+                  final InjectionContainer ic = container;
+                  InjectorFactory<?> factory = new InjectorFactory<UserTransactionPropertyInjector>()
                   {
-                     return new UserTransactionPropertyInjector(property, ic);
+                     public UserTransactionPropertyInjector create(BeanProperty property)
+                     {
+                        return new UserTransactionPropertyInjector(property, ic);
+                     }
+                  };
+                  if(envRef.getInjectionTargets() != null)
+                  {
+                     InjectionUtil.createInjectors(container.getInjectors(), container.getClassloader(), factory, envRef.getInjectionTargets());
+                     continue;
                   }
-               };
-               if(envRef.getInjectionTargets() != null)
-               {
-                  InjectionUtil.createInjectors(container.getInjectors(), container.getClassloader(), factory, envRef.getInjectionTargets());
-                  continue;
+                  else
+                  {
+                     mappedName = "java:comp/UserTransaction";
+                  }
                }
-               else
+               else if (TimerService.class.getName().equals(envRef.getType()))
                {
-                  encName = "java:comp/UserTransaction";
-               }
-            }
-            else if (TimerService.class.getName().equals(envRef.getType()))
-            {
-               final Container ic = (Container) container;
-               InjectorFactory<?> factory = new InjectorFactory<TimerServicePropertyInjector>()
-               {
-                  public TimerServicePropertyInjector create(BeanProperty property)
+                  final Container ic = (Container) container;
+                  InjectorFactory<?> factory = new InjectorFactory<TimerServicePropertyInjector>()
                   {
-                     return new TimerServicePropertyInjector(property, ic);
+                     public TimerServicePropertyInjector create(BeanProperty property)
+                     {
+                        return new TimerServicePropertyInjector(property, ic);
+                     }
+                  };
+                  if(envRef.getInjectionTargets() != null)
+                  {
+                     InjectionUtil.createInjectors(container.getInjectors(), container.getClassloader(), factory, envRef.getInjectionTargets());
+                     continue;
                   }
-               };
-               if(envRef.getInjectionTargets() != null)
+                  else
+                  {
+                     mappedName = "java:comp/TimerService";
+                  }
+               }
+               else if (ORB.class.getName().equals(envRef.getType()))
                {
-                  InjectionUtil.createInjectors(container.getInjectors(), container.getClassloader(), factory, envRef.getInjectionTargets());
-                  continue;
-               }
+                  mappedName = "java:comp/ORB";
+               }            
                else
                {
-                  encName = "java:comp/TimerService";
+                  throw new RuntimeException("mapped-name is required for " + envRef.getResourceRefName() + " of deployment " + container.getIdentifier());
                }
+               container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, mappedName, "<resource-ref>"));
             }
-            else if (ORB.class.getName().equals(envRef.getType()))
-            {
-               encName = "java:comp/ORB";
-            }            
-            else
-            {
-               throw new RuntimeException("mapped-name is required for " + envRef.getResourceRefName() + " of deployment " + container.getIdentifier());
-            }
          }
          else
          {




More information about the jboss-cvs-commits mailing list