geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1140479 - in /geronimo/server/trunk/plugins: axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/ bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/ connector-1_6/geronimo-connector-builder-...
Date Tue, 28 Jun 2011 08:25:39 GMT
Author: xuhaihong
Date: Tue Jun 28 08:25:38 2011
New Revision: 1140479

URL: http://svn.apache.org/viewvc?rev=1140479&view=rev
Log:
GERONIMO-6022 Support use the @Resource(name="java:global/env/abc") for environment entry injection

Added:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/ReferenceType.java
Modified:
    geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
    geronimo/server/trunk/plugins/bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/BValNamingBuilder.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java
    geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/CorbaRefBuilder.java
    geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/OpenEjbCorbaRefBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Injection.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/test/java/org/apache/geronimo/j2ee/annotation/HolderTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WebServiceContextAnnotationHelper.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansNamingBuilder.java

Modified: geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -32,6 +32,7 @@ import org.apache.geronimo.common.Deploy
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.HandlerInfoInfo;
 import org.apache.geronimo.j2ee.deployment.Module;
@@ -66,7 +67,7 @@ public class AxisServiceRefBuilder exten
     private final AxisBuilder axisBuilder;
 
     public AxisServiceRefBuilder(@ParamAttribute(name = "defaultEnvironment") Environment defaultEnvironment,
-                                 @ParamAttribute(name = "eeNamespaces") String[] eeNamespaces, 
+                                 @ParamAttribute(name = "eeNamespaces") String[] eeNamespaces,
                                  @ParamReference(name = "AxisBuilder", namingType = NameFactory.MODULE_BUILDER) AxisBuilder axisBuilder) {
         super(defaultEnvironment);
         this.axisBuilder = axisBuilder;
@@ -158,7 +159,7 @@ public class AxisServiceRefBuilder exten
 
 //we could get a Reference or the actual serializable Service back.
         Object ref = axisBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, gerServiceRefType, module, bundle);
-        put(name, ref, module.getJndiContext(), serviceRef.getInjectionTarget(), sharedContext);
+        put(name, ref, ReferenceType.SERVICE, module.getJndiContext(), serviceRef.getInjectionTarget(), sharedContext);
         //getJndiContextMap(componentContext).put(ENV + name, ref);
     }
 
