[jboss-cvs] JBossAS SVN: r99240 - in projects/jboss-deployers/branches/vfs3: deployers-core/src/main/java/org/jboss/deployers/plugins/structure and 24 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 11 14:36:49 EST 2010


Author: johnbailey
Date: 2010-01-11 14:36:47 -0500 (Mon, 11 Jan 2010)
New Revision: 99240

Added:
   projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataTypeFilter.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DependenciesTopologicalDeployerSorter.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/InOutTopologicalDeployerSorter.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DependenciesTopologicalOrderingUnitTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/InOutTopologicalOrderingUnitTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/MetaDataTypeFilterTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt
Removed:
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt
Modified:
   projects/jboss-deployers/branches/vfs3/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java
   projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
   projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
   projects/jboss-deployers/branches/vfs3/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/DeployersDeployerTestSuite.java
   projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/support/TestDependencyMetaData.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/dependency/test/DependenciesTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java
Log:
[JBAS-7361,JBAS-7362] - Merge from trunk -r 94884:99214

Modified: projects/jboss-deployers/branches/vfs3/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -21,7 +21,6 @@
  */
 package org.jboss.deployers.client.spi;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -110,7 +109,7 @@
    public ContextInfo addContext(PredeterminedManagedObjectAttachments context, String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
    {
       StructureMetaData structure = assureStructure(context);
-      ContextInfo result = StructureMetaDataFactory.createContextInfo(path, createMetaDataEntries(metaDataPath), classPath);
+      ContextInfo result = StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
       structure.addContext(result);
       return result;
    }
@@ -141,23 +140,6 @@
    }
 
    /**
-    * Create metadata path entries.
-    *
-    * @param metaDataPath the metadata path entries
-    * @return the entries
-    */
-   public static List<MetaDataEntry> createMetaDataEntries(List<String> metaDataPath)
-   {
-      if (metaDataPath == null)
-         throw new IllegalArgumentException("Null metadata path");
-
-      List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>(metaDataPath.size());
-      for (String path : metaDataPath)
-         entries.add(createMetaDataPathEntry(path));
-      return entries;
-   }
-
-   /**
     * Create a new classpath entry
     * 
     * @param path the path

Modified: projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -21,6 +21,7 @@
  */
 package org.jboss.deployers.plugins.structure;
 
+import java.util.Arrays;
 import java.util.List;
 
 import org.jboss.deployers.spi.structure.ClassPathEntry;
@@ -54,16 +55,31 @@
       return new ContextInfoImpl(path, classPath);
    }
 
+   protected ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath)
+   {
+      return new ContextInfoImpl(path, newMetaDataPathEntry(metaDataPath), classPath);
+   }
+
    protected ContextInfo newContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
    {
       return new ContextInfoImpl(path, metaDataPath, classPath);
    }
-   
-   protected ContextInfo newContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath)
+
+   protected ContextInfo newContextInfo(String path, List<String> metaDataPaths, List<ClassPathEntry> classPath)
    {
-      return new ContextInfoImpl(path, metaDataPath, classPath);
+      return new ContextInfoImpl(path, createMetaDataEntries(metaDataPaths), classPath);
    }
 
+   protected ContextInfo newContextInfo(String path, MetaDataEntry[] metaDataPaths, List<ClassPathEntry> classPath)
+   {
+      return new ContextInfoImpl(path, Arrays.asList(metaDataPaths), classPath);
+   }
+
+   protected ContextInfo newContextInfo(List<ClassPathEntry> classPath, List<MetaDataEntry> metaDataPaths, String path)
+   {
+      return new ContextInfoImpl(path, metaDataPaths, classPath);
+   }
+
    protected MetaDataEntry newMetaDataPathEntry(String metaDataPath)
    {
       return newMetaDataPathEntry(metaDataPath, MetaDataType.DEFAULT);

Modified: projects/jboss-deployers/branches/vfs3/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -21,7 +21,6 @@
 */
 package org.jboss.test.deployers.structure.test;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.Test;
@@ -29,7 +28,6 @@
 
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.spi.structure.MetaDataEntry;
 import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
 import org.jboss.test.deployers.structure.AbstractContextInfoTest;
 
@@ -78,10 +76,7 @@
    @Override
    protected ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
    {
-      List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>();
-      for (String mdp : metaDataPath)
-         entries.add(StructureMetaDataFactory.createMetaDataEntry(mdp));
-      return StructureMetaDataFactory.createContextInfo(path, entries, classPath);
+      return StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
    }
 
    @Override

Copied: projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataTypeFilter.java (from rev 99215, projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataTypeFilter.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataTypeFilter.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataTypeFilter.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.deployers.spi.structure;
+
+/**
+ * A metadata type filter
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface MetaDataTypeFilter
+{
+   /**
+    * Do we accept the type.
+    *
+    * @param type the current type to check
+    * @return true if we accept the type, false otherwise
+    */
+   boolean accepts(MetaDataType type);
+
+   public static final MetaDataTypeFilter DEFAULT = new MetaDataTypeFilter()
+   {
+      public boolean accepts(MetaDataType type)
+      {
+         return MetaDataType.DEFAULT == type;
+      }
+   };
+
+   public static final MetaDataTypeFilter ALL = new MetaDataTypeFilter()
+   {
+      public boolean accepts(MetaDataType type)
+      {
+         return true;
+      }
+   };
+}
\ No newline at end of file

Modified: projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -21,12 +21,14 @@
  */
 package org.jboss.deployers.spi.structure;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
  * StructureFactory.
  * 
  * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
 public abstract class StructureMetaDataFactory
@@ -86,7 +88,7 @@
     * @return the context info
     * @throws IllegalArgumentException for a null path or metadata path
     */
-   public static ContextInfo createContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
+   public static ContextInfo createContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath)
    {
       return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPath, classPath);
    }
@@ -100,12 +102,55 @@
     * @return the context info
     * @throws IllegalArgumentException for a null path or metadata path
     */
-   public static ContextInfo createContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath)
+   public static ContextInfo createContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
    {
       return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPath, classPath);
    }
 
    /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPaths the metadata paths
+    * @param classPath the class path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   public static ContextInfo createContextInfo(String path, List<String> metaDataPaths, List<ClassPathEntry> classPath)
+   {
+      return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPaths, classPath);
+   }
+
+   /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPaths the metadata path
+    * @param classPath the class path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   public static ContextInfo createContextInfo(String path, MetaDataEntry[] metaDataPaths, List<ClassPathEntry> classPath)
+   {
+      return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPaths, classPath);
+   }
+
+   /**
+    * Create a new ContextInfo.
+    * Switch parameter order to allow for method override.
+    *
+    * @param classPath the class path
+    * @param metaDataPaths the metadata path
+    * @param path the path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   public static ContextInfo createContextInfo(List<ClassPathEntry> classPath, List<MetaDataEntry> metaDataPaths, String path)
+   {
+      return StructureMetaDataBuilder.getInstance().newContextInfo(classPath, metaDataPaths, path);
+   }
+
+   /**
     * Create a new MetaData entry.
     *
     * @param metaDataPath the metadata path
@@ -129,6 +174,23 @@
    }
 
    /**
+    * Create metadata path entries.
+    *
+    * @param metaDataPath the metadata path entries
+    * @return the entries
+    */
+   protected static List<MetaDataEntry> createMetaDataEntries(List<String> metaDataPath)
+   {
+      if (metaDataPath == null)
+         throw new IllegalArgumentException("Null metadata path");
+
+      List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>(metaDataPath.size());
+      for (String path : metaDataPath)
+         entries.add(createMetaDataEntry(path));
+      return entries;
+   }
+
+   /**
     * Create a new classpath entry
     * 
     * @return the classpath entry
@@ -198,7 +260,7 @@
     * @return the context info
     * @throws IllegalArgumentException for a null path or metadata path
     */
