[jboss-cvs] JBossAS SVN: r68355 - in projects/microcontainer/trunk: container/src/main/org/jboss/reflect/plugins/introspection and 36 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 17 20:08:05 EST 2007


Author: alesj
Date: 2007-12-17 20:08:04 -0500 (Mon, 17 Dec 2007)
New Revision: 68355

Added:
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/META-INF/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/scripts/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/scripts/myscript.bsh
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/security-config.xml
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/root.bsh
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/META-INF/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/META-INF/jboss-structure.xml
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/empty.jar/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/empty.jar/empty
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jar1.jar/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jar1.jar/META-INF/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jar1.jar/META-INF/MANIFEST.MF
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/scripts/
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/scripts/myscript.bsh
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/security-config.xml
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/MultipleMetadataStructureUnitTestCase.java
Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ArrayInfoImpl.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeploymentFactory.java
   projects/microcontainer/trunk/deployers-client/src/tests/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java
   projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java
   projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
   projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
   projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
   projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
   projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java
   projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
   projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java
   projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
   projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/explicit/complex.deployer/META-INF/jboss-structure.xml
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BeanManagedDeploymentUnitTestCase.java
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java
   projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
Log:
Multiple metadata locations support.
ManagedObjectFactory being CollectionMetaType/Value aware.
Prepared IntrospectionTypeInfoFactoryImpl for WeakTypeCache override.

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ArrayInfoImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ArrayInfoImpl.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ArrayInfoImpl.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -21,11 +21,14 @@
 */
 package org.jboss.reflect.plugins;
 
+import java.lang.reflect.UndeclaredThrowableException;
+
 import org.jboss.metadata.spi.signature.Signature;
 import org.jboss.reflect.spi.AnnotationValue;
 import org.jboss.reflect.spi.ArrayInfo;
 import org.jboss.reflect.spi.PrimitiveInfo;
 import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
 
 /**
  * Array information
@@ -58,6 +61,9 @@
     */
    public ArrayInfoImpl(TypeInfo componentType)
    {
+      if (componentType == null)
+         throw new IllegalArgumentException("Null component type.");
+
       this.componentType = componentType;
       StringBuilder builder = new StringBuilder();
       builder.append("[");
@@ -67,7 +73,7 @@
          builder.append("[");
          temp = ((ArrayInfo) temp).getComponentType();
       }
-      if (temp.getClass().equals(PrimitiveInfo.class))
+      if (PrimitiveInfo.class.equals(temp.getClass()))
       {
          //builder.append(temp.getName());
          String encodedName = Signature.getPrimativeArrayType(temp.getName());
@@ -81,6 +87,25 @@
       calculateHash();
    }
 
+   @Deprecated
+   @SuppressWarnings("unchecked")
+   public Class<? extends Object> getType()
+   {
+      if (annotatedElement == null)
+      {
+         try
+         {
+            TypeInfoFactory tif = SerializationHelper.getTypeInfoFactory();
+            annotatedElement = tif.getTypeInfo(name, componentType.getType().getClassLoader()).getType();
+         }
+         catch (Throwable t)
+         {
+            throw new UndeclaredThrowableException(t);
+         }
+      }
+      return (Class<? extends Object>)annotatedElement;
+   }
+
    public TypeInfo getComponentType()
    {
       return componentType;

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -343,6 +343,16 @@
       return resolveComplexTypeInfo(cl, name);
    }
 