@@ -174,7 +175,7 @@ public class AxisServiceRefBuilder exten
     private static List<HandlerInfoInfo> buildHandlerInfoList(List<Handler> handlers, Bundle bundle) throws DeploymentException {
         List<HandlerInfoInfo> handlerInfos = new ArrayList<HandlerInfoInfo>();
         for (Handler handler: handlers) {
-            List<String> portNames = handler.getPortName(); 
+            List<String> portNames = handler.getPortName();
             String handlerClassName = handler.getHandlerClass();
             Class handlerClass;
             try {
@@ -186,7 +187,7 @@ public class AxisServiceRefBuilder exten
             for (ParamValue paramValue: handler.getInitParam()) {
                 config.put(paramValue.getParamName(), paramValue.getParamValue());
             }
-            List<QName> headerQNames = handler.getSoapHeader(); 
+            List<QName> headerQNames = handler.getSoapHeader();
             Set<String> soapRoles = new HashSet<String>(handler.getSoapRole());
             HandlerInfoInfo handlerInfoInfo = new HandlerInfoInfo(new HashSet(portNames), handlerClass, config, headerQNames, soapRoles);
             handlerInfos.add(handlerInfoInfo);

Modified: geronimo/server/trunk/plugins/bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/BValNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/BValNamingBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/BValNamingBuilder.java (original)
+++ geronimo/server/trunk/plugins/bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/BValNamingBuilder.java Tue Jun 28 08:25:38 2011
@@ -23,7 +23,6 @@ package org.apache.geronimo.bval.deploym
 import java.util.Collections;
 import java.util.Map;
 
-import javax.validation.ValidationException;
 import javax.validation.ValidatorFactory;
 
 import org.apache.geronimo.bval.DefaultValidatorFactoryReference;
@@ -33,14 +32,13 @@ import org.apache.geronimo.common.Deploy
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.jndi.JndiKey;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
-import org.apache.geronimo.naming.reference.ResourceReference;
 import org.apache.openejb.jee.InjectionTarget;
 import org.apache.openejb.jee.JndiConsumer;
 import org.apache.xmlbeans.QNameSet;
@@ -73,12 +71,12 @@ public class BValNamingBuilder extends A
             moduleContext.getGBeanInstance(abstractName);
             String osgiJndiName = module.getEarContext().getNaming().toOsgiJndiName(abstractName);
             String filter = "(osgi.jndi.service.name=" + osgiJndiName + ')';
-            put("java:comp/ValidatorFactory", new ValidatorFactoryResourceReference(filter, ValidatorFactory.class.getName()), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put("java:comp/ValidatorFactory", new ValidatorFactoryResourceReference(filter, ValidatorFactory.class.getName()), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
         } catch (GBeanNotFoundException e) {
             // if we can't find one on the module, then bind to a default validator factory 
-            put("java:comp/ValidatorFactory", new DefaultValidatorFactoryReference(), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put("java:comp/ValidatorFactory", new DefaultValidatorFactoryReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
         }
-        put("java:comp/Validator", new DefaultValidatorReference(), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+        put("java:comp/Validator", new DefaultValidatorReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
     }
 
     @Override

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -42,6 +42,7 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
@@ -131,20 +132,20 @@ public class AdminObjectRefBuilder exten
 
 
     public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map sharedContext) throws DeploymentException {
-        
+
         AbstractNameQuery transactionManager = module.getEarContext().getTransactionManagerName();
         if (transactionManager != null) {
             Set<AbstractNameQuery> query = new HashSet<AbstractNameQuery>();
             query.add(transactionManager);
             GBeanReference transactionManagerRef = new GBeanReference(module.getConfigId(), query, TransactionManager.class);
-            put("java:comp/TransactionManager", transactionManagerRef, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put("java:comp/TransactionManager", transactionManagerRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
             GBeanReference transactionSynchronizationRef = new GBeanReference(module.getConfigId(), query, TransactionSynchronizationRegistry.class);
-            put("java:comp/TransactionSynchronizationRegistry", transactionSynchronizationRef, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put("java:comp/TransactionSynchronizationRegistry", transactionSynchronizationRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
         }
-        
-        put("java:comp/Bundle", new BundleReference(), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
-        put("java:comp/BundleContext", new BundleContextReference(), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
-        
+
+        put("java:comp/Bundle", new BundleReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptyList(), sharedContext);
+        put("java:comp/BundleContext", new BundleContextReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptyList(), sharedContext);
+
         XmlObject[] gerResourceEnvRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_ADMIN_OBJECT_REF_QNAME_SET);
         Map<String, GerResourceEnvRefType> refMap = mapResourceEnvRefs(gerResourceEnvRefsUntyped);
         Map<String, Map<String, GerMessageDestinationType>> messageDestinations = module.getRootEarContext().getMessageDestinations();
@@ -192,7 +193,7 @@ public class AdminObjectRefBuilder exten
             if (value == null) {
                 unresolvedRefs.add(name);
             } else {
-                put(name, value, module.getJndiContext(), resourceEnvRef.getInjectionTarget(), sharedContext);
+                put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), resourceEnvRef.getInjectionTarget(), sharedContext);
             }
         }
 
@@ -235,7 +236,7 @@ public class AdminObjectRefBuilder exten
             }
 
             if (value != null) {
-                put(name, value, module.getJndiContext(), messageDestinationRef.getInjectionTarget(), sharedContext);
+                put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), messageDestinationRef.getInjectionTarget(), sharedContext);
             }
         }
 
@@ -261,7 +262,7 @@ public class AdminObjectRefBuilder exten
             } else {
                 addr = new StringRefAddr("","");
             }
-            
+
             String objectFactory = getStringValue(gerResourceEnvRef.getObjectFactory());
             String objectFactoryLocation = getStringValue(gerResourceEnvRef.getObjectFactoryLocation());
             return new Reference(clazz, addr, objectFactory, objectFactoryLocation);
@@ -435,20 +436,20 @@ public class AdminObjectRefBuilder exten
         public static final AdminObjectRefProcessor INSTANCE = new AdminObjectRefProcessor(null, null, null);
 
         private static final Set<String> knownResourceEnvEntries = new HashSet<String>(Arrays.asList(
-                "javax.ejb.SessionContext", 
-                "javax.ejb.MessageDrivenContext", 
-                "javax.ejb.EntityContext", 
-                "javax.ejb.TimerService", 
-                "javax.validation.Validator", 
+                "javax.ejb.SessionContext",
+                "javax.ejb.MessageDrivenContext",
+                "javax.ejb.EntityContext",
+                "javax.ejb.TimerService",
+                "javax.validation.Validator",
                 "javax.validation.ValidatorFactory",
                 "javax.enterprise.inject.spi.BeanManager",
-                "javax.transaction.UserTransaction", 
-                "javax.transaction.TransactionManager", 
+                "javax.transaction.UserTransaction",
+                "javax.transaction.TransactionManager",
                 "javax.transaction.TransactionSynchronizationRegistry",
                 "org.osgi.framework.Bundle",
                 "org.osgi.framework.BundleContext"
         ));
-        
+
         private final EARContext earContext;
         private final Map<String, GerResourceEnvRefType> refMap;
         private final Map<String, Map<String, GerMessageDestinationType>> messageDestinations;
@@ -462,7 +463,7 @@ public class AdminObjectRefBuilder exten
         public boolean processResource(JndiConsumer annotatedApp, Resource annotation, Class cls, Method method, Field field) throws DeploymentException {
             String resourceName = getResourceName(annotation, method, field);
             String resourceType = getResourceType(annotation, method, field);
-            
+
             String jndiName = getJndiName(resourceName);
 
             //If it already exists in xml as a message-destination-ref or resource-env-ref, we are done.
@@ -476,7 +477,7 @@ public class AdminObjectRefBuilder exten
                 }
                 return true;
             }
-            
+
             ResourceEnvRef resourceEnvRef = annotatedApp.getResourceEnvRefMap().get(jndiName);
             if (resourceEnvRef != null) {
                 if (method != null || field != null) {

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -43,6 +43,7 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
@@ -72,7 +73,6 @@ import org.apache.openejb.jee.Text;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -135,13 +135,13 @@ public class ResourceRefBuilder extends 
             ResourceRef resourceRef = entry.getValue();
             if (lookupJndiContextMap(module, name) != null) {
                 // some other builder handled this entry already
-                
+
                 // Always merge injections. This is for example where data source is defined as
                 // @DataSource(name='foo') and it is injected via @Resource(name='foo')
-                addInjections(normalize(name), resourceRef.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
-                
+                addInjections(normalize(name), ReferenceType.RESOURCE, resourceRef.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
+
                 continue;
-            }            
+            }
             String type = getStringValue(resourceRef.getResType());
             type = inferAndCheckType(module, bundle, resourceRef.getInjectionTarget(), name, type);
             GerResourceRefType gerResourceRef = refMap.get(name);
@@ -165,7 +165,7 @@ public class ResourceRefBuilder extends 
             if (value == null) {
                 unresolvedRefs.add(name);
             } else {
-                put(name, value, module.getJndiContext(), resourceRef.getInjectionTarget(), sharedContext);
+                put(name, value, ReferenceType.RESOURCE, module.getJndiContext(), resourceRef.getInjectionTarget(), sharedContext);
             }
 
         }
@@ -215,7 +215,7 @@ public class ResourceRefBuilder extends 
             if (iface != null) {
                 beanName = beanName + "!" + iface.getName();
             }
-            return new JndiReference("java:module/" + beanName);        
+            return new JndiReference("java:module/" + beanName);
         } else {
             //determine jsr-77 type from interface
             String j2eeType;
@@ -437,30 +437,30 @@ public class ResourceRefBuilder extends 
                         log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");
                     }
                 }
-                
+
                 if (method != null || field != null) {
                     List<InjectionTarget> targets = resourceRef.getInjectionTarget();
                     if (!hasTarget(method, field, targets)) {
                         resourceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                     }
                 }
-                
+
                 return true;
             }
-            
+
             return false;
         }
-        
+
         private boolean isManagedBeanReference(Class<?> resourceTypeClass, Resource annotation) {
             // Check if this is @Resource managedBean injection. Handle two cases:
-            // 1) @Resource managedBeanClass; or  
-            // 2) @Resource(lookup='...') managedBeanInterfaceClass; 
-            if (resourceTypeClass.isAnnotationPresent(ManagedBean.class) || 
+            // 1) @Resource managedBeanClass; or
+            // 2) @Resource(lookup='...') managedBeanInterfaceClass;
+            if (resourceTypeClass.isAnnotationPresent(ManagedBean.class) ||
                 (resourceTypeClass.isInterface() && annotation.lookup().length() != 0)) {
                 return true;
             }
             return false;
         }
     }
-        
+
 }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java Tue Jun 28 08:25:38 2011
