[jboss-cvs] JBossAS SVN: r94654 - trunk/server/src/main/java/org/jboss/web/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Oct 11 16:48:47 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-11 16:48:46 -0400 (Sun, 11 Oct 2009)
New Revision: 94654
Modified:
trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java
Log:
- Cleanups.
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-11 20:45:49 UTC (rev 94653)
+++ trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java 2009-10-11 20:48:46 UTC (rev 94654)
@@ -29,12 +29,8 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.ServiceLoader;
import java.util.Set;
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.annotation.HandlesTypes;
-
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
@@ -49,8 +45,8 @@
import org.jboss.metadata.web.spec.OrderingElementMetaData;
import org.jboss.metadata.web.spec.Web25MetaData;
import org.jboss.metadata.web.spec.Web30MetaData;
+import org.jboss.metadata.web.spec.WebCommonMetaData;
import org.jboss.metadata.web.spec.WebFragmentMetaData;
-import org.jboss.metadata.web.spec.WebCommonMetaData;
import org.jboss.metadata.web.spec.WebMetaData;
import org.jboss.virtual.VirtualFile;
@@ -170,7 +166,8 @@
}
Iterator<String> attachementNames = unit.getAttachments().keySet().iterator();
- HashSet<String> jarsWithoutFragmentsSet = (HashSet<String>) jarsSet.clone();
+ HashSet<String> jarsWithoutFragmentsSet = new HashSet<String>();
+ jarsWithoutFragmentsSet.addAll(jarsSet);
while (attachementNames.hasNext())
{
String location = attachementNames.next();
@@ -321,59 +318,65 @@
// - Merge the annotation metadata into the fragment meta data
// (unless the fragment exists and is meta data complete)
// - Merge the fragment metadata into merged fragment meta data
- if (!isComplete)
+ WebCommonMetaData mergedFragmentMetaData = new WebCommonMetaData();
+ if (specMetaData == null)
+ specMetaData = new WebMetaData();
+ String key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":classes";
+ WebMetaData annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if (annotatedMetaData != null)
{
- WebCommonMetaData mergedFragmentMetaData = new WebCommonMetaData();
- if (specMetaData == null)
- specMetaData = new WebMetaData();
- String key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":classes";
- WebMetaData annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if (isComplete)
+ {
+ // Discard @WebFilter, @WebListener and @WebServlet
+ annotatedMetaData.setFilters(null);
+ annotatedMetaData.setFilterMappings(null);
+ annotatedMetaData.setListeners(null);
+ annotatedMetaData.setServlets(null);
+ annotatedMetaData.setServletMappings(null);
+ }
+ WebMetaData specMerged = new WebMetaData();
+ AnnotationMergedView.merge(specMerged, specMetaData, annotatedMetaData);
+ specMetaData.augment(specMerged, null, true);
+ }
+ for (String jar : order)
+ {
+ WebFragmentMetaData webFragmentMetaData = webFragments.get(jar);
+ WebCommonMetaData webJarMetaData = new WebCommonMetaData();
+ if (webFragmentMetaData == null)
+ {
+ webFragmentMetaData = new WebFragmentMetaData();
+ }
+ key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":" + jar;
+ annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
+ if ((isComplete || webFragmentMetaData.isMetadataComplete()) && annotatedMetaData != null)
+ {
+ // Discard @WebFilter, @WebListener and @WebServlet
+ annotatedMetaData.setFilters(null);
+ annotatedMetaData.setFilterMappings(null);
+ annotatedMetaData.setListeners(null);
+ annotatedMetaData.setServlets(null);
+ annotatedMetaData.setServletMappings(null);
+ }
if (annotatedMetaData != null)
{
- WebMetaData specMerged = new WebMetaData();
- AnnotationMergedView.merge(specMerged, specMetaData, annotatedMetaData);
- specMetaData.augment(specMerged, null, true);
+ // Merge annotation corresponding to the JAR
+ AnnotationMergedView.merge(webJarMetaData, webFragmentMetaData, annotatedMetaData);
}
- for (String jar : order)
+ else
{
- WebFragmentMetaData webFragmentMetaData = webFragments.get(jar);
- WebCommonMetaData webJarMetaData = new WebCommonMetaData();
- if (webFragmentMetaData == null)
- {
- webFragmentMetaData = new WebFragmentMetaData();
- }
- key = AnnotationMetaDataDeployer.WEB_ANNOTATED_ATTACHMENT_NAME + ":" + jar;
- annotatedMetaData = unit.getAttachment(key, WebMetaData.class);
- if (webFragmentMetaData.isMetadataComplete() && annotatedMetaData != null)
- {
- // Discard @WebFilter, @WebListener and @WebServlet
- annotatedMetaData.setFilters(null);
- annotatedMetaData.setFilterMappings(null);
- annotatedMetaData.setListeners(null);
- annotatedMetaData.setServlets(null);
- annotatedMetaData.setServletMappings(null);
- }
- if (annotatedMetaData != null)
- {
- // Merge annotation corresponding to the JAR
- AnnotationMergedView.merge(webJarMetaData, webFragmentMetaData, annotatedMetaData);
- }
- else
- {
- webJarMetaData = webFragmentMetaData;
- }
- // Merge fragment meta data according to the conflict rules
- try
- {
- mergedFragmentMetaData.augment(webJarMetaData, specMetaData, false);
- }
- catch (Exception e)
- {
- DeploymentException.rethrowAsDeploymentException("Deployment error processing fragment for JAR: " + jar, e);
- }
+ webJarMetaData = webFragmentMetaData;
}
- specMetaData.augment(mergedFragmentMetaData, null, true);
+ // Merge fragment meta data according to the conflict rules
+ try
+ {
+ mergedFragmentMetaData.augment(webJarMetaData, 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)
// Create a merged view
More information about the jboss-cvs-commits
mailing list