-   protected abstract ContextInfo newContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath);
+   protected abstract ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath);
    
    /**
     * Create a new ContextInfo.
@@ -209,9 +271,42 @@
     * @return the context info
     * @throws IllegalArgumentException for a null path or metadata path
     */
-   protected abstract ContextInfo newContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath);
+   protected abstract ContextInfo newContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath);
 
    /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPaths the metadata paths
+    * @param classPath the class path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   protected abstract ContextInfo newContextInfo(String path, List<String> metaDataPaths, List<ClassPathEntry> classPath);
+
+   /**
+    * Create a new ContextInfo.
+    *
+    * @param classPath the class path
+    * @param metaDataPaths the metadata paths
+    * @param path the path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   protected abstract ContextInfo newContextInfo(List<ClassPathEntry> classPath, List<MetaDataEntry> metaDataPaths, String path);
+
+   /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPaths the metadata paths
+    * @param classPath the class path
+    * @return the context info
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   protected abstract ContextInfo newContextInfo(String path, MetaDataEntry[] metaDataPaths, List<ClassPathEntry> classPath);
+
+   /**
     * Create new metadata path entry.
     *
     * @param metaDataPath the metadata path

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -44,7 +44,7 @@
    private static final long serialVersionUID = 1L;
 
    /** The classloader state for deployments */
-   private static ControllerState CLASSLOADER_STATE = new ControllerState(DeploymentStages.CLASSLOADER.getName());
+   private static ControllerState CLASSLOADER_STATE = ControllerState.newState(DeploymentStages.CLASSLOADER.getName());
    
    /** The deployment unit */
    private DeploymentUnit unit;

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -406,7 +406,7 @@
          }
       }
 
-      controller.addState(new ControllerState(stageName), preceeds);
+      controller.addState(ControllerState.newState(stageName), preceeds);
       stages.put(stageName, stage);
       log.debug("Added stage " + stageName + " before " + preceeds);
    }
@@ -753,7 +753,7 @@
       checkShutdown();
 
       context.setRequiredStage(stage);