@@ -34,6 +34,7 @@ import org.apache.geronimo.datasource.Da
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -143,7 +144,7 @@ public class DataSourceBuilder extends A
 
         try {
             Object ref = DataSourceService.buildReference(dsDescription);
-            put(jndiName, ref, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put(jndiName, ref, ReferenceType.DATA_SOURCE, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
         } catch (IOException e) {
             throw new DeploymentException("Could not construct Reference for datasource " + dsDescription, e);
         }

Modified: geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/CorbaRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/CorbaRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/CorbaRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/CorbaRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -27,6 +27,7 @@ import org.apache.geronimo.gbean.SingleE
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
@@ -69,8 +70,8 @@ public class CorbaRefBuilder extends Abs
                 AbstractNameQuery corbaName = corbaGBeanNameSource.getCorbaGBeanName();
                 if (corbaName != null) {
                     Artifact[] moduleId = module.getConfigId();
-                    put("java:comp/ORB", new ORBReference(moduleId, corbaName), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
-                    put("java:comp/HandleDelegate", new HandleDelegateReference(moduleId, corbaName), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+                    put("java:comp/ORB", new ORBReference(moduleId, corbaName), ReferenceType.ORB, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+                    put("java:comp/HandleDelegate", new HandleDelegateReference(moduleId, corbaName), ReferenceType.HANDLEDELEGATE, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
                 }
             }
         }

Modified: geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/OpenEjbCorbaRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/OpenEjbCorbaRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/OpenEjbCorbaRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/OpenEjbCorbaRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -25,11 +25,13 @@ import java.util.Map;
 
 import javax.naming.Reference;
 import javax.xml.namespace.QName;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.corba.proxy.CORBAProxyReference;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -109,7 +111,7 @@ public class OpenEjbCorbaRefBuilder exte
 
             Reference ejbReference = addEJBRef(module, ejbRef, remoteRef, bundle);
             if (ejbReference != null) {
-                put(ejbRefName, ejbReference, module.getJndiContext(), ejbRef.getInjectionTarget(), sharedContext);
+                put(ejbRefName, ejbReference, ReferenceType.EJB, module.getJndiContext(), ejbRef.getInjectionTarget(), sharedContext);
             }
         }
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java Tue Jun 28 08:25:38 2011
@@ -61,18 +61,18 @@ public class Holder implements Serializa
             this.injectionMap = new HashMap<String, Set<Injection>>();
             addInjectionMap(source.getInjectionMap());
         }
-        
+
         if (source.getPostConstruct() != null) {
             this.postConstruct = new HashMap<String, LifecycleMethod>();
             addPostConstructs(source.getPostConstruct());
         }
-        
+
         if (source.getPreDestroy() != null) {
             this.preDestroy = new HashMap<String, LifecycleMethod>();
             addPreDestroys(source.getPreDestroy());
         }
     }
-    
+
     private Set<Injection> getInjectionList(String className) {
         if (injectionMap == null) {
             injectionMap = new HashMap<String, Set<Injection>>();
@@ -84,14 +84,14 @@ public class Holder implements Serializa
         }
         return injections;
     }
-    
+
     public void addInjection(String className, Injection newInjection) {
         Set<Injection> injections = getInjectionList(className);
         injections.add(newInjection);
     }
-    
+
     public void addInjections(String className, Collection<Injection> newInjections) {
-        Set<Injection> injections = getInjectionList(className);        
+        Set<Injection> injections = getInjectionList(className);
         for (Injection injection : newInjections) {
             injections.add(injection);
         }
@@ -123,12 +123,12 @@ public class Holder implements Serializa
         for (Map.Entry<String, Set<Injection>> entry : injectionMap.entrySet()) {
             String className = entry.getKey();
             Set<Injection> injections = entry.getValue();
-            addInjections(className, injections);            
+            addInjections(className, injections);
         }
     }
-    
+
     public List<Injection> getInjections(String className) {
-        if (injectionMap != null) {                  
+        if (injectionMap != null) {
             Set<Injection> injections = injectionMap.get(className);
             if (injections != null) {
                 return new ArrayList<Injection>(injections);
@@ -140,7 +140,7 @@ public class Holder implements Serializa
     public Map<String, Set<Injection>> getInjectionMap() {
         return injectionMap;
     }
-    
+
     public Map<String, LifecycleMethod> getPostConstruct() {
         return postConstruct;
     }
@@ -159,7 +159,7 @@ public class Holder implements Serializa
         ObjectRecipe objectRecipe = new ObjectRecipe(className);
         objectRecipe.allow(Option.FIELD_INJECTION);
         objectRecipe.allow(Option.PRIVATE_PROPERTIES);
-        Class clazz;
+        Class<?> clazz;
         try {
             clazz = classLoader.loadClass(className);
         } catch (ClassNotFoundException e) {
@@ -207,32 +207,37 @@ public class Holder implements Serializa
                     Object object = context.lookup(jndiName);
                     objectRecipe.setProperty(injection.getTargetName(), object);
                 } catch (NamingException e) {
+                    //Per EE 5.4.1.3, if no value is configured for environment entry, it will be ignored
+                    //In the past, we skip this in the EnvironmentEntryBuilder, while in Java EE 6, there are some sharable JNDI name spaces are added
+                    //So, in some scenarios, it is impossible to know whether the environment entry is available in the deploying process.
+                    if (injection.getType() != ReferenceType.ENV_ENTRY) {
+                        problems.add(e);
+                    }
                     log.info("Could not look up " + injection.getJndiName(), e);
-                    problems.add(e);
                 }
             }
         }
     }
 
     public void destroyInstance(Object o) throws Exception {
-        Class clazz = o.getClass();
+        Class<?> clazz = o.getClass();
         Map<String, LifecycleMethod> preDestroy = getPreDestroy();
         if (preDestroy != null) {
             apply(o, clazz, preDestroy);
         }
     }
 
-    public static void apply(Object o, Class clazz, Map<String, LifecycleMethod> map) throws IllegalAccessException, InvocationTargetException {
+    public static void apply(Object o, Class<?> clazz, Map<String, LifecycleMethod> map) throws IllegalAccessException, InvocationTargetException {
         if (clazz == null) {
             clazz = o.getClass();
         }
-        ArrayList<Class> classes = new ArrayList<Class>();
+        ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
         while (clazz != null && clazz != Object.class) {
             classes.add(clazz);
             clazz = clazz.getSuperclass();
         }
         for (int i = classes.size() - 1; i > -1; i--) {
-            Class clazz1 = classes.get(i);
+            Class<?> clazz1 = classes.get(i);
             LifecycleMethod m = map.get(clazz1.getName());
             if (m != null) {
                 m.call(o, clazz1);

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Injection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Injection.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Injection.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Injection.java Tue Jun 28 08:25:38 2011
@@ -30,12 +30,14 @@ public class Injection implements Serial
     private final String targetClassName;
     private final String targetName;
     private final String jndiName;
+    private final ReferenceType type;
 
 
-    public Injection(String targetClassName, String targetName, String jndiName) {
+    public Injection(String targetClassName, String targetName, String jndiName, ReferenceType type) {
         this.targetClassName = targetClassName;
         this.targetName = targetName;
         this.jndiName = jndiName;
+        this.type = type;
     }
 
 
@@ -50,58 +52,54 @@ public class Injection implements Serial
     public String getJndiName() {
         return jndiName;
     }
-    
+
+    public ReferenceType getType() {
+        return type;
+    }
+
+    @Override
     public String toString() {
-        StringBuffer buf = new StringBuffer();
-        buf.append(targetClassName).append(" ");
-        buf.append(targetName).append(" ");
-        buf.append(jndiName);
-        return buf.toString();
+        return "Injection [targetClassName=" + targetClassName + ", targetName=" + targetName + ", jndiName=" + jndiName + ", type=" + type + "]";
     }
 
+    @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
         result = prime * result + ((targetClassName == null) ? 0 : targetClassName.hashCode());
         result = prime * result + ((targetName == null) ? 0 : targetName.hashCode());
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
         return result;
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if (this == obj) {
+        if (this == obj)
             return true;
-        }
-        if (obj == null) {
+        if (obj == null)
             return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (getClass() != obj.getClass())
             return false;
-        }
-        final Injection other = (Injection) obj;        
+        Injection other = (Injection) obj;
         if (jndiName == null) {
-            if (other.jndiName != null) {
+            if (other.jndiName != null)
                 return false;
-            }
-        } else if (!jndiName.equals(other.jndiName)) {
+        } else if (!jndiName.equals(other.jndiName))
             return false;
-        }        
         if (targetClassName == null) {
-            if (other.targetClassName != null) { 
+            if (other.targetClassName != null)
                 return false;
-            }
-        } else if (!targetClassName.equals(other.targetClassName)) {
+        } else if (!targetClassName.equals(other.targetClassName))
             return false;
-        }        
         if (targetName == null) {
-            if (other.targetName != null) {
+            if (other.targetName != null)
                 return false;
-            }
-        } else if (!targetName.equals(other.targetName)) {
+        } else if (!targetName.equals(other.targetName))
+            return false;
+        if (type != other.type)
             return false;
-        }
-        
         return true;
     }
-    
+
 }

Added: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/ReferenceType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/ReferenceType.java?rev=1140479&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/ReferenceType.java (added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/ReferenceType.java Tue Jun 28 08:25:38 2011
@@ -0,0 +1,25 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.annotation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public enum ReferenceType {
+    ENV_ENTRY, EJB_LOCAL, EJB, RESOURCE, RESOURCE_ENV, MESSAGE_DESTINATION, PERSISTENCE_CONTEXT, PERSISTENCE_UNIT, DATA_SOURCE, SERVICE, GBEAN, HANDLEDELEGATE, ORB
+}

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/test/java/org/apache/geronimo/j2ee/annotation/HolderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/test/java/org/apache/geronimo/j2ee/annotation/HolderTest.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/test/java/org/apache/geronimo/j2ee/annotation/HolderTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/test/java/org/apache/geronimo/j2ee/annotation/HolderTest.java Tue Jun 28 08:25:38 2011
@@ -27,82 +27,82 @@ public class HolderTest extends TestCase
 
     public void testDuplicates() throws Exception {
         Holder holder = new Holder();
-        holder.addInjection("a1", new Injection("a1", "1", "2"));
-        holder.addInjection("a1", new Injection("a1", "1", "2"));
-        
-        holder.addInjection("a1", new Injection("a1", "1", "X"));
-        holder.addInjection("a1", new Injection("a1", "X", "2"));
-        
+        holder.addInjection("a1", new Injection("a1", "1", "2", ReferenceType.ENV_ENTRY));
+        holder.addInjection("a1", new Injection("a1", "1", "2", ReferenceType.ENV_ENTRY));
+
+        holder.addInjection("a1", new Injection("a1", "1", "X", ReferenceType.ENV_ENTRY));
+        holder.addInjection("a1", new Injection("a1", "X", "2", ReferenceType.ENV_ENTRY));
+
         List<Injection> injections = holder.getInjections("a1");
-        assertEquals(3, injections.size());        
+        assertEquals(3, injections.size());
     }
-    
-    
+
+
     public void testCopy() throws Exception {
         Holder source = new Holder();
-        source.addInjection("a1", new Injection("a1", "1", "2"));
-        source.addInjection("a1", new Injection("a1", "3", "4"));
-        
-        source.addInjection("b1", new Injection("b1", "5", "6"));
+        source.addInjection("a1", new Injection("a1", "1", "2", ReferenceType.ENV_ENTRY));
+        source.addInjection("a1", new Injection("a1", "3", "4", ReferenceType.ENV_ENTRY));
+
+        source.addInjection("b1", new Injection("b1", "5", "6", ReferenceType.ENV_ENTRY));
 
         HashMap<String, LifecycleMethod> postConstruct = new HashMap<String, LifecycleMethod>();
         postConstruct.put("class1", new LifecycleMethod("class1", "method1"));
         postConstruct.put("class2", new LifecycleMethod("class2", "method2"));
-        
+
         source.addPostConstructs(postConstruct);
-        
+
         HashMap<String, LifecycleMethod> preDestroy = new HashMap<String, LifecycleMethod>();
         preDestroy.put("class3", new LifecycleMethod("class3", "method1"));
         preDestroy.put("class4", new LifecycleMethod("class4", "method2"));
-        
+
         source.addPreDestroys(preDestroy);
-        
+
         Holder copy = new Holder(source);
-        
-        compareInjection(source.getInjectionMap(), copy.getInjectionMap());  
+
+        compareInjection(source.getInjectionMap(), copy.getInjectionMap());
         compareLifecycleMethod(source.getPostConstruct(), copy.getPostConstruct());
         compareLifecycleMethod(source.getPreDestroy(), copy.getPreDestroy());
     }
-    
+
     private void compareInjection(Map<String, Set<Injection>> expected, Map<String, Set<Injection>> actual) {
         assertNotNull(expected);
         assertNotNull(actual);
         assertTrue(expected != actual);
         assertEquals(expected.size(), actual.size());
-        
+
         for (Map.Entry<String, Set<Injection>> entry : expected.entrySet()) {
             String className = entry.getKey();
             Set<Injection> expectedInjections = entry.getValue();
-            
+
             Set<Injection> actualInjections = actual.get(className);
             compare(expectedInjections, actualInjections);
-        }                            
+        }
     }
-    
+
     private void compare(Set<Injection> expected, Set<Injection> actual) {
         assertNotNull(expected);
         assertNotNull(actual);
         assertTrue(expected != actual);
         assertEquals(expected.size(), actual.size());
-        
+
         for (Injection injection : expected) {
             assertTrue(actual.contains(injection));
         }
     }
-    
+
     private void compareLifecycleMethod(Map<String, LifecycleMethod> expected, Map<String, LifecycleMethod> actual) {
         assertNotNull(expected);
         assertNotNull(actual);
         assertTrue(expected != actual);
         assertEquals(expected.size(), actual.size());
-        
+
         for (Map.Entry<String, LifecycleMethod> entry : expected.entrySet()) {
             String className = entry.getKey();
             LifecycleMethod expectedMethod = entry.getValue();
-            
+
             LifecycleMethod actualMethod = actual.get(className);
             assertEquals(expectedMethod, actualMethod);
         }
     }
-    
+
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java Tue Jun 28 08:25:38 2011
@@ -18,7 +18,6 @@
 package org.apache.geronimo.naming.deployment;
 
 import java.beans.Introspector;
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -32,6 +31,7 @@ import java.util.Set;
 
 import javax.annotation.Resource;
 import javax.xml.namespace.QName;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
@@ -39,6 +39,7 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.annotation.Injection;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
@@ -133,7 +134,7 @@ public abstract class AbstractNamingBuil
 
     public void initContext(JndiConsumer specDD, XmlObject plan, Module module) throws DeploymentException {
     }
-    
+
     public int getPriority() {
         return NORMAL_PRIORITY;
     }
@@ -149,7 +150,7 @@ public abstract class AbstractNamingBuil
      * @param injectionTargets
      * @param sharedContext
      */
-    protected void put(String key, Object value, Map<JndiKey, Map<String, Object>> contexts, List<InjectionTarget> injectionTargets, Map<EARContext.Key, Object> sharedContext) {
+    protected void put(String key, Object value, ReferenceType type, Map<JndiKey, Map<String, Object>> contexts, List<InjectionTarget> injectionTargets, Map<EARContext.Key, Object> sharedContext) {
         key = normalize(key);
         JndiKey jndiKey = keyFor(key);
         Map<String, Object> scope = contexts.get(jndiKey);
@@ -157,11 +158,13 @@ public abstract class AbstractNamingBuil
             scope = new HashMap<String, Object>();
             contexts.put(jndiKey, scope);
         }
-        log.debug("binding at name " + key + " in scope " + jndiKey + " value " + value);
+        if (log.isDebugEnabled()) {
+            log.debug("binding at name " + key + " in scope " + jndiKey + " value " + value);
+        }
         scope.put(key, value);
-        addInjections(key, injectionTargets, NamingBuilder.INJECTION_KEY.get(sharedContext));
+        addInjections(key, type, injectionTargets, NamingBuilder.INJECTION_KEY.get(sharedContext));
     }
-    
+
     protected Object lookupJndiContextMap(Module module, String key) {
         key = normalize(key);
         JndiKey jndiKey = keyFor(key);
@@ -186,15 +189,19 @@ public abstract class AbstractNamingBuil
         return JndiScope.valueOf(type);
     }
 
+    protected boolean isSharableJndiNamespace(String name) {
+        name = normalize(name);
+        return name.startsWith("app/") || name.startsWith("module/") || name.startsWith("global/");
+    }
 
     protected static String getJndiName(String name) {
-        if (name.indexOf(':') == -1) {   
+        if (name.indexOf(':') == -1) {
             return "java:comp/env/" + name.trim();
         } else {
             return name.trim();
         }
     }
-    
+
     protected AbstractName getGBeanName(Map<EARContext.Key, Object> sharedContext) {
         return GBEAN_NAME_KEY.get(sharedContext);
     }
@@ -284,7 +291,7 @@ public abstract class AbstractNamingBuil
     protected static String getStringValue(String s) {
         return s == null ? null : s.trim();
     }
-    
+
 
     public static AbstractNameQuery buildAbstractNameQuery(GerPatternType pattern, String type, String moduleType, Set interfaceTypes) {
         return ENCConfigBuilder.buildAbstractNameQueryFromPattern(pattern, null, type, moduleType, interfaceTypes);
@@ -293,7 +300,7 @@ public abstract class AbstractNamingBuil
     public static AbstractNameQuery buildAbstractNameQuery(Artifact configId, String module, String name, String type, String moduleType) {
         return ENCConfigBuilder.buildAbstractNameQuery(configId, module, normalizeJndiName(name), type, moduleType);
     }
-    
+
     private static String normalizeJndiName(String name) {
         if (name.startsWith("java:")) {
             return name.substring(name.indexOf("/env/") + 5);
@@ -327,11 +334,11 @@ public abstract class AbstractNamingBuil
         return clazz;
     }
 
-    protected void addInjections(String jndiName, List<InjectionTarget> injectionTargets, Holder holder) {
+    protected void addInjections(String jndiName, ReferenceType type, List<InjectionTarget> injectionTargets, Holder holder) {
         for (InjectionTarget injectionTarget : injectionTargets) {
             String targetName = injectionTarget.getInjectionTargetName().trim();
             String targetClassName = injectionTarget.getInjectionTargetClass().trim();
-            holder.addInjection(targetClassName, new Injection(targetClassName, targetName, jndiName));
+            holder.addInjection(targetClassName, new Injection(targetClassName, targetName, jndiName, type));
         }
     }
 
@@ -374,7 +381,7 @@ public abstract class AbstractNamingBuil
         }
         return type.getName();
     }
-    
+
     private static Class<?> chooseType(String name, Class<?> originalType, Class<?> alternativeType) throws DeploymentException{
         alternativeType = deprimitivize(alternativeType);
         originalType = deprimitivize(originalType);
@@ -390,8 +397,8 @@ public abstract class AbstractNamingBuil
             } else {
                 throw new DeploymentException("Mismatched types in named: " + name + " type: " + originalType );
             }
-        } 
-        
+        }
+
         return originalType;
     }
 
@@ -414,9 +421,9 @@ public abstract class AbstractNamingBuil
     }
 
     private Class<?> getField(Class<?> clazz, String fieldName) throws NoSuchFieldException, DeploymentException {
-        
+
         Class<?> type = null;
-        
+
         do {
             try {
                 Field field = clazz.getDeclaredField(fieldName);
@@ -426,7 +433,7 @@ public abstract class AbstractNamingBuil
                 } else {
                     type = field.getType();
                 }
-                
+
             } catch (NoSuchFieldException e) {
                 //look at superclass
             }
@@ -446,16 +453,16 @@ public abstract class AbstractNamingBuil
                     }
                 }
             }
