[jboss-cvs] JBossAS SVN: r63684 - in projects/microcontainer/trunk: deployers-structure-spi and 21 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 27 11:58:38 EDT 2007


Author: adrian at jboss.org
Date: 2007-06-27 11:58:37 -0400 (Wed, 27 Jun 2007)
New Revision: 63684

Added:
   projects/microcontainer/trunk/deployers-structure-spi/
   projects/microcontainer/trunk/deployers-structure-spi/.classpath
   projects/microcontainer/trunk/deployers-structure-spi/.project
   projects/microcontainer/trunk/deployers-structure-spi/pom.xml
   projects/microcontainer/trunk/deployers-structure-spi/src/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/ClassLoaderFactory.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContext.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContextVisitor.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentResourceLoader.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentUnit.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructuralDeployers.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructureBuilder.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Capability.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ClassLoaderMetaData.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ExportAll.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ModuleCapability.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/PackageCapability.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequireModule.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequirePackage.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Requirement.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/DeploymentResourceClassLoader.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/EmptyResourceLoader.java
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/main/
   projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/main/MainDeployerStructure.java
   projects/microcontainer/trunk/deployers-structure-spi/src/resources/
   projects/microcontainer/trunk/deployers-structure-spi/src/resources/tests/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientAttachmentsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientManagedObjectsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientAttachmentsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/AbstractStructureBuilderTest.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTest.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTestSuite.java
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/test/
   projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/test/AbstractStructureBuilderUnitTestCase.java
Log:
Import refactored deployers code

Added: projects/microcontainer/trunk/deployers-structure-spi/.classpath
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/.classpath	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/.classpath	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main"/>
+	<classpathentry kind="src" path="src/tests"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT-sources.jar"/>
+	<classpathentry kind="src" path="/jboss-deployers-client-spi"/>
+	<classpathentry kind="src" path="/jboss-deployers-core-spi"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jboss-deployers-core"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jboss-deployers-client"/>
+	<classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>

