openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1233928 - in /openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee: EjbResolver.java ExtendedStandaloneResourceInjectionService.java
Date Fri, 20 Jan 2012 14:29:48 GMT
Author: gpetracek
Date: Fri Jan 20 14:29:48 2012
New Revision: 1233928

URL: http://svn.apache.org/viewvc?rev=1233928&view=rev
Log:
OWB-641 support of @EJB(mappedName)

Modified:
    openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
    openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java

Modified: openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java?rev=1233928&r1=1233927&r2=1233928&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
(original)
+++ openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
Fri Jan 20 14:29:48 2012
@@ -18,9 +18,10 @@
  */
 package org.apache.webbeans.resource.spi.ee;
 
+import javax.ejb.EJB;
 import javax.naming.NamingException;
 
 public interface EjbResolver
 {
-    <T> T resolve(Class<T> resourceReference) throws NamingException;
+    <T> T resolve(Class<T> resourceReference, EJB ejbAnnotation) throws NamingException;
 }

Modified: openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java?rev=1233928&r1=1233927&r2=1233928&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java
(original)
+++ openwebbeans/trunk/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java
Fri Jan 20 14:29:48 2012
@@ -62,11 +62,12 @@ public class ExtendedStandaloneResourceI
     {
         if (resourceReference.supports(EJB.class))
         {
+            EJB ejbAnnotation = resourceReference.getAnnotation(EJB.class);
             for (EjbResolver ejbResolver : this.ejbResolvers)
             {
                 try
                 {
-                    X result = ejbResolver.resolve(resourceReference.getResourceType());
+                    X result = ejbResolver.resolve(resourceReference.getResourceType(), ejbAnnotation);
                     if(result != null)
                     {
                         return result;
@@ -81,8 +82,9 @@ public class ExtendedStandaloneResourceI
                     }
                 }
             }
-            
-            String jndiName = convertToJndiName(resourceReference.getResourceType());
+
+            String mappedName = ejbAnnotation.mappedName();
+            String jndiName = convertToJndiName(resourceReference.getResourceType(), mappedName);
             X result = lookupEjb(jndiName, resourceReference.getResourceType());
 
             return result;
@@ -91,9 +93,13 @@ public class ExtendedStandaloneResourceI
         return super.getResourceReference(resourceReference);
     }
 
-    private String convertToJndiName(Class resourceType)
+    private String convertToJndiName(Class resourceType, String mappedName)
     {
-        return resourceType.getSimpleName() + "#" + resourceType.getName();
+        if(mappedName.length() == 0)
+        {
+            mappedName = resourceType.getSimpleName();
+        }
+        return mappedName + "#" + resourceType.getName();
     }
 
     private <X> X lookupEjb(String jndiName, Class<X> resourceType)



Mime
View raw message