-            
+
             if (type != null) {
                 return deprimitivize(type);
             }
-            
+
             clazz = clazz.getSuperclass();
         } while (clazz != null);
-        
 
-        
+
+
         throw new NoSuchFieldException(fieldName);
     }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java Tue Jun 28 08:25:38 2011
@@ -33,6 +33,7 @@ import org.apache.geronimo.deployment.xm
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
@@ -108,14 +109,13 @@ public class EnvironmentEntryBuilder ext
         for (Map.Entry<String, EnvEntry> entry : specDD.getEnvEntryMap().entrySet()) {
             String name = entry.getKey();
             EnvEntry envEntry = entry.getValue();
-            
+
             if (lookupJndiContextMap(module, name) != null) {
                 // some other builder handled this entry already
-                addInjections(normalize(name), envEntry.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
-                
+                addInjections(normalize(name), ReferenceType.ENV_ENTRY, envEntry.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
                 continue;
-            }         
-            
+            }
+
             String type = getStringValue(envEntry.getEnvEntryType());
 
             Object value = null;
@@ -194,7 +194,10 @@ public class EnvironmentEntryBuilder ext
             // perform resource injection only if there is a value specified
             // see Java EE 5 spec, section EE.5.4.1.3
             if (value != null) {
-                put(name, value, module.getJndiContext(), envEntry.getInjectionTarget(), sharedContext);
+                put(name, value, ReferenceType.ENV_ENTRY, module.getJndiContext(), envEntry.getInjectionTarget(), sharedContext);
+            } else if(isSharableJndiNamespace(name)) {
+                //Even the value is configured, while it is belong to those shareable namespace, it is still to be added to the injection list
+                addInjections(normalize(name), ReferenceType.ENV_ENTRY, envEntry.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
             }
         }
 
@@ -239,10 +242,10 @@ public class EnvironmentEntryBuilder ext
                 "java.lang.String",
                 "java.lang.Class"
         ));
