[jboss-cvs] JBossAS SVN: r76599 - in trunk: server/src/main/org/jboss/deployment and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 4 03:12:01 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-08-04 03:12:01 -0400 (Mon, 04 Aug 2008)
New Revision: 76599

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ResourceHandler.java
   trunk/server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java
   trunk/server/src/main/org/jboss/deployment/plugin/MappedDeploymentEndpointResolver.java
Log:
JBAS-5830, message-destinations need to be resolved across the ear modules

Modified: trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ResourceHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ResourceHandler.java	2008-08-04 06:19:18 UTC (rev 76598)
+++ trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ResourceHandler.java	2008-08-04 07:12:01 UTC (rev 76599)
@@ -255,16 +255,12 @@
          if (jndiName == null || jndiName.equals(""))
          {
             // Look for a message-destination-link
-            String link = envRef.getLink();
-            if( link != null )
+            jndiName = envRef.getResolvedJndiName();
+            if (jndiName == null)
             {
-               jndiName = container.resolveMessageDestination(link);
-               if (jndiName == null)
-                  throw new RuntimeException("message-destination-link not found " + link + " of deployment " + container.getIdentifier());
+               throw new RuntimeException("message-destination has no jndi-name/resolved-jndi-name " + envRef);
                // TODO: add dependency
             }
-            else
-               throw new RuntimeException("mapped-name or message-destination-link is required for " + envRef.getMessageDestinationRefName() + " of deployment " + container.getIdentifier());
          }
          container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, jndiName, "<message-destination-ref>"));
          InjectionUtil.injectionTarget(encName, envRef, container, container.getEncInjections());

Modified: trunk/server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java	2008-08-04 06:19:18 UTC (rev 76598)
+++ trunk/server/src/main/org/jboss/deployment/MappedReferenceMetaDataResolverDeployer.java	2008-08-04 07:12:01 UTC (rev 76599)
@@ -216,7 +216,7 @@
       // First map the ejbs
       mapEjbs(unit, endpointMap, endpointAlternateMap, trace);
       // Map all sources of message-destinations
-      mapMessageDestinations(unit, endpointMap, trace);
+      mapMessageDestinations(unit, endpointMap, endpointAlternateMap, trace);
       // Map persistence units
       mapPersistenceUnits(unit, endpointMap, trace);
       // Display the endpoint map for debugging
@@ -237,7 +237,10 @@
 
    }
 
-   protected void mapMessageDestinations(DeploymentUnit unit, Map<String, ContainerDependencyMetaData> endpointMap, boolean trace)
+   protected void mapMessageDestinations(DeploymentUnit unit,
+         Map<String, ContainerDependencyMetaData> endpointMap,
+         Map<String, String> endpointAlternateMap,
+         boolean trace)
    {
       String vfsPath = unit.getRelativePath();
       JBossMetaData ejbMetaData = unit.getAttachment(JBossMetaData.class);
@@ -246,19 +249,19 @@
       if(ejbMetaData != null)
       {
          msgDestinations = ejbMetaData.getAssemblyDescriptor().getMessageDestinations();
-         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, loader, trace);
+         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, endpointAlternateMap, loader, trace);
       }
       JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
       if(webMetaData != null)
       {
          msgDestinations = webMetaData.getMessageDestinations();
-         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, loader, trace);
+         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, endpointAlternateMap, loader, trace);
       }
       JBossClientMetaData clientMetaData = unit.getAttachment(JBossClientMetaData.class);
       if(clientMetaData != null)
       {
          msgDestinations = clientMetaData.getMessageDestinations();
-         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, loader, trace);
+         mapMessageDestinations(vfsPath, msgDestinations, endpointMap, endpointAlternateMap, loader, trace);
       }
 
       // Process children
@@ -266,12 +269,13 @@
       if(children != null)
       {
          for(DeploymentUnit child : children)
-            mapMessageDestinations(child, endpointMap, trace);
+            mapMessageDestinations(child, endpointMap, endpointAlternateMap, trace);
       }
    }
 
    protected void mapMessageDestinations(String vfsPath, MessageDestinationsMetaData msgDestinations,
          Map<String, ContainerDependencyMetaData> endpointMap,
+         Map<String, String> endpointAlternateMap,
          ClassLoader loader, boolean trace)
    {
       if(msgDestinations == null || msgDestinations.size() == 0)
@@ -291,7 +295,21 @@
          endpointMap.put(destPath, destMD);
          if(trace)
             log.trace("mapMessageDestinations: "+destPath+", mappedName: "+mappedName);
-      }
+         
+         // Create global message-destination/destName alt-mappings
+         String destKey = EndpointType.MessageDestination  + "/" + destName;
+         if(endpointAlternateMap.containsKey(destKey) == false)
+         {
+            endpointAlternateMap.put(destKey, destPath);
+            if(trace)
+               log.trace("mapMessageDestinations, added alternate root message-destination: "+destPath);
+         }
+         else
+         {
+            log.debug("Duplicate root ejb-name: "+destKey+" from: "+destPath);
+         }
+
+     }
    }
 
    /**

Modified: trunk/server/src/main/org/jboss/deployment/plugin/MappedDeploymentEndpointResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/plugin/MappedDeploymentEndpointResolver.java	2008-08-04 06:19:18 UTC (rev 76598)
+++ trunk/server/src/main/org/jboss/deployment/plugin/MappedDeploymentEndpointResolver.java	2008-08-04 07:12:01 UTC (rev 76599)
@@ -26,6 +26,7 @@
 import org.jboss.deployment.dependency.ContainerDependencyMetaData;
 import org.jboss.deployment.spi.DeploymentEndpointResolver;
 import org.jboss.deployment.spi.EndpointInfo;
+import org.jboss.deployment.spi.EndpointType;
 import org.jboss.logging.Logger;
 
 /**
@@ -78,8 +79,10 @@
       return info;
    }
 
-   /* (non-Javadoc)
+   /* 
+
     * @see org.jboss.deployment.spi.DeploymentEndpointResolver#getEndpointInfo(java.lang.String, org.jboss.deployment.spi.EndpointType)
+    * @see EndpointType
     */
    public EndpointInfo getEndpointInfo(String ref, String type, String vfsContext)
    {
@@ -129,8 +132,15 @@
       if(ref.indexOf('#') == -1)
       {
          // See MappedReferenceMetaDataResolverDeployer.mapEjbs
-         key = "ejb/" + ref;
-         
+         if(type.equals(EndpointType.EJB))
+         {
+            key = "ejb/" + ref;
+         }
+         else if(type.equals(EndpointType.MessageDestination))
+         {
+            key = "message-destination/" + ref;            
+         }
+
          String ejbCompID = endpointAlternateMap.get(key);
          if(ejbCompID != null)
          {




More information about the jboss-cvs-commits mailing list