+/*
+   // TODO - uncomment one the jboss-commons-core is updated
+   protected TypeInfo getGenericArrayType(GenericArrayType type)
+   {
+      Type compType = type.getGenericComponentType();
+      TypeInfo componentType = getTypeInfo(compType);
+      return new ArrayInfoImpl(componentType);
+   }
+*/
+
    private TypeInfo resolveComplexTypeInfo(ClassLoader cl, String name)
          throws ClassNotFoundException
    {

Modified: projects/microcontainer/trunk/deployers-client/src/tests/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-client/src/tests/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-client/src/tests/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -67,9 +67,17 @@
 
    protected static void assertDefaultMetaDataPath(ContextInfo contextInfo)
    {
-      assertNull(contextInfo.getMetaDataPath());
+      assertNotNull(contextInfo);
+      assertNotNull(contextInfo.getMetaDataPath());
+      assertTrue(contextInfo.getMetaDataPath().isEmpty());
    }
 
+   protected static void assertDefaultMetaDataPath(List<String> metaDataPath)
+   {
+      assertEquals(1, metaDataPath.size());
+      assertEquals("metaDataPath", metaDataPath.get(0));
+   }
+
    protected static void assertDefaultClassPath(List<ClassPathEntry> classPath)
    {
       assertNotNull(classPath);
@@ -294,7 +302,7 @@
       List<ClassPathEntry> classPath = factory.createClassPath("ClassPath");
       ContextInfo context = factory.addContext(deployment, "path", "metaDataPath", classPath);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertEquals(classPath, context.getClassPath());
 
       assertContexts(deployment, context);
@@ -303,7 +311,7 @@
       deployment = createDeployment();
       context = factory.addContext(deployment, "path", "metaDataPath", classPath);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertNull(context.getClassPath());
 
       assertContexts(deployment, context);
@@ -336,7 +344,7 @@
 
       try
       {
-         factory.addContext(deployment, "path", null, classPath);
+         factory.addContext(deployment, "path", (String)null, classPath);
          fail("Should not be here");
       }
       catch (Exception e)
@@ -397,7 +405,7 @@
       List<ClassPathEntry> classPath = factory.createClassPath("ClassPath");
       ContextInfo context1 = factory.addContext(deployment, "path1", "metaDataPath", classPath);
       assertEquals("path1", context1.getPath());
-      assertEquals("metaDataPath", context1.getMetaDataPath());
+      assertDefaultMetaDataPath(context1.getMetaDataPath());
       assertEquals(classPath, context1.getClassPath());
       
       StructureMetaData structure = assertStructureMetaData(deployment);

Modified: projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeploymentFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeploymentFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeploymentFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -94,6 +94,24 @@
    }
    
    /**
+    * Add a context to a deployment
+    *
+    * @param context the context
+    * @param path the path
+    * @param metaDataPath the meta data path
+    * @param classPath the classpath
+    * @return the context info
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public ContextInfo addContext(PredeterminedManagedObjectAttachments context, String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      StructureMetaData structure = assureStructure(context);
+      ContextInfo result = StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+      structure.addContext(result);
+      return result;
+   }
+
+   /**
     * Create a new classpath entry
     * 
     * @param path the path

Modified: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -26,6 +26,7 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.jboss.deployers.spi.attachments.helpers.PredeterminedManagedObjectAttachmentsImpl;
@@ -36,6 +37,7 @@
  * ContextInfoImpl.
  * 
  * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
  * @author Scott.Stark at jboss.org
  * @version $Revision: 1.1 $
  */
@@ -49,7 +51,7 @@
    private String path;
    
    /** The metadata path */
-   private String metaDataPath;
+   private List<String> metaDataPath;
    
    /** The class path entries */
    private List<ClassPathEntry> classPath = ClassPathEntryImpl.DEFAULT;
@@ -95,17 +97,34 @@
     * Create a new ContextInfoImpl.
     * 
     * @param path the path
-    * @param metaDataPath the metadata path
+    * @param metaDataPath a single metadata path
     * @param classPath the class path
     * @throws IllegalArgumentException for a null path or metadata path
     */
    public ContextInfoImpl(String path, String metaDataPath, List<ClassPathEntry> classPath)
    {
       setPath(path);
+      if (metaDataPath == null)
+         throw new IllegalArgumentException("Null metadata path.");
+      setMetaDataPath(Collections.singletonList(metaDataPath));
+      setClassPath(classPath);
+   }
+   
+   /**
+    * Create a new ContextInfoImpl.
+    *
+    * @param path the path
+    * @param metaDataPath the metadata paths
+    * @param classPath the class path
+    * @throws IllegalArgumentException for a null path or metadata path
+    */
+   public ContextInfoImpl(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      setPath(path);
       setMetaDataPath(metaDataPath);
       setClassPath(classPath);
    }
-   
+
    public String getPath()
    {
       return path;
@@ -124,24 +143,41 @@
       this.path = path;
    }
 
-   public String getMetaDataPath()
+   public List<String> getMetaDataPath()
    {
+      if (metaDataPath == null)
+         return Collections.emptyList();
       return metaDataPath;
    }
 
    /**
-    * Set the metaDataPath.
-    * 
-    * @param metaDataPath the metaDataPath.
-    * @throws IllegalArgumentException for a null path
+    * Set the meta data paths.
+    *
+    * @param metaDataPath the meta data paths
     */
-   public void setMetaDataPath(String metaDataPath)
+   public void setMetaDataPath(List<String> metaDataPath)
    {
-      if (metaDataPath == null)
-         throw new IllegalArgumentException("Null metaDataPath");
       this.metaDataPath = metaDataPath;
    }
 
+   public void addMetaDataPath(String path)
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      if (metaDataPath == null)
+         metaDataPath = Collections.singletonList(path);
+      else if (metaDataPath.size() == 1)
+      {
+         List<String> paths = new ArrayList<String>();
+         paths.addAll(metaDataPath);
+         paths.add(path);
+         metaDataPath = paths;
+      }
+      else
+         metaDataPath.add(path);
+   }
+
    public List<ClassPathEntry> getClassPath()
    {
       return classPath;
@@ -161,6 +197,7 @@
    {
       if (entry == null)
          throw new IllegalArgumentException("Null entry");
+
       if (classPath == null || classPath == ClassPathEntryImpl.DEFAULT)
       {
          List<ClassPathEntry> old = classPath;
@@ -230,10 +267,8 @@
       if (getPath().equals(other.getPath()) == false)
          return false;
 
-      String thisMetaDataPath = getMetaDataPath();
-      String otherMetaDataPath = other.getMetaDataPath();
-      if (thisMetaDataPath == null)
-         return otherMetaDataPath == null;
+      List<String> thisMetaDataPath = getMetaDataPath();
+      List<String> otherMetaDataPath = other.getMetaDataPath();
       if (thisMetaDataPath.equals(otherMetaDataPath) == false)
          return false;
 
@@ -255,9 +290,9 @@
    {
       super.readExternal(in);
       setPath(in.readUTF());
-      boolean isNullMetaDataPath = in.readBoolean();
-      if (isNullMetaDataPath == false)
-         setMetaDataPath(in.readUTF());
+      boolean isEmptyMetaDataPath = in.readBoolean();
+      if (isEmptyMetaDataPath == false)
+         setMetaDataPath((List<String>)in.readObject());
       setClassPath((List) in.readObject());
       setRelativeOrder(in.readInt());
       boolean isNullComparator = in.readBoolean();
@@ -276,11 +311,11 @@
    {
       super.writeExternal(out);
       out.writeUTF(getPath());
-      String metaDataPath = getMetaDataPath();
-      boolean isNullMetaDataPath = (metaDataPath == null);
-      out.writeBoolean(isNullMetaDataPath);
-      if (isNullMetaDataPath == false)
-         out.writeUTF(metaDataPath);
+      List<String> metaDataPath = getMetaDataPath();
+      boolean isEmptyMetaDataPath = metaDataPath.isEmpty();
+      out.writeBoolean(isEmptyMetaDataPath);
+      if (isEmptyMetaDataPath == false)
+         out.writeObject(metaDataPath);
       out.writeObject(getClassPath());
       out.writeInt(getRelativeOrder());
       String comparator = getComparatorClassName();

Modified: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -56,6 +56,11 @@
       return new ContextInfoImpl(path, metaDataPath, classPath);
    }
    
+   protected ContextInfo newContextInfo(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      return new ContextInfoImpl(path, metaDataPath, classPath);
+   }
+
    protected ClassPathEntry newClassPathEntry(String path, String suffixes)
    {
       return new ClassPathEntryImpl(path, suffixes);

Modified: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -105,18 +105,26 @@
    
    protected abstract ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath);
 
+   protected abstract ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath);
+
+   protected static void assertDefaultMetaDataPath(List<String> metaDataPath)
+   {
+      assertEquals(1, metaDataPath.size());
+      assertEquals("metaDataPath", metaDataPath.get(0));
+   }
+
    public void testConstructorPathAndMetaDataAndClassPath()
    {
       List<ClassPathEntry> classPath = createClassPath("ClassPath");
       ContextInfo context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertEquals(classPath, context.getClassPath());
 
       classPath = null;
       context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertNull(context.getClassPath());
    }
    
@@ -135,7 +143,7 @@
 
       try
       {
-         createPathAndMetaDataAndClassPath("path", null, classPath);
+         createPathAndMetaDataAndClassPath("path", (String)null, classPath);
          fail("Should not be here");
       }
       catch (Exception e)
@@ -236,12 +244,12 @@
       List<ClassPathEntry> classPath = createClassPath("ClassPath");
       context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertEquals(classPath, context.getClassPath());
 
       context = serializeDeserialize(context, ContextInfo.class);
       assertEquals("path", context.getPath());
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertEquals(classPath, context.getClassPath());
    }
 }

Modified: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -61,7 +61,9 @@
 
    protected static void assertDefaultMetaDataPath(ContextInfo contextInfo)
    {
-      assertNull(contextInfo.getMetaDataPath());
+      assertNotNull(contextInfo);
+      assertNotNull(contextInfo.getMetaDataPath());
+      assertTrue(contextInfo.getMetaDataPath().isEmpty());
    }
    
    protected static void assertDefaultClassPath(List<ClassPathEntry> classPath)

Modified: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -22,14 +22,14 @@
 package org.jboss.test.deployers.structure.test;
 
 import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.jboss.deployers.plugins.attachments.AttachmentsImpl;
 import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
 import org.jboss.deployers.plugins.structure.ContextInfoImpl;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.test.deployers.structure.AbstractContextInfoTest;
@@ -77,6 +77,12 @@
    }
 
    @Override