-                
+
         private EnvEntryRefProcessor() {
         }
-        
+
         public boolean processResource(JndiConsumer annotatedApp, Resource annotation, Class cls, Method method, Field field) {
             String resourceName = getResourceName(annotation, method, field);
             Class resourceType = getResourceTypeClass(annotation, method, field);
@@ -250,10 +253,10 @@ public class EnvironmentEntryBuilder ext
                 log.debug("addResource(): <env-entry> found");
 
                 EnvEntry envEntry = annotatedApp.getEnvEntryMap().get(getJndiName(resourceName));
-                                
+
                 if (envEntry == null) {
                     try {
-                        
+
                         log.debug("addResource(): Does not exist in DD: " + resourceName);
 
                         // Doesn't exist in deployment descriptor -- add new
@@ -298,17 +301,17 @@ public class EnvironmentEntryBuilder ext
                         log.debug("ResourceAnnotationHelper: Exception caught while processing <env-entry>");
                     }
                 }
-                
+
                 if (method != null || field != null) {
                     List<InjectionTarget> targets = envEntry.getInjectionTarget();
                     if (!hasTarget(method, field, targets)) {
                         envEntry.getInjectionTarget().add(configureInjectionTarget(method, field));
                     }
                 }
-                
+
                 return true;
             }
