[jboss-cvs] JBossAS SVN: r80791 - in projects/jboss-deployers/trunk: deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 11 04:44:56 EST 2008


Author: alesj
Date: 2008-11-11 04:44:56 -0500 (Tue, 11 Nov 2008)
New Revision: 80791

Added:
   projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/BridgeDeploymentUnitFilter.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VirtualFileDeploymentUnitFilter.java
Modified:
   projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationEnvironmentDeployer.java
Log:
[JBDEPLOY-130]; add DU filtering to AnnEnvDeployer.

Copied: projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java (from rev 80551, projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnit.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java	2008-11-11 09:44:56 UTC (rev 80791)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.deployers.structure.spi;
+
+/**
+ * DeploymentUnitFilter.<p>
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface DeploymentUnitFilter
+{
+   /**
+    * Match the deployment unit
+    *
+    * @param unit the deployment unit
+    * @return true when it matches
+    */
+   boolean accepts(DeploymentUnit unit);
+}
\ No newline at end of file


Property changes on: projects/jboss-deployers/trunk/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationEnvironmentDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationEnvironmentDeployer.java	2008-11-11 08:51:14 UTC (rev 80790)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationEnvironmentDeployer.java	2008-11-11 09:44:56 UTC (rev 80791)
@@ -36,6 +36,7 @@
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnitFilter;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -49,6 +50,8 @@
    private boolean keepAnnotations;
    private boolean checkInterfaces;
 
+   private VFSDeploymentUnitFilter filter;
+
    public AnnotationEnvironmentDeployer()
    {
       super(Module.class);
@@ -88,6 +91,16 @@
    }
 
    /**
+    * Set vfs deployment filter.
+    *
+    * @param filter the vfs deployment filter.
+    */
+   public void setFilter(VFSDeploymentUnitFilter filter)
+   {
+      this.filter = filter;
+   }
+
+   /**
     * Create GenericAnnotationResourceVisitor.
     *
     * Can be used change existing GARV's filter.
@@ -198,6 +211,10 @@
 
    public void deploy(VFSDeploymentUnit unit, Module module) throws DeploymentException
    {
+      // running this deployer is costly, check if it should be run
+      if (filter != null && filter.accepts(unit) == false)
+         return;
+
       if (module == null)
       {
          VFSDeploymentUnit parent = unit.getParent();

Copied: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java (from rev 80551, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java	2008-11-11 09:44:56 UTC (rev 80791)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployers.vfs.spi.structure;
+
+/**
+ * VFSDeploymentUnitFilter.<p>
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VFSDeploymentUnitFilter
+{
+   /**
+    * Match the deployment unit
+    *
+    * @param unit the vfs deployment unit
+    * @return true when it matches
+    */
+   boolean accepts(VFSDeploymentUnit unit);
+}
\ No newline at end of file


Property changes on: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/BridgeDeploymentUnitFilter.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/BridgeDeploymentUnitFilter.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/BridgeDeploymentUnitFilter.java	2008-11-11 09:44:56 UTC (rev 80791)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.deployers.vfs.spi.structure.helpers;
+
+import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnitFilter;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * Bridge deployment unit filter.
+ * 
+ * It implements both, plain deployment unit and vfs deployment unit filters.
+ * It delegates work to vfs du filter if du is vfs instance.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class BridgeDeploymentUnitFilter implements DeploymentUnitFilter, VFSDeploymentUnitFilter
+{
+   public boolean accepts(DeploymentUnit unit)
+   {
+      return (unit instanceof VFSDeploymentUnit) && accepts((VFSDeploymentUnit)unit);
+   }
+}

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VirtualFileDeploymentUnitFilter.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VirtualFileDeploymentUnitFilter.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VirtualFileDeploymentUnitFilter.java	2008-11-11 09:44:56 UTC (rev 80791)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.deployers.vfs.spi.structure.helpers;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * VirtualFileDeploymentUnitFilter.
+ *
+ * It delegates the filtering to VirtualFileFilter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VirtualFileDeploymentUnitFilter extends BridgeDeploymentUnitFilter
+{
+   private VirtualFileFilter filter;
+
+   public VirtualFileDeploymentUnitFilter(VirtualFileFilter filter)
+   {
+      if (filter == null)
+         throw new IllegalArgumentException("Null filter");
+      this.filter = filter;
+   }
+
+   public boolean accepts(VFSDeploymentUnit unit)
+   {
+      VirtualFile root = unit.getRoot();
+      return filter.accepts(root);
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list