+   protected ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      return new ContextInfoImpl(path, metaDataPath, classPath);
+   }
+
+   @Override
    protected ClassPathEntry createClassPathEntry(String path)
    {
       return new ClassPathEntryImpl(path);
@@ -114,21 +120,35 @@
       }
    }
    
-   public void testSetMetaDataPath()
+   public void testAddMetaDataPath()
    {
       ContextInfoImpl context = createDefault();
       assertEquals("", context.getPath());
       assertDefaultNonPath(context);
       
-      context.setMetaDataPath("metaDataPath");
-      assertEquals("metaDataPath", context.getMetaDataPath());
+      context.addMetaDataPath("metaDataPath");
+      assertDefaultMetaDataPath(context.getMetaDataPath());
       assertDefaultClassPath(context.getClassPath());
 
-      context.setMetaDataPath("changed");
-      assertEquals("changed", context.getMetaDataPath());
+      context.addMetaDataPath("added");
+      assertEquals(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
       assertDefaultClassPath(context.getClassPath());
    }
    
+   public void testAddToDefaultMetaDataPath()
+   {
+      List<ClassPathEntry> classPath = new ArrayList<ClassPathEntry>();
+      classPath.add(new ClassPathEntryImpl());
+      ContextInfo context = createPathAndMetaDataAndClassPath("", "metaDataPath", classPath);
+      assertEquals("", context.getPath());
+      assertDefaultMetaDataPath(context.getMetaDataPath());
+      assertDefaultClassPath(context.getClassPath());
+
+      context.addMetaDataPath("added");
+      assertEquals(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
+      assertDefaultClassPath(context.getClassPath());
+   }
+
    public void testSetMetaDataPathErrors()
    {
       ContextInfoImpl context = createDefault();
@@ -137,7 +157,7 @@
 
       try
       {
-         context.setMetaDataPath(null);
+         context.addMetaDataPath(null);
          fail("Should not be here!");
       }
       catch (Exception e)

Modified: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -25,7 +25,6 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
@@ -74,6 +73,12 @@
    }
 
    @Override
+   protected ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      return StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+   }
+
+   @Override
    protected ClassPathEntry createClassPathEntry(String path)
    {
       return StructureMetaDataFactory.createClassPathEntry(path);

Modified: projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java
===================================================================
--- projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -31,6 +31,7 @@
  *  
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
+ * @author ales.justin at jboss.org
  * @version $Revision: 1.1$
  */
 public interface ContextInfo extends PredeterminedManagedObjectAttachments, Serializable
@@ -50,9 +51,17 @@
     * 
     * @return the path of the metdata location.
     */
-   String getMetaDataPath();
+   List<String> getMetaDataPath();
 
    /**
+    * Add the metaDataPath.
+    *
+    * @param path the metaDataPath.
+    * @throws IllegalArgumentException for a null path
+    */
+   void addMetaDataPath(String path);
+
+   /**
     * Get the classpath locations within the context
     * 
     * @return the possibly null context classpath

Modified: projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -92,6 +92,20 @@
    }
 
    /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPath 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, List<String> metaDataPath, List<ClassPathEntry> classPath)
+   {
+      return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPath, classPath);
+   }
+
+   /**
     * Create a new classpath entry
     * 
     * @return the classpath entry
@@ -164,6 +178,17 @@
    protected abstract ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath);
    
    /**
+    * Create a new ContextInfo.
+    *
+    * @param path the path
+    * @param metaDataPath the metadata path
+    * @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> metaDataPath, List<ClassPathEntry> classPath);
+
+   /**
     * Create a new classpath entry
     * 
     * @param path the path

Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -45,10 +45,12 @@
 import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
 import org.jboss.metatype.api.types.ArrayMetaType;
 import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.values.ArrayValue;
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.SimpleValue;
 import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.CollectionValue;
 
 /**
  * Mock profile service for testing implementation details.
@@ -230,6 +232,22 @@
                }
             }
          }
+         else if (propType.isCollection())
+         {
+            CollectionMetaType amt = (CollectionMetaType) propType;
+            MetaType etype = amt.getElementType();
+            if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
+            {
+               CollectionValue avalue = (CollectionValue) prop.getValue();
+               MetaValue[] elements = avalue.getElements();
+               for(int n = 0; n < avalue.getSize(); n ++)
+               {
+                  GenericValue gv = (GenericValue) elements[n];
+                  ManagedObject propMO = (ManagedObject) gv.getValue();
+                  processManagedObject(propMO, md);
+               }
+            }
+         }
       }
    }
 

Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -22,14 +22,13 @@
 package org.jboss.test.deployers.managed.test;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.spi.attachments.MutableAttachments;
@@ -37,10 +36,10 @@
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
 import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
-import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.types.MetaType;
 import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.CollectionValue;
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.test.deployers.AbstractDeployerTest;
@@ -165,15 +164,15 @@
       ManagedProperty deployments = propsMap.get("deployments");
       assertNotNull(deployments);
       assertEquals("The DS connection factories", deployments.getDescription());
-      MetaType deploymentsType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+      MetaType deploymentsType = new CollectionMetaType(List.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
       assertEquals(deploymentsType, deployments.getMetaType());
-      ArrayValue value = ArrayValue.class.cast(deployments.getValue());
-      ArrayMetaType valueType = value.getMetaType();
+      CollectionValue value = CollectionValue.class.cast(deployments.getValue());
+      CollectionMetaType valueType = value.getMetaType();
       assertEquals(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, valueType.getElementType());
 
-      assertEquals(1, value.getLength());
+      assertEquals(1, value.getSize());
       // Validate the ConnMetaData ManagedObject
-      GenericValue localConnMOGV = GenericValue.class.cast(value.getValue(0));
+      GenericValue localConnMOGV = GenericValue.class.cast(value.getElements()[0]);
       ManagedObject localConnMO = ManagedObject.class.cast(localConnMOGV.getValue());
       assertEquals(ConnMetaData.class.getName(), localConnMO.getName());
       propsMap = localConnMO.getProperties();
@@ -216,13 +215,13 @@
       ManagedProperty dsDeployments = propsMap.get("deployments");
       assertNotNull(deployments);
       assertEquals("The DS connection factories", dsDeployments.getDescription());
-      MetaType deploymentsType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+      MetaType deploymentsType = new CollectionMetaType(List.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
       assertEquals(deploymentsType, dsDeployments.getMetaType());
-      ArrayValue value = ArrayValue.class.cast(dsDeployments.getValue());
-      ArrayMetaType valueType = value.getMetaType();
+      CollectionValue value = CollectionValue.class.cast(dsDeployments.getValue());
+      CollectionMetaType valueType = value.getMetaType();
       assertEquals(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, valueType.getElementType());
 
-      assertEquals(2, value.getLength());
+      assertEquals(2, value.getSize());
       ManagedObject localConnMO = null;
       ManagedObject xaConnMO = null;
       for(Object md : value)

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -38,5 +38,4 @@
    {
       return new AbstractVFSDeployment(root);
    }
-
 }

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -26,6 +26,7 @@
 import java.io.ObjectOutput;
 import java.util.Collections;
 import java.util.List;
+import java.util.ArrayList;
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
@@ -52,8 +53,8 @@
    /** The root virtual file */
    private VirtualFile root;
    
-   /** The meta data location */
-   private VirtualFile metaDataLocation;
+   /** The meta data locations */
+   private List<VirtualFile> metaDataLocations;
    
    /** The class paths */
    private List<VirtualFile> classPath;
@@ -105,28 +106,43 @@
       return root;
    }
    
-   public void setMetaDataPath(String path)
+   public void setMetaDataPath(List<String> paths)
    {
-      if (path == null)
-         setMetaDataLocation(null);
+      if (paths == null)
+      {
+         setMetaDataLocations(null);
+         return;
+      }
+
       try
       {
-         setMetaDataLocation(root.findChild(path));
+         List<VirtualFile> locations = new ArrayList<VirtualFile>();
+         for (String path : paths)
+         {
+            if (path == null)
+               throw new IllegalArgumentException("Null path in paths: " + paths);
+
+            locations.add(root.findChild(path));
+         }
+         setMetaDataLocations(locations);
       }
       catch (IOException e)
       {
-         log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
+         log.debug("Meta data path does not exist: root=" + root.getPathName() + " paths=" + paths);
       }
    }
 
-   public VirtualFile getMetaDataLocation()
+   public List<VirtualFile> getMetaDataLocations()
    {
-      return metaDataLocation;
+      if (metaDataLocations == null)
+         return Collections.emptyList();
+      
+      return metaDataLocations;
    }
 
-   public void setMetaDataLocation(VirtualFile location)
+   public void setMetaDataLocations(List<VirtualFile> locations)
    {
-      this.metaDataLocation = location;
+      this.metaDataLocations = locations;
    }
    
    public VirtualFile getMetaDataFile(String name)
@@ -135,8 +151,8 @@
          throw new IllegalArgumentException("Null name");
       try
       {
-         // There isn't a metadata location so let's see whether the root matches.
-         if (metaDataLocation == null)
+         // 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))
@@ -149,14 +165,8 @@
             // No match
             return null;
          }
-         // Look in the meta data location
-         VirtualFile result = metaDataLocation.findChild(name);
-         if (result != null)
-         {
-            log.trace("Found " + name + " in " + metaDataLocation.getName());
-            deployed();
-         }
-         return result;
+         // Look in the meta data locations
+         return searchMetaDataLocations(name);
       }
       catch (Exception e)
       {
@@ -165,6 +175,35 @@
       }
    }
 
