[jboss-cvs] JBossAS SVN: r70043 - in projects/microcontainer/trunk: deployers-impl/src/main/org/jboss/deployers/plugins/deployers and 24 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 22 16:44:16 EST 2008
Author: alesj
Date: 2008-02-22 16:44:16 -0500 (Fri, 22 Feb 2008)
New Revision: 70043
Added:
projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/matchers/
projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/matchers/JarExtensionProvider.java
projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/FileMatcher.java
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/META-INF/
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/META-INF/some.bsh
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/META-INF/
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/META-INF/some-beans.xml
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.jbss
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.rhts
projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.xyz
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedFileStructure.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedJARStructure.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBeanDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBshDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestExtensionDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/FileMatchersTestCase.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/JarExtensionsTestCase.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/KernelHolderDeployersTest.java
Removed:
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileMatcher.java
Modified:
projects/microcontainer/trunk/classloading/src/main/org/jboss/classloading/plugins/metadata/VersionMetaMapper.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java
projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/deployer/kernel/BeanDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/nonmetadata/support/MockBshDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/api/annotations/MetaMapping.java
projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/spi/values/MetaMapper.java
Log:
JBMICROCONT-235, JBMICROCONT-236; FileMatcher moved to parser deployer, do callback on JARStructure.
Fix DeployerImpl to use plain Controller.
Add deployers check on the MainDeployer.
Javadocs metatype fixes.
Modified: projects/microcontainer/trunk/classloading/src/main/org/jboss/classloading/plugins/metadata/VersionMetaMapper.java
===================================================================
--- projects/microcontainer/trunk/classloading/src/main/org/jboss/classloading/plugins/metadata/VersionMetaMapper.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/classloading/src/main/org/jboss/classloading/plugins/metadata/VersionMetaMapper.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -58,5 +58,4 @@
String value = (String) simple.getValue();
return Version.parseVersion(value);
}
-
}
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -32,7 +32,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerContextActions;
import org.jboss.dependency.spi.ControllerState;
@@ -72,7 +72,7 @@
private static final Logger log = Logger.getLogger(DeployersImpl.class);
/** The dependency state machine */
- private AbstractController controller;
+ private Controller controller;
/** The repository */
private MutableMetaDataRepository repository;
@@ -95,7 +95,7 @@
* @param controller the controller
* @throws IllegalArgumentException for a null controller
*/
- public DeployersImpl(AbstractController controller)
+ public DeployersImpl(Controller controller)
{
this(controller, null);
}
@@ -107,7 +107,7 @@
* @param deployers the deployers
* @throws IllegalArgumentException for a null controller
*/
- public DeployersImpl(AbstractController controller, Set<Deployer> deployers)
+ public DeployersImpl(Controller controller, Set<Deployer> deployers)
{
if (controller == null)
throw new IllegalArgumentException("Null controller");
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -389,6 +389,9 @@
if (deployments == null)
throw new IllegalArgumentException("Null deployments.");
+ if (deployers == null)
+ throw new IllegalStateException("No deployers");
+
lockRead();
try
{
@@ -434,6 +437,9 @@
if (deployments == null)
throw new IllegalArgumentException("Null deployments.");
+ if (deployers == null)
+ throw new IllegalStateException("No deployers");
+
lockRead();
try
{
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -24,6 +24,7 @@
import java.util.Set;
import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.Controller;
import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
@@ -97,10 +98,15 @@
structure.setStructureBuilder(builder);
return structure;
}
-
+
+ protected Controller getController()
+ {
+ return new AbstractController();
+ }
+
protected Deployers createDeployers()
{
- AbstractController controller = new AbstractController();
+ Controller controller = getController();
return new DeployersImpl(controller);
}
Modified: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -26,6 +26,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.spi.deployer.matchers.JarExtensionProvider;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.factory.ManagedObjectFactory;
@@ -40,7 +41,7 @@
* @version $Revision: 1.1 $
*/
public abstract class AbstractParsingDeployerWithOutput<T> extends AbstractParsingDeployer
- implements ManagedObjectCreator
+ implements ManagedObjectCreator, JarExtensionProvider
{
/** The metadata file name */
private String name;
@@ -48,6 +49,9 @@
/** The suffix */
private String suffix;
+ /** The jar extension */
+ private String jarExtension;
+
/** Include the deployment file */
private boolean includeDeploymentFile = false;
@@ -115,6 +119,26 @@
}
/**
+ * Get the jar extension.
+ *
+ * @return the jar extension
+ */
+ public String getJarExtension()
+ {
+ return jarExtension;
+ }
+
+ /**
+ * Set the jar extension.
+ *
+ * @param jarExtension the jar extension
+ */
+ public void setJarExtension(String jarExtension)
+ {
+ this.jarExtension = jarExtension;
+ }
+
+ /**
* Get the includeDeploymentFile.
*
* @return the includeDeploymentFile.
Added: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/matchers/JarExtensionProvider.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/matchers/JarExtensionProvider.java (rev 0)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/matchers/JarExtensionProvider.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,37 @@
+/*
+* 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.spi.deployer.matchers;
+
+/**
+ * Jar file extension provider.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface JarExtensionProvider
+{
+ /**
+ * Get the provided jar extension.
+ *
+ * @return the jar extension, or null if non can be provided
+ */
+ String getJarExtension();
+}
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/deployer/kernel/BeanDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/deployer/kernel/BeanDeployer.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/deployer/kernel/BeanDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -49,6 +49,7 @@
{
super(KernelDeployment.class);
setSuffix("-beans.xml");
+ setJarExtension(".beans");
// Enable ManagedObject creation based on annotations by default
setBuildManagedObject(true);
}
Deleted: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileMatcher.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileMatcher.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileMatcher.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -1,40 +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.vfs.plugins.structure.file;
-
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Matches virtual file to check if it can be deployed.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public interface FileMatcher
-{
- /**
- * Check if file param is deployable.
- *
- * @param file the virtual file
- * @return true if we have a match, false otherwise
- */
- boolean isDeployable(VirtualFile file);
-}
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -29,6 +29,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
import org.jboss.virtual.VirtualFile;
import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.beans.metadata.api.annotations.Uninstall;
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -25,12 +25,15 @@
import java.util.Set;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.matchers.JarExtensionProvider;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.beans.metadata.api.annotations.Install;
+import org.jboss.beans.metadata.api.annotations.Uninstall;
/**
* JARStructure.
@@ -79,6 +82,22 @@
JarUtils.setJarSuffixes(suffixes);
}
+ @Install
+ public void addJarExtension(JarExtensionProvider provider)
+ {
+ String extension = provider.getJarExtension();
+ if (extension != null)
+ JarUtils.addJarSuffix(extension);
+ }
+
+ @Uninstall
+ public void removeJarExtension(JarExtensionProvider provider)
+ {
+ String extension = provider.getJarExtension();
+ if (extension != null)
+ JarUtils.removeJarSuffix(extension);
+ }
+
public boolean determineStructure(VirtualFile root, VirtualFile parent, VirtualFile file, StructureMetaData metaData, VFSStructuralDeployers deployers) throws DeploymentException
{
ContextInfo context = null;
Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/META-INF/some.bsh
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/META-INF/some.bsh (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/beanshell.jar/META-INF/some.bsh 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1 @@
+#BeanShell
\ No newline at end of file
Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/META-INF/some-beans.xml
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/META-INF/some-beans.xml (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/qwert.beans/META-INF/some-beans.xml 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Test" class="java.lang.Object"/>
+</deployment>
Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.jbss
===================================================================
(Binary files differ)
Property changes on: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.jbss
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.rhts
===================================================================
(Binary files differ)
Property changes on: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.rhts
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.xyz
===================================================================
(Binary files differ)
Property changes on: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/matchers/some.xyz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -34,6 +34,7 @@
import org.jboss.test.deployers.vfs.structure.VFSStructureTestSuite;
import org.jboss.test.deployers.vfs.structurebuilder.VFSStructureBuilderTestSuite;
import org.jboss.test.deployers.vfs.managed.VFSManagedTestSuite;
+import org.jboss.test.deployers.vfs.matchers.VFSMatchersTestSuite;
/**
* Deployers VFS Test Suite.
@@ -61,6 +62,7 @@
suite.addTest(VFSManagedTestSuite.suite());
suite.addTest(NonMetadataDeployersTestSuite.suite());
suite.addTest(ClassLoaderTestSuite.suite());
+ suite.addTest(VFSMatchersTestSuite.suite());
return suite;
}
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/nonmetadata/support/MockBshDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/nonmetadata/support/MockBshDeployer.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/nonmetadata/support/MockBshDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -25,7 +25,7 @@
import java.util.Set;
import java.util.HashSet;
-import org.jboss.deployers.vfs.plugins.structure.file.FileMatcher;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
@@ -63,11 +63,6 @@
scipts.add(metaData);
}
- public boolean isDeployable(VirtualFile file)
- {
- return file.getName().endsWith(getSuffix());
- }
-
public Set<BshScript> getScipts()
{
return scipts;
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -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.test.deployers.vfs.matchers;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.test.deployers.vfs.matchers.test.FileMatchersTestCase;
+import org.jboss.test.deployers.vfs.matchers.test.JarExtensionsTestCase;
+
+/**
+ * Matchers test suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSMatchersTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("VFS Matchers Tests");
+
+ suite.addTest(FileMatchersTestCase.suite());
+ suite.addTest(JarExtensionsTestCase.suite());
+
+ return suite;
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedFileStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedFileStructure.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedFileStructure.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,59 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
+import org.jboss.beans.metadata.api.annotations.Install;
+import org.jboss.beans.metadata.api.annotations.Uninstall;
+
+/**
+ * Exposes matchers.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ExposedFileStructure extends FileStructure
+{
+ protected Set<FileMatcher> matchers = new HashSet<FileMatcher>();
+
+ public Set<FileMatcher> getMatchers()
+ {
+ return matchers;
+ }
+
+ @Install
+ public boolean addFileMatcher(FileMatcher fm)
+ {
+ super.addFileMatcher(fm);
+ return matchers.add(fm);
+ }
+
+ @Uninstall
+ public boolean removeFileMatcher(FileMatcher fm)
+ {
+ matchers.remove(fm);
+ return super.removeFileMatcher(fm);
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedJARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedJARStructure.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/ExposedJARStructure.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,54 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Exposes recognized files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ExposedJARStructure extends JARStructure
+{
+ protected Set<String> recognized = new HashSet<String>();
+
+ public Set<String> getRecognized()
+ {
+ return recognized;
+ }
+
+ public boolean determineStructure(VirtualFile root, VirtualFile parent, VirtualFile file, StructureMetaData metaData, VFSStructuralDeployers deployers) throws DeploymentException
+ {
+ boolean determined = super.determineStructure(root, parent, file, metaData, deployers);
+ if (determined)
+ recognized.add(file.getName());
+ return determined;
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,55 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Gather feedback from deployer units.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class FeedbackDeployer extends AbstractVFSParsingDeployer<Object>
+{
+ private Set<String> files = new HashSet<String>();
+
+ protected FeedbackDeployer()
+ {
+ super(Object.class);
+ }
+
+ protected Object parse(VFSDeploymentUnit unit, VirtualFile file, Object root) throws Exception
+ {
+ files.add(file.getName());
+ return null;
+ }
+
+ public Set<String> getFiles()
+ {
+ return files;
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBeanDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBeanDeployer.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBeanDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,34 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class TestBeanDeployer extends FeedbackDeployer
+{
+ public TestBeanDeployer()
+ {
+ setSuffix("-beans.xml");
+ setJarExtension(".beans");
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBshDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBshDeployer.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestBshDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,33 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class TestBshDeployer extends FeedbackDeployer
+{
+ public TestBshDeployer()
+ {
+ setSuffix(".bsh");
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestExtensionDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestExtensionDeployer.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/support/TestExtensionDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,35 @@
+/*
+* 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.test.deployers.vfs.matchers.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class TestExtensionDeployer extends FeedbackDeployer
+{
+ public TestExtensionDeployer(String extension)
+ {
+ setSuffix(extension);
+ // plural :-)
+ setJarExtension(extension + "s");
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/FileMatchersTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/FileMatchersTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/FileMatchersTestCase.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,117 @@
+/*
+* 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.test.deployers.vfs.matchers.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.deployers.vfs.matchers.support.ExposedFileStructure;
+import org.jboss.test.deployers.vfs.matchers.support.FeedbackDeployer;
+import org.jboss.test.deployers.vfs.matchers.support.TestBeanDeployer;
+import org.jboss.test.deployers.vfs.matchers.support.TestBshDeployer;
+
+/**
+ * File matchers tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FileMatchersTestCase extends KernelHolderDeployersTest
+{
+ public FileMatchersTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(FileMatchersTestCase.class);
+ }
+
+ public void testMatchers() throws Throwable
+ {
+ KernelController controller = getController();
+
+ MainDeployerImpl main = new MainDeployerImpl();
+ main.setStructuralDeployers(createStructuralDeployers());
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JARStructure", JARStructure.class.getName());
+ controller.install(builder.getBeanMetaData());
+ builder = BeanMetaDataBuilder.createBuilder("FileStructure", ExposedFileStructure.class.getName());
+ controller.install(builder.getBeanMetaData());
+
+ ControllerContext jarContext = controller.getInstalledContext("JARStructure");
+ assertNotNull(jarContext);
+ JARStructure jarStructure = (JARStructure)jarContext.getTarget();
+ assertNotNull(jarStructure);
+ addStructureDeployer(main, jarStructure);
+
+ ControllerContext fileContext = controller.getInstalledContext("FileStructure");
+ assertNotNull(fileContext);
+ ExposedFileStructure fileStructure = (ExposedFileStructure)fileContext.getTarget();
+ assertNotNull(fileStructure);
+ addStructureDeployer(main, fileStructure);
+
+ Set<FileMatcher> matchers = fileStructure.getMatchers();
+ assertNotNull(matchers);
+ assertEmpty(matchers);
+
+ builder = BeanMetaDataBuilder.createBuilder("BeanDeployer", TestBeanDeployer.class.getName());
+ controller.install(builder.getBeanMetaData());
+ assertEquals(1, matchers.size());
+
+ builder = BeanMetaDataBuilder.createBuilder("BshDeployer", TestBshDeployer.class.getName());
+ controller.install(builder.getBeanMetaData());
+ assertEquals(2, matchers.size());
+
+ Deployers deployers = createDeployers();
+ main.setDeployers(deployers);
+ ControllerContext bdContext = controller.getInstalledContext("BeanDeployer");
+ assertNotNull(bdContext);
+ FeedbackDeployer beanDeployer = (FeedbackDeployer)bdContext.getTarget();
+ assertNotNull(beanDeployer);
+ addDeployer(main, beanDeployer);
+ ControllerContext bsContext = controller.getInstalledContext("BshDeployer");
+ assertNotNull(bsContext);
+ FeedbackDeployer shellDeployer = (FeedbackDeployer)bsContext.getTarget();
+ assertNotNull(shellDeployer);
+ addDeployer(main, shellDeployer);
+
+ Deployment deploymentBean = createDeployment("/matchers", "qwert.beans");
+ assertDeploy(main, deploymentBean);
+
+ Deployment deploymentShell = createDeployment("/matchers", "beanshell.jar");
+ assertDeploy(main, deploymentShell);
+
+ assertNotNull(beanDeployer.getFiles());
+ assertEquals(new String[]{"some-beans.xml"}, beanDeployer.getFiles().toArray());
+ assertNotNull(shellDeployer.getFiles());
+ assertEquals(new String[]{"some.bsh"}, shellDeployer.getFiles().toArray());
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/JarExtensionsTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/JarExtensionsTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/JarExtensionsTestCase.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,129 @@
+/*
+* 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.test.deployers.vfs.matchers.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.deployers.vfs.matchers.support.ExposedFileStructure;
+import org.jboss.test.deployers.vfs.matchers.support.ExposedJARStructure;
+import org.jboss.test.deployers.vfs.matchers.support.FeedbackDeployer;
+import org.jboss.test.deployers.vfs.matchers.support.TestExtensionDeployer;
+
+/**
+ * Jar extensions tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JarExtensionsTestCase extends KernelHolderDeployersTest
+{
+ public JarExtensionsTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(JarExtensionsTestCase.class);
+ }
+
+ public void testExtensionProviders() throws Throwable
+ {
+ KernelController controller = getController();
+
+ MainDeployerImpl main = new MainDeployerImpl();
+ main.setStructuralDeployers(createStructuralDeployers());
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JARStructure", ExposedJARStructure.class.getName());
+ controller.install(builder.getBeanMetaData());
+ builder = BeanMetaDataBuilder.createBuilder("FileStructure", ExposedFileStructure.class.getName());
+ controller.install(builder.getBeanMetaData());
+
+ ControllerContext jarContext = controller.getInstalledContext("JARStructure");
+ assertNotNull(jarContext);
+ ExposedJARStructure jarStructure = (ExposedJARStructure)jarContext.getTarget();
+ assertNotNull(jarStructure);
+ addStructureDeployer(main, jarStructure);
+
+ ControllerContext fileContext = controller.getInstalledContext("FileStructure");
+ assertNotNull(fileContext);
+ ExposedFileStructure fileStructure = (ExposedFileStructure)fileContext.getTarget();
+ assertNotNull(fileStructure);
+ addStructureDeployer(main, fileStructure);
+
+ Set<FileMatcher> matchers = fileStructure.getMatchers();
+ assertNotNull(matchers);
+ assertEmpty(matchers);
+
+ builder = BeanMetaDataBuilder.createBuilder("RhtDeployer", TestExtensionDeployer.class.getName());
+ builder.addConstructorParameter(String.class.getName(), ".rht");
+ controller.install(builder.getBeanMetaData());
+ assertEquals(1, matchers.size());
+
+ builder = BeanMetaDataBuilder.createBuilder("JbsDeployer", TestExtensionDeployer.class.getName());
+ builder.addConstructorParameter(String.class.getName(), ".jbs");
+ controller.install(builder.getBeanMetaData());
+ assertEquals(2, matchers.size());
+
+ Set<String> suffixes = jarStructure.getSuffixes();
+ assertTrue(suffixes.contains(".rhts"));
+ assertTrue(suffixes.contains(".jbss"));
+
+ Deployers deployers = createDeployers();
+ main.setDeployers(deployers);
+ ControllerContext rhtContext = controller.getInstalledContext("RhtDeployer");
+ assertNotNull(rhtContext);
+ FeedbackDeployer rhtDeployer = (FeedbackDeployer)rhtContext.getTarget();
+ assertNotNull(rhtDeployer);
+ addDeployer(main, rhtDeployer);
+ ControllerContext jbsContext = controller.getInstalledContext("JbsDeployer");
+ assertNotNull(jbsContext);
+ FeedbackDeployer jbsDeployer = (FeedbackDeployer)jbsContext.getTarget();
+ assertNotNull(jbsDeployer);
+ addDeployer(main, jbsDeployer);
+
+ Deployment deploymentRHT = createDeployment("/matchers", "some.rhts");
+ assertDeploy(main, deploymentRHT);
+ assertTrue(jarStructure.getRecognized().contains("some.rhts"));
+
+ Deployment deploymentJBS = createDeployment("/matchers", "some.jbss");
+ assertDeploy(main, deploymentJBS);
+ assertTrue(jarStructure.getRecognized().contains("some.jbss"));
+
+ Deployment deploymentXYZ = createDeployment("/matchers", "some.xyz");
+ assertDeploy(main, deploymentXYZ);
+ assertFalse(jarStructure.getRecognized().contains("some.xyz"));
+
+ assertNotNull(rhtDeployer.getFiles());
+ assertEquals(new String[]{"some.rht"}, rhtDeployer.getFiles().toArray());
+ assertNotNull(jbsDeployer.getFiles());
+ assertEquals(new String[]{"some.jbs"}, jbsDeployer.getFiles().toArray());
+ }
+}
+
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/KernelHolderDeployersTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/KernelHolderDeployersTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/matchers/test/KernelHolderDeployersTest.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,70 @@
+/*
+* 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.test.deployers.vfs.matchers.test;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.deployers.BaseDeployersVFSTest;
+
+/**
+ * Holds a Kernel instance
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class KernelHolderDeployersTest extends BaseDeployersVFSTest
+{
+ private Kernel kernel;
+ private KernelController controller;
+
+ protected KernelHolderDeployersTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+
+ kernel = bootstrap.getKernel();
+ controller = kernel.getController();
+ }
+
+ protected KernelController getController()
+ {
+ return controller;
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (controller != null)
+ controller.shutdown();
+
+ controller = null;
+ kernel = null;
+ }
+}
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.deployers.vfs.structure.file.support;
-import org.jboss.deployers.vfs.plugins.structure.file.FileMatcher;
+import org.jboss.deployers.vfs.spi.deployer.FileMatcher;
import org.jboss.virtual.VirtualFile;
/**
Modified: projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -36,7 +36,7 @@
* @author <a href="adrian at jboss.org">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public abstract class AbstractVFSParsingDeployer<T> extends AbstractParsingDeployerWithOutput<T>
+public abstract class AbstractVFSParsingDeployer<T> extends AbstractParsingDeployerWithOutput<T> implements FileMatcher
{
/**
* Create a new AbstractVFSParsingDeployer.
@@ -49,6 +49,11 @@
super(output);
}
+ public boolean isDeployable(VirtualFile file)
+ {
+ return file.getName().endsWith(getSuffix());
+ }
+
/**
* Callback to do prechecking on the deployment
*
Added: projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/FileMatcher.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/FileMatcher.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/FileMatcher.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -0,0 +1,40 @@
+/*
+* 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.deployer;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Matches virtual file to check if it can be deployed.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface FileMatcher
+{
+ /**
+ * Check if file param is deployable.
+ *
+ * @param file the virtual file
+ * @return true if we have a match, false otherwise
+ */
+ boolean isDeployable(VirtualFile file);
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/api/annotations/MetaMapping.java
===================================================================
--- projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/api/annotations/MetaMapping.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/api/annotations/MetaMapping.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -38,6 +38,10 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface MetaMapping
{
- /** The meta mapper */
+ /**
+ * The meta mapper
+ *
+ * @return mapper class
+ */
Class<? extends MetaMapper<?>> value();
}
Modified: projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/spi/values/MetaMapper.java
===================================================================
--- projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/spi/values/MetaMapper.java 2008-02-22 21:34:10 UTC (rev 70042)
+++ projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/spi/values/MetaMapper.java 2008-02-22 21:44:16 UTC (rev 70043)
@@ -114,7 +114,7 @@
* Create the meta value
*
* @param metaType the metatype
- * @param object
+ * @param object the object
* @return the meta value
*/
public abstract MetaValue createMetaValue(MetaType<?> metaType, T object);
More information about the jboss-cvs-commits
mailing list