-            
+
             return false;
         }
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -28,6 +28,7 @@ import org.apache.geronimo.common.Deploy
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -92,7 +93,7 @@ public class GBeanRefBuilder extends Abs
 
             String refName = gbeanRef.getRefName();
 
-            put(refName, new GBeanReference(module.getConfigId(), queries, gBeanType), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+            put(refName, new GBeanReference(module.getConfigId(), queries, gBeanType), ReferenceType.GBEAN, module.getJndiContext(), Collections.<InjectionTarget> emptyList(), sharedContext);
 
         }
     }

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -26,6 +26,7 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 import javax.xml.ws.handler.Handler;
 import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.jaxws.handler.HandlerChainsInfoBuilder;
@@ -152,7 +153,7 @@ public abstract class JAXWSServiceRefBui
         Object ref = createService(serviceRef, gerServiceRef, module, bundle,
                                    serviceInterfaceClass, serviceQName,
                                    wsdlURI, serviceReferenceType, portComponentRefMap);
-        put(name, ref, module.getJndiContext(), serviceRef.getInjectionTarget(), sharedContext);
+        put(name, ref, ReferenceType.SERVICE, module.getJndiContext(), serviceRef.getInjectionTarget(), sharedContext);
     }
 
     protected abstract Object createService(ServiceRef serviceRef, GerServiceRefType gerServiceRef,

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WebServiceContextAnnotationHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WebServiceContextAnnotationHelper.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WebServiceContextAnnotationHelper.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WebServiceContextAnnotationHelper.java Tue Jun 28 08:25:38 2011
@@ -26,6 +26,7 @@ import javax.xml.ws.WebServiceContext;
 
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.annotation.Injection;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.xbean.finder.ClassFinder;
 
 public class WebServiceContextAnnotationHelper {
@@ -48,7 +49,7 @@ public class WebServiceContextAnnotation
             Class type = getInjectionType(resource.type(), null, field);
             if (WebServiceContext.class == type) {
                 holder.addInjection(field.getDeclaringClass().getName(),
-                                    new Injection(field.getDeclaringClass().getName(), getInjectionName(null, field), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME));
+                                    new Injection(field.getDeclaringClass().getName(), getInjectionName(null, field), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME, ReferenceType.RESOURCE_ENV));
             }
         }
         List<Method> methods = finder.findAnnotatedMethods(Resource.class);