+   /**
+    * Search the metadata locations.
+    * In this impl the first one matching is returned.
+    *
+    * @param name the file name to find
+    * @return found file or null if not found
+    */
+   protected VirtualFile searchMetaDataLocations(String name)
+   {
+      VirtualFile result = null;
+      for(VirtualFile location : getMetaDataLocations())
+      {
+         try
+         {
+            result = location.findChild(name);
+            if (result != null)
+            {
+               log.trace("Found " + name + " in " + location.getName());
+               deployed();
+               break;
+            }
+         }
+         catch (IOException ignored)
+         {
+         }
+      }
+      return result;
+   }
+
    public List<VirtualFile> getMetaDataFiles(String name, String suffix)
    {
       if (name == null && suffix == null)
@@ -173,7 +212,7 @@
       {
          // There isn't a metadata location so let's see whether the root matches.
          // i.e. the top level is an xml
-         if (metaDataLocation == null)
+         if (metaDataLocations == null || metaDataLocations.isEmpty())
          {
             // It has to be a plain file
             if (root != null && SecurityActions.isLeaf(root))
@@ -189,13 +228,18 @@
             return Collections.emptyList();
          }
          // Look in the meta data location
-         List<VirtualFile> result = metaDataLocation.getChildren(new MetaDataMatchFilter(name, suffix));
-         if (result != null && result.isEmpty() == false)
+         List<VirtualFile> results = new ArrayList<VirtualFile>();
+         for (VirtualFile location : metaDataLocations)
          {
-            log.trace("Found " + name + " in " + metaDataLocation.getName());
-            deployed();
+            List<VirtualFile> result = location.getChildren(new MetaDataMatchFilter(name, suffix));
+            if (result != null && result.isEmpty() == false)
+            {
+               log.trace("Found " + name + " in " + location.getName());
+               results.addAll(result);
+               deployed();
+            }
          }
-         return result;
+         return results;
       }
       catch (Exception e)
       {
@@ -247,7 +291,9 @@
    {
       super.readExternal(in);
       root = (VirtualFile) in.readObject();
-      metaDataLocation = (VirtualFile) in.readObject();
+      boolean isNullOrEmpty = in.readBoolean();
+      if (isNullOrEmpty == false)
+         metaDataLocations = (List<VirtualFile>) in.readObject();
       classPath = (List) in.readObject();
    }
 
@@ -262,7 +308,10 @@
    {
       super.writeExternal(out);
       out.writeObject(root);
-      out.writeObject(metaDataLocation);
+      boolean isNullOrEmpty = metaDataLocations == null || metaDataLocations.isEmpty();
+      out.writeBoolean(isNullOrEmpty);
+      if (isNullOrEmpty == false)
+         out.writeObject(metaDataLocations);
       out.writeObject(classPath);
    }
 }

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -25,6 +25,7 @@
 import java.util.HashSet;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.List;
 
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.spi.DeploymentException;
@@ -148,8 +149,8 @@
          
          // Create the context in the parent structure
          ContextInfo parentContext;
-         String metaDataPath = recognised.getMetaDataPath();
-         if (metaDataPath == null)
+         List<String> metaDataPath = recognised.getMetaDataPath();
+         if (metaDataPath == null || metaDataPath.isEmpty())
             parentContext = StructureMetaDataFactory.createContextInfo(relativePath, recognised.getClassPath());
          else
             parentContext = StructureMetaDataFactory.createContextInfo(relativePath, metaDataPath, recognised.getClassPath());

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -90,8 +90,8 @@
          log.trace("Apply context: " + context.getName() + " " + contextInfo);
          
          VFSDeploymentContext vfsContext = (VFSDeploymentContext) context;
-         String metaDataPath = contextInfo.getMetaDataPath();
-         if (metaDataPath != null)
+         List<String> metaDataPath = contextInfo.getMetaDataPath();
+         if (metaDataPath != null && metaDataPath.isEmpty() == false)
             vfsContext.setMetaDataPath(contextInfo.getMetaDataPath());
          
          boolean classPathHadVF = false;

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -22,6 +22,7 @@
 package org.jboss.deployers.vfs.plugins.structure.explicit;
 
 import java.util.ArrayList;
+import java.util.LinkedHashSet;
 
 import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
 import org.jboss.deployers.plugins.structure.ContextInfoImpl;
@@ -41,7 +42,7 @@
 {
    public StructureMetaDataImpl newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
-      StructureMetaDataImpl metaData = null;
+      StructureMetaDataImpl metaData;
       if (root != null)
          metaData = (StructureMetaDataImpl) root;
       else
@@ -66,24 +67,34 @@
    public Object newChild(ContextInfoImpl parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
       Object child = null;
-      if (localName.equals("classpath"))
-         child = new ArrayList<ClassPathEntry>();
-      else if (localName.equals("path"))
+      if("path".equals(localName))
       {
          String path = attrs.getValue("name");
          parent.setPath(path);
       }
-      else if (localName.equals("metaDataPath"))
+      else if ("metaDataPath".equals(localName))
+         child = new LinkedHashSet<String>();
+      else if (localName.equals("classpath"))
+         child = new ArrayList<ClassPathEntry>();
+
+      return child;
+   }
+
+   public Object newChild(LinkedHashSet<String> parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if("path".equals(localName))
       {
          String path = attrs.getValue("name");
-         parent.setMetaDataPath(path);
+         parent.add(path);
       }
       return child;
    }
+
    public Object newChild(ArrayList<ClassPathEntry> parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
       Object child = null;
-      if( localName.equals("path") )
+      if("path".equals(localName))
       {
          String name = attrs.getValue("name");
          String suffixes = attrs.getValue("suffixes");
@@ -98,6 +109,11 @@
       parent.addContext(context);
    }
    
+   public void addChild(ContextInfoImpl context, LinkedHashSet<String> metaDataPath, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      context.setMetaDataPath(new ArrayList<String>(metaDataPath));
+   }
+
    public void addChild(ContextInfoImpl context, ArrayList<ClassPathEntry> classpath, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       context.setClassPath(classpath);

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/scripts/myscript.bsh
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/scripts/myscript.bsh	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/scripts/myscript.bsh	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,2 @@
+type=bsh
+name=myscript

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/security-config.xml
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/security-config.xml	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/jmx/interceptors/security-config.xml	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,3 @@
+<config>
+   <security/>
+</config>
\ No newline at end of file

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/root.bsh
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/root.bsh	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/nonmetadata/nmd.jar/root.bsh	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,2 @@
+type=bsh
+name=root

Modified: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/explicit/complex.deployer/META-INF/jboss-structure.xml
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/explicit/complex.deployer/META-INF/jboss-structure.xml	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/explicit/complex.deployer/META-INF/jboss-structure.xml	2007-12-18 01:08:04 UTC (rev 68355)
@@ -1,19 +1,25 @@
 <structure>
 	<context>
 		<path name=""/>
-		<metaDataPath name="META-INF"/>
-		<classpath>
+		<metaDataPath>
+         <path name="META-INF"/>
+      </metaDataPath>
+      <classpath>
 			<path name="jar1.jar"/>
 			<path name="lib-dir" suffixes=".jar"/>
 		</classpath>
 	</context>
 	<context>
 		<path name="sub.jar"/>
-		<metaDataPath name="META-INF" />
+      <metaDataPath>
+         <path name="META-INF"/>
+      </metaDataPath>
 	</context>
 	<context>
 		<path name="x.war"/>
-		<metaDataPath name="WEB-INF"/>
+      <metaDataPath>
+         <path name="WEB-INF"/>
+      </metaDataPath>
 		<classpath>
 			<path name="x.war/WEB-INF/classes"/>
 			<path name="x.war/WEB-INF/lib" suffixes=".jar"/>

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/META-INF/jboss-structure.xml
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/META-INF/jboss-structure.xml	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/META-INF/jboss-structure.xml	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,19 @@
+<structure>
+	<context>
+		<path name=""/>
+		<metaDataPath>
+         <path name="META-INF"/>
+         <path name="jmx/interceptors"/>
+         <path name="jmx/interceptors/scripts"/>
+      </metaDataPath>
+      <classpath>
+			<path name="jar1.jar"/>
+		</classpath>
+	</context>
+   <context>
+      <path name="jar1.jar"/>
+      <metaDataPath>
+         <path name="META-INF"/>
+      </metaDataPath>
+   </context>
+</structure>

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/empty.jar/empty
===================================================================

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jar1.jar/META-INF/MANIFEST.MF
===================================================================

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/scripts/myscript.bsh
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/scripts/myscript.bsh	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/scripts/myscript.bsh	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,2 @@
+type=bsh
+name=myscript

Added: projects/microcontainer/trunk/deployers-vfs/src/resources/tests/structure/multiple/metadata.deployer/jmx/interceptors/security-config.xml
===================================================================

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/DeployersVFSTestSuite.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -27,6 +27,7 @@
 
 import org.jboss.test.deployers.vfs.deployer.bean.BeanDeployerTestSuite;
 import org.jboss.test.deployers.vfs.deployer.jaxp.VFSDeployerTestSuite;
+import org.jboss.test.deployers.vfs.deployer.nonmetadata.NonMetadataDeployersTestSuite;
 import org.jboss.test.deployers.vfs.deploymentfactory.VFSDeploymentFactoryTestSuite;
 import org.jboss.test.deployers.vfs.metadata.VFSMetaDataTestSuite;
 import org.jboss.test.deployers.vfs.structure.VFSStructureTestSuite;
@@ -57,6 +58,7 @@
       suite.addTest(VFSDeployerTestSuite.suite());
       suite.addTest(BeanDeployerTestSuite.suite());
       suite.addTest(VFSManagedTestSuite.suite());
+      suite.addTest(NonMetadataDeployersTestSuite.suite());
 
       return suite;
    }

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BeanManagedDeploymentUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BeanManagedDeploymentUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BeanManagedDeploymentUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -33,8 +33,7 @@
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.metatype.api.types.ArrayMetaType;
-import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.values.CollectionValue;
 import org.jboss.metatype.api.values.GenericValue;
 
@@ -77,10 +76,10 @@
       log.info("KernelDeployment.ManagedProperties: "+kdMO.getProperties());
       ManagedProperty beanFactories = kdMO.getProperty("beanFactories");
       assertNotNull(beanFactories);
-      ArrayValue beanFactoriesAV = ArrayValue.class.cast(beanFactories.getValue());
-      ArrayMetaType valueType = beanFactoriesAV.getMetaType();
-      assertEquals("BeanFactories size", 2, beanFactoriesAV.getLength());
-      GenericValue beanFactoriesGV = (GenericValue) beanFactoriesAV.getValue(0);
+      CollectionValue beanFactoriesAV = CollectionValue.class.cast(beanFactories.getValue());
+      CollectionMetaType valueType = beanFactoriesAV.getMetaType();
+      assertEquals("BeanFactories size", 2, beanFactoriesAV.getSize());
+      GenericValue beanFactoriesGV = (GenericValue) beanFactoriesAV.getElements()[0];
       log.info("BeanFactories[0].GV: "+beanFactoriesGV);
       ManagedObject beanFactoriesMO = (ManagedObject) beanFactoriesGV.getValue();
       assertNotNull(beanFactoriesMO);

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -24,6 +24,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.Collections;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -80,7 +81,7 @@
    public void testExactMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       String expected = getVfsURL("/metadata/toplevel/metadata.jar/META-INF/jboss-service.xml");
       assertMetaDataMatch(context, expected, "jboss-service.xml");
    }
@@ -88,28 +89,28 @@
    public void testNotExactMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "not-correct.xml");
    }
 
    public void testExactMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "jboss-service.xml");
    }
 
    public void testNotExactMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "not-correct.xml");
    }
 
    public void testPartialMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       Set<String> expected = new HashSet<String>();
       expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/1-ds.xml"));
       expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/2-ds.xml"));
