[jboss-cvs] JBossAS SVN: r57265 - in projects/microcontainer/trunk: container/src/main/org/jboss/virtual/plugins/vfs/helpers deployers/src/main/org/jboss/deployers/plugins/structure/vfs deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 28 10:12:33 EDT 2006
Author: adrian at jboss.org
Date: 2006-09-28 10:12:23 -0400 (Thu, 28 Sep 2006)
New Revision: 57265
Added:
projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/vfs/helpers/SuffixesExcludeFilter.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractCandidateStructureVisitor.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitor.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitorFactory.java
Removed:
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitor.java
Modified:
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WARStructure.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WebInfLibFilter.java
Log:
Expose some of the rules in the structural deployers to configuration.
Added: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/vfs/helpers/SuffixesExcludeFilter.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/vfs/helpers/SuffixesExcludeFilter.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/vfs/helpers/SuffixesExcludeFilter.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.virtual.plugins.vfs.helpers;
+
+import java.util.List;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Filters out a set of suffixes
+ *
+ * @author adrian at jboss.org
+ * @version $Revision: 44223 $
+ */
+public class SuffixesExcludeFilter implements VirtualFileFilter
+{
+ /** The suffixes */
+ private List<String> suffixes;
+
+ /**
+ * Create a new SuffixMatchFilter,
+ *
+ * @param suffixes the suffixes
+ * @throws IllegalArgumentException for null suffixes
+ */
+ public SuffixesExcludeFilter(List<String> suffixes)
+ {
+ if (suffixes == null)
+ throw new IllegalArgumentException("Null suffixes");
+ for (String suffix : suffixes)
+ {
+ if (suffix == null)
+ throw new IllegalArgumentException("Null suffix in " + suffixes);
+ }
+ this.suffixes = suffixes;
+ }
+
+ public boolean accepts(VirtualFile file)
+ {
+ String name = file.getName();
+ for (int i = 0; i < suffixes.size(); ++i)
+ {
+ if (name.endsWith(suffixes.get(0)))
+ return false;
+ }
+ return true;
+ }
+}
Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractCandidateStructureVisitor.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractCandidateStructureVisitor.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractCandidateStructureVisitor.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -0,0 +1,176 @@
+/*
+* 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.plugins.structure.vfs;
+
+import java.io.IOException;
+
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.plugins.structure.vfs.jar.JARCandidateStructureVisitor;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileVisitor;
+
+/**
+ * Visits the structure and creates candidates
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractCandidateStructureVisitor extends AbstractVirtualFileVisitor
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(JARCandidateStructureVisitor.class);
+
+ /** The parent deployment context */
+ private final DeploymentContext parent;
+
+ /** The meta data location */
+ private final String metaDataPath;
+
+ /** Ignore directories */
+ private boolean ignoreDirectories;
+
+ /** A filter */
+ private VirtualFileFilter filter;
+
+ /**
+ * Create a new CandidateStructureVisitor.
+ *
+ * @param parent the parent
+ * @throws IllegalArgumentException for a null parent
+ */
+ public AbstractCandidateStructureVisitor(DeploymentContext parent)
+ {
+ this(parent, null);
+ }
+
+ /**
+ * Create a new CandidateStructureVisitor.
+ *
+ * @param parent the parent
+ * @param attributes the attributes
+ * @throws IllegalArgumentException for a null parent
+ */
+ public AbstractCandidateStructureVisitor(DeploymentContext parent, VisitorAttributes attributes)
+ {
+ super(attributes);
+ if (parent == null)
+ throw new IllegalArgumentException("Null parent");
+ this.parent = parent;
+ VirtualFile metaDataLocation = parent.getMetaDataLocation();
+ if (metaDataLocation != null)
+ metaDataPath = metaDataLocation.getPathName();
+ else
+ metaDataPath = null;
+ }
+
+ /**
+ * Get the parent deployment context
+ *
+ * @return the parent.
+ */
+ public DeploymentContext getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Get the ignoreDirectories.
+ *
+ * @return the ignoreDirectories.
+ */
+ public boolean isIgnoreDirectories()
+ {
+ return ignoreDirectories;
+ }
+
+ /**
+ * Get the filter.
+ *
+ * @return the filter.
+ */
+ public VirtualFileFilter getFilter()
+ {
+ return filter;
+ }
+
+ /**
+ * Set the filter.
+ *
+ * @param filter the filter.
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ /**
+ * Set the ignoreDirectories.
+ *
+ * @param ignoreDirectories the ignoreDirectories.
+ */
+ public void setIgnoreDirectories(boolean ignoreDirectories)
+ {
+ this.ignoreDirectories = ignoreDirectories;
+ }
+
+ public void visit(VirtualFile virtualFile)
+ {
+ DeploymentContext candidate = createCandidate(virtualFile);
+ if (candidate != null)
+ parent.addChild(candidate);
+ }
+
+ /**
+ * Create a new candidate deployment context
+ *
+ * @param virtualFile the virtual file
+ * @return the candidate or null if it is not a candidate
+ */
+ protected DeploymentContext createCandidate(VirtualFile virtualFile)
+ {
+ // Exclude the meta data location
+ if (metaDataPath != null && virtualFile.getPathName().startsWith(metaDataPath))
+ return null;
+
+ // Ignore directories that are not archives when asked
+ try
+ {
+ if (ignoreDirectories && virtualFile.isLeaf() == false && virtualFile.isArchive() == false)
+ return null;
+ }
+ catch (IOException e)
+ {
+ log.debug("Ignoring " + virtualFile + " reason=" + e);
+ return null;
+ }
+
+ // Apply any filter
+ if (filter != null && filter.accepts(virtualFile) == false)
+ return null;
+
+ return new AbstractDeploymentContext(virtualFile, true, parent);
+ }
+}
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -21,10 +21,12 @@
*/
package org.jboss.deployers.plugins.structure.vfs;
+import org.jboss.deployers.plugins.structure.vfs.jar.JARCandidateStructureVisitorFactory;
import org.jboss.deployers.spi.structure.DeploymentContext;
import org.jboss.deployers.spi.structure.vfs.StructureDeployer;
import org.jboss.logging.Logger;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
import org.jboss.virtual.VisitorAttributes;
/**
@@ -39,29 +41,64 @@
{
/** The log */
protected Logger log = Logger.getLogger(getClass());
-
+
+ /** The candidate structure visitor factory */
+ private CandidateStructureVisitorFactory candidateStructureVisitorFactory = JARCandidateStructureVisitorFactory.INSTANCE;
+
public int getRelativeOrder()
{
return Integer.MAX_VALUE;
}
+ /**
+ * Get the candidateStructureVisitorFactory.
+ *
+ * @return the candidateStructureVisitorFactory.
+ */
+ public CandidateStructureVisitorFactory getCandidateStructureVisitorFactory()
+ {
+ return candidateStructureVisitorFactory;
+ }
+
+ /**
+ * Set the candidateStructureVisitorFactory.
+ *
+ * @param candidateStructureVisitorFactory the candidateStructureVisitorFactory.
+ * @throws IllegalArgumentException for a null candidate structure
+ */
+ public void setCandidateStructureVisitorFactory(CandidateStructureVisitorFactory candidateStructureVisitorFactory)
+ {
+ if (candidateStructureVisitorFactory == null)
+ throw new IllegalArgumentException("Null candidateStructureVisitorFactory");
+ this.candidateStructureVisitorFactory = candidateStructureVisitorFactory;
+ }
+
public abstract boolean determineStructure(DeploymentContext context);
/**
* Add all children as candidates
*
* @param parent the parent context
- * @param ignoreDirectories whether to ignore directories that are not archives
* @throws Exception for any error
*/
- protected void addAllChildren(DeploymentContext parent, boolean ignoreDirectories) throws Exception
+ protected void addAllChildren(DeploymentContext parent) throws Exception
{
+ addChildren(parent, null);
+ }
+
+ /**
+ * Add all children as candidates
+ *
+ * @param parent the parent context
+ * @param attributes the visitor attributes uses {@link VisitorAttributes#DEFAULT} when null
+ * @throws Exception for any error
+ */
+ protected void addChildren(DeploymentContext parent, VisitorAttributes attributes) throws Exception
+ {
if (parent == null)
throw new IllegalArgumentException("Null parent");
- VisitorAttributes attributes = VisitorAttributes.DEFAULT;
- CandidateStructureVisitor visitor = new CandidateStructureVisitor(parent, attributes, ignoreDirectories);
-
+ VirtualFileVisitor visitor = candidateStructureVisitorFactory.createVisitor(parent, attributes);
VirtualFile root = parent.getRoot();
root.visit(visitor);
}
Deleted: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitor.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitor.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitor.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -1,118 +0,0 @@
-/*
-* 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.plugins.structure.vfs;
-
-import java.io.IOException;
-
-import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileVisitor;
-
-/**
- * Visits the structure and creates candidates
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class CandidateStructureVisitor extends AbstractVirtualFileVisitor
-{
- /** The log */
- private static final Logger log = Logger.getLogger(CandidateStructureVisitor.class);
-
- /** The parent deployment context */
- private final DeploymentContext parent;
-
- /** The meta data location */
- private final String metaDataPath;
-
- /** Ignore directories */
- private boolean ignoreDirectories;
-
- /**
- * Create a new CandidateStructureVisitor.
- *
- * @param parent the parent
- * @throws IllegalArgumentException for a null parent
- */
- public CandidateStructureVisitor(DeploymentContext parent)
- {
- this(parent, null, false);
- }
-
- /**
- * Create a new CandidateStructureVisitor.
- *
- * @param parent the parent
- * @param attributes the attributes
- * @param ignoreDirectories whether to ignore directories
- * @throws IllegalArgumentException for a null parent
- */
- public CandidateStructureVisitor(DeploymentContext parent, VisitorAttributes attributes, boolean ignoreDirectories)
- {
- super(attributes);
- if (parent == null)
- throw new IllegalArgumentException("Null parent");
- this.parent = parent;
- VirtualFile metaDataLocation = parent.getMetaDataLocation();
- if (metaDataLocation != null)
- metaDataPath = metaDataLocation.getPathName();
- else
- metaDataPath = null;
- this.ignoreDirectories = ignoreDirectories;
- }
-
- public void visit(VirtualFile virtualFile)
- {
- DeploymentContext candidate = createCandidate(virtualFile);
- if (candidate != null)
- parent.addChild(candidate);
- }
-
- /**
- * Create a new candidate deployment context
- *
- * @param virtualFile the virtual file
- * @return the candidate or null if it is not a candidate
- */
- protected DeploymentContext createCandidate(VirtualFile virtualFile)
- {
- // Exclude the meta data location
- if (metaDataPath != null && virtualFile.getPathName().startsWith(metaDataPath))
- return null;
-
- try
- {
- if (ignoreDirectories && virtualFile.isLeaf() && virtualFile.isArchive() == false)
- return null;
- }
- catch (IOException e)
- {
- log.debug("Ignoring " + virtualFile + " reason=" + e);
- return null;
- }
-
- return new AbstractDeploymentContext(virtualFile, true, parent);
- }
-}
Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -0,0 +1,45 @@
+/*
+* 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.plugins.structure.vfs;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * CandidateStructureVisitorFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface CandidateStructureVisitorFactory
+{
+ /**
+ * Create the visitor
+ *
+ * @param context the deployment context
+ * @param attributes the visitor attributes uses {@link VisitorAttributes#DEFAULT} when null
+ * @return the visitor
+ * @throws Exception for any error
+ */
+ VirtualFileVisitor createVisitor(DeploymentContext context, VisitorAttributes attributes) throws Exception;
+}
Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitor.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitor.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitor.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -0,0 +1,50 @@
+/*
+* 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.plugins.structure.vfs.jar;
+
+import org.jboss.deployers.plugins.structure.vfs.AbstractCandidateStructureVisitor;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Creates the candidates according to the jar structure
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARCandidateStructureVisitor extends AbstractCandidateStructureVisitor
+{
+ /**
+ * Create a new JARCandidateStructureVisitor.
+ *
+ * @param parent the parent
+ * @param attributes the attributes
+ * @throws IllegalArgumentException for a null parent
+ * @throws Exception for any error
+ */
+ public JARCandidateStructureVisitor(DeploymentContext parent, VisitorAttributes attributes) throws Exception
+ {
+ super(parent, attributes);
+ // We ignore plain directories as subdeployments
+ setIgnoreDirectories(true);
+ }
+}
Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitorFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitorFactory.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARCandidateStructureVisitorFactory.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -0,0 +1,72 @@
+/*
+* 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.plugins.structure.vfs.jar;
+
+import org.jboss.deployers.plugins.structure.vfs.CandidateStructureVisitorFactory;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * JARCandidateStructureVisitorFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARCandidateStructureVisitorFactory implements CandidateStructureVisitorFactory
+{
+ /** An instance of the factory */
+ public static final JARCandidateStructureVisitorFactory INSTANCE = new JARCandidateStructureVisitorFactory();
+
+ /** The filter */
+ private VirtualFileFilter filter;
+
+ /**
+ * Get the filter.
+ *
+ * @return the filter.
+ */
+ public VirtualFileFilter getFilter()
+ {
+ return filter;
+ }
+
+ /**
+ * Set the filter.
+ *
+ * @param filter the filter.
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ public VirtualFileVisitor createVisitor(DeploymentContext context, VisitorAttributes attributes) throws Exception
+ {
+
+ JARCandidateStructureVisitor visitor = new JARCandidateStructureVisitor(context, attributes);
+ if (filter != null)
+ visitor.setFilter(filter);
+ return visitor;
+ }
+}
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -89,8 +89,7 @@
context.setClassPath(paths);
// We tentatively try all the children as potential subdeployments
- // but ignore subdirectories if it is an archive
- addAllChildren(context, root.isArchive());
+ addAllChildren(context);
return true;
}
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WARStructure.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WARStructure.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -29,6 +29,8 @@
import org.jboss.deployers.spi.structure.DeploymentContext;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
/**
* WARStructure.
@@ -38,12 +40,41 @@
*/
public class WARStructure extends AbstractStructureDeployer
{
+ /** The default filter */
+ public static final VirtualFileFilter DEFAULT_WEB_INF_LIB_FILTER = new SuffixMatchFilter(".jar");
+
+ /** The web-inf/lib filter */
+ private VirtualFileFilter webInfLibFilter = DEFAULT_WEB_INF_LIB_FILTER;
+
@Override
public int getRelativeOrder()
{
return 1000;
}
+ /**
+ * Get the webInfLibFilter.
+ *
+ * @return the webInfLibFilter.
+ */
+ public VirtualFileFilter getWebInfLibFilter()
+ {
+ return webInfLibFilter;
+ }
+
+ /**
+ * Set the webInfLibFilter.
+ *
+ * @param webInfLibFilter the webInfLibFilter.
+ * @throws IllegalArgumentException for a null filter
+ */
+ public void setWebInfLibFilter(VirtualFileFilter webInfLibFilter)
+ {
+ if (webInfLibFilter == null)
+ throw new IllegalArgumentException("Null filter");
+ this.webInfLibFilter = webInfLibFilter;
+ }
+
public boolean determineStructure(DeploymentContext context)
{
try
@@ -91,7 +122,7 @@
try
{
VirtualFile webinfLib = webinf.findChild("lib");
- List<VirtualFile> archives = webinfLib.getChildren(WebInfLibFilter.INSTANCE);
+ List<VirtualFile> archives = webinfLib.getChildren(webInfLibFilter);
for (VirtualFile archive : archives)
paths.add(archive);
}
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WebInfLibFilter.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WebInfLibFilter.java 2006-09-28 14:11:34 UTC (rev 57264)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/war/WebInfLibFilter.java 2006-09-28 14:12:23 UTC (rev 57265)
@@ -43,13 +43,6 @@
/** The instance */
public static final WebInfLibFilter INSTANCE = new WebInfLibFilter();
- /**
- * Singleton
- */
- private WebInfLibFilter()
- {
- }
-
public VisitorAttributes getAttributes()
{
return VisitorAttributes.DEFAULT;
More information about the jboss-cvs-commits
mailing list