@@ -57,7 +58,7 @@ public class WebServiceContextAnnotation
             Class type = getInjectionType(resource.type(), method, null);
             if (WebServiceContext.class == type) {
                 holder.addInjection(method.getDeclaringClass().getName(),
-                                    new Injection(method.getDeclaringClass().getName(), getInjectionName(method, null), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME));
+                                    new Injection(method.getDeclaringClass().getName(), getInjectionName(method, null), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME, ReferenceType.RESOURCE_ENV));
             }
         }
     }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -25,13 +25,16 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.annotation.EJBAnnotationHelper;
@@ -49,6 +52,7 @@ import org.apache.geronimo.xbeans.geroni
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.assembler.classic.AppInfo;
+import org.apache.openejb.assembler.classic.EjbLocalReferenceInfo;
 import org.apache.openejb.assembler.classic.JndiEncBuilder;
 import org.apache.openejb.assembler.classic.JndiEncInfo;
 import org.apache.openejb.config.JndiEncInfoBuilder;
@@ -130,6 +134,7 @@ public class EjbRefBuilder extends Abstr
         }
 
         Map<String, Object> map = null;
+        Set<String> ejbLocalRefNames = new HashSet<String>();
         try {
             EjbModuleBuilder.EarData earData = EjbModuleBuilder.EarData.KEY.get(module.getRootEarContext().getGeneralData());
             Collection<GeronimoEjbInfo> ejbInfos = Collections.emptySet();
@@ -162,6 +167,10 @@ public class EjbRefBuilder extends Abstr
             JndiEncBuilder jndiEncBuilder = new JndiEncBuilder(ejbEncInfo, null, moduleId, module.getModuleURI(), moduleId, getClass().getClassLoader());
 
             map = jndiEncBuilder.buildMap();
+            
+            for (EjbLocalReferenceInfo ejbLocalReferenceInfo : ejbEncInfo.ejbLocalReferences) {
+                ejbLocalRefNames.add(ejbLocalReferenceInfo.referenceName);
+            }
         } catch (OpenEJBException e) {
             throw new DeploymentException(e);
         }