@@ -119,28 +120,28 @@
    public void testNotPartialMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, null, "-not.xml");
    }
 
    public void testPartialMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, null, "-ds.xml");
    }
 
    public void testNotPartialMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, null, "-not.xml");
    }
 
    public void testExactAndPartialMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       Set<String> expected = new HashSet<String>();
       expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/jboss-service.xml"));
       expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/1-ds.xml"));
@@ -151,21 +152,21 @@
    public void testNotExactAndPartialMatchMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "not-correct.xml", "-not.xml");
    }
 
    public void testExactAndPartialMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "jboss-service.xml", "-ds.xml");
    }
 
    public void testNotExactAndPartialMatchNoMetaInf() throws Exception
    {
       VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
-      context.setMetaDataPath("META-INF");
+      context.setMetaDataPath(Collections.singletonList("META-INF"));
       assertNoMetaDataMatch(context, "jboss-service.xml", "-not.xml");
    }
    

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -108,11 +108,26 @@
    protected void assertMetaData(VFSDeploymentContext context, String metaDataPath) throws Exception
    {
       VirtualFile root = context.getRoot();
-      VirtualFile metaDataLocation = context.getMetaDataLocation();
+      List<VirtualFile> metaDataLocation = context.getMetaDataLocations();
       VirtualFile expected = root.findChild(metaDataPath);
-      assertEquals(expected, metaDataLocation);
+      assertNotNull(metaDataLocation);
+      assertEquals(1, metaDataLocation.size());
+      assertEquals(expected, metaDataLocation.get(0));
    }
    