-      ControllerState state = new ControllerState(stageName);
+      ControllerState state = ControllerState.getInstance(stageName);
       try
       {
          controller.change(deploymentControllerContext, state);

Copied: projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DependenciesTopologicalDeployerSorter.java (from rev 99215, projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DependenciesTopologicalDeployerSorter.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DependenciesTopologicalDeployerSorter.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DependenciesTopologicalDeployerSorter.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,316 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.plugins.sort;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.deployers.spi.Ordered;
+import org.jboss.deployers.spi.deployer.Deployer;
+
+/**
+ * Implements <a href="http://en.wikipedia.org/wiki/Topological_sorting">topological sorting</a> for acyclic graphs.
+ * The algorithm complexity is <b>O(m+n)</b>, where <b>m</b> is count of vertices and <b>n</b> is count of edges.
+ * However this complexity isn't true for this algorithm implementation because there's backward compatibility
+ * requirement that deployers have to be ordered by their relative number or name if they're on the same processing level.
+ * <b>IOW this backward compatible sorting requirement violates algorithm linear complexity</b>, see:
+ * <a href="https://jira.jboss.org/jira/browse/JBDEPLOY-233">JBDEPLOY-233</a>.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+public class DependenciesTopologicalDeployerSorter implements DeployerSorter
+{
+
+   public List<Deployer> sortDeployers(List<Deployer> registeredDeployers, Deployer newDeployer)
+   {
+      return this.createOrientedGraph(registeredDeployers, newDeployer).sort();
+   }
+
+   private Graph createOrientedGraph(final List<Deployer> deployers, final Deployer newDeployer)
+   {
+      final Graph graph = new Graph();
+
+      for (final Deployer deployer : deployers)
+         graph.addVertex(deployer);
+
+      graph.addVertex(newDeployer);
+      graph.createEdges();
+
+      return graph;
+   }
+
+   private static class Graph
+   {
+      private Map<String, Dependency> dependencies = new HashMap<String, Dependency>();
+      private Set<Vertex> vertices = new HashSet<Vertex>();
+
+      public void addVertex(final Deployer deployer)
+      {
+         // create disjunct sets
+         final Set<String> inputs = new HashSet<String>();
+         inputs.addAll(deployer.getInputs());
+         final Set<String> outputs = new HashSet<String>();
+         outputs.addAll(deployer.getOutputs());
+         final Set<String> intersection = this.getIntersection(inputs, outputs);
+
+         // register vertex
+         final Vertex vertex = new Vertex(deployer);
+         this.vertices.add(vertex);
+
+         // register dependencies
+         Dependency dependency;
+         for (final String in : inputs)
+         {
+            dependency = this.getDependency(in);
+            dependency.consumers.add(vertex);
+         }
+
+         for (final String inOut : intersection)
+         {
+            dependency = this.getDependency(inOut);
+            dependency.modifiers.add(vertex);
+         }
+
+         for (final String out : outputs)
+         {
+            dependency = this.getDependency(out);
+            dependency.producers.add(vertex);
+         }
+      }
+
+      public List<Deployer> sort()
+      {
+         // L ← Empty list that will contain the sorted elements
+         List<Deployer> retVal = new LinkedList<Deployer>();
+         // S ← Set of all nodes with no incoming edges
+         List<Vertex> roots = this.getRoots();
+         // ensure backward compatibility
+         Collections.sort(roots, Ordered.COMPARATOR);
+
+         // while S is non-empty do
+         Vertex root;
+         Set<Vertex> nextLevel;
+         while(!roots.isEmpty())
+         {
+            // remove a node n from S
+            root = roots.remove(0);
+            // insert n into L
+            retVal.add(root.getDeployer());
+
+            // for each node m with an edge e from n to m do
+            if (root.hasConsumers())
+            {
+               // ensure backward compatibility
+               nextLevel = new TreeSet<Vertex>(Ordered.COMPARATOR);
+               for(final Vertex consumer : root.consumers)
+               {
+                  // remove edge e from the graph
+                  consumer.decrementDegree();
+                  // if m has no other incoming edges then insert m into S
+                  if (!consumer.hasProducers())
+                  {
+                     this.remove(consumer);
+                     nextLevel.add(consumer);
+                  }
+               }
+
+               // append to the end of list in sorted order
+               roots.addAll(nextLevel);
+            }
+         }
+
+         if (this.vertices.size() > 0)
+         {
+            // if graph has edges then graph has at least one cycle
+            throw new IllegalStateException("Cycle detected in subgraph: " + this.vertices);
+         }
+         else
+         {
+            // topologically sorted order
+            return retVal;
+         }
+      }
+
+      private Set<String> getIntersection(final Set<String> inputs, final Set<String> outputs)
+      {
+         final Set<String> intersection = new HashSet<String>();
+
+         for (final String input : inputs)
+            for (final String output : outputs)
+               if (input.equals(output)) 
+                  intersection.add(input);
+
+         inputs.removeAll(intersection);
+         outputs.removeAll(intersection);
+
+         return intersection;
+      }
+
+      private Dependency getDependency(final String name)
+      {
+         if (this.dependencies.containsKey(name))
+         {
+            return this.dependencies.get(name);
+         }
+         else
+         {
+            final Dependency newDependency = new Dependency();
+            this.dependencies.put(name, newDependency);
+            return newDependency;
+         }
+      }
+
+      private void createEdges()
+      {
+         Dependency dependency;
+         boolean hasModifiers;
+
+         for (final String dependencyName : this.dependencies.keySet())
+         {
+            dependency = this.dependencies.get(dependencyName);
+            hasModifiers = dependency.modifiers.size() > 0;
+
+            if (hasModifiers)
+            {
+               this.createEdges(dependency.producers, dependency.modifiers);
+               this.createEdges(dependency.modifiers, dependency.consumers);
+            }
+            else
+            {
+               this.createEdges(dependency.producers, dependency.consumers);
+            }
+         }
+      }
+
+      private void createEdges(final List<Vertex> producers, final List<Vertex> consumers)
+      {
+         for (final Vertex producer : producers)
+            for (final Vertex consumer : consumers)
+            {
+               producer.addConsumer(consumer);
+               consumer.incrementDegree();
+            }
+      }
+
+      private List<Vertex> getRoots()
+      {
+         final List<Vertex> retVal = new LinkedList<Vertex>();
+
+         Vertex current;
+         for (final Iterator<Vertex> i = this.vertices.iterator(); i.hasNext(); )
+         {
+            current = i.next();
+            if (!current.hasProducers())
+            {
+               retVal.add(current);
+               i.remove();
+            }
+         }
+
+         return retVal;
+      }
+
+      private void remove(final Vertex v)
+      {
+         this.vertices.remove(v);
+      }
+
+      private static class Vertex implements Ordered
+      {
+         // Wrapped deployer
+         private Deployer deployer;
+         // Incoming edges
+         private int inDegree;
+         // Outgoing edges
+         private List<Vertex> consumers = new LinkedList<Vertex>();
+
+         public Vertex(final Deployer deployer)
+         {
+            this.deployer = deployer;
+         }
+
+         public void incrementDegree()
+         {
+            this.inDegree++;
+         }
+
+         public void decrementDegree()
+         {
+            this.inDegree--;
+         }
+
+         public boolean hasProducers()
+         {
+            return this.inDegree > 0;
+         }
+
+         public void addConsumer(final Vertex v)
+         {
+            this.consumers.add(v);
+         }
+
+         public boolean hasConsumers()
+         {
+            return this.consumers.size() > 0;
+         }
+
+         public Deployer getDeployer()
+         {
+            return this.deployer;
+         }
+
+         public int getRelativeOrder()
+         {
+            return this.deployer.getRelativeOrder();
+         }
+
+         public void setRelativeOrder(final int order)
+         {
+            throw new UnsupportedOperationException();
+         }
+
+         public String toString()
+         {
+            return this.deployer.toString();
+         }
+      }
+
+      private static class Dependency
+      {
+         // deployers creating this dependency
+         private List<Vertex> producers = new LinkedList<Vertex>();
+         // deployers modifying this dependency
+         private List<Vertex> modifiers = new LinkedList<Vertex>();
+         // deployers consuming this dependency
+         private List<Vertex> consumers = new LinkedList<Vertex>();
+      }
+
+   }
+
+}

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -25,6 +25,7 @@
  * Sorter factory.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
  */
 public class DeployerSorterFactory
 {
@@ -36,6 +37,6 @@
     */
    public static DeployerSorter newSorter()
    {
-      return new KahnDeployerSorter();      
+      return new DependenciesTopologicalDeployerSorter();      
    }
 }

Copied: projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/InOutTopologicalDeployerSorter.java (from rev 99215, projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/InOutTopologicalDeployerSorter.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/InOutTopologicalDeployerSorter.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/InOutTopologicalDeployerSorter.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.deployers.plugins.sort;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.TreeSet;
+
+import org.jboss.deployers.spi.Ordered;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.util.graph.Edge;
+import org.jboss.util.graph.Graph;
+import org.jboss.util.graph.Vertex;
+
+/**
+ * Simple topological sorting: http://en.wikipedia.org/wiki/Topological_sorting.
+ * 
+ * Each input or output is a task, dependency between tasks is determined by deployer.
+ * e.g. Deployer D has input X and output Y, hence we have 2 tasks and the dependency between them,
+ * meaning that task X needs to be finished before task Y.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class InOutTopologicalDeployerSorter implements DeployerSorter
+{
+   @SuppressWarnings({"unchecked"})
+   public List<Deployer> sortDeployers(List<Deployer> original, Deployer newDeployer)
+   {
+      Graph<Integer> graph = new Graph<Integer>();
+      Map<String, Set<Deployer>> output2deployer = new HashMap<String, Set<Deployer>>();
+      List<Deployer> splitList = new SplitList<Deployer>(original, newDeployer);
+      Set<Deployer> notUsed = new TreeSet<Deployer>(Ordered.COMPARATOR);
+      for (Deployer deployer : splitList)
+      {
+         boolean used = false;
+
+         Set<String> inputs = deployer.getInputs();
+         Set<Vertex<Integer>> ivd = fillVertices(inputs, graph);
+         Set<String> outputs = deployer.getOutputs();
+         Set<Vertex<Integer>> ovd = fillVertices(outputs, graph);
+         ivd.retainAll(ovd); // intersection
+         for (String output : outputs)
+         {
+            Set<Deployer> deployers = output2deployer.get(output);
+            if (deployers == null)
+            {
+               deployers = new TreeSet<Deployer>(Ordered.COMPARATOR);
+               output2deployer.put(output, deployers);
+            }
+            deployers.add(deployer);
+            used = true;
+
+            for (String input : inputs)
+            {
+               Vertex<Integer> from = graph.findVertexByName(input);
+               Vertex<Integer> to = graph.findVertexByName(output);
+               // ignore pass-through
+               if (from != to && ivd.contains(from) == false)
+                  graph.addEdge(from, to, 0);
+            }
+         }
+
+         if (used == false)
+            notUsed.add(deployer);
+      }
+      Stack<Vertex<Integer>> noIncoming = new Stack<Vertex<Integer>>();
+      for (Vertex<Integer> vertex : graph.getVerticies())
+      {
+         if (vertex.getIncomingEdgeCount() == 0)
+            noIncoming.push(vertex);
+      }
+      List<Vertex<Integer>> sorted = new ArrayList<Vertex<Integer>>();
+      while(noIncoming.isEmpty() == false)
+      {
+         Vertex<Integer> n = noIncoming.pop();
+         sorted.add(n);
+         n.setData(sorted.size());
+         List<Edge<Integer>> edges = new ArrayList<Edge<Integer>>(n.getOutgoingEdges());
+         for (Edge<Integer> edge : edges)
+         {
+            Vertex<Integer> m = edge.getTo();
+            graph.removeEdge(n, m);
+            if (m.getIncomingEdgeCount() == 0)
+               noIncoming.push(m);
+         }
+      }
+      if (graph.getEdges().isEmpty() == false)
+         throw new IllegalStateException("We have a cycle: " + newDeployer + ", previous: " + original);
+
+      Set<Deployer> sortedDeployers = new LinkedHashSet<Deployer>();
+      for (Vertex<Integer> v : sorted)
+      {
+         Set<Deployer> deployers = output2deployer.get(v.getName());
+         if (deployers != null)
+         {
+            Deployer first = deployers.iterator().next();
+            Iterator<Deployer> notUsedIter = notUsed.iterator();
+            while(notUsedIter.hasNext())
+            {
+               Deployer next = notUsedIter.next();
+               if (next.getInputs().isEmpty() && Ordered.COMPARATOR.compare(next, first) < 0)
+               {
+                  sortedDeployers.add(next);
+                  notUsedIter.remove();
+               }
+            }
+            for (Deployer deployer : deployers)
+            {
+               if (sortedDeployers.contains(deployer) == false)
+                  sortedDeployers.add(deployer);               
+            }
+         }
+      }
+      sortedDeployers.addAll(notUsed); // add the one's with no output
+      return new ArrayList<Deployer>(sortedDeployers);
+   }
+
+   private static Set<Vertex<Integer>> fillVertices(Set<String> keys, Graph<Integer> graph)
+   {
+      Map<Vertex<Integer>, Object> dv = new IdentityHashMap<Vertex<Integer>, Object>();
+      for (String key : keys)
+         dv.put(getVertex(key, graph), 0);
+      return dv.keySet();
+   }
+
+   private static Vertex<Integer> getVertex(String key, Graph<Integer> graph)
+   {
+      Vertex<Integer> vertex = graph.findVertexByName(key);
+      if (vertex == null)
+      {
+         vertex = new Vertex<Integer>(key);
+         graph.addVertex(vertex);
+      }
+      return vertex;
+   }
+
+   private class SplitList<T> extends AbstractList<T>
+   {
+      private List<T> head;
+      private List<T> tail;
+
+      private SplitList(List<T> head, T tail)
+      {
+         this.head = head;
+         this.tail = Collections.singletonList(tail);
+      }
+
+      @Override
+      public T get(int index)
+      {
+         int headSize = head.size();
+         if (index < headSize)
+            return head.get(index);
+         else
+            return tail.get(index - headSize);
+      }
+
+      @Override
+      public int size()
+      {
+         return head.size() + tail.size();
+      }
+   }
+}
\ No newline at end of file

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -234,7 +234,7 @@
    {
       ControllerContext context = unit.getAttachment(ControllerContext.class);
       assertNotNull("Expecting controller context attachment: " + unit, context);
-      ControllerState state = new ControllerState(stage.getName());
+      ControllerState state = ControllerState.getInstance(stage.getName());
       assertEquals(state, context.getState());
    }
 

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -26,6 +26,8 @@
 import java.util.Set;
 
 import org.jboss.classloader.plugins.filter.CombiningClassFilter;
+import org.jboss.classloader.plugins.filter.JavaOnlyClassFilter;
+import org.jboss.classloader.plugins.filter.NothingClassFilter;
 import org.jboss.classloader.spi.ClassLoaderSystem;
 import org.jboss.classloader.spi.ParentPolicy;
 import org.jboss.classloader.spi.filter.ClassFilter;
@@ -54,10 +56,7 @@
 import org.jboss.test.deployers.annotations.support.InterceptionClassLoaderSystem;
 import org.jboss.test.deployers.annotations.support.InterceptionClassLoaderSystemDeployer;
 import org.jboss.test.deployers.classloading.support.MockClassLoaderDescribeDeployer;
-import org.jboss.classloader.plugins.filter.NothingClassFilter;
-import org.jboss.classloader.plugins.filter.JavaOnlyClassFilter;
 
-
 /**
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/DeployersDeployerTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/DeployersDeployerTestSuite.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/DeployersDeployerTestSuite.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -27,6 +27,7 @@
 
 import org.jboss.test.deployers.deployer.helpers.test.ExactAttachmentDeployerWithVisitorTestCase;
 import org.jboss.test.deployers.deployer.test.ComponentUnitTestCase;
+import org.jboss.test.deployers.deployer.test.DependenciesTopologicalOrderingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.DeployerClassLoaderUnitTestCase;
 import org.jboss.test.deployers.deployer.test.DeployerContextClassLoaderUnitTestCase;
 import org.jboss.test.deployers.deployer.test.DeployerFlowUnitTestCase;
@@ -39,10 +40,10 @@
 import org.jboss.test.deployers.deployer.test.DominoOrderingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.HeuristicAllOrNothingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.HeuristicRussionDollUnitTestCase;
+import org.jboss.test.deployers.deployer.test.InOutTopologicalOrderingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.IndexingOrderingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.KahnOrderingUnitTestCase;
 import org.jboss.test.deployers.deployer.test.MultipleComponentTypeUnitTestCase;
-import org.jboss.test.deployers.deployer.test.TopologicalOrderingUnitTestCase;
 
 /**
  * Deployers Deployer Test Suite.
@@ -79,8 +80,9 @@
       suite.addTest(DeployerFlowUnitTestCase.suite());
       suite.addTest(DominoOrderingUnitTestCase.suite());
       suite.addTest(KahnOrderingUnitTestCase.suite());
-      suite.addTest(TopologicalOrderingUnitTestCase.suite());
+      suite.addTest(InOutTopologicalOrderingUnitTestCase.suite());
       suite.addTest(IndexingOrderingUnitTestCase.suite());
+      suite.addTest(DependenciesTopologicalOrderingUnitTestCase.suite());
 
       // helper deployers
       suite.addTest(ExactAttachmentDeployerWithVisitorTestCase.suite());

Modified: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/support/TestDependencyMetaData.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/support/TestDependencyMetaData.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/support/TestDependencyMetaData.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -38,7 +38,7 @@
  */
 public class TestDependencyMetaData
 {
-   private static final ControllerState CLASSLOADER = new ControllerState(DeploymentStages.CLASSLOADER.getName());
+   private static final ControllerState CLASSLOADER = ControllerState.newState(DeploymentStages.CLASSLOADER.getName());
    
    public String name;
    
@@ -63,10 +63,10 @@
    {
       ControllerState whenState = CLASSLOADER;
       if (whenRequired != null)
-         whenState = new ControllerState(whenRequired.getName());
+         whenState = ControllerState.getInstance(whenRequired.getName());
       ControllerState depState = ControllerState.INSTALLED;
       if (dependentState != null)
-         depState = new ControllerState(dependentState.getName()); 
+         depState = ControllerState.getInstance(dependentState.getName());
       DependencyItem item = new AbstractDependencyItem(name, iDependOn, whenState, depState);
       this.iDependOn.add(item);
       return item;

Copied: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DependenciesTopologicalOrderingUnitTestCase.java (from rev 99215, projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DependenciesTopologicalOrderingUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DependenciesTopologicalOrderingUnitTestCase.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DependenciesTopologicalOrderingUnitTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.deployer.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.sort.DeployerSorter;
+import org.jboss.deployers.plugins.sort.DependenciesTopologicalDeployerSorter;
+
+/**
+ * Tests topological sorting.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+public class DependenciesTopologicalOrderingUnitTestCase extends AbstractSorterOrderingUnitTest
+{
+
+   public DependenciesTopologicalOrderingUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(DependenciesTopologicalOrderingUnitTestCase.class);
+   }
+
+   @Override
+   protected DeployerSorter createSorter()
+   {
+      return new DependenciesTopologicalDeployerSorter();
+   }
+
+}

Copied: projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/InOutTopologicalOrderingUnitTestCase.java (from rev 99215, projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/InOutTopologicalOrderingUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/InOutTopologicalOrderingUnitTestCase.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/InOutTopologicalOrderingUnitTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,69 @@
+/*
+* 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.deployer.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.sort.DeployerSorter;
+import org.jboss.deployers.plugins.sort.InOutTopologicalDeployerSorter;
+
+/**
+ * Simple topological sorting.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class InOutTopologicalOrderingUnitTestCase extends AbstractSorterOrderingUnitTest
+{
+   public InOutTopologicalOrderingUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(InOutTopologicalOrderingUnitTestCase.class);
+   }
+
+   @Override
+   protected DeployerSorter createSorter()
+   {
+      return new InOutTopologicalDeployerSorter();
+   }
+
+   @Override
+   public void testDeployersOrder1() throws Exception
+   {
+      // TODO - how much do we allow pass-through to participate in ordering?
+      // This just creates duplicit edges from vertex A to vertex B in final graph.
+   }
+
+   public void testAlgorithmPerformance()
+   {
+      // ignored
+   }
+
+   public void testAlgorithmPerformance2()
+   {
+      // ignored
+   }
+}
\ No newline at end of file

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -33,6 +33,7 @@
 
 import org.jboss.deployers.spi.structure.MetaDataEntry;
 import org.jboss.deployers.spi.structure.MetaDataType;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
@@ -155,6 +156,14 @@
 
    public List<VirtualFile> getMetaDataLocations()
    {
+      return getMetaDataLocations(MetaDataTypeFilter.DEFAULT);
+   }
+
+   public List<VirtualFile> getMetaDataLocations(MetaDataTypeFilter filter)
+   {
+      if (filter == null)
+         throw new IllegalArgumentException("Null filter");
+
       if (metaDataLocations == null || metaDataLocations.isEmpty())
       {
          return Collections.emptyList();
@@ -164,8 +173,11 @@
          List<VirtualFile> result = new ArrayList<VirtualFile>();
          for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
          {
-            VirtualFile location = entry.getKey();
-            result.add(location);
+            if (filter.accepts(entry.getValue()))
+            {
+               VirtualFile location = entry.getKey();
+               result.add(location);
+            }
          }
          return result;
       }
@@ -195,15 +207,22 @@
 
    public VirtualFile getMetaDataFile(String name)
    {
+      return getMetaDataFile(name, MetaDataTypeFilter.DEFAULT);
+   }
+
+   public VirtualFile getMetaDataFile(String name, MetaDataTypeFilter filter)
+   {
       if (name == null)
          throw new IllegalArgumentException("Null name");
+      if (filter == null)
+         throw new IllegalArgumentException("Null filter");
       try
       {
          // There isn't a metadata locations so let's see whether the root matches.
          if (metaDataLocations == null || metaDataLocations.isEmpty())
          {
             // It has to be a plain file
-            if (root != null && SecurityActions.isLeaf(root))
+            if (root != null && root.exists() && SecurityActions.isLeaf(root))
             {
                String fileName = root.getName();
                if (fileName.equals(name))
@@ -214,7 +233,7 @@
             return null;
          }
          // Look in the meta data locations
-         return searchMetaDataLocations(name);
+         return searchMetaDataLocations(name, filter);
       }
       catch (Exception e)
       {
@@ -233,17 +252,33 @@
     */
    protected VirtualFile searchMetaDataLocations(String name)
    {
+      return searchMetaDataLocations(name, MetaDataTypeFilter.DEFAULT);
+   }
+
+   /**
+    * Search the metadata locations.
+    * In this impl the first one matching is returned.
+    *
+    * @param name the file name to find
+    * @param filter the metadata type filter
+    * @return found file or null if not found
+    */
+   protected VirtualFile searchMetaDataLocations(String name, MetaDataTypeFilter filter)
+   {
       VirtualFile result = null;
       for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
       {
-         VirtualFile location = entry.getKey();
-         result = location.getChild(name);
-         if (result.exists())
+         if (filter.accepts(entry.getValue()))
          {
-            if (log.isTraceEnabled())
-               log.trace("Found " + name + " in " + location.getName());
-            deployed();
-            break;
+            VirtualFile location = entry.getKey();
+            result = location.getChild(name);
+            if (result.exists())
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Found " + name + " in " + location.getName());
+               deployed();
+               break;
+            }
          }
       }
       return result != null && result.exists() ? result : null;
@@ -251,20 +286,30 @@
 
    public List<VirtualFile> getMetaDataFiles(String name, String suffix)
    {
+      return getMetaDataFiles(name, suffix, MetaDataTypeFilter.DEFAULT);
+   }
+
+   public List<VirtualFile> getMetaDataFiles(String name, String suffix, MetaDataTypeFilter mdtf)
+   {
       if (name == null && suffix == null)
          throw new IllegalArgumentException("Null name and suffix");
 
       VirtualFileFilter filter = new MetaDataMatchFilter(name, suffix);
-      return getMetaDataFiles(filter);
+      return getMetaDataFiles(filter, mdtf);
    }
 
    public List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter)
    {
-      if (filter == null)
+      return getMetaDataFiles(filter, MetaDataTypeFilter.DEFAULT);     
+   }
+
+   public List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter, MetaDataTypeFilter mdtf)
+   {
+      if (filter == null || mdtf == null)
       {
          // we don't wanna guess what needs to be filtered
          // if all is what you want, use your own ALL filter
-         throw new IllegalArgumentException("Null filter");
+         throw new IllegalArgumentException("Null filter - VFS or MetaDataType: vfs=" + filter + ", mdt=" + mdtf);
       }
 
       try
@@ -288,14 +333,17 @@
          List<VirtualFile> results = new ArrayList<VirtualFile>();
          for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
          {
-            VirtualFile location = entry.getKey();
-            List<VirtualFile> result = location.getChildren(filter);
-            if (result != null && result.isEmpty() == false)
+            if (mdtf.accepts(entry.getValue()))
             {
-               if (log.isTraceEnabled())
-                  log.trace("Found results with " + filter + " in " + location.getName());
-               results.addAll(result);
-               deployed();
+               VirtualFile location = entry.getKey();
+               List<VirtualFile> result = location.getChildren(filter);
+               if (result != null && result.isEmpty() == false)
+               {
+                  if (log.isTraceEnabled())
+                     log.trace("Found results with " + filter + " in " + location.getName());
+                  results.addAll(result);
+                  deployed();
+               }
             }
          }
          return results;

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentUnit.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -23,6 +23,7 @@
 
 import java.util.List;
 
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentResourceLoader;
@@ -65,16 +66,31 @@
       return getDeploymentContext().getMetaDataFile(name);
    }
 
+   public VirtualFile getMetaDataFile(String name, MetaDataTypeFilter filter)
+   {
+      return getDeploymentContext().getMetaDataFile(name, filter);
+   }
+
    public List<VirtualFile> getMetaDataFiles(String name, String suffix)
    {
       return getDeploymentContext().getMetaDataFiles(name, suffix);
    }
 
+   public List<VirtualFile> getMetaDataFiles(String name, String suffix, MetaDataTypeFilter filter)
+   {
+      return getDeploymentContext().getMetaDataFiles(name, suffix, filter);
+   }
+
    public List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter)
    {
       return getDeploymentContext().getMetaDataFiles(filter);
    }
 
+   public List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter, MetaDataTypeFilter mdtf)
+   {
+      return getDeploymentContext().getMetaDataFiles(filter, mdtf);
+   }
+
    public void prependMetaDataLocation(VirtualFile... locations)
    {
       getDeploymentContext().prependMetaDataLocation(locations);

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -156,7 +156,7 @@
          if (metaDataPath == null || metaDataPath.isEmpty())
             parentContextInfo = StructureMetaDataFactory.createContextInfo(relativePath, recognised.getClassPath());
          else
-            parentContextInfo = StructureMetaDataFactory.createContextInfo(relativePath, metaDataPath, recognised.getClassPath());
+            parentContextInfo = StructureMetaDataFactory.createContextInfo(recognised.getClassPath(), metaDataPath, relativePath);
 
          // copy the modification type information
          parentContextInfo.setModificationType(recognised.getModificationType());

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/dependency/test/DependenciesTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/dependency/test/DependenciesTestCase.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/dependency/test/DependenciesTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -78,7 +78,7 @@
       DeploymentUnit du = addDeployment("/dependency", "bean");
       try
       {
-         assertDeployment(du, new ControllerState("PreReal"));
+         assertDeployment(du, ControllerState.getInstance("PreReal"));
          DeploymentUnit tmDU = assertDeploy("/dependency", "support");
          try
          {
@@ -123,7 +123,7 @@
       DeploymentUnit du = addDeployment("/dependency", "nested");
       try
       {
-         assertDeployment(du, new ControllerState("PreReal"));
+         assertDeployment(du, ControllerState.getInstance("PreReal"));
          DeploymentUnit tmDU = assertDeploy("/dependency", "support");
          try
          {
@@ -145,7 +145,7 @@
       DeploymentUnit du = addDeployment("/dependency", "bean");
       try
       {
-         assertDeployment(du, new ControllerState("PreReal"));
+         assertDeployment(du, ControllerState.getInstance("PreReal"));
          DeploymentUnit tmDU = assertDeploy("/dependency", "support");
          try
          {
@@ -153,7 +153,7 @@
 
             undeploy(tmDU);
 
-            assertDeployment(du, new ControllerState("PreReal"));
+            assertDeployment(du, ControllerState.getInstance("PreReal"));
 
             tmDU = assertDeploy("/dependency", "support");
 

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -21,8 +21,12 @@
 */
 package org.jboss.test.deployers.vfs.deployer.validate.test;
 
+import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
+import java.security.CodeSigner;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import junit.framework.Test;
@@ -38,6 +42,7 @@
 import org.jboss.test.deployers.vfs.deployer.validate.support.TestXmlDeployer;
 import org.jboss.vfs.VFS;
 import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.spi.FileSystem;
 import org.jboss.xb.binding.JBossXBException;
 
 /**
@@ -69,14 +74,14 @@
       map.put(xmlDeployer, RuntimeException.class);
       map.put(new SchemaResolverDeployer<Object>(Object.class), JBossXBException.class);
 
-      VirtualFile root = VFS.getChild("/NonExistent/File/Path");
+      VirtualFile root = getNullStreamFile();
       AbstractVFSDeploymentContext context = new MyVFSDeploymentContext(root, "");
       DeploymentUnit unit = context.getDeploymentUnit();
 
       for(AbstractVFSParsingDeployer<?> deployer : map.keySet())
       {
          // set name to "" to match in deployment
-         deployer.setName("");
+         deployer.setName("nullfile");
          try
          {
             deployer.deploy(unit);
@@ -93,4 +98,73 @@
          }
       }
    }
+   
+   public VirtualFile getNullStreamFile() throws IOException 
+   {
+      VirtualFile file = VFS.getChild("/nullfile");
+      
+      VFS.mount(file, new FileSystem()
+      {
+         public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException
+         {
+            return null;
+         }
+         
+         public boolean isReadOnly()
+         {
+            return false;
+         }
+         
+         public boolean isFile(VirtualFile mountPoint, VirtualFile target)
+         {
+            return true;
+         }
+         
+         public boolean isDirectory(VirtualFile mountPoint, VirtualFile target)
+         {
+            return false;
+         }
+         
+         public long getSize(VirtualFile mountPoint, VirtualFile target)
+         {
+            return 0;
+         }
+         
+         public long getLastModified(VirtualFile mountPoint, VirtualFile target)
+         {
+            return 0;
+         }
+         
+         public File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException
+         {
+            return null;
+         }
+         
+         public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target)
+         {
+            return null;
+         }
+         
+         public CodeSigner[] getCodeSigners(VirtualFile mountPoint, VirtualFile target)
+         {
+            return null;
+         }
+         
+         public boolean exists(VirtualFile mountPoint, VirtualFile target)
+         {
+            return true;
+         }
+         
+         public boolean delete(VirtualFile mountPoint, VirtualFile target)
+         {
+            return false;
+         }
+         
+         public void close() throws IOException
+         {
+         }
+      });
+      
+      return file;
+   }
 }

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -26,6 +26,7 @@
 import junit.textui.TestRunner;
 import org.jboss.test.deployers.vfs.matchers.test.FileMatchersTestCase;
 import org.jboss.test.deployers.vfs.matchers.test.JarExtensionsTestCase;
+import org.jboss.test.deployers.vfs.matchers.test.MetaDataTypeFilterTestCase;
 import org.jboss.test.deployers.vfs.matchers.test.NameIgnoreMechanismTestCase;
 
 /**
@@ -47,6 +48,7 @@
       suite.addTest(FileMatchersTestCase.suite());
       suite.addTest(JarExtensionsTestCase.suite());
       suite.addTest(NameIgnoreMechanismTestCase.suite());
+      suite.addTest(MetaDataTypeFilterTestCase.suite());
 
       return suite;
    }

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/MetaDataTypeFilterTestCase.java (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/MetaDataTypeFilterTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/MetaDataTypeFilterTestCase.java	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/MetaDataTypeFilterTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,93 @@
+/*
+* 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 junit.framework.Test;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure;
+import org.jboss.test.deployers.BaseDeployersVFSTest;
+import org.jboss.test.deployers.vfs.matchers.support.FeedbackDeployer;
+
+/**
+ * MetaDataType filter tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MetaDataTypeFilterTestCase extends BaseDeployersVFSTest
+{
+   public MetaDataTypeFilterTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(MetaDataTypeFilterTestCase.class);
+   }
+
+   public void testAlternative() throws Exception
+   {
+      FeedbackDeployer fbd = new FeedbackDeployer();
+      fbd.setAllowMultipleFiles(true);
+      fbd.setSuffix(".txt");
+      fbd.setFilter(MetaDataTypeFilter.ALL);
+
+      DeployerClient main = createMainDeployer(fbd);
+      addStructureDeployer(main, new DeclaredStructure());
+
+      Deployment deployment = createDeployment("/matchers", "mdtf");
+      main.deploy(deployment);
+
+      assertEquals(3, fbd.getFiles().size());
+   }
+
+   public void testFilterFromUnit() throws Exception
+   {
+      AbstractDeployer pre = new AbstractDeployer()
+      {
+         public void deploy(DeploymentUnit unit) throws DeploymentException
+         {
+            unit.addAttachment(MetaDataTypeFilter.class, MetaDataTypeFilter.ALL);
+         }
+      };
+      pre.setStage(DeploymentStages.PRE_PARSE);
+      FeedbackDeployer fbd = new FeedbackDeployer();
+      fbd.setAllowMultipleFiles(true);
+      fbd.setSuffix(".txt");
+      fbd.setFilter(null); // disable default
+
+      DeployerClient main = createMainDeployer(fbd, pre);
+      addStructureDeployer(main, new DeclaredStructure());
+
+      Deployment deployment = createDeployment("/matchers", "mdtf");
+      main.deploy(deployment);
+
+      assertEquals(3, fbd.getFiles().size());
+   }
+}
\ No newline at end of file

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -27,6 +27,7 @@
 import java.util.List;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl;
 import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
@@ -159,8 +160,13 @@
    
    protected void assertMetaData(VFSDeploymentContext context, String metaDataPath) throws Exception
    {
+      assertMetaData(context, metaDataPath, MetaDataTypeFilter.DEFAULT);
+   }
+
+   protected void assertMetaData(VFSDeploymentContext context, String metaDataPath, MetaDataTypeFilter filter) throws Exception
+   {
       VirtualFile root = context.getRoot();
-      List<VirtualFile> metaDataLocation = context.getMetaDataLocations();
+      List<VirtualFile> metaDataLocation = context.getMetaDataLocations(filter);
       VirtualFile expected = root.getChild(metaDataPath);
       assertNotNull(metaDataLocation);
       assertEquals(1, metaDataLocation.size());
@@ -169,8 +175,13 @@
    
    protected void assertMetaDatas(VFSDeploymentContext context, String... metaDataPath) throws Exception
    {
+      assertMetaDatas(context, MetaDataTypeFilter.DEFAULT, metaDataPath);  
+   }
+
+   protected void assertMetaDatas(VFSDeploymentContext context, MetaDataTypeFilter filter, String... metaDataPath) throws Exception
+   {
       VirtualFile root = context.getRoot();
-      List<VirtualFile> metaDataLocations = context.getMetaDataLocations();
+      List<VirtualFile> metaDataLocations = context.getMetaDataLocations(filter);
       assertNotNull(metaDataLocations);
       int i = 0;
       for(String path : metaDataPath)

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -24,6 +24,8 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.jboss.deployers.spi.structure.MetaDataType;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
@@ -83,8 +85,14 @@
    public void testAlternative() throws Throwable
    {
       VFSDeploymentContext root = assertDeploy("/structure/explicit", "alt.jar");
-      // Validate the root context info
-      assertMetaDatas(root, "META-INF", "config");
-      // TODO -- check alt usage
+      assertMetaData(root, "META-INF");
+      assertMetaDatas(root, MetaDataTypeFilter.ALL, "META-INF", "config");
+      assertMetaData(root, "config", new MetaDataTypeFilter()
+      {
+         public boolean accepts(MetaDataType type)
+         {
+            return MetaDataType.ALTERNATIVE == type;
+         }
+      });
    }
 }

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf)

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF)

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt	2010-01-11 15:49:22 UTC (rev 99215)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -1 +0,0 @@
-Empty.

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/empty.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1 @@
+Empty.

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt	2010-01-11 15:49:22 UTC (rev 99215)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -1 +0,0 @@
-First.

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/fst.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1 @@
+First.

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml	2010-01-11 15:49:22 UTC (rev 99215)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml	2010-01-11 19:36:47 UTC (rev 99240)
@@ -1,9 +0,0 @@
-<structure>
-  <context>
-    <path name=""/>
-    <metaDataPath>
-      <path name="META-INF" type="Default"/>
-      <path name="alt" type="Alt"/>
-    </metaDataPath>
-  </context>
-</structure>

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/META-INF/jboss-structure.xml	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,9 @@
+<structure>
+  <context>
+    <path name=""/>
+    <metaDataPath>
+      <path name="META-INF" type="Default"/>
+      <path name="alt" type="Alt"/>
+    </metaDataPath>
+  </context>
+</structure>

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/alt)

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp	2010-01-11 15:49:22 UTC (rev 99215)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp	2010-01-11 19:36:47 UTC (rev 99240)
@@ -1 +0,0 @@
-Tmp file.

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/qwert.tmp	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1 @@
+Tmp file.

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt	2010-01-11 15:49:22 UTC (rev 99215)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -1,2 +0,0 @@
-Second.
-

Copied: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt (from rev 99215, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt)
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt	                        (rev 0)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/resources/matchers/mdtf/alt/snd.txt	2010-01-11 19:36:47 UTC (rev 99240)
@@ -0,0 +1,2 @@
+Second.
+

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/AbstractVFSParsingDeployer.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -32,6 +32,7 @@
 
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.vfs.VirtualFile;
@@ -52,6 +53,9 @@
    /** The allow multiple fiels flag */
    private boolean allowMultipleFiles;
 
+   /** The metadata type filter */
+   private MetaDataTypeFilter filter = MetaDataTypeFilter.DEFAULT;
+
    /**
     * Create a new AbstractVFSParsingDeployer.
     * 
@@ -103,13 +107,30 @@
       // Ignore non-vfs deployments
       if (unit instanceof VFSDeploymentUnit == false)
       {
-         log.trace("Not a vfs deployment: " + unit.getName());
+         if (log.isTraceEnabled())
+            log.trace("Not a vfs deployment: " + unit.getName());
+         
          return false;
       }
       return accepts((VFSDeploymentUnit) unit);
    }
 
    /**
+    * Get metadata type filter from unit - if deployer's filter is set to null.
+    *
+    * @param unit the deployment unit
+    * @return metadata type filter
+    */
+   protected MetaDataTypeFilter getMetaDataTypeFilter(DeploymentUnit unit)
+   {
+      if (filter != null)
+         return filter;
+
+      MetaDataTypeFilter mdtf = unit.getAttachment(MetaDataTypeFilter.class);
+      return mdtf != null ? mdtf : MetaDataTypeFilter.DEFAULT;
+   }
+
+   /**
     * Open stream and validate if not null.
     *
     * @param file the virtual file
@@ -169,7 +190,7 @@
          altMappingsMap.put(file.getName(), altExpectedClass);
       }
       if(checkMetaDataFile && file == null)
-         file = unit.getMetaDataFile(originalName);
+         file = unit.getMetaDataFile(originalName, getMetaDataTypeFilter(unit));
 
       return file;
    }
@@ -250,7 +271,7 @@
          return parseAndInit(vfsDeploymentUnit, file, root, true);
 
       // try all name+suffix matches
-      List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
+      List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix, getMetaDataTypeFilter(unit));
       switch (files.size())
       {
          case 0 :
@@ -320,7 +341,7 @@
             VirtualFile file = getMetadataFile(vfsDeploymentUnit, matchFileToClass(unit, name), name, false);
             if (file == null)
             {
-               List<VirtualFile> matched = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
+               List<VirtualFile> matched = vfsDeploymentUnit.getMetaDataFiles(name, suffix, getMetaDataTypeFilter(unit));
                if (matched != null && matched.isEmpty() == false)
                   files.addAll(matched);
                else
@@ -432,4 +453,14 @@
    {
       this.allowMultipleFiles = allowMultipleFiles;
    }
+
+   /**
+    * Set metadata type filter.
+    *
+    * @param filter the metadata type filter
+    */
+   public void setFilter(MetaDataTypeFilter filter)
+   {
+      this.filter = filter;
+   }
 }

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.vfs.VirtualFile;
 import org.jboss.vfs.VirtualFileFilter;
@@ -59,6 +60,14 @@
    List<VirtualFile> getMetaDataLocations();
    
    /**
+    * Get the meta data locations
+    *
+    * @param filter the metadata type filter
+    * @return the meta data locations
+    */
+   List<VirtualFile> getMetaDataLocations(MetaDataTypeFilter filter);
+
+   /**
     * Set the meta data locations
     * 
     * @param locations the meta data location
@@ -66,8 +75,9 @@
    void setMetaDataLocations(List<VirtualFile> locations);
    
    /**
-    * Gets a metadata file
-    * 
+    * Gets a metadata file. This is a file located under the deployment metadata
+    * context(s).
+    *
     * @param name the name to exactly match
     * @return the virtual file or null if not found
     * @throws IllegalArgumentException for a null name
@@ -75,9 +85,20 @@
    VirtualFile getMetaDataFile(String name);
 
    /**
-    * Gets metadata files for this deployment
-    * 
+    * Gets a metadata file. This is a file located under the deployment metadata
+    * context(s).
+    *
     * @param name the name to exactly match
+    * @param filter the metadata type filter
+    * @return the virtual file or null if not found
+    * @throws IllegalArgumentException for a null name
+    */
+   VirtualFile getMetaDataFile(String name, MetaDataTypeFilter filter);
+
+   /**
+    * Gets the metadata files for this deployment unit
+    *
+    * @param name the name to exactly match
     * @param suffix the suffix to partially match
     * @return the virtual files that match
     * @throws IllegalArgumentException if both the name and suffix are null
@@ -87,6 +108,17 @@
    /**
     * Gets the metadata files for this deployment unit
     *
+    * @param name the name to exactly match
+    * @param suffix the suffix to partially match
+    * @param filter the metadata type filter
+    * @return the virtual files that match
+    * @throws IllegalArgumentException if both the name and suffix are null
+    */
+   List<VirtualFile> getMetaDataFiles(String name, String suffix, MetaDataTypeFilter filter);
+
+   /**
+    * Gets the metadata files for this deployment unit
+    *
     * @param filter the file filter
     * @return the virtual files that match
     * @throws IllegalArgumentException if both the name and suffix are null
@@ -94,6 +126,16 @@
    List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter);
 
    /**
+    * Gets the metadata files for this deployment unit
+    *
+    * @param filter the file filter
+    * @param mdtf the metadata type filter
+    * @return the virtual files that match
+    * @throws IllegalArgumentException if both the name and suffix are null
+    */
+   List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter, MetaDataTypeFilter mdtf);
+
+   /**
     * Prepend metadata file locations.
     * 
     * @param locations the locations

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnit.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -23,6 +23,7 @@
 
 import java.util.List;
 
+import org.jboss.deployers.spi.structure.MetaDataTypeFilter;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.vfs.VirtualFile;
 import org.jboss.vfs.VirtualFileFilter;
@@ -47,6 +48,17 @@
    VirtualFile getMetaDataFile(String name);
    
    /**
+    * Gets a metadata file. This is a file located under the deployment metadata
+    * context(s).
+    *
+    * @param name the name to exactly match
+    * @param filter the metadata type filter
+    * @return the virtual file or null if not found
+    * @throws IllegalArgumentException for a null name
+    */
+   VirtualFile getMetaDataFile(String name, MetaDataTypeFilter filter);
+
+   /**
     * Gets the metadata files for this deployment unit
     * 
     * @param name the name to exactly match
@@ -55,15 +67,36 @@
     * @throws IllegalArgumentException if both the name and suffix are null
     */
    List<VirtualFile> getMetaDataFiles(String name, String suffix);
-   
+
    /**
     * Gets the metadata files for this deployment unit
     *
+    * @param name the name to exactly match
+    * @param suffix the suffix to partially match
+    * @param filter the metadata type filter
+    * @return the virtual files that match
+    * @throws IllegalArgumentException if both the name and suffix are null
+    */
+   List<VirtualFile> getMetaDataFiles(String name, String suffix, MetaDataTypeFilter filter);
+
+   /**
+    * Gets the metadata files for this deployment unit
+    *
     * @param filter the file filter
     * @return the virtual files that match
     * @throws IllegalArgumentException if both the name and suffix are null
     */
    List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter);
+
+   /**
+    * Gets the metadata files for this deployment unit
+    *
+    * @param filter the file filter
+    * @param mdtf the metadata type filter
+    * @return the virtual files that match
+    * @throws IllegalArgumentException if both the name and suffix are null
+    */
+   List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter, MetaDataTypeFilter mdtf);
    
    /**
     * Prepend metadata file locations.

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java	2010-01-11 19:20:55 UTC (rev 99239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java	2010-01-11 19:36:47 UTC (rev 99240)
@@ -431,7 +431,7 @@
 
       // Create and link the context
       if (metaDataPath != null)
-         return StructureMetaDataFactory.createContextInfo("", createMetaDataEntry(metaDataPath), null);
+         return StructureMetaDataFactory.createContextInfo("", metaDataPath, null);
       else
          return StructureMetaDataFactory.createContextInfo("", null);
    }
@@ -455,17 +455,6 @@
     * Create metadata entry.
     *
     * @param path the path
-    * @return the metadata entry
-    */
-   private MetaDataEntry createMetaDataEntry(String path)
-   {
-      return StructureMetaDataFactory.createMetaDataEntry(path);
-   }
-
-   /**
-    * Create metadata entry.
-    *
-    * @param path the path
     * @param type the type
     * @return the metadata entry
     */
@@ -502,7 +491,7 @@
          throw new IllegalArgumentException("Null context");
 
       VirtualFile root = context.getFile();
-      List<MetaDataEntry> metaDataPath = CollectionsFactory.createLazyList();
+      List<String> metaDataPath = CollectionsFactory.createLazyList();
       // Determine whether the metadata paths exists
       if (metaDataPaths != null && metaDataPaths.length > 0)
       {
@@ -510,7 +499,7 @@
          {
             VirtualFile child = root.getChild(path);
             if (child.exists())
-               metaDataPath.add(createMetaDataEntry(path));
+               metaDataPath.add(path);
          }
       }
 




More information about the jboss-cvs-commits mailing list