@@ -180,10 +189,11 @@ public class EjbRefBuilder extends Abstr
                     name.startsWith("app/") ||
                     name.startsWith("module/") ||
                     name.startsWith("comp/")) {
+                ReferenceType referenceType = ejbLocalRefNames.contains(name) ? ReferenceType.EJB_LOCAL : ReferenceType.EJB;
                 if (uri != null) {
                     //handle ejb ref for application client module
                     value = createClientRef(value);
-                    handleJndiUrlReference(value, moduleJndiContext, injectionsMap, sharedContext);
+                    handleJndiUrlReference(value, referenceType, moduleJndiContext, injectionsMap, sharedContext);
                 }
                 name = "java:" + name;
                 if (value instanceof Serializable) {
@@ -192,7 +202,7 @@ public class EjbRefBuilder extends Abstr
                         log.warn("No entry in ejb-jar.xml for name:\n " + name + "\n Known names:\n " + injectionsMap.keySet());
                         injections = Collections.emptyList();
                     }
-                    put(name, value, module.getJndiContext(), injections, sharedContext);
+                    put(name, value, referenceType, module.getJndiContext(), injections, sharedContext);
                 }
             }
         }
@@ -244,8 +254,8 @@ public class EjbRefBuilder extends Abstr
      * so that they could be used in application client.
      * 
      */
-    private void handleJndiUrlReference(Object value, Map<JndiKey, Map<String, Object>> moduleJndiContext,
-            Map<String, List<InjectionTarget>> injectionsMap, Map<EARContext.Key, Object> sharedContext) {
+    private void handleJndiUrlReference(Object value, ReferenceType ReferenceType, Map<JndiKey, Map<String, Object>> moduleJndiContext, Map<String, List<InjectionTarget>> injectionsMap,
+            Map<EARContext.Key, Object> sharedContext) {
 
         if (!(value instanceof JndiUrlReference)) {
             return;
@@ -277,7 +287,7 @@ public class EjbRefBuilder extends Abstr
         if (injections == null) {
             injections = Collections.emptyList();
         }
-        put(name, valueToConvert, moduleJndiContext, injections, sharedContext);
+        put(name, valueToConvert, ReferenceType, moduleJndiContext, injections, sharedContext);
     }
         
 

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java Tue Jun 28 08:25:38 2011
@@ -32,6 +32,7 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.annotation.PersistenceContextAnnotationHelper;
@@ -119,7 +120,7 @@ public class PersistenceRefBuilder exten
 
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(), persistenceUnitNameQuery);
 
-                put(persistenceUnitRefName, reference, module.getJndiContext(), persistenceUnitRef.getInjectionTarget(), sharedContext);
+                put(persistenceUnitRefName, reference, ReferenceType.PERSISTENCE_UNIT, module.getJndiContext(), persistenceUnitRef.getInjectionTarget(), sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -131,7 +132,7 @@ public class PersistenceRefBuilder exten
                 String persistenceUnitRefName = gerPersistenceUnitRef.getPersistenceUnitRefName();
                 AbstractNameQuery persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceUnitRef, localConfiguration);
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(), persistenceUnitNameQuery);
-                put(persistenceUnitRefName, reference, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+                put(persistenceUnitRefName, reference, ReferenceType.PERSISTENCE_UNIT, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -165,7 +166,7 @@ public class PersistenceRefBuilder exten
                     persistenceUnitNameQuery = findPersistenceUnitQuery(module, localConfiguration, persistenceContextRef);
                 }
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
-                put(persistenceContextRefName, reference, module.getJndiContext(), persistenceContextRef.getInjectionTarget(), sharedContext);
+                put(persistenceContextRefName, reference, ReferenceType.PERSISTENCE_CONTEXT, module.getJndiContext(), persistenceContextRef.getInjectionTarget(), sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -181,7 +182,7 @@ public class PersistenceRefBuilder exten
                 addProperties(gerPersistenceContextRef, properties);
                 AbstractNameQuery persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceContextRef, localConfiguration);
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
-                put(persistenceContextRefName, reference, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+                put(persistenceContextRefName, reference, ReferenceType.PERSISTENCE_CONTEXT, module.getJndiContext(), Collections.<InjectionTarget> emptyList(), sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansNamingBuilder.java?rev=1140479&r1=1140478&r2=1140479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansNamingBuilder.java (original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansNamingBuilder.java Tue Jun 28 08:25:38 2011
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.j2ee.annotation.ReferenceType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -42,7 +43,7 @@ import org.apache.xmlbeans.XmlObject;
 public class OpenWebBeansNamingBuilder extends AbstractNamingBuilder {
     @Override
     public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
-        put("java:comp/BeanManager", new BeanManagerReference(), module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
+        put("java:comp/BeanManager", new BeanManagerReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptyList(), sharedContext);
     }
 
     @Override



Mime
View raw message