+   protected void assertMetaDatas(VFSDeploymentContext context, String... metaDataPath) throws Exception
+   {
+      VirtualFile root = context.getRoot();
+      List<VirtualFile> metaDataLocations = context.getMetaDataLocations();
+      assertNotNull(metaDataLocations);
+      int i = 0;
+      for(String path : metaDataPath)
+      {
+         VirtualFile expected = root.findChild(path);
+         assertEquals(expected, metaDataLocations.get(i++));
+      }
+   }
+
    protected VFSDeploymentContext assertChildContext(VFSDeploymentContext context, String name) throws Exception
    {
       List<DeploymentContext> children = context.getChildren();

Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/MultipleMetadataStructureUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/MultipleMetadataStructureUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/MultipleMetadataStructureUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -0,0 +1,85 @@
+/*
+* 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.structure.explicit.test;
+
+import java.util.List;
+
+import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
+import org.jboss.virtual.VirtualFile;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * MultipleMetadataStructure deployer unit tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MultipleMetadataStructureUnitTestCase extends AbstractStructureTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(MultipleMetadataStructureUnitTestCase.class);
+   }
+
+   public MultipleMetadataStructureUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      enableTrace("org.jboss.deployers");
+   }
+
+   protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
+   {
+      return determineStructureWithStructureDeployers(deployment, new DeclaredStructure(), new JARStructure(), new FileStructure());
+   }
+
+   public void testMultipleMetadata() throws Throwable
+   {
+      VFSDeploymentContext root = assertDeploy("/structure/multiple", "metadata.deployer");
+      assertChildContexts(root, "jar1.jar");
+
+      // Validate the root context info
+      assertMetaDatas(root, "META-INF", "jmx/interceptors", "jmx/interceptors/scripts");
+      assertClassPath(root, "jar1.jar");
+
+      VirtualFile bsh = root.getMetaDataFile("myscript.bsh");
+      assertNotNull(bsh);
+      List<VirtualFile> bshs = root.getMetaDataFiles(null, ".bsh");
+      assertNotNull(bshs);
+      assertEquals(1, bshs.size());
+      VirtualFile security = root.getMetaDataFile("security-config.xml");
+      assertNotNull(security);
+      List<VirtualFile> cfgs = root.getMetaDataFiles(null, "-config.xml");
+      assertNotNull(cfgs);
+      assertEquals(1, cfgs.size());
+   }
+}

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -107,16 +107,19 @@
    
    protected void checkMetaDataLocation(VFSDeploymentContext context, ContextInfo contextInfo) throws Exception
    {
-      String metaDataPath = contextInfo.getMetaDataPath();
-      VirtualFile metaDataLocation = context.getMetaDataLocation();
+      List<String> metaDataPaths = contextInfo.getMetaDataPath();
+      assertNotNull(metaDataPaths);
+      List<VirtualFile> metaDataLocations = context.getMetaDataLocations();
+      assertNotNull(metaDataLocations);
 
-      if (metaDataPath == null)
-         assertNull(metaDataLocation);
+      if (metaDataPaths.isEmpty())
+         assertEmpty(metaDataLocations);
       else
       {
          VirtualFile root = context.getRoot();
-         VirtualFile expected = root.findChild(metaDataPath);
-         assertEquals(expected, metaDataLocation);
+         VirtualFile expected = root.findChild(metaDataPaths.get(0));
+         assertEquals(1, metaDataLocations.size());
+         assertEquals(expected, metaDataLocations.get(0));
       }
    }
    

Modified: projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -44,23 +44,23 @@
    /**
     * Set the meta data path relative to the root
     * 
-    * @param path the path
+    * @param paths the path
     */
-   void setMetaDataPath(String path);
+   void setMetaDataPath(List<String> paths);
 
    /**
-    * Get the meta data location
+    * Get the meta data locations
     * 
-    * @return the meta data location
+    * @return the meta data locations
     */
-   VirtualFile getMetaDataLocation();
+   List<VirtualFile> getMetaDataLocations();
    
    /**
-    * Set the meta data location
+    * Set the meta data locations
     * 
-    * @param location the meta data location
+    * @param locations the meta data location
     */
-   void setMetaDataLocation(VirtualFile location);
+   void setMetaDataLocations(List<VirtualFile> locations);
    
    /**
     * Gets a metadata file

Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java	2007-12-18 00:01:45 UTC (rev 68354)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java	2007-12-18 01:08:04 UTC (rev 68355)
@@ -32,6 +32,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
@@ -73,10 +74,12 @@
 import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
 import org.jboss.managed.spi.factory.RuntimeComponentNameTransformer;
 import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.types.GenericMetaType;
 import org.jboss.metatype.api.types.MetaType;
 import org.jboss.metatype.api.types.MetaTypeFactory;
 import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.CollectionValueSupport;
 import org.jboss.metatype.api.values.GenericValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
@@ -415,8 +418,10 @@
                if (managed)
                {
                   TypeInfo typeInfo = propertyInfo.getType();
-                  if( typeInfo.isArray() || typeInfo.isCollection() )
+                  if(typeInfo.isArray())
                      metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
+                  else if (typeInfo.isCollection())
+                     metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
                   else
                      metaType = MANAGED_OBJECT_META_TYPE;
                }
@@ -721,19 +726,35 @@
             // todo - AJ: changed some generics by best guess
             ArrayMetaType<GenericValueSupport> moType = new ArrayMetaType<GenericValueSupport>(1, MANAGED_OBJECT_META_TYPE);
             ArrayValueSupport<GenericValueSupport> moArrayValue = new ArrayValueSupport<GenericValueSupport>(moType);
-            ArrayList<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
+            List<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
             for(Object element : cvalue)
             {
                ManagedObject mo = initManagedObject((Serializable) element, null, null);
                tmp.add(new GenericValueSupport(MANAGED_OBJECT_META_TYPE, mo));
             }
             GenericValueSupport[] mos = new GenericValueSupport[tmp.size()];
-            tmp.toArray(mos);
-            moArrayValue.setValue(mos);
+            moArrayValue.setValue(tmp.toArray(mos));
             return moArrayValue;
          }
       }
-      
+      else if (propertyType.isCollection())
+      {
+         CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
+         if (MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
+         {
+            Collection cvalue = getAsCollection(value);
+            List<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
+            for(Object element : cvalue)
+            {
+               ManagedObject mo = initManagedObject((Serializable) element, null, null);
+               tmp.add(new GenericValueSupport(MANAGED_OBJECT_META_TYPE, mo));
+            }
+            GenericValueSupport[] mos = new GenericValueSupport[tmp.size()];
+            CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), MANAGED_OBJECT_META_TYPE);
+            return new CollectionValueSupport(moType, tmp.toArray(mos));
+         }
+      }
+
       return metaValueFactory.create(value, propertyInfo.getType());
    }
 




More information about the jboss-cvs-commits mailing list