[jboss-cvs] JBossAS SVN: r109108 - in trunk: weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 4 01:09:27 EDT 2010


Author: marius.bogoevici
Date: 2010-11-04 01:09:26 -0400 (Thu, 04 Nov 2010)
New Revision: 109108

Added:
   trunk/testsuite/src/resources/deployers/weld/translator/war/WEB-INF/beans.xml
Modified:
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldMcExtensionsIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java
   trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java
   trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
Log:
JBAS-8590

* Activate WeldFacesIntegrationDeployer only for WARs which are bean archives
* Change WeldWebTierIntegrationDeployer to be consistent with WeldFacesIntegrationDeployer
* rename DeployersUtils methods and change signatures for clarity
* add beans.xml file for the war of deployers/weld/translator - otherwise it's not a beans archive

Added: trunk/testsuite/src/resources/deployers/weld/translator/war/WEB-INF/beans.xml
===================================================================

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/DeployersUtils.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -117,7 +117,7 @@
     * @param unit the deployment unit
     * @return true if beans.xml files exist, false otherwise
     */
-   public static boolean checkForWeldFilesInUnitAndChildren(DeploymentUnit unit)
+   public static boolean checkForWeldFilesAcrossDeployment(DeploymentUnit unit)
    {
       if (unit == null)
          throw new IllegalArgumentException("Null deployment unit");
@@ -128,7 +128,7 @@
       if (flag != null)
          return flag;
 
-      flag = searchForBeans(top);
+      flag = checkForWeldFiles(top, true);
       top.addAttachment(WELD_DEPLOYMENT_FLAG, flag, Boolean.class);
 
       return flag;
@@ -138,22 +138,26 @@
     * Search deployment hierarchy for beans.xml files.
     *
     * @param unit the deployment unit
+    * @param includeChildren whether children should be searched as well
     * @return true if beans.xml files exist, false otherwise
     */
-   private static boolean searchForBeans(DeploymentUnit unit)
+   public static boolean checkForWeldFiles(DeploymentUnit unit, boolean includeChildren)
    {
       Collection files = unit.getAttachment(WELD_FILES, Collection.class);
       if (files != null && files.isEmpty() == false)
          return true;
 
-      List<DeploymentUnit> children = unit.getChildren();
-      if (children != null && children.isEmpty() == false)
+      if (includeChildren)
       {
-         for (DeploymentUnit child : children)
+         List<DeploymentUnit> children = unit.getChildren();
+         if (children != null && children.isEmpty() == false)
          {
-            boolean result = searchForBeans(child);
-            if (result)
-               return true;
+            for (DeploymentUnit child : children)
+            {
+               boolean result = checkForWeldFiles(child, true);
+               if (result)
+                  return true;
+            }
          }
       }
       return false;

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldCoreIntegrationDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -23,7 +23,7 @@
    @Override // we override this, as we want any beans.xml
    protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
    {
-      return DeployersUtils.checkForWeldFilesInUnitAndChildren(unit);
+      return DeployersUtils.checkForWeldFilesAcrossDeployment(unit);
    }
 
    @Override

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldFacesIntegrationDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -18,7 +18,7 @@
       super(JBossWebMetaData.class);
       // We do this at top level to ensure that any deployment (ear or war)
       // that supports WB gets this integration (even if that particular war doesn't have beans.xml)
-      setTopLevelOnly(true);
+      setDisableOptional(true);
       setInputs(DeployersUtils.WELD_FILES);
       setIntegrationURLs(getURLs());
    }
@@ -26,7 +26,7 @@
    @Override // we override this, as we want any beans.xml
    protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
    {
-      return unit.getAttachment(DeployersUtils.WELD_FILES) != null;
+      return DeployersUtils.checkForWeldFiles(unit, false);
    }
 
    @Override

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldMcExtensionsIntegrationDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldMcExtensionsIntegrationDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldMcExtensionsIntegrationDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -23,7 +23,7 @@
    @Override // we override this, as we want any beans.xml
    protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
    {
-      return DeployersUtils.checkForWeldFilesInUnitAndChildren(unit);
+      return DeployersUtils.checkForWeldFilesAcrossDeployment(unit);
    }
 
    @Override

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/cl/WeldWebTierIntegrationDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -16,13 +16,13 @@
    {
       super(JBossWebMetaData.class); // we only look at wars
       setDisableOptional(true); // it needs to be web deployment, or why would you use JSF?
-      //setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
    }
 
    @Override
    protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
    {
-      return unit.getAttachment(DeployersUtils.WELD_FILES) != null;
+      // assume that it is an integration deployment
+      return DeployersUtils.checkForWeldFiles(unit,false);
    }
 
    protected String getShortLibName()

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/AbstractBootstrapInfoDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -55,7 +55,7 @@
       {
          deployInternal(unit, info);
       }
-      else if (DeployersUtils.checkForWeldFilesInUnitAndChildren(unit))
+      else if (DeployersUtils.checkForWeldFilesAcrossDeployment(unit))
       {
          info = new BootstrapInfo();
          unit.addAttachment(BootstrapInfo.class, info);

Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/metadata/PostJBossAppMetadataDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -52,7 +52,7 @@
    @Override
    protected boolean isIsolated(VFSDeploymentUnit unit, Collection<VirtualFile> wbXml)
    {
-      return (super.isIsolated(unit, wbXml) && (wbXml != null || DeployersUtils.checkForWeldFilesInUnitAndChildren(unit)));
+      return (super.isIsolated(unit, wbXml) && (wbXml != null || DeployersUtils.checkForWeldFilesAcrossDeployment(unit)));
    }
 
    protected String getJMXName(JBossAppMetaData metaData, DeploymentUnit unit)

Modified: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	2010-11-03 20:48:34 UTC (rev 109107)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java	2010-11-04 05:09:26 UTC (rev 109108)
@@ -49,7 +49,7 @@
    @Override
    protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
    {
-      return DeployersUtils.checkForWeldFilesInUnitAndChildren(unit);
+      return DeployersUtils.checkForWeldFilesAcrossDeployment(unit);
    }
 
    protected Set<URL> getURLs()



More information about the jboss-cvs-commits mailing list