Added: projects/microcontainer/trunk/deployers-structure-spi/.project
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/.project	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/.project	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-deployers-structure-spi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: projects/microcontainer/trunk/deployers-structure-spi/pom.xml
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/pom.xml	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/pom.xml	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,65 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>jboss</groupId>
+    <artifactId>jboss-microcontainer</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jboss-deployers-structure-spi</artifactId>
+  <packaging>jar</packaging>
+  <name>JBoss Deployers Structure SPI</name>
+  <url>http://www.jboss.com/products/jbossmc</url>
+  <description>JBoss Deployers Structure SPI</description>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>	   	   
+    </plugins>
+  </build>
+  <dependencies>
+    <!-- Global dependencies -->
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-deployers-client-spi</artifactId>
+    </dependency>
+	  <!-- Test dependencies -->
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.0.4-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+	    <groupId>junit</groupId>
+	    <artifactId>junit</artifactId>
+	    <version>3.8.1</version>
+	    <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-deployers-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-deployers-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jboss</groupId>
+      <artifactId>jboss-deployers-client</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>  
+</project>

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/ClassLoaderFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/ClassLoaderFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/ClassLoaderFactory.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi;
+
+/**
+ * ClassLoaderFactory.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ClassLoaderFactory
+{
+   /**
+    * Create a classloader for this deployment
+    * 
+    * @param context the deployment context
+    * @return classloader or null if not created
+    * @throws Exception for any error
+    */
+   ClassLoader createClassLoader(DeploymentContext context) throws Exception;
+   
+   /**
+    * Remove a classloader for this deployment
+    * 
+    * @param context the deployment context
+    * @throws Exception for any error
+    */
+   void removeClassLoader(DeploymentContext context) throws Exception;
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContext.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContext.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,279 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.attachments.ManagedObjectsWithTransientAttachments;
+
+/**
+ * DeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 59630 $
+ */
+public interface DeploymentContext extends ManagedObjectsWithTransientAttachments
+{
+   /**
+    * Get the deployment name
+    * 
+    * @return the name
+    */
+   String getName();
+
+   /**
+    * Get the simple vfs name of the deployment unit. This is the simple
+    * name of the virtual file .
+    * 
+    * vfs path ------------------- relative path
+    * deploy/some.ear              "some.ear"
+    * deploy/some.ear/x.ejb        "x.ejb"
+    * deploy/some.ear/y.sar        "y.sar"
+    * deploy/some.ear/y.sar/z.rar  "z.rar"
+    * @return the deployment unit simple path
+    */
+   String getSimpleName();
+
+   /**
+    * Get the path of this deployment relative to the top of the deployment
+    * 
+    * vfs path ------------------- relative path
+    * deploy/some.ear              ""
+    * deploy/some.ear/x.ejb        "/x.ejb"
+    * deploy/some.ear/y.sar        "/y.sar"
+    * deploy/some.ear/y.sar/z.rar  "/y.sar/z.rar"
+    * 
+    * @return the top-level deployment relative path
+    */
+   String getRelativePath();
+
+   /**
+    * Get the deployment types associated with this deployment.
+    * @return set of deployment type names deployers have identified
+    * in this deployment.
+    */
+   Set<String> getTypes();
+   
+   /**
+    * Get the deployment state
+    * 
+    * @return the state
+    */
+   DeploymentState getState();
+   
+   /**
+    * Set the deployment state
+    * 
+    * @param state the state
+    */
+   void setState(DeploymentState state);
+
+   /**
+    * Get the deployment (if this is a top level context)
+    * 
+    * @return the deployment
+    */
+   Deployment getDeployment();
+   
+   /**
+    * Set the deployment
+    * 
+    * @param deployment the deployment
+    * @throws IllegalArgumentException for a null deployment
+    */
+   void setDeployment(Deployment deployment);
+
+   /**
+    * Get the deployment unit
+    * 
+    * @return the deployment
+    */
+   DeploymentUnit getDeploymentUnit();
+
+   /**
+    * Set the deployment unit
+    * 
+    * @param unit the deployment unit
+    */
+   void setDeploymentUnit(DeploymentUnit unit);
+   
+   /**
+    * Gets the classloader for this deployment unit
+    * 
+    * @return the classloader
+    */
+   ClassLoader getClassLoader();
+   
+   /**
+    * Set the class loader
+    * 
+    * @param classLoader the new classloader
+    */
+   void setClassLoader(ClassLoader classLoader);
+
+   /**
+    * Create a classloader
+    * 
+    * @param factory the factory
+    * @return false if there is already is a classloader
+    * @throws DeploymentException for any error
+    */
+   boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException;
+
+   /**
+    * Remove the classloader created by the factory
+    */
+   void removeClassLoader();
+
+   /**
+    * Whether this is a top level deployment
+    * 
+    * @return true when top level
+    */
+   boolean isTopLevel();
+   
+   /**
+    * Get the top level deployment
+    * 
+    * @return the top level deployment
+    */
+   DeploymentContext getTopLevel();
+   
+   /**
+    * The parent
+    * 
+    * @return the parent
+    */
+   DeploymentContext getParent();
+   
+   /**
+    * Set the parent
+    * 
+    * @param parent the parent
+    */
+   void setParent(DeploymentContext parent);
+   
+   /**
+    * The children
+    * 
+    * @return the children
+    */
+   List<DeploymentContext> getChildren();
+
+   /**
+    * Add a child
+    * 
+    * @param child the child to add
+    */
+   void addChild(DeploymentContext child);
+
+   /**
+    * Remove a child
+    * 
+    * @param child the child to remove
+    * @return whether it was removed
+    */
+   boolean removeChild(DeploymentContext child);
+   
+   /**
+    * Whether this is a component
+    * 
+    * @return true when a component
+    */
+   boolean isComponent();
+   
+   /**
+    * The components
+    * 
+    * @return the components
+    */
+   List<DeploymentContext> getComponents();
+
+   /**
+    * Add a component
+    * 
+    * @param component the componnet to add
+    */
+   void addComponent(DeploymentContext component);
+
+   /**
+    * Remove a component
+    * 
+    * @param component the component to remove
+    * @return whether it was removed
+    */
+   boolean removeComponent(DeploymentContext component);
+   
+   /**
+    * Get a resource loader
+    * 
+    * @return the resource loader
+    */
+   DeploymentResourceLoader getResourceLoader();
+   
+   /**
+    * Get a resource classloader
+    * 
+    * @return the resource classloader loader
+    */
+   ClassLoader getResourceClassLoader();
+
+   /**
+    * Visit the context and the children
+    * 
+    * @param visitor the visitor
+    * @throws DeploymentException for any error in the visitor
+    * @throws IllegalArgumentException for a null visitor
+    */
+   void visit(DeploymentContextVisitor visitor) throws DeploymentException;
+
+   /**
+    * Whether the deployment was processed
+    * 
+    * @return true when processed
+    */
+   boolean isDeployed();
+
+   /**
+    * Touch the context to say it is deployed
+    */
+   void deployed();
+   
+   /**
+    * Get the problem for this context
+    * 
+    * @return the problem
+    */
+   Throwable getProblem();
+
+   /**
+    * Set the problem for this context
+    * 
+    * @param problem the problem
+    */
+   void setProblem(Throwable problem);
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContextVisitor.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContextVisitor.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentContextVisitor.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi;
+
+import org.jboss.deployers.spi.DeploymentException;
+
+/**
+ * DeploymentContextVisitor.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentContextVisitor
+{
+   /**
+    * Visit a context
+    * 
+    * @param context the context
+    * @throws DeploymentException for any error
+    */
+   void visit(DeploymentContext context) throws DeploymentException;
+   
+   /**
+    * Invoked when there is a subsequent error in the visit
+    * 
+    * @param context the context
+    */
+   void error(DeploymentContext context);
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentResourceLoader.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentResourceLoader.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentResourceLoader.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * DeploymentResourceLoader.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentResourceLoader
+{
+   /**
+    * Get a resource
+    * 
+    * @param name the name of the resource
+    * @return the resource url
+    */
+   URL getResource(String name);
+   
+   /**
+    * Get resources
+    * 
+    * @param name the name of the resource
+    * @return the resource urls
+    * @throws IOException for any error
+    */
+   Enumeration<URL> getResources(String name) throws IOException;
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentUnit.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentUnit.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/DeploymentUnit.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,170 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+
+/**
+ * DeploymentUnit.<p>
+ * 
+ * A deployment unit represents a single unit
+ * that deployers work with.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentUnit extends MutableAttachments
+{
+   /**
+    * Get the deployment units name
+    * 
+    *  @return the name;
+    */
+   String getName();
+
+   /**
+    * Get the simple vfs name of the deployment unit. This is the simple
+    * name of the virtual file .
+    * 
+    * vfs path ------------------- simple name
+    * deploy/some.ear              "some.ear"
+    * deploy/some.ear/x.ejb        "x.ejb"
+    * deploy/some.ear/y.sar        "y.sar"
+    * deploy/some.ear/y.sar/z.rar  "z.rar"
+    * deploy/complexwithappxml.ear/module-mbean1.sar/submbean.sar submbean.sar
+    * @return the deployment unit simple path
+    */
+   String getSimpleName();
+
+   /**
+    * Get the path of this deployment relative to the top of the deployment
+    * 
+    * vfs path ------------------- relative path
+    * deploy/some.ear              ""
+    * deploy/some.ear/x.ejb        "/x.ejb"
+    * deploy/some.ear/y.sar        "/y.sar"
+    * deploy/some.ear/y.sar/z.rar  "/y.sar/z.rar"
+    * 
+    * @return the top-level deployment relative path
+    */
+   String getRelativePath();
+   
+   /**
+    * Get the deployment types associated with this deployment.
+    * 
+    * @return set of deployment type names deployers have identified
+    * in this deployment.
+    */
+   Set<String> getTypes();
+
+   /**
+    * Gets the classloader for this deployment unit
+    * 
+    * @return the classloader
+    */
+   ClassLoader getClassLoader();
+
+   /**
+    * Create the classloader
+    * 
+    * @param factory the classloader factory
+    * @return false if the classloader already exists
+    * @throws IllegalArgumentException for a null factory
+    * @throws DeploymentException for any error
+    */
+   boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException;
+   
+   /**
+    * Get all the metadata for the expected type
+    * 
+    * @param <T> the type to get
+    * @param type the type
+    * @return a set of metadata matching the type
+    * @throws IllegalArgumentException if the type is null 
+    */
+   <T> Set<? extends T> getAllMetaData(Class<T> type);
+
+   /**
+    * Get the transient managed objects
+    * 
+    * @return the managed objects
+    */
+   MutableAttachments getTransientManagedObjects();
+   
+   /**
+    * Get the top leve deployment unit
+    * 
+    * @return the top level deployment unit
+    */
+   DeploymentUnit getTopLevel();
+   
+   /**
+    * Get the parent deployment unit
+    * 
+    * @return the parent or null if there is no parent
+    */
+   DeploymentUnit getParent();
+   
+   /**
+    * Get the children
+    * 
+    * @return the children
+    */
+   List<DeploymentUnit> getChildren();
+   
+   /**
+    * Add a component
+    * 
+    * @param name the name
+    * @return the new deployment unit
+    * @throws IllegalArgumentException for a null name
+    */
+   DeploymentUnit addComponent(String name);
+   
+   /**
+    * Remove a component
+    * 
+    * @param name the name
+    * @return true when removed
+    * @throws IllegalArgumentException for a null name
+    */
+   boolean removeComponent(String name);
+   
+   /**
+    * Get a resource loader
+    * 
+    * @return the resource loader
+    */
+   DeploymentResourceLoader getResourceLoader();
+   
+   /**
+    * Get a resource classloader
+    * 
+    * @return the resource classloader loader
+    */
+   ClassLoader getResourceClassLoader();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructuralDeployers.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructuralDeployers.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructuralDeployers.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,43 @@
+/*
+ * 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.structure.spi;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+
+/**
+ * Determine the structure of a deployment
+ *  
+ * @author adrian at jboss.org
+ * @version $Revision: 1.1$
+ */
+public interface StructuralDeployers
+{
+   /**
+    * Determine the structure for a deployment
+    * 
+    * @param deployment the deployment
+    * @return the deployment context
+    * @throws DeploymentException for any error
+    */
+   DeploymentContext determineStructure(Deployment deployment) throws DeploymentException;
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructureBuilder.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructureBuilder.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/StructureBuilder.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,47 @@
+/*
+ * 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.structure.spi;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+
+/**
+ * A StructureBuilder transforms the StructureMetaData for a deployment info
+ * a DeploymentContext tree.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public interface StructureBuilder
+{
+   /**
+    * Create the tree
+    * 
+    * @param deployment the deployment
+    * @param metaData the metaData
+    * @return the deployment context
+    * @throws DeploymentException for any error
+    */
+   DeploymentContext populateContext(Deployment deployment, StructureMetaData metaData) throws DeploymentException;
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Capability.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Capability.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Capability.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+import org.jboss.deployers.structure.spi.DeploymentContext;
+
+/**
+ * Capability.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Capability
+{
+   /**
+    * Whether this capability resolves the requirement
+    * 
+    * @param context the deployment context
+    * @param requirement the requirement
+    * @throws IllegalArgumentException for a null requirement
+    * @return true when it is resolves the requirement
+    */
+   boolean resolves(DeploymentContext context, Requirement requirement);
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ClassLoaderMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ClassLoaderMetaData.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ClassLoaderMetaData.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,232 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * ClassLoaderMetaData.
+ * 
+ * TODO needs greatly expanding
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassLoaderMetaData implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -2782951093046585620L;
+
+   /** The name */
+   private String name;
+   
+   /** The version */
+   private Version version;
+   
+   /** The classloading domain */
+   private String domain;
+
+   /** The parent domain */
+   private String parentDomain;
+   
+   /** Whether to enforce j2se classloading compliance */
+   private boolean j2seClassLoadingCompliance;
+   
+   /** Whether to export all */
+   private ExportAll exportAll;
+   
+   /** The requirements */
+   private Set<Requirement> requirements;
+   
+   /** The capabilities */
+   private Set<Capability> capabilities;
+
+   /**
+    * Get the name.
+    * 
+    * @return the name.
+    */
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param name the name.
+    */
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   /**
+    * Get the version.
+    * 
+    * @return the version.
+    */
+   public Version getVersion()
+   {
+      return version;
+   }
+
+   /**
+    * Set the version.
+    * 
+    * @param version the version.
+    */
+   public void setVersion(Version version)
+   {
+      this.version = version;
+   }
+
+   /**
+    * Get the domain.
+    * 
+    * @return the domain.
+    */
+   public String getDomain()
+   {
+      return domain;
+   }
+
+   /**
+    * Set the domain.
+    * 
+    * @param domain the domain.
+    */
+   public void setDomain(String domain)
+   {
+      this.domain = domain;
+   }
+
+   /**
+    * Get the parentDomain.
+    * 
+    * @return the parentDomain.
+    */
+   public String getParentDomain()
+   {
+      return parentDomain;
+   }
+
+   /**
+    * Set the parentDomain.
+    * 
+    * @param parentDomain the parentDomain.
+    */
+   public void setParentDomain(String parentDomain)
+   {
+      this.parentDomain = parentDomain;
+   }
+
+   /**
+    * Get the exportAll.
+    * 
+    * @return the exportAll.
+    */
+   public ExportAll getExportAll()
+   {
+      return exportAll;
+   }
+
+   /**
+    * Set the exportAll.
+    * 
+    * @param exportAll the exportAll.
+    */
+   public void setExportAll(ExportAll exportAll)
+   {
+      this.exportAll = exportAll;
+   }
+
+   /**
+    * Get the j2seClassLoadingCompliance.
+    * 
+    * @return the j2seClassLoadingCompliance.
+    */
+   public boolean isJ2seClassLoadingCompliance()
+   {
+      return j2seClassLoadingCompliance;
+   }
+
+   /**
+    * Set the j2seClassLoadingCompliance.
+    * 
+    * @param classLoadingCompliance the j2seClassLoadingCompliance.
+    */
+   public void setJ2seClassLoadingCompliance(boolean classLoadingCompliance)
+   {
+      j2seClassLoadingCompliance = classLoadingCompliance;
+   }
+
+   /**
+    * Get the capabilities.
+    * 
+    * @return the capabilities.
+    */
+   public Set<Capability> getCapabilities()
+   {
+      return capabilities;
+   }
+
+   /**
+    * Set the capabilities.
+    * 
+    * @param capabilities the capabilities.
+    */
+   public void setCapabilities(Set<Capability> capabilities)
+   {
+      this.capabilities = capabilities;
+   }
+
+   /**
+    * Whether to import all
+    * 
+    * @return true when there are no requirements
+    */
+   public boolean isImportAll()
+   {
+      return requirements == null || requirements.isEmpty();
+   }
+   
+   /**
+    * Get the requirements.
+    * 
+    * @return the requirements.
+    */
+   public Set<Requirement> getRequirements()
+   {
+      return requirements;
+   }
+
+   /**
+    * Set the requirements.
+    * 
+    * @param requirements the requirements.
+    */
+   public void setRequirements(Set<Requirement> requirements)
+   {
+      this.requirements = requirements;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ExportAll.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ExportAll.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ExportAll.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * ExportAll.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public enum ExportAll
+{
+   /** All packages */
+   ALL,
+   
+   /** All non empty packages */
+   NON_EMPTY
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ModuleCapability.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ModuleCapability.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/ModuleCapability.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * ModuleCapability.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ModuleCapability extends Capability
+{
+   /**
+    * The name of the module
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * The version of the module 
+    * 
+    * @return the version
+    */
+   Version getVersion();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/PackageCapability.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/PackageCapability.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/PackageCapability.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * PackageCapability.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PackageCapability extends Capability
+{
+   /**
+    * Get the package name
+    * 
+    * @return the package name
+    */
+   String getPackageName();
+   
+   /**
+    * Get the package version
+    * 
+    * @return the version
+    */
+   Version getVersion();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequireModule.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequireModule.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequireModule.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * RequireModule.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface RequireModule extends Requirement
+{
+   /**
+    * The required module name
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * The version range
+    * 
+    * @return version range
+    */
+   VersionRange getVersionRange();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequirePackage.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequirePackage.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/RequirePackage.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * RequirePackage.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface RequirePackage extends Requirement
+{
+   /**
+    * The required package name
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * The version range
+    * 
+    * @return version range
+    */
+   VersionRange getVersionRange();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Requirement.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Requirement.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Requirement.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * Requirement.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Requirement
+{
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * Version.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Version extends Comparable<Version>
+{
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.classloading;
+
+/**
+ * VersionRange.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VersionRange
+{
+   /** The low range */
+   private Version low;
+   
+   /** Whether low is inclusive */
+   private boolean lowInclusive;
+   
+   /** The high range */
+   private Version high;
+   
+   /** Whether high is inclusive */
+   private boolean highInclusive;
+   
+   /**
+    * Create a new VersionRange with just a low inclusive check
+    * 
+    * @param low the low range (null for no lower bound)
+    */
+   public VersionRange(Version low)
+   {
+      this(low, null);
+   }
+   
+   /**
+    * Create a new VersionRange with low inclusive and high non-inclusive
+    * 
+    * @param low the low range (null for no lower bound)
+    * @param high the high range (null for no higher bound)
+    */
+   public VersionRange(Version low, Version high)
+   {
+      this(low, true, high, false);
+   }
+   
+   /**
+    * Create a new VersionRange.
+    * 
+    * @param low the low range (null for no lower bound)
+    * @param lowInclusive whether the low bound is inclusive
+    * @param high the high range (null for no higher bound)
+    * @param highInclusive whether the high bound is inclusive
+    */
+   public VersionRange(Version low, boolean lowInclusive, Version high, boolean highInclusive)
+   {
+      this.low = low;
+      this.lowInclusive = lowInclusive;
+      this.high = high;
+      this.highInclusive = highInclusive;
+   }
+
+   /**
+    * Get the low.
+    * 
+    * @return the low.
+    */
+   public Version getLow()
+   {
+      return low;
+   }
+
+   /**
+    * Get the lowInclusive.
+    * 
+    * @return the lowInclusive.
+    */
+   public boolean isLowInclusive()
+   {
+      return lowInclusive;
+   }
+
+   /**
+    * Get the high.
+    * 
+    * @return the high.
+    */
+   public Version getHigh()
+   {
+      return high;
+   }
+
+   /**
+    * Get the highInclusive.
+    * 
+    * @return the highInclusive.
+    */
+   public boolean isHighInclusive()
+   {
+      return highInclusive;
+   }
+
+   /**
+    * Test whether a version is in range
+    * 
+    * @param version the version to test
+    * @return true when the version is in range
+    * @throws IllegalArgumentException for a null version
+    */
+   public  boolean isInRange(Version version)
+   {
+      if (version == null)
+         throw new IllegalArgumentException("Null version");
+
+      int comparison; 
+      if (low != null)
+      {
+         comparison = low.compareTo(version);
+         if (comparison < 0)
+            return false;
+         if (lowInclusive == false && comparison == 0)
+            return false;
+      }
+      if (high != null)
+      {
+         comparison = high.compareTo(version);
+         if (comparison > 0)
+            return false;
+         if (highInclusive == false && comparison == 0)
+            return false;
+      }
+      return true;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,524 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.helpers;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectsWithTransientAttachmentsImpl;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentContextVisitor;
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+
+/**
+ * AbstractDeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentContext extends ManagedObjectsWithTransientAttachmentsImpl implements DeploymentContext
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 7368360479461613969L;
+
+   /** The log */
+   protected Logger log = Logger.getLogger(getClass());
+   
+   /** The name */
+   private String name;
+   
+   /** The simple name */
+   private String simpleName;
+
+   /** The relative path */
+   private String relativePath;
+   
+   /** The deployment state */
+   private DeploymentState state;
+
+   /** Throwable */
+   private Throwable problem;
+
+   /** The deployment */
+   private Deployment deployment;
+   
+   /** The deployment unit */
+   private transient DeploymentUnit unit;
+   
+   /** The class loader */
+   private transient ClassLoader classLoader;
+
+   /** The class loader factory for this deployment */
+   private transient ClassLoaderFactory classLoaderFactory;
+
+   /** The resource classloader */
+   private transient ClassLoader resourceClassLoader;
+   
+   /** Whether this deployment was processed */
+   private boolean deployed;
+   
+   /** The parent context */
+   private DeploymentContext parent;
+
+   /** The types of deployments this has been identified as */
+   private Set<String> deploymentTypes = new CopyOnWriteArraySet<String>();
+
+   /** The child contexts */
+   private List<DeploymentContext> children = new CopyOnWriteArrayList<DeploymentContext>();
+
+   /** The component contexts */
+   private List<DeploymentContext> components = new CopyOnWriteArrayList<DeploymentContext>();
+
+   /**
+    * For serialization
+    */
+   public AbstractDeploymentContext()
+   {
+   }
+
+   /**
+    * Create a new AbstractDeploymentContext.
+    * 
+    * @param name the name
+    * @param relativePath the relative path to the top of the deployment
+    * @throws IllegalArgumentException if the name is null
+    */
+   public AbstractDeploymentContext(String name, String relativePath)
+   {
+      this(name, name, relativePath);
+   }
+
+   /**
+    * Create a new AbstractDeploymentContext.
+    * 
+    * @param name the name
+    * @param simpleName the simple name
+    * @param relativePath the relative path to the top of the deployment
+    * @throws IllegalArgumentException if the name is null
+    */
+   public AbstractDeploymentContext(String name, String simpleName, String relativePath)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      if (relativePath == null)
+         throw new IllegalArgumentException("Null relative path");
+      this.name = name;
+      this.simpleName = simpleName;
+      if (simpleName == null)
+         this.simpleName = name;
+      this.relativePath = relativePath;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public String getSimpleName()
+   {
+      return simpleName;
+   }
+
+   public String getRelativePath()
+   {
+      return relativePath;
+   }
+
+   public Set<String> getTypes()
+   {
+      return deploymentTypes;
+   }
+
+   public DeploymentState getState()
+   {
+      return state;
+   }
+
+   public void setState(DeploymentState state)
+   {
+      if (state == null)
+         throw new IllegalArgumentException("Null state");
+      this.state = state;
+   }
+
+   public Deployment getDeployment()
+   {
+      return deployment;
+   }
+   
+   public void setDeployment(Deployment deployment)
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Null deployment");
+      this.deployment = deployment;
+   }
+   
+   public DeploymentUnit getDeploymentUnit()
+   {
+      if (unit == null)
+         unit = createDeploymentUnit();
+      return unit;
+   }
+
+   public void setDeploymentUnit(DeploymentUnit unit)
+   {
+      this.unit = unit;
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      return classLoader;
+   }
+   
+   public void setClassLoader(ClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+      if (classLoader != null)
+         log.trace("ClassLoader for " + name + " is " + classLoader);
+   }
+
+   public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException
+   {
+      if (factory == null)
+         throw new IllegalArgumentException("Null factory");
+      
+      ClassLoader cl = getClassLoader();
+      if (cl != null)
+         return false;
+
+      try
+      {
+         cl = factory.createClassLoader(this);
+         if (cl != null)
+         {
+            setClassLoader(cl);
+            this.classLoaderFactory = factory;
+         }
+      }
+      catch (Throwable t)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t);
+      }
+      return true;
+   }
+
+   public void removeClassLoader()
+   {
+      if (classLoaderFactory == null)
+         return;
+      try
+      {
+         classLoaderFactory.removeClassLoader(this);
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error removing classloader for " + getName(), t);
+      }
+      classLoaderFactory = null;
+      setClassLoader(null);
+   }
+
+   public boolean isTopLevel()
+   {
+      return parent == null;
+   }
+
+   public DeploymentContext getTopLevel()
+   {
+      DeploymentContext result = this;
+      DeploymentContext parent = getParent();
+      while (parent != null)
+      {
+         result = parent;
+         parent = parent.getParent();
+      }
+      return result;
+   }
+   
+   public DeploymentContext getParent()
+   {
+      return parent;
+   }
+
+   public void setParent(DeploymentContext parent)
+   {
+      if (parent != null && this.parent != null)
+         throw new IllegalStateException("Context already has a parent " + getName());
+      this.parent = parent;
+   }
+
+   public List<DeploymentContext> getChildren()
+   {
+      return Collections.unmodifiableList(children);
+   }
+
+   public void addChild(DeploymentContext child)
+   {
+      if (child == null)
+         throw new IllegalArgumentException("Null child");
+      children.add(child);
+   }
+
+   public boolean removeChild(DeploymentContext child)
+   {
+      if (child == null)
+         throw new IllegalArgumentException("Null child");
+      return children.remove(child);
+   }
+
+   public boolean isComponent()
+   {
+      return false;
+   }
+   
+   public List<DeploymentContext> getComponents()
+   {
+      return Collections.unmodifiableList(components);
+   }
+
+   public void addComponent(DeploymentContext component)
+   {
+      if (component == null)
+         throw new IllegalArgumentException("Null component");
+      deployed();
+      components.add(component);
+      log.debug("Added component " + component.getName() + " to " + getName());
+   }
+
+   public boolean removeComponent(DeploymentContext component)
+   {
+      if (component == null)
+         throw new IllegalArgumentException("Null component");
+
+      List<DeploymentContext> componentComponents = component.getComponents();
+      if (componentComponents.isEmpty() == false)
+         log.warn("Removing component " + name + " which still has components " + componentComponents);
+      boolean result = components.remove(component);
+      if (result)
+         log.debug("Removed component " + component.getName() + " from " + getName());
+      return result;
+   }
+
+   public ClassLoader getResourceClassLoader()
+   {
+      if (resourceClassLoader != null)
+         return resourceClassLoader;
+      
+      DeploymentResourceLoader loader = getResourceLoader();
+      resourceClassLoader = new DeploymentResourceClassLoader(loader);
+      return resourceClassLoader;
+   }
+
+   public DeploymentResourceLoader getResourceLoader()
+   {
+      return EmptyResourceLoader.INSTANCE;
+   }
+
+   public void visit(DeploymentContextVisitor visitor) throws DeploymentException
+   {
+      if (visitor == null)
+         throw new IllegalArgumentException("Null visitor");
+
+      visit(this, visitor);
+   }
+   
+   /**
+    * Visit a context
+    * 
+    * @param context the context
+    * @param visitor the visitor
+    * @throws DeploymentException for any error
+    */
+   private void visit(DeploymentContext context, DeploymentContextVisitor visitor) throws DeploymentException
+   {
+      visitor.visit(context);
+      try
+      {
+         List<DeploymentContext> children = context.getChildren();
+         if (children.isEmpty())
+            return;
+         
+         DeploymentContext[] childContexts = children.toArray(new DeploymentContext[children.size()]);
+         for (int i = 0; i < childContexts.length; ++i)
+         {
+            if (childContexts[i] == null)
+               throw new IllegalStateException("Null child context for " + context.getName() + " children=" + children);
+            try
+            {
+               visit(childContexts[i], visitor);
+            }
+            catch (Throwable t)
+            {
+               for (int j = i-1; j >= 0; --j)
+                  visitError(childContexts[j], visitor, true);
+               throw DeploymentException.rethrowAsDeploymentException("Error visiting: " + childContexts[i].getName(), t);
+            }
+         }
+      }
+      catch (Throwable t)
+      {
+         visitError(context, visitor, false);
+         throw DeploymentException.rethrowAsDeploymentException("Error visiting: " + context.getName(), t);
+      }
+   }
+
+   /**
+    * Unwind the visit invoking the previously visited context's error handler
+    * 
+    * @param context the context
+    * @param visitor the visitor
+    * @param visitChildren whether to visit the children
+    * @throws DeploymentException for any error
+    */
+   private void visitError(DeploymentContext context, DeploymentContextVisitor visitor, boolean visitChildren) throws DeploymentException
+   {
+      if (visitChildren)
+      {
+         List<DeploymentContext> children = context.getChildren();
+         if (children.isEmpty())
+            return;
+         
+         for (DeploymentContext child : children)
+         {
+            try
+            {
+               visitError(child, visitor, true);
+            }
+            catch (Throwable t)
+            {
+               log.warn("Error during visit error: " + child.getName(), t);
+            }
+         }
+         
+      }
+      try
+      {
+         visitor.error(context);
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during visit error: " + context.getName(), t);
+      }
+   }
+
+   public Throwable getProblem()
+   {
+      return problem;
+   }
+
+   public void setProblem(Throwable problem)
+   {
+      this.problem = problem;
+   }
+   
+   public boolean isDeployed()
+   {
+      return deployed;
+   }
+   
+   public void deployed()
+   {
+      deployed = true;
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName());
+      buffer.append('@');
+      buffer.append(System.identityHashCode(this));
+      buffer.append('{').append(name).append('}');
+      return buffer.toString();
+   }
+
+   /**
+    * Create a deployment unit
+    * 
+    * @return the deployment unit
+    */
+   protected DeploymentUnit createDeploymentUnit()
+   {
+      return new AbstractDeploymentUnit(this);
+   }
+
+   @SuppressWarnings("unchecked")
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      super.readExternal(in);
+      name = in.readUTF();
+      simpleName = in.readUTF();
+      relativePath = in.readUTF();
+      state = (DeploymentState) in.readObject();
+      problem = (Throwable) in.readObject();
+      deployment = (Deployment) in.readObject();
+      deployed = in.readBoolean();
+      parent = (DeploymentContext) in.readObject();
+      deploymentTypes = (Set) in.readObject();
+      children = (List) in.readObject();
+      components = (List) in.readObject();
+   }
+
+   /**
+    * @serialData name
+    * @serialData simpleName
+    * @serialData relativePath
+    * @serialData state
+    * @serialData problem
+    * @serialData deployment
+    * @serialData deployed
+    * @serialData parent
+    * @serialData deploymentTypes
+    * @serialData children
+    * @serialData components
+    * @param out the output
+    * @throws IOException for any error
+    */
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      super.writeExternal(out);
+      out.writeUTF(name);
+      out.writeUTF(simpleName);
+      out.writeUTF(relativePath);
+      out.writeObject(state);
+      out.writeObject(problem);
+      out.writeObject(deployment);
+      out.writeBoolean(deployed);
+      out.writeObject(parent);
+      out.writeObject(deploymentTypes);
+      out.writeObject(children);
+      out.writeObject(components);
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,372 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi.helpers;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * AbstractDeploymentUnit.<p>
+ * 
+ * This is just a wrapper to the deployment context that
+ * restricts people from "poking" behind the scenes.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnit extends AbstractMutableAttachments implements DeploymentUnit
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1513962148798298768L;
+   
+   /** The deployment context */
+   private DeploymentContext deploymentContext;
+
+   /**
+    * For serialization
+    */
+   public AbstractDeploymentUnit()
+   {
+   }
+
+   /**
+    * Create a new AbstractDeploymentUnit.
+    * 
+    * @param deploymentContext the deployment context
+    * @throws IllegalArgumentException for a null deployment context
+    */
+   public AbstractDeploymentUnit(DeploymentContext deploymentContext)
+   {
+      if (deploymentContext == null)
+         throw new IllegalArgumentException("Null deployment context");
+      this.deploymentContext = deploymentContext;
+   }
+   
+   public String getName()
+   {
+      return deploymentContext.getName();
+   }
+   
+   public String getSimpleName()
+   {
+      return deploymentContext.getSimpleName();
+   }
+
+   public String getRelativePath()
+   {
+      return deploymentContext.getRelativePath();
+   }
+
+   public Set<String> getTypes()
+   {
+      return deploymentContext.getTypes();
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      ClassLoader cl = deploymentContext.getClassLoader();
+      if (cl == null)
+         throw new IllegalStateException("ClassLoader has not been set");
+      deploymentContext.deployed();
+      return cl;
+   }
+
+   public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException
+   {
+      return deploymentContext.createClassLoader(factory);
+   }
+
+   public DeploymentUnit getTopLevel()
+   {
+      DeploymentUnit top = getParent();
+      if (top == null)
+         top = this;
+      return top;
+   }
+
+   public DeploymentUnit getParent()
+   {
+      DeploymentContext parent = deploymentContext.getParent();
+      if (parent == null)
+         return null;
+      return parent.getDeploymentUnit();
+   }
+
+   public List<DeploymentUnit> getChildren()
+   {
+      List<DeploymentContext> children = deploymentContext.getChildren();
+      if (children == null || children.isEmpty())
+         return Collections.emptyList();
+      
+      List<DeploymentUnit> result = new ArrayList<DeploymentUnit>(children.size());
+      for (DeploymentContext child : children)
+      {
+         DeploymentUnit unit = child.getDeploymentUnit();
+         result.add(unit);
+      }
+      return result;
+   }
+
+   /**
+    * Create a component deployment context
+    * 
+    * @param name the name
+    * @param parent the parent
+    * @return the deployment context
+    */
+   protected DeploymentContext createComponentDeploymentContext(String name, DeploymentContext parent)
+   {
+      return new ComponentDeploymentContext(name, parent);
+   }
+
+   /**
+    * Create a component deployment unit
+    * 
+    * @param component the component contextr
+    * @return the deployment unit
+    */
+   protected DeploymentUnit createComponentDeploymentUnit(DeploymentContext component)
+   {
+      return new AbstractDeploymentUnit(component);
+   }
+   
+   public DeploymentUnit addComponent(String name)
+   {
+      DeploymentContext component = createComponentDeploymentContext(name, deploymentContext);
+      DeploymentUnit unit = createComponentDeploymentUnit(component);
+      component.setDeploymentUnit(unit);
+      deploymentContext.addComponent(component);
+      return unit;
+   }
+
+   public boolean removeComponent(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      
+      for (DeploymentContext component : deploymentContext.getComponents())
+      {
+         if (name.equals(component.getName()))
+            return deploymentContext.removeComponent(component);
+      }
+      return false;
+   }
+
+   public <T> Set<? extends T> getAllMetaData(Class<T> type)
+   {
+      if (type == null)
+         throw new IllegalArgumentException("Null type");
+      
+      Set<T> result = new HashSet<T>();
+      Map<String, Object> attachments = getAttachments();
+      for (Object object : attachments.values())
+      {
+         if (type.isInstance(object))
+         {
+            T t = type.cast(object);
+            result.add(t);
+         }
+      }
+      if (result.isEmpty() == false)
+         deploymentContext.deployed();
+      return result;
+   }
+
+   public MutableAttachments getTransientManagedObjects()
+   {
+      return deploymentContext.getTransientManagedObjects();
+   }
+
+   public Object addAttachment(String name, Object attachment)
+   {
+      deploymentContext.deployed();
+      return deploymentContext.getTransientAttachments().addAttachment(name, attachment);
+   }
+
+   public void clear()
+   {
+      deploymentContext.getTransientAttachments().clear();
+      deploymentContext.getTransientManagedObjects().clear();
+   }
+
+   public void clearChangeCount()
+   {
+      deploymentContext.getTransientAttachments().clearChangeCount();
+      deploymentContext.getTransientManagedObjects().clearChangeCount();
+   }
+
+   public int getChangeCount()
+   {
+      return deploymentContext.getTransientAttachments().getChangeCount() + deploymentContext.getTransientManagedObjects().getChangeCount();
+   }
+
+   public Object removeAttachment(String name)
+   {
+      return deploymentContext.getTransientAttachments().removeAttachment(name);
+   }
+
+   public Object getAttachment(String name)
+   {
+      DeploymentContext parent = deploymentContext.getParent();
+      if (deploymentContext.isComponent() == false)
+         parent = null;
+      Object result = deploymentContext.getPredeterminedManagedObjects().getAttachment(name);
+      if (result != null)
+      {
+         deploymentContext.deployed();
+         return result;
+      }
+      if (parent != null)
+      {
+         result = parent.getPredeterminedManagedObjects().getAttachment(name);
+         if (result != null)
+         {
+            deploymentContext.deployed();
+            return result;
+         }
+      }
+      result = deploymentContext.getTransientManagedObjects().getAttachment(name);
+      if (result != null)
+      {
+         deploymentContext.deployed();
+         return result;
+      }
+      if (parent != null)
+      {
+         result = parent.getTransientManagedObjects().getAttachment(name);
+         if (result != null)
+         {
+            deploymentContext.deployed();
+            return result;
+         }
+      }
+      result = deploymentContext.getTransientAttachments().getAttachment(name);
+      if (result != null)
+      {
+         deploymentContext.deployed();
+         return result;
+      }
+      if (parent != null)
+      {
+         result = parent.getTransientAttachments().getAttachment(name);
+         if (result != null)
+         {
+            deploymentContext.deployed();
+            return result;
+         }
+      }
+      return null;
+   }
+
+   public Map<String, Object> getAttachments()
+   {
+      DeploymentContext parent = deploymentContext.getParent();
+      if (deploymentContext.isComponent() == false)
+         parent = null;
+      HashMap<String, Object> result = new HashMap<String, Object>();
+      if (parent != null)
+         result.putAll(parent.getTransientAttachments().getAttachments());
+      result.putAll(deploymentContext.getTransientAttachments().getAttachments());
+      if (parent != null)
+         result.putAll(parent.getTransientManagedObjects().getAttachments());
+      result.putAll(deploymentContext.getTransientManagedObjects().getAttachments());
+      if (parent != null)
+         result.putAll(parent.getPredeterminedManagedObjects().getAttachments());
+      result.putAll(deploymentContext.getPredeterminedManagedObjects().getAttachments());
+      if (result.isEmpty() == false)
+         deploymentContext.deployed();
+      return Collections.unmodifiableMap(result);
+   }
+
+   public boolean hasAttachments()
+   {
+      if (deploymentContext.getTransientAttachments().hasAttachments())
+         return true;
+      else if (deploymentContext.getTransientManagedObjects().hasAttachments())
+         return true;
+      else if (deploymentContext.getPredeterminedManagedObjects().hasAttachments())
+         return true;
+      
+      if (deploymentContext.isComponent())
+         return deploymentContext.getParent().getDeploymentUnit().hasAttachments();
+      return false;
+   }
+
+   public boolean isAttachmentPresent(String name)
+   {
+      return getAttachment(name) != null;
+   }
+   
+   public ClassLoader getResourceClassLoader()
+   {
+      return deploymentContext.getResourceClassLoader();
+   }
+
+   public DeploymentResourceLoader getResourceLoader()
+   {
+      return deploymentContext.getResourceLoader();
+   }
+
+   /**
+    * Get the deployment context
+    * 
+    * @return the deployment context
+    */
+   protected DeploymentContext getDeploymentContext()
+   {
+      return deploymentContext;
+   }
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      super.readExternal(in);
+      deploymentContext = (DeploymentContext) in.readObject();
+   }
+
+   /**
+    * @serialData deploymentContext
+    * @param out the output
+    * @throws IOException for any error
+    */
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      super.writeExternal(out);
+      out.writeObject(deploymentContext);
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.helpers;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.StructuralDeployers;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+
+/**
+ * AbstractStructuralDeployers.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractStructuralDeployers implements StructuralDeployers
+{
+   /** The structure builder */
+   private StructureBuilder structureBuilder;
+
+   /**
+    * Get the structureBuilder.
+    * 
+    * @return the structureBuilder.
+    */
+   public StructureBuilder getStructureBuilder()
+   {
+      return structureBuilder;
+   }
+
+   /**
+    * Set the structureBuilder.
+    * 
+    * @param structureBuilder the structureBuilder.
+    */
+   public void setStructureBuilder(StructureBuilder structureBuilder)
+   {
+      this.structureBuilder = structureBuilder;
+   }
+
+   public DeploymentContext determineStructure(Deployment deployment) throws DeploymentException
+   {
+      StructureBuilder builder = getStructureBuilder();
+      if (builder == null)
+         throw new IllegalStateException("No structure builder has been configured");
+      
+      Throwable problem = null;
+
+      Attachments attachments = deployment.getPredeterminedManagedObjects();
+      StructureMetaData structureMetaData = attachments.getAttachment(StructureMetaData.class);
+      if (structureMetaData == null)
+      {
+         structureMetaData = StructureMetaDataFactory.createStructureMetaData();
+         try
+         {
+            determineStructure(deployment, structureMetaData);
+         }
+         catch (Throwable t)
+         {
+            problem = t;
+         }
+      }
+      
+      DeploymentContext result = structureBuilder.populateContext(deployment, structureMetaData);
+      if (problem != null)
+      {
+         result.setState(DeploymentState.ERROR);
+         result.setProblem(problem);
+      }
+      return result;
+   }
+   
+   protected void determineStructure(Deployment deployment, StructureMetaData structure) throws Exception
+   {
+      // NOTHING
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.helpers;
+
+import java.util.List;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+import org.jboss.logging.Logger;
+
+/**
+ * AbstractStructureBuilder.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractStructureBuilder implements StructureBuilder
+{
+   /** The log */
+   private final Logger log = Logger.getLogger(getClass());
+   
+   public DeploymentContext populateContext(Deployment deployment, StructureMetaData metaData) throws DeploymentException
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Null deployment");
+
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("Populating deployment " + deployment.getName() + " metaData=" + metaData);
+      
+      DeploymentContext result = null;
+      try
+      {
+         result = createRootDeploymentContext(deployment);
+         if (result == null)
+            throw new IllegalStateException("Root deployment context is null");
+         result.setDeployment(deployment);
+
+         ContextInfo contextInfo = metaData.getContext("");
+         if (contextInfo == null)
+            contextInfo = StructureMetaDataFactory.createContextInfo("", null);
+         contextInfo.setPredeterminedManagedObjects(deployment.getPredeterminedManagedObjects());
+         applyContextInfo(result, contextInfo);
+      }
+      catch (Throwable t)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Error populating deployment " + deployment.getName(), t);
+      }
+      
+      try
+      {
+         if (metaData != null)
+         {
+            result.getTransientManagedObjects().addAttachment(StructureMetaData.class, metaData);
+            populateContext(result, metaData);
+         }
+      }
+      catch (Throwable t)
+      {
+         result.setProblem(t);
+         result.setState(DeploymentState.ERROR);
+         log.warn("Error populating deployment " + deployment.getName(), t);
+      }
+      return result;
+   }
+
+   /**
+    * Populate the child deployment contexts
+    * 
+    * @param context the context
+    * @param metaData the metadata
+    * @throws Exception for any error
+    */
+   protected void populateContext(DeploymentContext context, StructureMetaData metaData) throws Exception
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null context");
+      if (metaData == null)
+         throw new IllegalArgumentException("Null metaData");
+      
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("Populating Context " + context.getName() + " metaData=" + metaData);
+      
+      List<ContextInfo> contexts = metaData.getContexts();
+      if (contexts == null)
+         return;
+      
+      try
+      {
+         for (ContextInfo child : contexts)
+         {
+            // Only process the child contexts
+            if ("".equals(child.getPath()) == false)
+            {
+               DeploymentContext childContext = createChildDeploymentContext(context, child);
+               if (childContext == null)
+                  throw new IllegalStateException("Child deployment context is null");
+
+               context.addChild(childContext);
+               childContext.setParent(context);
+
+               applyContextInfo(childContext, child);
+
+               Attachments attachments = child.getPredeterminedManagedObjects(); 
+               if (attachments != null)
+               {
+                  StructureMetaData childStructure = attachments.getAttachment(StructureMetaData.class);
+                  if (childStructure != null)
+                     populateContext(childContext, childStructure);
+               }
+            }
+         }
+      }
+      catch (Throwable t)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Error populating context " + context.getName(), t);
+      }
+   }
+
+   /**
+    * Apply the context info
+    * 
+    * @param context the context
+    * @param contextInfo the contextInfo
+    * @throws Exception for any error
+    */
+   protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception
+   {
+      Attachments attachments = contextInfo.getPredeterminedManagedObjects();
+      if (attachments != null)
+         context.setPredeterminedManagedObjects(attachments);
+   }
+   
+   /**
+    * Create the root deployment context
+    * 
+    * @param deployment the deployment
+    * @return the deployment context
+    * @throws Exception for any error
+    */
+   protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception
+   {
+      return new AbstractDeploymentContext(deployment.getName(), "");
+   }
+   
+   /**
+    * Create a child deployment context
+    * 
+    * @param parent the parent deployment context
+    * @param child the child context
+    * @return the deployment context
+    * @throws Exception for any error
+    */
+   protected DeploymentContext createChildDeploymentContext(DeploymentContext parent, ContextInfo child) throws Exception
+   {
+      String path = child.getPath();
+      String name = parent.getName() + "/" + path;
+      return new AbstractDeploymentContext(name, path); 
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,380 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.structure.spi.helpers;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.AttachmentsFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentContextVisitor;
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+
+/**
+ * AbstractDeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 59630 $
+ */
+public class ComponentDeploymentContext implements DeploymentContext
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -5105972679660633071L;
+
+   /** The log */
+   protected Logger log = Logger.getLogger(getClass());
+   
+   /** The name */
+   private String name;
+   
+   /** The deployment unit */
+   private DeploymentUnit unit;
+
+   /** The parent context */
+   private DeploymentContext parent;
+
+   /** The component contexts */
+   private List<DeploymentContext> components = new CopyOnWriteArrayList<DeploymentContext>();
+   
+   /** The attachments */
+   private transient MutableAttachments transientAttachments = AttachmentsFactory.createMutableAttachments();
+   
+   /** The managed objects */
+   private transient MutableAttachments transientManagedObjects = AttachmentsFactory.createMutableAttachments();
+
+   /**
+    * For serialization
+    */
+   public ComponentDeploymentContext()
+   {
+   }
+
+   /**
+    * Create a new ComponentDeploymentContext.
+    * 
+    * @param name the name
+    * @param parent the parent
+    * @throws IllegalArgumentException if the name or parent is null
+    */
+   public ComponentDeploymentContext(String name, DeploymentContext parent)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      if (parent == null)
+         throw new IllegalArgumentException("Null parent");
+      this.name = name;
+      this.parent = parent;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public String getSimpleName()
+   {
+      return parent.getSimpleName();
+   }
+
+   public String getRelativePath()
+   {
+      return parent.getRelativePath();
+   }
+
+   public Set<String> getTypes()
+   {
+      return parent.getTypes();
+   }
+
+   public DeploymentState getState()
+   {
+      return parent.getState();
+   }
+
+   public void setState(DeploymentState state)
+   {
+      parent.setState(state);
+   }
+
+   public DeploymentUnit getDeploymentUnit()
+   {
+      if (unit == null)
+         throw new IllegalStateException("Deployment unit has not been set");
+      return unit;
+   }
+
+   public void setDeploymentUnit(DeploymentUnit unit)
+   {
+      this.unit = unit;
+   }
+   
+   public void setMetaDataPath(String path)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      return parent.getClassLoader();
+   }
+   
+   public void setClassLoader(ClassLoader classLoader)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+   
+   public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException
+   {
+      return false;
+   }
+
+   public void removeClassLoader()
+   {
+   }
+
+   public boolean isTopLevel()
+   {
+      return false;
+   }
+
+   public DeploymentContext getTopLevel()
+   {
+      return parent.getTopLevel();
+   }
+   
+   public DeploymentContext getParent()
+   {
+      return parent;
+   }
+
+   public void setParent(DeploymentContext parent)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+
+   public List<DeploymentContext> getChildren()
+   {
+      return Collections.emptyList();
+   }
+
+   public void addChild(DeploymentContext child)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+
+   public boolean removeChild(DeploymentContext child)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+
+   public Deployment getDeployment()
+   {
+      return parent.getDeployment();
+   }
+
+   public void setDeployment(Deployment deployment)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+
+   public boolean isComponent()
+   {
+      return true;
+   }
+
+   public List<DeploymentContext> getComponents()
+   {
+      return Collections.unmodifiableList(components);
+   }
+
+   public void addComponent(DeploymentContext component)
+   {
+      if (component == null)
+         throw new IllegalArgumentException("Null component");
+      components.add(component);
+   }
+
+   public boolean removeComponent(DeploymentContext component)
+   {
+      if (component == null)
+         throw new IllegalArgumentException("Null component");
+      return components.remove(component);
+   }
+
+   public ClassLoader getResourceClassLoader()
+   {
+      return parent.getResourceClassLoader();
+   }
+
+   public DeploymentResourceLoader getResourceLoader()
+   {
+      return parent.getResourceLoader();
+   }
+
+   public void visit(DeploymentContextVisitor visitor) throws DeploymentException
+   {
+      if (visitor == null)
+         throw new IllegalArgumentException("Null visitor");
+
+      visit(this, visitor);
+   }
+   
+   /**
+    * Visit a context
+    * 
+    * @param context the context
+    * @param visitor the visitor
+    * @throws DeploymentException for any error
+    */
+   private void visit(DeploymentContext context, DeploymentContextVisitor visitor) throws DeploymentException
+   {
+      visitor.visit(context);
+      try
+      {
+         List<DeploymentContext> children = context.getChildren();
+         if (children.isEmpty())
+            return;
+         
+         DeploymentContext[] childContexts = children.toArray(new DeploymentContext[children.size()]);
+         for (int i = 0; i < childContexts.length; ++i)
+         {
+            if (childContexts[i] == null)
+               throw new IllegalStateException("Null child context for " + context.getName() + " children=" + children);
+            try
+            {
+               visit(childContexts[i], visitor);
+            }
+            catch (Throwable t)
+            {
+               for (int j = i-1; j >= 0; --j)
+                  visitError(childContexts[j], visitor, true);
+               throw DeploymentException.rethrowAsDeploymentException("Error visiting: " + childContexts[i].getName(), t);
+            }
+         }
+      }
+      catch (Throwable t)
+      {
+         visitError(context, visitor, false);
+         throw DeploymentException.rethrowAsDeploymentException("Error visiting: " + context.getName(), t);
+      }
+   }
+
+   /**
+    * Unwind the visit invoking the previously visited context's error handler
+    * 
+    * @param context the context
+    * @param visitor the visitor
+    * @param visitChildren whether to visit the children
+    * @throws DeploymentException for any error
+    */
+   private void visitError(DeploymentContext context, DeploymentContextVisitor visitor, boolean visitChildren) throws DeploymentException
+   {
+      if (visitChildren)
+      {
+         List<DeploymentContext> children = context.getChildren();
+         if (children.isEmpty())
+            return;
+         
+         for (DeploymentContext child : children)
+         {
+            try
+            {
+               visitError(child, visitor, true);
+            }
+            catch (Throwable t)
+            {
+               log.warn("Error during visit error: " + child.getName(), t);
+            }
+         }
+         
+      }
+      try
+      {
+         visitor.error(context);
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during visit error: " + context.getName(), t);
+      }
+   }
+
+   public Attachments getPredeterminedManagedObjects()
+   {
+      return parent.getPredeterminedManagedObjects();
+   }
+   
+   public void setPredeterminedManagedObjects(Attachments objects)
+   {
+      throw new UnsupportedOperationException("Not supported for components");
+   }
+   
+   public MutableAttachments getTransientManagedObjects()
+   {
+      return transientManagedObjects;
+   }
+   
+   public MutableAttachments getTransientAttachments()
+   {
+      return transientAttachments;
+   }
+
+   public Throwable getProblem()
+   {
+      return parent.getProblem();
+   }
+
+   public void setProblem(Throwable problem)
+   {
+      parent.setProblem(problem);
+   }
+   
+   public void deployed()
+   {
+      parent.deployed();
+   }
+
+   public boolean isDeployed()
+   {
+      return parent.isDeployed();
+   }
+
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName());
+      buffer.append('@');
+      buffer.append(System.identityHashCode(this));
+      buffer.append('{').append(name).append('}');
+      return buffer.toString();
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/DeploymentResourceClassLoader.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/DeploymentResourceClassLoader.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/DeploymentResourceClassLoader.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.helpers;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+
+/**
+ * DeploymentResourceClassLoader.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeploymentResourceClassLoader extends ClassLoader
+{
+   /** The loader */
+   private DeploymentResourceLoader loader;
+   
+   /**
+    * Create a new DeploymentResourceClassLoader.
+    * 
+    * @param loader the loader
+    * @throws IllegalArgumentException for a null loader
+    */
+   public DeploymentResourceClassLoader(DeploymentResourceLoader loader)
+   {
+      if (loader == null)
+         throw new IllegalArgumentException("Null loader");
+      this.loader = loader;
+   }
+
+   @Override
+   protected URL findResource(String name)
+   {
+      return loader.getResource(name);
+   }
+
+   @Override
+   protected Enumeration<URL> findResources(String name) throws IOException
+   {
+      return loader.getResources(name);
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/EmptyResourceLoader.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/EmptyResourceLoader.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/EmptyResourceLoader.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.helpers;
+
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+
+/**
+ * EmptyResourceLoader.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class EmptyResourceLoader implements DeploymentResourceLoader
+{
+   /** The singleton instance */
+   public static final DeploymentResourceLoader INSTANCE = new EmptyResourceLoader();
+
+   /** Empty urls */
+   private static final Enumeration<URL> empty = new Vector<URL>().elements();
+   
+   public URL getResource(String name)
+   {
+      return null;
+   }
+
+   public Enumeration<URL> getResources(String name)
+   {
+      return empty;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/main/MainDeployerStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/main/MainDeployerStructure.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/main/MainDeployerStructure.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.structure.spi.main;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * MainDeployerStructure.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MainDeployerStructure
+{
+   /**
+    * Get a deployment unit
+    * 
+    * @param name the name of the unit
+    * @return the unit or null if not found
+    * @throws IllegalArgumentException for a null name
+    */
+   DeploymentUnit getDeploymentUnit(String name);
+
+   /**
+    * Get a deployment context
+    * 
+    * @param name the name of the context
+    * @param errorNotFound whether to throw an error if not found
+    * @return the context
+    * @throws IllegalArgumentException for a null name
+    * @throws DeploymentException for not found
+    */
+   DeploymentUnit getDeploymentUnit(String name, boolean errorNotFound) throws DeploymentException;
+
+   /**
+    * Get a deployment context
+    * 
+    * @param name the name of the context
+    * @return the context or null if not found
+    * @throws IllegalArgumentException for a null name
+    */
+   @Deprecated
+   DeploymentContext getDeploymentContext(String name);
+
+   /**
+    * Get a deployment context
+    * 
+    * @param name the name of the context
+    * @param errorNotFound whether to throw an error if not found
+    * @return the context
+    * @throws IllegalArgumentException for a null name
+    * @throws DeploymentException for not found
+    */
+   @Deprecated
+   DeploymentContext getDeploymentContext(String name, boolean errorNotFound) throws DeploymentException;
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,53 @@
+/*
+* 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;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.structure.attachments.StructureAttachmentsTestSuite;
+import org.jboss.test.deployers.structure.structurebuilder.StructureBuilderTestSuite;
+
+/**
+ * Deployers Structure Test Suite.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class DeployersStructureTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Deployers Structure Tests");
+
+      suite.addTest(StructureAttachmentsTestSuite.suite());
+      suite.addTest(StructureBuilderTestSuite.suite());
+
+      return suite;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,65 @@
+/*
+* 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.structure.attachments;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextTransientAttachmentsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextTransientManagedObjectsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitAttachmentHierarchyUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitAttachmentsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitTransientAttachmentsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitTransientManagedObjectsUnitTestCase;
+
+/**
+ * StructureAttachmentsTestSuite.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureAttachmentsTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Structure Attachment Tests");
+
+      suite.addTest(AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentContextTransientManagedObjectsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentContextTransientAttachmentsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentUnitTransientAttachmentsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentUnitAttachmentsUnitTestCase.suite());
+      suite.addTest(AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.suite());
+
+      return suite;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,61 @@
+/*
+* 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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase.class);
+   }
+   
+   public AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected Attachments getAttachments()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return context.getPredeterminedManagedObjects();
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return (MutableAttachments) context.getPredeterminedManagedObjects();
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientAttachmentsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientAttachmentsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientAttachmentsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,61 @@
+/*
+* 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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * AbstractDeploymentContextTransientAttachmentsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentContextTransientAttachmentsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentContextTransientAttachmentsUnitTestCase.class);
+   }
+   
+   public AbstractDeploymentContextTransientAttachmentsUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected Attachments getAttachments()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return context.getTransientAttachments();
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return context.getTransientAttachments();
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientManagedObjectsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientManagedObjectsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentContextTransientManagedObjectsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,61 @@
+/*
+* 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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * AbstractDeploymentContextTransientManagedObjectsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentContextTransientManagedObjectsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentContextTransientManagedObjectsUnitTestCase.class);
+   }
+   
+   public AbstractDeploymentContextTransientManagedObjectsUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected Attachments getAttachments()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return context.getTransientManagedObjects();
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      AbstractDeploymentContext context = new AbstractDeploymentContext("test", "");
+      return context.getTransientManagedObjects();
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,157 @@
+/*
+* 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.structure.attachments.test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * DeploymentUnitAttachmentHierarchyUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnitAttachmentHierarchyUnitTestCase extends BaseTestCase
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.class);
+   }
+   
+   private DeploymentUnit unit;
+
+   private MutableAttachments predeterminedManagedObjects;
+   
+   private MutableAttachments transientManagedObjects;
+
+   private MutableAttachments transientAttachments;
+   
+   public AbstractDeploymentUnitAttachmentHierarchyUnitTestCase(String name)
+   {
+      super(name);
+      AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+      unit = new AbstractDeploymentUnit(context);
+      context.setDeploymentUnit(unit);
+      predeterminedManagedObjects = (MutableAttachments) context.getPredeterminedManagedObjects();
+      transientManagedObjects = context.getTransientManagedObjects();
+      transientAttachments = context.getTransientAttachments();
+   }
+   
+   public void testPredeterminedIsFirstByName()
+   {
+      predeterminedManagedObjects.addAttachment("Name", "pMO");
+      transientManagedObjects.addAttachment("Name", "tMO");
+      transientAttachments.addAttachment("Name", "tA");
+      assertEquals("pMO", unit.getAttachment("Name"));
+      Map<String, String> expected = Collections.singletonMap("Name", "pMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testPredeterminedIsFirstByNameAndType()
+   {
+      predeterminedManagedObjects.addAttachment("Name", "pMO", String.class);
+      transientManagedObjects.addAttachment("Name", "tMO", String.class);
+      transientAttachments.addAttachment("Name", "tA", String.class);
+      assertEquals("pMO", unit.getAttachment("Name"));
+      assertEquals("pMO", unit.getAttachment("Name", String.class));
+      Map<String, String> expected = Collections.singletonMap("Name", "pMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testPredeterminedIsFirstByType()
+   {
+      predeterminedManagedObjects.addAttachment(String.class, "pMO");
+      transientManagedObjects.addAttachment(String.class, "tMO");
+      transientAttachments.addAttachment(String.class, "tA");
+      assertEquals("pMO", unit.getAttachment(String.class.getName()));
+      assertEquals("pMO", unit.getAttachment(String.class.getName(), String.class));
+      assertEquals("pMO", unit.getAttachment(String.class));
+      Map<String, String> expected = Collections.singletonMap(String.class.getName(), "pMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientManagedObjectsIsSecondByName()
+   {
+      transientManagedObjects.addAttachment("Name", "tMO");
+      transientAttachments.addAttachment("Name", "tA");
+      assertEquals("tMO", unit.getAttachment("Name"));
+      Map<String, String> expected = Collections.singletonMap("Name", "tMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientManagedObjectsIsSecondAndType()
+   {
+      transientManagedObjects.addAttachment("Name", "tMO", String.class);
+      transientAttachments.addAttachment("Name", "tA", String.class);
+      assertEquals("tMO", unit.getAttachment("Name"));
+      assertEquals("tMO", unit.getAttachment("Name", String.class));
+      Map<String, String> expected = Collections.singletonMap("Name", "tMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientManagedObjectsIsSecondByType()
+   {
+      transientManagedObjects.addAttachment(String.class, "tMO");
+      transientAttachments.addAttachment(String.class, "tA");
+      assertEquals("tMO", unit.getAttachment(String.class.getName()));
+      assertEquals("tMO", unit.getAttachment(String.class.getName(), String.class));
+      assertEquals("tMO", unit.getAttachment(String.class));
+      Map<String, String> expected = Collections.singletonMap(String.class.getName(), "tMO");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientAttrachmentsIsThirdByName()
+   {
+      transientAttachments.addAttachment("Name", "tA");
+      assertEquals("tA", unit.getAttachment("Name"));
+      Map<String, String> expected = Collections.singletonMap("Name", "tA");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientAttrachmentsIsThirdAndType()
+   {
+      transientAttachments.addAttachment("Name", "tA", String.class);
+      assertEquals("tA", unit.getAttachment("Name"));
+      assertEquals("tA", unit.getAttachment("Name", String.class));
+      Map<String, String> expected = Collections.singletonMap("Name", "tA");
+      assertEquals(expected, unit.getAttachments());
+   }
+   
+   public void testTransientAttrachmentsIsThirdByType()
+   {
+      transientAttachments.addAttachment(String.class, "tA");
+      assertEquals("tA", unit.getAttachment(String.class.getName()));
+      assertEquals("tA", unit.getAttachment(String.class.getName(), String.class));
+      assertEquals("tA", unit.getAttachment(String.class));
+      Map<String, String> expected = Collections.singletonMap(String.class.getName(), "tA");
+      assertEquals(expected, unit.getAttachments());
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitAttachmentsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,71 @@
+/*
+* 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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * DeploymentUnitAttachmentsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnitAttachmentsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentUnitAttachmentsUnitTestCase.class);
+   }
+   
+   private DeploymentUnit unit;
+   
+   public AbstractDeploymentUnitAttachmentsUnitTestCase(String name)
+   {
+      super(name);
+      AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+      unit = new AbstractDeploymentUnit(context);
+      context.setDeploymentUnit(unit);
+   }
+
+   public void testSerialization() throws Exception
+   {
+      // Not really serializable
+   }
+
+   protected Attachments getAttachments()
+   {
+      return unit;
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      return unit;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * DeploymentUnitPredeterminedManagedObjectsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase.class);
+   }
+   
+   private DeploymentUnit unit;
+
+   private MutableAttachments mutable; 
+   
+   public AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase(String name)
+   {
+      super(name);
+      AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+      unit = new AbstractDeploymentUnit(context);
+      context.setDeploymentUnit(unit);
+      mutable = (MutableAttachments) context.getPredeterminedManagedObjects();
+   }
+
+   protected Attachments getAttachments()
+   {
+      return mutable;
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      return mutable;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientAttachmentsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientAttachmentsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientAttachmentsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * DeploymentUnitTransientAttachmentsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnitTransientAttachmentsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentUnitTransientAttachmentsUnitTestCase.class);
+   }
+   
+   private DeploymentUnit unit;
+
+   private MutableAttachments mutable; 
+   
+   public AbstractDeploymentUnitTransientAttachmentsUnitTestCase(String name)
+   {
+      super(name);
+      AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+      unit = new AbstractDeploymentUnit(context);
+      context.setDeploymentUnit(unit);
+      mutable = context.getTransientAttachments();
+   }
+
+   protected Attachments getAttachments()
+   {
+      return mutable;
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      return mutable;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/attachments/test/AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -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.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+
+/**
+ * DeploymentUnitTransientManagedObjectsUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnitTransientManagedObjectsUnitTestCase extends AttachmentsTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractDeploymentUnitTransientManagedObjectsUnitTestCase.class);
+   }
+   
+   private DeploymentUnit unit;
+
+   private MutableAttachments mutable; 
+   
+   public AbstractDeploymentUnitTransientManagedObjectsUnitTestCase(String name)
+   {
+      super(name);
+      AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+      unit = new AbstractDeploymentUnit(context);
+      context.setDeploymentUnit(unit);
+      mutable = context.getTransientManagedObjects();
+   }
+
+   protected Attachments getAttachments()
+   {
+      return mutable;
+   }
+
+   protected MutableAttachments getMutable()
+   {
+      return mutable;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/AbstractStructureBuilderTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/AbstractStructureBuilderTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/AbstractStructureBuilderTest.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,183 @@
+/*
+* 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.structure.structurebuilder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * AbstractStructureBuilderTest.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractStructureBuilderTest extends BaseTestCase
+{
+   public AbstractStructureBuilderTest(String name)
+   {
+      super(name);
+   }
+   
+   protected abstract DeploymentContext build(Deployment deployment) throws DeploymentException;
+   
+   protected abstract Deployment createDeployment();
+   
+   protected abstract DeploymentFactory getDeploymentFactory();
+
+   protected abstract String getDeploymentName();
+   
+   public void testSimple() throws Exception
+   {
+      Deployment deployment = createDeployment();
+      StructureMetaData structure = StructureMetaDataFactory.createStructureMetaData();
+      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
+      attachments.addAttachment(StructureMetaData.class, structure);
+      
+      DeploymentContext context = build(deployment);
+      checkDeployment(context, deployment);
+   }
+   
+   public void testSimpleWithAttachment() throws Exception
+   {
+      Deployment deployment = createDeployment();
+      StructureMetaData structure = StructureMetaDataFactory.createStructureMetaData();
+      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
+      attachments.addAttachment(StructureMetaData.class, structure);
+      attachments.addAttachment("test", "hello");
+      
+      DeploymentContext context = build(deployment);
+      checkDeployment(context, deployment);
+   }
+   
+   public void testOneChild() throws Exception
+   {
+      DeploymentFactory factory = getDeploymentFactory();
+      Deployment deployment = createDeployment();
+      factory.addContext(deployment, "child1");
+      
+      DeploymentContext context = build(deployment);
+      checkDeployment(context, deployment);
+   }
+   
+   public void testManyChildren() throws Exception
+   {
+      DeploymentFactory factory = getDeploymentFactory();
+      Deployment deployment = createDeployment();
+      factory.addContext(deployment, "child1");
+      factory.addContext(deployment, "child2");
+      factory.addContext(deployment, "child3");
+      
+      DeploymentContext context = build(deployment);
+      checkDeployment(context, deployment);
+   }
+   
+   public void testMetaDataLocation() throws Exception
+   {
+      DeploymentFactory factory = getDeploymentFactory();
+      Deployment deployment = createDeployment();
+      factory.addContext(deployment, "", ContextInfo.DEFAULT_METADATA_PATH, factory.createClassPath(""));
+      
+      DeploymentContext context = build(deployment);
+      checkDeployment(context, deployment);
+   }
+   
+   protected void checkDeployment(DeploymentContext context, Deployment deployment) throws Exception
+   {
+      assertNotNull(context);
+      
+      assertEquals(deployment.getName(), context.getName());
+      
+      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
+      StructureMetaData structure = attachments.getAttachment(StructureMetaData.class);
+      checkAttachments(context, deployment);
+      checkDeployment(context, structure);
+
+      ContextInfo contextInfo = structure.getContext("");
+      if (contextInfo == null)
+         contextInfo = StructureMetaDataFactory.createContextInfo();
+      checkContextInfo(context, contextInfo);
+   }
+   
+   protected void checkDeployment(String parentName, DeploymentContext context, ContextInfo contextInfo) throws Exception
+   {
+      assertNotNull(context);
+      
+      String expectedName;
+      if (parentName.endsWith("/"))
+         expectedName = parentName + contextInfo.getPath();
+      else
+         expectedName = parentName + "/" + contextInfo.getPath();
+      
+      assertEquals(expectedName, context.getName());
+      
+      StructureMetaData structure = contextInfo.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
+      checkAttachments(context, contextInfo);
+      if (structure != null)
+         checkDeployment(context, structure);
+
+      checkContextInfo(context, contextInfo);
+   }
+   
+   protected void checkDeployment(DeploymentContext context, StructureMetaData structure) throws Exception
+   {
+      assertNotNull(context);
+      
+      List<ContextInfo> contextInfos = structure.getContexts();
+      int numContexts = contextInfos.size();
+      // Ignore the parent
+      if (structure.getContext("") != null)
+        --numContexts; 
+      List<DeploymentContext> children = context.getChildren();
+      int numChildren = children.size();
+
+      assertEquals("Should have the same number contexts=" + contextInfos + " children=" + children, numContexts, numChildren);
+      
+      for (DeploymentContext childContext : children)
+      {
+         ContextInfo contextInfo = structure.getContext(childContext.getRelativePath());
+         assertNotNull("Should have a context info " + childContext + " in " + contextInfos, contextInfo);
+         checkDeployment(context.getName(), childContext, contextInfo);
+      }
+   }
+   
+   protected void checkAttachments(DeploymentContext context, PredeterminedManagedObjectAttachments predetermined) throws Exception
+   {
+      Map<String, Object> expected = predetermined.getPredeterminedManagedObjects().getAttachments();
+      Map<String, Object> actual = context.getPredeterminedManagedObjects().getAttachments();
+      assertEquals(expected, actual);
+   }
+   
+   protected void checkContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception
+   {
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTest.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.structure.structurebuilder;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+
+/**
+ * StructureBuilderTest.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class StructureBuilderTest extends AbstractStructureBuilderTest
+{
+   public StructureBuilderTest(String name)
+   {
+      super(name);
+   }
+   
+   protected DeploymentContext build(Deployment deployment) throws DeploymentException
+   {
+      StructureMetaData structure = deployment.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
+      return getStructureBuilder().populateContext(deployment, structure);
+   }
+   
+   protected abstract StructureBuilder getStructureBuilder();
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTestSuite.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/StructureBuilderTestSuite.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.structure.structurebuilder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.structure.structurebuilder.test.AbstractStructureBuilderUnitTestCase;
+
+/**
+ * StructureBuilderTestSuite.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureBuilderTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Structure Builder Tests");
+
+      suite.addTest(AbstractStructureBuilderUnitTestCase.suite());
+
+      return suite;
+   }
+}

Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/test/AbstractStructureBuilderUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/test/AbstractStructureBuilderUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/structurebuilder/test/AbstractStructureBuilderUnitTestCase.java	2007-06-27 15:58:37 UTC (rev 63684)
@@ -0,0 +1,71 @@
+/*
+* 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.structure.structurebuilder.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+import org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder;
+import org.jboss.test.deployers.structure.structurebuilder.StructureBuilderTest;
+
+/**
+ * AbstractStructureBuilderUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractStructureBuilderUnitTestCase extends StructureBuilderTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(AbstractStructureBuilderUnitTestCase.class);
+   }
+   
+   public AbstractStructureBuilderUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected StructureBuilder getStructureBuilder()
+   {
+      return new AbstractStructureBuilder();
+   }
+
+   protected Deployment createDeployment()
+   {
+      return new AbstractDeployment(getDeploymentName());
+   }
+
+   protected DeploymentFactory getDeploymentFactory()
+   {
+      return new DeploymentFactory();
+   }
+
+   protected String getDeploymentName()
+   {
+      return getName();
+   }
+}




More information about the jboss-cvs-commits mailing list