[jboss-svn-commits] JBL Code SVN: r28929 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/listeners/deployers/mc and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 14 03:02:15 EDT 2009
Author: beve
Date: 2009-08-14 03:02:13 -0400 (Fri, 14 Aug 2009)
New Revision: 28929
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/GroupingStructure.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilter.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilterUnitTest.java
Removed:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructure.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructureUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbExtensionProvider.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbStructure.java
labs/jbossesb/trunk/product/services/jbrules/src/main/resources/META-INF/jboss-structure.xml
labs/jbossesb/trunk/product/services/slsb/src/main/resources/META-INF/jboss-structure.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-structure.xml
labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-structure.xml
Modified:
labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2655 "AS5 Deployer: Add StructureDeployer to support subdeployments in subdirectories and not only the root or the esb archive"
Modified: labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
===================================================================
--- labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,10 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- JBoss ESB 4.x + JBossAS5 integration -->
-
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="EsbDirectoryStructure" class="org.jboss.soa.esb.listeners.deployers.mc.EsbDirectoryStructure"/>
+ <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
+ <property name="shortCircuitFilter">
+ <inject bean="EsbFilter"/>
+ </property>
+ <property name="metaDataPaths">
+ <array elementClass="java.lang.String">
+ <value>META-INF</value>
+ <value>.</value>
+ </array>
+ </property>
+ <property name="libs">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>jars</value>
+ </set>
+ </property>
+ <property name="libFilter">
+ <inject bean="JarFilter"/>
+ </property>
+ <property name="groups">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>wars</value>
+ </set>
+ </property>
+ <property name="groupFilter">
+ <inject bean="WarFilter"/>
+ </property>
+ </bean>
<bean name="EsbConfigParser" class="org.jboss.soa.esb.listeners.deployers.mc.EsbConfigParser">
<property name="esbDeploymentPrefix">jboss.esb:deployment=</property>
@@ -25,5 +51,23 @@
</list>
</property>
</bean>
+
+ <bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.esb</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.jar</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.war</parameter>
+ </constructor>
+ </bean>
</deployment>
Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructure.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructure.java 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructure.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source 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.
- *
- * 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.soa.esb.listeners.deployers.mc;
-
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
-import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * This StructureDeployer implmentation will recursively try to determine
- * the structure of all files and directories in a .esb archive deployment.
- * This class was added to support deployments in sub directories.
- * <p/>
- *
- * Dislaimer: Most of this code was copied from org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbDirectoryStructure extends AbstractVFSStructureDeployer
-{
- public EsbDirectoryStructure()
- {
- setRelativeOrder(Integer.MAX_VALUE);
- }
-
- public boolean determineStructure(StructureContext context) throws DeploymentException
- {
- try
- {
- final VirtualFile file = context.getFile();
- // jar structure should already handle top level dirs
- if (context.isTopLevel() == false && isLeaf(file) == false && isMetadataPath(context) == false)
- {
- final List<VirtualFile> children = file.getChildren();
- if (children != null && children.isEmpty() == false)
- {
- VFSStructuralDeployers structuralDeployers = context.getDeployers();
-
- // get top
- while (context.getParentContext() != null)
- context = context.getParentContext();
-
- if (context.getName().endsWith(EsbConstants.ESB_ARCHIVE_SUFFIX))
- {
- for (VirtualFile child : children)
- {
- structuralDeployers.determineStructure(child, context);
- }
- }
- }
- }
- return false;
- }
- catch (final Exception e)
- {
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure.", e);
- }
- }
-
- /**
- * Is the current context already part of metadata path.
- *
- * @param context
- * the current structure context
- * @return true if already part of parent's context metadata path
- */
- protected boolean isMetadataPath(final StructureContext context)
- {
- final StructureContext parentContext = context.getParentContext();
- if (parentContext == null)
- return false;
-
- final StructureMetaData smd = parentContext.getMetaData();
- final ContextInfo info = smd.getContext("");
- final List<String> metadataPaths = info.getMetaDataPath();
- if (metadataPaths != null && metadataPaths.isEmpty() == false)
- {
- final String relativePath = AbstractStructureDeployer.getRelativePath(context.getParent(), context.getFile());
- for (String path : metadataPaths)
- if (relativePath.equalsIgnoreCase(path))
- return true;
- }
-
- return false;
- }
-
-}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/GroupingStructure.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/GroupingStructure.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/GroupingStructure.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -0,0 +1,258 @@
+package org.jboss.soa.esb.listeners.deployers.mc;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.util.collection.CollectionsFactory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Similar to jar or directory structure, being able to handle sub-dirs, but a
+ * bit more strict then dir structure. Only listed sub-directories are
+ * candidates for potential sub-deployments.
+ *
+ * It also allows you to set metadata paths, libs and should the root be part of
+ * classpath. Each of sub-dirs can be filtered per path or by default per lib or
+ * group.
+ *
+ * In order to accept anything one must first set shortCircuitFilter instance.
+ *
+ * @see org.jboss.deployers.vfs.plugins.structure.jar.JARStructure
+ * @see org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GroupingStructure extends AbstractVFSStructureDeployer
+{
+ private static final String[] META_INF = { "META-INF" };
+
+ private VirtualFileFilter shortCircuitFilter; // by default null, so we
+ // don't accept anything
+ private boolean rootClasspathEntry;
+
+ // paths
+ private String[] metaDataPaths;
+ private Set<String> libs;
+ private Set<String> groups;
+
+ // filters
+ private VirtualFileFilter libFilter;
+ private VirtualFileFilter groupFilter;
+ private Map<String, VirtualFileFilter> filters; // filter per path
+
+ public GroupingStructure()
+ {
+ setRelativeOrder(9000); // before jar structure
+ setRootClasspathEntry(true); // by default root is part of classpath
+ setLibs(Collections.<String> emptySet()); // empty libs
+ setMetaDataPaths(META_INF); // default metadata locations
+ setGroups(CollectionsFactory.<String> createLazySet()); // lazy groups
+ setFilters(Collections.<String, VirtualFileFilter> emptyMap()); // empty
+ // filters
+ }
+
+ public boolean determineStructure(StructureContext structureContext) throws DeploymentException
+ {
+ VirtualFile file = structureContext.getFile();
+
+ if (shortCircuitFileCheck(file) == false)
+ return false;
+
+ ContextInfo context = null;
+ try
+ {
+ context = createContext(structureContext, metaDataPaths);
+
+ if (rootClasspathEntry)
+ addClassPath(structureContext, file, true, true, context);
+
+ // add any archives in libs
+ for (String lib : libs)
+ {
+ VirtualFile libVF = file.getChild(lib);
+ if (libVF != null)
+ {
+ VirtualFileFilter lf = filters.get(lib);
+ if (lf == null)
+ lf = libFilter;
+
+ List<VirtualFile> archives = libVF.getChildren(lf);
+ for (VirtualFile archive : archives)
+ addClassPath(structureContext, archive, true, true, context);
+ } else
+ {
+ if (log.isTraceEnabled())
+ log.info("No such lib: " + lib + ", " + file);
+ }
+ }
+
+ // check only children of defined sub-dirs / groups
+ for (String group : groups)
+ {
+ VirtualFile groupVF = file.getChild(group);
+ if (groupVF != null)
+ {
+ VirtualFileFilter gf = filters.get(group);
+ if (gf == null)
+ gf = groupFilter;
+
+ List<VirtualFile> children = groupVF.getChildren(gf);
+ for (VirtualFile child : children)
+ structureContext.determineChildStructure(child);
+ } else
+ {
+ if (log.isTraceEnabled())
+ log.info("No such group: " + group + ", " + file);
+ }
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ // Remove the invalid context
+ if (context != null)
+ structureContext.removeChild(context);
+
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ }
+ }
+
+ /**
+ * Do short circuit file check.
+ *
+ * @param file
+ * the file
+ * @return true if we accept the file
+ */
+ protected boolean shortCircuitFileCheck(VirtualFile file)
+ {
+ return shortCircuitFilter != null && shortCircuitFilter.accepts(file);
+ }
+
+ /**
+ * Set short circuit file filter.
+ *
+ * @param shortCircuitFilter
+ * the short circuit file filter
+ */
+ public void setShortCircuitFilter(VirtualFileFilter shortCircuitFilter)
+ {
+ this.shortCircuitFilter = shortCircuitFilter;
+ }
+
+ /**
+ * Is root part of classpath.
+ *
+ * @param rootClasspathEntry
+ * root cp flag
+ */
+ public void setRootClasspathEntry(boolean rootClasspathEntry)
+ {
+ this.rootClasspathEntry = rootClasspathEntry;
+ }
+
+ /**
+ * Set libs; added as cp entries.
+ *
+ * @param libs
+ * the libs
+ */
+ public void setLibs(Set<String> libs)
+ {
+ if (libs == null)
+ throw new IllegalArgumentException("Null libs");
+
+ this.libs = libs;
+ }
+
+ /**
+ * Set default lib filter.
+ *
+ * @param libFilter
+ * the filter
+ */
+ public void setLibFilter(VirtualFileFilter libFilter)
+ {
+ this.libFilter = libFilter;
+ }
+
+ /**
+ * Set the default metadata paths.
+ *
+ * @param metaDataPaths
+ * the meta data paths
+ */
+ public void setMetaDataPaths(String[] metaDataPaths)
+ {
+ this.metaDataPaths = metaDataPaths;
+ }
+
+ /**
+ * Set groups. Aka grouping sub-directories.
+ *
+ * @param groups
+ * the groups
+ */
+ public void setGroups(Set<String> groups)
+ {
+ if (groups == null)
+ throw new IllegalArgumentException("Null groups");
+
+ this.groups = groups;
+ }
+
+ /**
+ * Add group.
+ *
+ * @param group
+ * the group
+ */
+ public void addGroup(String group)
+ {
+ groups.add(group);
+ }
+
+ /**
+ * Remove group.
+ *
+ * @param group
+ * the group
+ */
+ public void removeGroup(String group)
+ {
+ groups.remove(group);
+ }
+
+ /**
+ * Set default group filter.
+ *
+ * @param groupFilter
+ * the filter
+ */
+ public void setGroupFilter(VirtualFileFilter groupFilter)
+ {
+ this.groupFilter = groupFilter;
+ }
+
+ /**
+ * Set filter per path.
+ *
+ * @param filters
+ * the filters
+ */
+ public void setFilters(Map<String, VirtualFileFilter> filters)
+ {
+ if (filters == null)
+ throw new IllegalArgumentException("Null filters");
+
+ this.filters = filters;
+ }
+}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilter.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilter.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source 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.
+ *
+ * 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.soa.esb.listeners.deployers.mc.util;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * A {@link VirtualFileFilter} implementation that takes a suffix as a parameter to its
+ * constructor.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class VfsFileFilter implements VirtualFileFilter
+{
+ private final String suffix;
+
+ /**
+ * Creates a instance using the passed in suffix
+ * @param suffix The suffix for this filter.
+ *
+ * @throws IllegalArgumentException If the passed in suffix is null.
+ */
+ public VfsFileFilter(final String suffix)
+ {
+ if (suffix == null)
+ throw new IllegalArgumentException("suffix argument must not be null");
+
+ this.suffix = suffix;
+
+ }
+
+ /**
+ * Accepts only files ending with the suffix.
+ *
+ * @param file The file to filter.
+ * @return true If the file name ends with suffix.
+ */
+ public boolean accepts(final VirtualFile file)
+ {
+ return file.getName().endsWith(suffix);
+ }
+
+ public String getSuffix()
+ {
+ return suffix;
+ }
+}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -35,13 +35,4 @@
<uncallback method="removeDeployer"/>
</bean>
- <bean name="EsbStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <incallback method="addJarExtension">
- <parameter><inject bean="EsbExtensionProvider"/></parameter>
- </incallback>
- </bean>
- <bean name="EsbExtensionProvider" class="org.jboss.soa.esb.listeners.deployers.mc.EsbExtensionProvider"/>
-
-
-
</deployment>
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructureUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructureUnitTest.java 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDirectoryStructureUnitTest.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source 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.
- *
- * 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.soa.esb.listeners.deployers.mc;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl;
-import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
-import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.virtual.VirtualFile;
-import org.junit.Test;
-
-/**
- * Unit test for {@link EsbStructure}.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 4.7
- *
- */
-public class EsbDirectoryStructureUnitTest
-{
- private URL dir = getClass().getResource("/org/jboss/soa/esb/listeners/deployers/mc/test_esb_archives");
-
- @Test
- public void explodedArchiveWithSubDir() throws Exception
- {
- VFSStructuralDeployersImpl structuralDeployers = createStructureDeployers(true);
-
- VirtualFile virtualFile = TestUtil.getVirtualFile(dir, "exploded-esb-archive-subdeployment.esb", getClass());
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(virtualFile);
-
- VFSDeploymentContext context = (VFSDeploymentContext)structuralDeployers.determineStructure(deployment);
-
- assertTrue(context.isTopLevel());
- assertNotNull(context.getMetaDataFile("jboss-esb.xml"));
- assertNotNull(context.getFile("request.xsd"));
- assertNotNull(context.getFile("subdir"));
- assertNotNull(context.getFile("subdir/test.war"));
-
- List<DeploymentContext> children = context.getChildren();
- assertEquals(1, children.size());
- assertEquals("test.war", children.get(0).getSimpleName());
- }
-
- @Test
- public void explodedArchiveWithSubDirWithoutEsbDirectoryStructure() throws Exception
- {
- // Not adding EsbDirectoryStructure to the structure deployers.
- VFSStructuralDeployersImpl structuralDeployers = createStructureDeployers(false);
-
- VirtualFile virtualFile = TestUtil.getVirtualFile(dir, "exploded-esb-archive-subdeployment.esb", getClass());
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(virtualFile);
-
- VFSDeploymentContext context = (VFSDeploymentContext)structuralDeployers.determineStructure(deployment);
-
- assertTrue(context.isTopLevel());
- assertNotNull(context.getMetaDataFile("jboss-esb.xml"));
- assertNotNull(context.getFile("request.xsd"));
- assertNotNull(context.getFile("subdir"));
- assertNotNull(context.getFile("subdir/test.war"));
-
- List<DeploymentContext> children = context.getChildren();
- assertEquals(0, children.size());
- }
-
- private VFSStructuralDeployersImpl createStructureDeployers(boolean withEsbDirStructure)
- {
- final VFSStructuralDeployersImpl structuralDeployers = new VFSStructuralDeployersImpl();
- VFSStructureBuilder builder = new VFSStructureBuilder();
-
- structuralDeployers.setStructureBuilder(builder);
- structuralDeployers.addDeployer(new JARStructure());
- if (withEsbDirStructure)
- structuralDeployers.addDeployer(new EsbDirectoryStructure());
- return structuralDeployers;
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(EsbDirectoryStructureUnitTest.class);
- }
-
-}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbExtensionProvider.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbExtensionProvider.java 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbExtensionProvider.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, 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.soa.esb.listeners.deployers.mc;
-
-import org.jboss.deployers.spi.deployer.matchers.JarExtensionProvider;
-
-/**
- * Simply adds the '.esb' extension.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbExtensionProvider implements JarExtensionProvider
-{
- /**
- * Returns '.esb'.
- *
- * @return String The '.esb' extension.
- */
- public final String getJarExtension()
- {
- return ".esb";
- }
-
-}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbStructure.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbStructure.java 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbStructure.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, 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.soa.esb.listeners.deployers.mc;
-
-import java.util.HashSet;
-
-import org.apache.log4j.Logger;
-import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
-
-/**
- * A StructureDeployer that can identify .esb archives.
- *
- * A StructureDeployer is a deployer that runs prior to normal deployers, and
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbStructure extends JARStructure
-{
- /**
- * Logger.
- */
- private Logger log = Logger.getLogger(EsbStructure.class);
-
- /**
- * Suffix used to identify a esb archive(file or directory).
- */
- private static final String ESB_JAR_SUFFIX = ".esb";
-
- /**
- * The suffixes that this structure handles.
- */
- private HashSet<String> suffixes;
-
- /**
- *
- */
- public EsbStructure()
- {
- setRelativeOrder(1000);
- suffixes = new HashSet<String>();
- suffixes.add(ESB_JAR_SUFFIX);
- setSuffixes(suffixes);
- addJarExtension(null);
- log.info(this);
- }
-
- /**
- * Returns a string representation of this instance.
- * @return String The string representation of this instance.
- *
- */
- @Override
- public final String toString()
- {
- return "EsbStructure [suffixes='" + suffixes + "']";
- }
-
-
-}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -30,13 +30,53 @@
<incallback method="addDeployer"/>
<uncallback method="removeDeployer"/>
</bean>
-
- <bean name="EsbStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <incallback method="addJarExtension">
- <parameter><inject bean="EsbExtensionProvider"/></parameter>
- </incallback>
+
+ <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
+ <property name="shortCircuitFilter">
+ <inject bean="EsbFilter"/>
+ </property>
+ <property name="metaDataPaths">
+ <array elementClass="java.lang.String">
+ <value>META-INF</value>
+ <value>.</value>
+ </array>
+ </property>
+ <property name="libs">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>jars</value>
+ </set>
+ </property>
+ <property name="libFilter">
+ <inject bean="JarFilter"/>
+ </property>
+ <property name="groups">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>wars</value>
+ </set>
+ </property>
+ <property name="groupFilter">
+ <inject bean="WarFilter"/>
+ </property>
</bean>
- <bean name="EsbExtensionProvider" class="org.jboss.soa.esb.listeners.deployers.mc.EsbExtensionProvider"/>
+ <bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.esb</parameter>
+ </constructor>
+ </bean>
+ <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.jar</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.war</parameter>
+ </constructor>
+ </bean>
+
</deployment>
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -31,13 +31,54 @@
<uncallback method="removeDeployer"/>
</bean>
- <bean name="EsbStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <incallback method="addJarExtension">
- <parameter><inject bean="EsbExtensionProvider"/></parameter>
- </incallback>
+ <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
+ <property name="shortCircuitFilter">
+ <inject bean="EsbFilter"/>
+ </property>
+ <property name="metaDataPaths">
+ <array elementClass="java.lang.String">
+ <value>META-INF</value>
+ <value>.</value>
+ </array>
+ </property>
+ <property name="libs">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>jars</value>
+ </set>
+ </property>
+ <property name="libFilter">
+ <inject bean="JarFilter"/>
+ </property>
+ <property name="groups">
+ <set elementClass="java.lang.String">
+ <value>.</value>
+ <value>wars</value>
+ </set>
+ </property>
+ <property name="groupFilter">
+ <inject bean="WarFilter"/>
+ </property>
</bean>
- <bean name="EsbExtensionProvider" class="org.jboss.soa.esb.listeners.deployers.mc.EsbExtensionProvider"/>
+ <bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.esb</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.jar</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
+ <constructor>
+ <parameter>.war</parameter>
+ </constructor>
+ </bean>
+
<bean name="ClassLoaderDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.TestClassLoaderDeployer"/>
</deployment>
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilterUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsFileFilterUnitTest.java 2009-08-14 07:02:13 UTC (rev 28929)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source 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.
+ *
+ * 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.soa.esb.listeners.deployers.mc.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import junit.framework.JUnit4TestAdapter;
+
+/**
+ * Unit test for {@link VfsFileFilter}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class VfsFileFilterUnitTest
+{
+ @Test ( expected = IllegalArgumentException.class )
+ public void constructWithNullSuffix()
+ {
+ new VfsFileFilter(null);
+ }
+
+ @Test
+ public void construct()
+ {
+ VfsFileFilter vfsFileFilter = new VfsFileFilter(".esb");
+ assertEquals(".esb", vfsFileFilter.getSuffix());
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(VfsFileFilterUnitTest.class);
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/resources/META-INF/jboss-structure.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,12 +0,0 @@
-<structure>
- <context>
- <path name=""/>
- <metaDataPath>
- <path name="META-INF"/>
- </metaDataPath>
- <classpath>
- <path name=""/>
- <path name="" suffixes=".jar"/>
- </classpath>
- </context>
-</structure>
Deleted: labs/jbossesb/trunk/product/services/slsb/src/main/resources/META-INF/jboss-structure.xml
===================================================================
--- labs/jbossesb/trunk/product/services/slsb/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/services/slsb/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,12 +0,0 @@
-<structure>
- <context>
- <path name=""/>
- <metaDataPath>
- <path name="META-INF"/>
- </metaDataPath>
- <classpath>
- <path name=""/>
- <path name="" suffixes=".jar"/>
- </classpath>
- </context>
-</structure>
Deleted: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-structure.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,12 +0,0 @@
-<structure>
- <context>
- <path name=""/>
- <metaDataPath>
- <path name="META-INF"/>
- </metaDataPath>
- <classpath>
- <path name=""/>
- <path name="" suffixes=".jar"/>
- </classpath>
- </context>
-</structure>
Deleted: labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-structure.xml
===================================================================
--- labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 04:59:57 UTC (rev 28928)
+++ labs/jbossesb/trunk/product/services/spring/src/main/resources/META-INF/jboss-structure.xml 2009-08-14 07:02:13 UTC (rev 28929)
@@ -1,12 +0,0 @@
-<structure>
- <context>
- <path name=""/>
- <metaDataPath>
- <path name="META-INF"/>
- </metaDataPath>
- <classpath>
- <path name=""/>
- <path name="" suffixes=".jar"/>
- </classpath>
- </context>
-</structure>
More information about the jboss-svn-commits
mailing list