[jboss-cvs] JBossAS SVN: r95875 - trunk/server/src/main/java/org/jboss/web/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 30 21:23:33 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-30 21:23:33 -0400 (Fri, 30 Oct 2009)
New Revision: 95875
Modified:
trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java
Log:
- Some field renaming to read nicer.
- Also augment with annotations from JARs excluded from the order.
Modified: trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java 2009-10-31 00:35:25 UTC (rev 95874)
+++ trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java 2009-10-31 01:23:33 UTC (rev 95875)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -41,7 +41,6 @@
import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.AbsoluteOrderingMetaData;
-import org.jboss.metadata.web.spec.AnnotationMergedView;
import org.jboss.metadata.web.spec.OrderingElementMetaData;
import org.jboss.metadata.web.spec.Web25MetaData;
import org.jboss.metadata.web.spec.Web30MetaData;
@@ -290,6 +289,7 @@
if (otherPos >= 0)
{
order.addAll(otherPos, jarsSet);
+ jarsSet.clear();
}
}
else if (orderings.size() > 0)
@@ -303,11 +303,13 @@
{
DeploymentException.rethrowAsDeploymentException("Invalid ordering", e);
}
+ jarsSet.clear();
}
else
{
// No order specified
order.addAll(jarsSet);
+ jarsSet.clear();
}
if (log.isDebugEnabled())
@@ -334,20 +336,22 @@
if (specMetaData == null)
specMetaData = new WebMetaData();
String key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":classes";
- WebMetaData annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
- if (annotatedMetaData != null)
+ // Augment with meta data from annotations in /WEB-INF/classes
+ WebMetaData classesAnnotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if (classesAnnotatedMetaData != null)
{
if (isComplete)
{
// Discard @WebFilter, @WebListener and @WebServlet
- annotatedMetaData.setFilters(null);
- annotatedMetaData.setFilterMappings(null);
- annotatedMetaData.setListeners(null);
- annotatedMetaData.setServlets(null);
- annotatedMetaData.setServletMappings(null);
+ classesAnnotatedMetaData.setFilters(null);
+ classesAnnotatedMetaData.setFilterMappings(null);
+ classesAnnotatedMetaData.setListeners(null);
+ classesAnnotatedMetaData.setServlets(null);
+ classesAnnotatedMetaData.setServletMappings(null);
}
- specMetaData.augment(annotatedMetaData, null, true);
+ specMetaData.augment(classesAnnotatedMetaData, null, true);
}
+ // Augment with meta data from fragments and annotations from the corresponding JAR
for (String jar : order)
{
WebFragmentMetaData webFragmentMetaData = webFragments.get(jar);
@@ -356,20 +360,20 @@
webFragmentMetaData = new WebFragmentMetaData();
}
key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":" + jar;
- annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
- if ((isComplete || webFragmentMetaData.isMetadataComplete()) && annotatedMetaData != null)
+ WebMetaData jarAnnotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if ((isComplete || webFragmentMetaData.isMetadataComplete()) && jarAnnotatedMetaData != null)
{
// Discard @WebFilter, @WebListener and @WebServlet
- annotatedMetaData.setFilters(null);
- annotatedMetaData.setFilterMappings(null);
- annotatedMetaData.setListeners(null);
- annotatedMetaData.setServlets(null);
- annotatedMetaData.setServletMappings(null);
+ jarAnnotatedMetaData.setFilters(null);
+ jarAnnotatedMetaData.setFilterMappings(null);
+ jarAnnotatedMetaData.setListeners(null);
+ jarAnnotatedMetaData.setServlets(null);
+ jarAnnotatedMetaData.setServletMappings(null);
}
- if (annotatedMetaData != null)
+ if (jarAnnotatedMetaData != null)
{
// Merge annotations corresponding to the JAR
- webFragmentMetaData.augment(annotatedMetaData, null, true);
+ webFragmentMetaData.augment(jarAnnotatedMetaData, null, true);
}
// Merge fragment meta data according to the conflict rules
try
@@ -381,6 +385,36 @@
DeploymentException.rethrowAsDeploymentException("Deployment error processing fragment for JAR: " + jar, e);
}
}
+ // Augment with meta data from annotations from JARs excluded from the order
+ for (String jar : jarsSet)
+ {
+ WebFragmentMetaData webFragmentMetaData = new WebFragmentMetaData();
+ key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":" + jar;
+ WebMetaData jarAnnotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if (jarAnnotatedMetaData != null)
+ {
+ // Discard @WebFilter, @WebListener and @WebServlet
+ jarAnnotatedMetaData.setFilters(null);
+ jarAnnotatedMetaData.setFilterMappings(null);
+ jarAnnotatedMetaData.setListeners(null);
+ jarAnnotatedMetaData.setServlets(null);
+ jarAnnotatedMetaData.setServletMappings(null);
+ }
+ if (jarAnnotatedMetaData != null)
+ {
+ // Merge annotations corresponding to the JAR
+ webFragmentMetaData.augment(jarAnnotatedMetaData, null, true);
+ }
+ // Merge fragment meta data according to the conflict rules
+ try
+ {
+ mergedFragmentMetaData.augment(webFragmentMetaData, specMetaData, false);
+ }
+ catch (Exception e)
+ {
+ DeploymentException.rethrowAsDeploymentException("Deployment error processing fragment for JAR: " + jar, e);
+ }
+ }
specMetaData.augment(mergedFragmentMetaData, null, true);
// Override with meta data (JBossWebMetaData)
More information about the jboss-cvs-commits
mailing list