[jboss-cvs] JBossAS SVN: r78949 - in trunk/server: src/etc/deployers and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 30 08:27:07 EDT 2008
Author: alesj
Date: 2008-09-30 08:27:07 -0400 (Tue, 30 Sep 2008)
New Revision: 78949
Added:
trunk/server/src/etc/deployers/directory-deployer-jboss-beans.xml
trunk/server/src/main/org/jboss/deployment/EarLibExcludeDeployer.java
Modified:
trunk/server/build.xml
trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml
trunk/server/src/main/org/jboss/deployment/OptAnnotationMetaDataDeployer.java
Log:
[JBAS-5895]; exclude ear's lib directory when doing annotation scanning.
Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml 2008-09-30 09:15:40 UTC (rev 78948)
+++ trunk/server/build.xml 2008-09-30 12:27:07 UTC (rev 78949)
@@ -88,6 +88,7 @@
<path refid="org.jboss.ws.classpath"/>
<path refid="jboss.metadata.classpath"/>
<path refid="jboss.jboss.deployers.classpath"/>
+ <path refid="jboss.jboss.cl.classpath"/>
<path refid="jboss.jboss.man.classpath"/>
<path refid="jboss.jboss.mdr.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
Added: trunk/server/src/etc/deployers/directory-deployer-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/directory-deployer-jboss-beans.xml (rev 0)
+++ trunk/server/src/etc/deployers/directory-deployer-jboss-beans.xml 2008-09-30 12:27:07 UTC (rev 78949)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Legacy directory structure - JBAS-5900.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Disabled by default, due to performance impact -->
+ <!--<bean name="DirectoryStructure" class="org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure"/>-->
+
+</deployment>
Modified: trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml 2008-09-30 09:15:40 UTC (rev 78948)
+++ trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml 2008-09-30 12:27:07 UTC (rev 78949)
@@ -13,8 +13,16 @@
<!-- Generic scanning deployer - using javassist to do lookup -->
- <bean name="GenScanDeployer" class="org.jboss.deployers.vfs.plugins.annotations.AnnotationEnvironmentDeployer"/>
+ <bean name="EarLibExcludeDeployer" class="org.jboss.deployment.EarLibExcludeDeployer"/>
+ <bean name="GenScanDeployer" class="org.jboss.deployers.vfs.plugins.annotations.FilteredAnnotationEnvironmentDeployer">
+ <property name="inputs">
+ <set elementClass="java.lang.String">
+ <value>org.jboss.classloading.spi.visitor.ResourceFilter.recurse</value>
+ </set>
+ </property>
+ </bean>
+
<bean name="AnnotationMetaDataDeployer" class="org.jboss.deployment.OptAnnotationMetaDataDeployer">
<property name="metaDataCompleteIsDefault">false</property>
</bean>
Copied: trunk/server/src/main/org/jboss/deployment/EarLibExcludeDeployer.java (from rev 78928, trunk/server/src/main/org/jboss/deployment/OptAnnotationMetaDataDeployer.java)
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EarLibExcludeDeployer.java (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/EarLibExcludeDeployer.java 2008-09-30 12:27:07 UTC (rev 78949)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployment;
+
+import java.net.URL;
+
+import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Exclude ear's lib from AnnotationEnvironmentDeployer / OptAnnotationMetaDataDeployer processing.
+ *
+ * @author Ales.Justin at jboss.org
+ */
+public class EarLibExcludeDeployer extends AbstractSimpleVFSRealDeployer<JBossAppMetaData>
+{
+ public EarLibExcludeDeployer()
+ {
+ super(JBossAppMetaData.class);
+ setStage(DeploymentStages.POST_CLASSLOADER);
+ setOutputs(ResourceFilter.class.getName() + ".recurse");
+ }
+
+ public void deploy(VFSDeploymentUnit unit, JBossAppMetaData jBossAppMetaData) throws DeploymentException
+ {
+ if (unit.isTopLevel() == false)
+ return;
+
+ try
+ {
+ VirtualFile root = unit.getRoot();
+ String libDir = jBossAppMetaData.getLibraryDirectory();
+ if (libDir == null || libDir.length() == 0) // take 'lib' even on empty
+ libDir = "lib";
+ VirtualFile lib = root.getChild(libDir);
+ if (lib != null)
+ {
+ ResourceFilter recurseFilter = new UrlExcludeResourceFilter(lib.toURL());
+ unit.addAttachment(ResourceFilter.class.getName() + ".recurse", recurseFilter, ResourceFilter.class);
+ log.debug("Excluding ear's lib directory: " + lib);
+ }
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Cannot exclude ear's lib.", e);
+ }
+ }
+
+ /**
+ * Do exclude based on url.
+ */
+ private class UrlExcludeResourceFilter implements ResourceFilter
+ {
+ private URL url;
+
+ private UrlExcludeResourceFilter(URL url)
+ {
+ if (url == null)
+ throw new IllegalArgumentException("Null url");
+ this.url = url;
+ }
+
+ public boolean accepts(ResourceContext rc)
+ {
+ return url.equals(rc.getUrl()) == false;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/server/src/main/org/jboss/deployment/OptAnnotationMetaDataDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/OptAnnotationMetaDataDeployer.java 2008-09-30 09:15:40 UTC (rev 78948)
+++ trunk/server/src/main/org/jboss/deployment/OptAnnotationMetaDataDeployer.java 2008-09-30 12:27:07 UTC (rev 78949)
@@ -169,17 +169,7 @@
Class<Annotation> annotationClass = (Class<Annotation>)annotation;
Set<Element<Annotation, Class<?>>> elements = env.classIsAnnotatedWith(annotationClass);
for(Element<Annotation, Class<?>> elt : elements)
- {
- try
- {
- // TODO: JBAS-5895 why should this annotation even be seen?
classes.add(elt.getOwner());
- }
- catch(Exception e)
- {
- log.debug("Failed to load class for: "+elt, e);
- }
- }
}
Collection<Class<? extends Annotation>> methodAnnotations = context.getMethodAnnotations();
More information about the jboss-cvs-commits
mailing list