[Jboss-cvs] JBossAS SVN: r56509 - in projects/microcontainer/trunk: . deployers deployers/src deployers/src/etc deployers/src/main deployers/src/main/org deployers/src/main/org/jboss deployers/src/main/org/jboss/deployers deployers/src/main/org/jboss/deployers/plugins deployers/src/main/org/jboss/deployers/plugins/deployer deployers/src/main/org/jboss/deployers/plugins/deployment deployers/src/main/org/jboss/deployers/plugins/structure deployers/src/main/org/jboss/deployers/plugins/structure/vfs deployers/src/main/org/jboss/deployers/spi deployers/src/main/org/jboss/deployers/spi/deployement deployers/src/main/org/jboss/deployers/spi/deployer deployers/src/main/org/jboss/deployers/spi/structure deployers/src/main/org/jboss/deployers/spi/structure/vfs deployers/src/resources deployers/src/resources/tests deployers/src/resources/tests/structure deployers/src/resources/tests/structure/jar deployers/src/resources/tests/structure/jar/nested deployers/src/resources/tests/structure/j! ar/simple deployers/src/tests deployers/src/tests/org deployers/src/tests/org/jboss deployers/src/tests/org/jboss/test deployers/src/tests/org/jboss/test/deployers deployers/src/tests/org/jboss/test/deployers/structure deployers/src/tests/org/jboss/test/deployers/structure/jar deployers/src/tests/org/jboss/test/deployers/structure/jar/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 1 11:58:15 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-01 11:58:03 -0400 (Fri, 01 Sep 2006)
New Revision: 56509

Added:
   projects/microcontainer/trunk/deployers/
   projects/microcontainer/trunk/deployers/.classpath
   projects/microcontainer/trunk/deployers/.cvsignore
   projects/microcontainer/trunk/deployers/.project
   projects/microcontainer/trunk/deployers/build-test.xml
   projects/microcontainer/trunk/deployers/build.bat
   projects/microcontainer/trunk/deployers/build.sh
   projects/microcontainer/trunk/deployers/build.xml
   projects/microcontainer/trunk/deployers/src/
   projects/microcontainer/trunk/deployers/src/etc/
   projects/microcontainer/trunk/deployers/src/etc/default.mf
   projects/microcontainer/trunk/deployers/src/main/
   projects/microcontainer/trunk/deployers/src/main/org/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/DeployerWrapper.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractVFSDeploymentContext.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/JARStructure.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/StructureDeployerWrapper.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/DeploymentException.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployement/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployement/MainDeployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/Deployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/DeploymentUnit.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentState.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/StructureDetermined.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/StructureDeployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/VFSDeploymentContext.java
   projects/microcontainer/trunk/deployers/src/resources/
   projects/microcontainer/trunk/deployers/src/resources/tests/
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.jar
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.zip
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.jar
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.zip
   projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/simple.txt
   projects/microcontainer/trunk/deployers/src/tests/
   projects/microcontainer/trunk/deployers/src/tests/org/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/BaseDeployersTest.java
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/DependencyAllTestSuite.java
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/StructureTestSuite.java
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/
   projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/JARStructureUnitTestCase.java
Log:
Incomplete refactoring of the deployers

Added: projects/microcontainer/trunk/deployers/.classpath
===================================================================
--- projects/microcontainer/trunk/deployers/.classpath	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/.classpath	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main"/>
+	<classpathentry kind="src" path="src/tests"/>
+	<classpathentry kind="lib" path="src/resources/tests"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common/lib/jboss-common.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/container"/>
+	<classpathentry kind="output" path="output/eclipse-classes"/>
+</classpath>

Added: projects/microcontainer/trunk/deployers/.cvsignore
===================================================================
--- projects/microcontainer/trunk/deployers/.cvsignore	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/.cvsignore	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,2 @@
+output
+build.log

Added: projects/microcontainer/trunk/deployers/.project
===================================================================
--- projects/microcontainer/trunk/deployers/.project	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/.project	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>deployers</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/build-test.xml
===================================================================
--- projects/microcontainer/trunk/deployers/build-test.xml	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/build-test.xml	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+   <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+   <!ENTITY libraries  SYSTEM "../thirdparty/libraries.ent">
+   <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
+]>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build-test.xml 55339 2006-08-05 15:16:29 +0000 (Sat, 05 Aug 2006) adrian at jboss.org $ -->
+
+<project default="main" name="JBoss/Deployers Tests">
+
+  <!-- ================================================================== -->
+  <!-- Setup                                                              -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Include the common Buildmagic elements.
+     |
+     | This defines several different targets, properties and paths.
+     | It also sets up the basic extention tasks amoung other things.
+   -->
+
+  &buildmagic;
+
+  <!--
+     | Include the normal targets.
+   -->
+  &targets;
+
+  <!-- ================================================================== -->
+  <!-- Configuration                                                      -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Configure the build system.
+     |
+     | This target is invoked by the Buildmagic initialization logic and
+     | should contain module specific configuration elements.
+   -->
+
+  <target name="configure" unless="configure.disable">
+
+    <!-- =================== -->
+    <!-- Basic Configuration -->
+    <!-- =================== -->
+
+    <!-- Module name(s) & version -->
+    <property name="module.name" value="deployers"/>
+    <property name="module.Name" value="JBoss Deployers"/>
+    <property name="module.version" value="DEV"/>
+    <property name="jar.prefix" value="jboss-${module.name}-test"/>
+
+    <!-- ========= -->
+    <!-- Libraries -->
+    <!-- ========= -->
+
+    &libraries;
+
+    <!-- The combined library classpath -->
+    <path id="library.classpath">
+      <path refid="jboss.common.classpath"/>
+      <path refid="jboss.container.classpath"/>
+      <path refid="junit.junit.classpath"/>
+      <path refid="apache.log4j.classpath"/>
+      <path refid="jboss.test.classpath"/>
+    </path>
+
+    <!-- ======= -->
+    <!-- Modules -->
+    <!-- ======= -->
+
+<!-- this -->
+<property name="jboss.this.root" value="${module.root}/output"/>
+<property name="jboss.this.lib" value="${jboss.this.root}/lib"/>
+<path id="jboss.this.classpath">
+   <fileset dir="${jboss.this.lib}">
+      <include name="*.jar"/>
+      <exclude name="${jar.prefix}.jar"/>
+   </fileset>
+</path>
+<!-- container -->
+<property name="jboss.container.root" value="${project.root}/container"/>
+<property name="jboss.container.lib" value="${jboss.container.root}/output/lib"/>
+<path id="jboss.container.classpath">
+   <fileset dir="${jboss.container.lib}">
+      <include name="jboss-container.jar"/>
+   </fileset>
+</path>
+
+    <!-- The combined dependant module classpath -->
+    <path id="dependentmodule.classpath">
+      <path refid="jboss.this.classpath"/>
+    </path>
+
+    <!-- ===== -->
+    <!-- Tasks -->
+    <!-- ===== -->
+
+   <property name="source.java" value="${module.source}/tests"/>
+   <property name="javac.target" value="1.5"/>
+   <property name="javac.source" value="1.5"/>
+   <property name="build.classes" value="${module.output}/classes-tests"/>
+   <property name="build.testlog" value="${module.output}/log"/>
+   <property name="build-bypass.disabled" value="true"/>
+
+   <call target="_default:task-init"/>
+
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Compile                                                            -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Compile everything.
+     |
+     | This target should depend on other compile-* targets for each
+     | different type of compile that needs to be performed, short of
+     | documentation compiles.
+   -->
+
+  <target name="compile"
+	  description="Compile all source files."
+	  depends="_default:compile-classes"
+  />
+
+  <!-- ================================================================== -->
+  <!-- Archives                                                           -->
+  <!-- ================================================================== -->
+
+  <!--
+     |  Build all jar files.
+    -->
+  <target name="module-jars" depends="init">
+
+    <jar jarfile="${build.lib}/jboss-deployers-test.jar" manifest="${build.etc}/default.mf">
+      <fileset dir="${build.classes}"/>
+    </jar>
+
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Tests                                                              -->
+  <!-- ================================================================== -->
+
+   <target name="tests" depends="most"
+      description="Execute all tests in the given test directory.">
+      <mkdir dir="${build.reports}"/>
+      <mkdir dir="${build.testlog}"/>
+      <delete file="${build.testlog}/test.log"/>
+      <junit dir="${module.output}"
+         printsummary="yes"
+         haltonerror="false"
+         haltonfailure="false"
+         fork="true">
+
+         <sysproperty key="build.testlog" value="${build.testlog}"/>
+
+         <classpath>
+            <pathelement location="${build.classes}"/>
+            <pathelement location="${build.resources}/tests"/>
+            <path refid="javac.classpath"/>
+            <path refid="apache.xerces.classpath"/>
+         </classpath>
+
+         <formatter type="plain" usefile="true"/>
+         <formatter type="xml" usefile="true"/>
+
+         <batchtest todir="${build.reports}"
+            haltonerror="false"
+            haltonfailure="false"
+            fork="true">
+
+            <fileset dir="${build.classes}">
+               <include name="org/jboss/test/**/*TestCase.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>
+
+   <target name="one-test" depends="init"
+      description="Execute all tests in the given test directory.">
+      <mkdir dir="${build.reports}"/>
+      <mkdir dir="${build.testlog}"/>
+      <delete file="${build.testlog}/test.log"/>
+      <junit dir="${module.output}"
+         printsummary="yes"
+         haltonerror="false"
+         haltonfailure="false"
+         fork="true">
+
+         <sysproperty key="build.testlog" value="${build.testlog}"/>
+
+         <classpath>
+            <pathelement location="${build.classes}"/>
+            <pathelement location="${build.resources}/tests"/>
+            <path refid="javac.classpath"/>
+            <path refid="apache.xerces.classpath"/>
+         </classpath>
+
+         <formatter type="plain" usefile="true"/>
+         <formatter type="xml" usefile="true"/>
+
+         <test todir="${build.reports}" name="${test}"
+               haltonerror="${junit.batchtest.haltonerror}"
+               haltonfailure="${junit.batchtest.haltonfailure}"
+               fork="${junit.batchtest.fork}"/>
+      </junit>
+   </target>
+
+</project>

Added: projects/microcontainer/trunk/deployers/build.bat
===================================================================
--- projects/microcontainer/trunk/deployers/build.bat	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/build.bat	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,89 @@
+ at echo off
+REM  ======================================================================
+REM
+REM  This is the main entry point for the build system.
+REM
+REM  Users should be sure to execute this file rather than 'ant' to ensure
+REM  the correct version is being used with the correct configuration.
+REM
+REM  ======================================================================
+REM
+REM $Id: build.bat 31497 2005-05-24 18:47:10 +0200 (Tue, 24 May 2005) adrian $
+REM
+REM Authors:
+REM     Jason Dillon <jason at planet57.com>
+REM     Sacha Labourey <sacha.labourey at cogito-info.ch>
+REM
+
+REM ******************************************************
+REM Ignore the ANT_HOME variable: we want to use *our*
+REM ANT version and associated JARs.
+REM ******************************************************
+REM Ignore the users classpath, cause it might mess
+REM things up
+REM ******************************************************
+
+SETLOCAL
+
+set CLASSPATH=
+set ANT_HOME=
+set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Dbuild.script=build.bat
+
+REM ******************************************************
+REM - "for" loops have been unrolled for compatibility
+REM   with some WIN32 systems.
+REM ******************************************************
+
+set NAMES=tools;tools\ant;tools\apache\ant
+set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
+
+REM ******************************************************
+REM ******************************************************
+
+SET EXECUTED=FALSE
+for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6
+
+goto :EOF
+
+
+REM ******************************************************
+REM ********* Search for names in the subfolders *********
+REM ******************************************************
+
+:subLoop
+for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************ Test if ANT Batch file exists ***********
+REM ******************************************************
+
+:testIfExists
+if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************** Batch file has been found *************
+REM ******************************************************
+
+:BatchFound
+if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
+set EXECUTED=TRUE
+
+goto :EOF
+
+REM ******************************************************
+REM ************* Execute Batch file only once ***********
+REM ******************************************************
+
+:ExecuteBatch
+echo Calling %1 %2 %3 %4 %5 %6 %7 %8
+call %1 %2 %3 %4 %5 %6 %7 %8
+
+:end
+
+if "%NOPAUSE%" == "" pause


Property changes on: projects/microcontainer/trunk/deployers/build.bat
___________________________________________________________________
Name: svn:executable
   + 

Added: projects/microcontainer/trunk/deployers/build.sh
===================================================================
--- projects/microcontainer/trunk/deployers/build.sh	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/build.sh	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,172 @@
+#!/bin/sh
+### ====================================================================== ###
+##                                                                          ##
+##  This is the main entry point for the build system.                      ##
+##                                                                          ##
+##  Users should be sure to execute this file rather than 'ant' to ensure   ##
+##  the correct version is being used with the correct configuration.       ##
+##                                                                          ##
+### ====================================================================== ###
+
+# $Id: build.sh 31497 2005-05-24 18:47:10 +0200 (Tue, 24 May 2005) adrian $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+GREP="grep"
+ROOT="/"
+
+# Ignore user's ANT_HOME if it is set
+ANT_HOME=""
+
+# the default search path for ant
+ANT_SEARCH_PATH="\
+    tools
+    tools/ant \
+    tools/apache/ant \
+    ant"
+
+# the default build file name
+ANT_BUILD_FILE="build.xml"
+
+# the default arguments
+ANT_OPTIONS="-find $ANT_BUILD_FILE"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+case "`uname`" in
+    CYGWIN*)
+        cygwin=true
+        ;;
+
+    Darwin*)
+        darwin=true
+        ;;
+esac
+
+#
+# Helper to complain.
+#
+die() {
+    echo "${PROGNAME}: $*"
+    exit 1
+}
+
+#
+# Helper to complain.
+#
+warn() {
+    echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to source a file if it exists.
+#
+maybe_source() {
+    for file in $*; do
+	if [ -f "$file" ]; then
+	    . $file
+	fi
+    done
+}
+
+search() {
+    search="$*"
+    for d in $search; do
+	ANT_HOME="`pwd`/$d"
+	ANT="$ANT_HOME/bin/ant"
+	if [ -x "$ANT" ]; then
+	    # found one
+	    echo $ANT_HOME
+	    break
+	fi
+    done
+}
+
+#
+# Main function.
+#
+main() {
+    # if there is a build config file. then source it
+    maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
+
+    # Increase the maximum file descriptors if we can
+    if [ $cygwin = "false" ]; then
+	MAX_FD_LIMIT=`ulimit -H -n`
+	if [ $? -eq 0 ]; then
+	    if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+		# use the system max
+		MAX_FD="$MAX_FD_LIMIT"
+	    fi
+
+	    ulimit -n $MAX_FD
+	    if [ $? -ne 0 ]; then
+		warn "Could not set maximum file descriptor limit: $MAX_FD"
+	    fi
+	else
+	    warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+	fi
+    fi
+
+    # try the search path
+    ANT_HOME=`search $ANT_SEARCH_PATH`
+
+    # try looking up to root
+    if [ "x$ANT_HOME" = "x" ]; then
+	target="build"
+	_cwd=`pwd`
+
+	while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
+	    cd ..
+	    cwd=`pwd`
+	    ANT_HOME=`search $ANT_SEARCH_PATH`
+	done
+
+	# make sure we get back
+	cd $_cwd
+
+	if [ "$cwd" != "$ROOT" ]; then
+	    found="true"
+	fi
+
+	# complain if we did not find anything
+	if [ "$found" != "true" ]; then
+	    die "Could not locate Ant; check \$ANT or \$ANT_HOME."
+	fi
+    fi
+
+    # make sure we have one
+    ANT=$ANT_HOME/bin/ant
+    if [ ! -x "$ANT" ]; then
+	die "Ant file is not executable: $ANT"
+    fi
+
+    # need to specify planet57/buildmagic protocol handler package
+    ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
+
+    # setup some build properties
+    ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
+
+    # change to the directory where the script lives so users are not forced
+    # to be in the same directory as build.xml
+    cd $DIRNAME
+
+    # export some stuff for ant
+    export ANT ANT_HOME ANT_OPTS
+
+    # execute in debug mode, or simply execute
+    if [ "x$ANT_DEBUG" != "x" ]; then
+	/bin/sh -x $ANT $ANT_OPTIONS "$@"
+    else
+	exec $ANT $ANT_OPTIONS "$@"
+    fi
+}
+
+##
+## Bootstrap
+##
+
+main "$@"


Property changes on: projects/microcontainer/trunk/deployers/build.sh
___________________________________________________________________
Name: svn:executable
   + 

Added: projects/microcontainer/trunk/deployers/build.xml
===================================================================
--- projects/microcontainer/trunk/deployers/build.xml	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/build.xml	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+   <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+   <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+   <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
+]>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build.xml 55205 2006-08-04 16:46:15 +0000 (Fri, 04 Aug 2006) kabir.khan at jboss.com $ -->
+
+<project default="main" name="JBoss/Deployers">
+
+  <!-- ================================================================== -->
+  <!-- Setup                                                              -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Include the common Buildmagic elements.
+     |
+     | This defines several different targets, properties and paths.
+     | It also sets up the basic extention tasks amoung other things.
+   -->
+
+  &buildmagic;
+
+  <!--
+     | Include the normal targets.
+   -->
+  &targets;
+
+  <!-- ================================================================== -->
+  <!-- Configuration                                                      -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Configure the build system.
+     |
+     | This target is invoked by the Buildmagic initialization logic and
+     | should contain module specific configuration elements.
+   -->
+
+  <target name="configure" unless="configure.disable">
+
+    <!-- =================== -->
+    <!-- Basic Configuration -->
+    <!-- =================== -->
+
+    <!-- Module name(s) & version -->
+    <property name="module.name" value="deployers"/>
+    <property name="module.Name" value="JBoss Deployers"/>
+    <property name="module.version" value="DEV"/>
+
+    <!-- ========= -->
+    <!-- Libraries -->
+    <!-- ========= -->
+
+    &libraries;
+<!-- container -->
+<property name="jboss.container.root" value="${project.root}/container"/>
+<property name="jboss.container.lib" value="${jboss.container.root}/output/lib"/>
+<path id="jboss.container.classpath">
+   <fileset dir="${jboss.container.lib}">
+      <include name="jboss-container.jar"/>
+   </fileset>
+</path>
+
+    <!-- The combined library classpath -->
+    <path id="library.classpath">
+      <path refid="jboss.common.classpath"/>
+      <path refid="jboss.container.classpath"/>
+    </path>
+
+    <!-- The combined dependant module classpath -->
+    <path id="dependentmodule.classpath">
+    </path>
+     
+    <!-- ===== -->
+    <!-- Tasks -->
+    <!-- ===== -->
+
+    <property name="jar.prefix" value="jboss-${module.name}"/>
+    <property name="javac.target" value="1.5"/>
+    <property name="javac.source" value="1.5"/>
+
+    <call target="_default:task-init"/>
+
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Compile                                                            -->
+  <!-- ================================================================== -->
+
+  <!--
+     | Compile everything.
+     |
+     | This target should depend on other compile-* targets for each
+     | different type of compile that needs to be performed, short of
+     | documentation compiles.
+   -->
+
+  <target name="compile"
+	  description="Compile all source files."
+	  depends="_default:compile-classes,
+	           _default:compile-resources,
+              _default:compile-etc"
+  />
+   
+  <!-- ================================================================== -->
+  <!-- Archives                                                           -->
+  <!-- ================================================================== -->
+
+  <!-- 
+     |  Build all jar files.
+    -->
+  <target name="module-jars" depends="init">
+    
+    <jar jarfile="${build.lib}/${jar.prefix}.jar" manifest="${build.etc}/default.mf">
+      <fileset dir="${build.classes}"/>
+    </jar>
+  </target>
+
+</project>

Added: projects/microcontainer/trunk/deployers/src/etc/default.mf
===================================================================
--- projects/microcontainer/trunk/deployers/src/etc/default.mf	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/etc/default.mf	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeployer.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeployer.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -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.deployers.plugins.deployer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+
+/**
+ * AbstractDeployer.<p>
+ * 
+ * We don't care about the order by default.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractDeployer implements Deployer
+{
+   public boolean isRelevant(DeploymentUnit unit)
+   {
+      return true;
+   }
+
+   public int getRelativeOrder()
+   {
+      return Integer.MAX_VALUE;
+   }
+
+   public abstract void deploy(DeploymentUnit unit) throws DeploymentException;
+
+   public abstract void undeploy(DeploymentUnit unit);
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,75 @@
+/*
+* 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.plugins.deployer;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+
+/**
+ * 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>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentUnit implements DeploymentUnit
+{
+   /** The deployment context */
+   private DeploymentContext deploymentContext;
+
+   /**
+    * Create a new AbstractDeploymentUnit.
+    * 
+    * @param deploymentContext the 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 ClassLoader getClassLoader()
+   {
+      return deploymentContext.getClassLoader();
+   }
+
+   public URL getMetaData(String name)
+   {
+      return deploymentContext.getMetaData(name);
+   }
+
+   public InputStream getMetaDataAsStream(String name)
+   {
+      return deploymentContext.getMetaDataAsStream(name);
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/DeployerWrapper.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/DeployerWrapper.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/DeployerWrapper.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,127 @@
+/*
+* 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.plugins.deployer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.logging.Logger;
+
+/**
+ * DeployerWrapper.<p>
+ * 
+ * To avoid any problems with error handling by the deployers.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeployerWrapper implements Deployer
+{
+   /** The log */
+   private Logger log; 
+   
+   /** The deployer */
+   private Deployer deployer;
+   
+   /**
+    * Create a new DeployerWrapper.
+    * 
+    * @param deployer the deployer
+    */
+   public DeployerWrapper(Deployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      this.deployer = deployer;
+      this.log = Logger.getLogger(deployer.getClass());
+   }
+   
+   public boolean isRelevant(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null unit");
+
+      try
+      {
+         boolean result = deployer.isRelevant(unit);
+         if (log.isTraceEnabled())
+            log.trace("isRelevant " + unit.getName() + " result=" + result);
+         return result;
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during isRelevant: " + unit.getName(), t);
+         return false;
+      }
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null unit");
+
+      try
+      {
+         log.debug("Deploying: " + unit.getName());
+         deployer.deploy(unit);
+         log.debug("Deployed:  " + unit.getName());
+      }
+      catch (Throwable t)
+      {
+         log.error("Error during deploy: " + unit.getName(), t);
+         throw DeploymentException.rethrowAsDeploymentException("Error during deploy: " + unit.getName(), t);
+      }
+   }
+
+   public void undeploy(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null unit");
+      try
+      {
+         log.debug("Undeploying: " + unit.getName());
+         deployer.undeploy(unit);
+         log.debug("Undeployed:  " + unit.getName());
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during undeploy: " + unit.getName(), t);
+      }
+   }
+   
+   public int getRelativeOrder()
+   {
+      return deployer.getRelativeOrder();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      return deployer.equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return deployer.hashCode();
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,396 @@
+/*
+* 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.plugins.deployment;
+
+import static org.jboss.deployers.spi.structure.DeploymentState.DEPLOYED;
+import static org.jboss.deployers.spi.structure.DeploymentState.DEPLOYING;
+import static org.jboss.deployers.spi.structure.DeploymentState.ERROR;
+import static org.jboss.deployers.spi.structure.DeploymentState.UNDEPLOYED;
+import static org.jboss.deployers.spi.structure.DeploymentState.UNDEPLOYING;
+import static org.jboss.deployers.spi.structure.StructureDetermined.NO;
+import static org.jboss.deployers.spi.structure.StructureDetermined.PREDETERMINED;
+import static org.jboss.deployers.spi.structure.StructureDetermined.YES;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.jboss.deployers.plugins.deployer.AbstractDeploymentUnit;
+import org.jboss.deployers.plugins.deployer.DeployerWrapper;
+import org.jboss.deployers.plugins.structure.vfs.StructureDeployerWrapper;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployement.MainDeployer;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.structure.vfs.StructureDeployer;
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.logging.Logger;
+
+/**
+ * MainDeployerImpl.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class MainDeployerImpl implements MainDeployer
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(MainDeployerImpl.class);
+   
+   /** Whether we are shutdown */
+   private AtomicBoolean shutdown = new AtomicBoolean(false);
+   
+   /** The structure deployers */
+   private SortedSet<StructureDeployer> structureDeployers = new TreeSet<StructureDeployer>(StructureDeployer.COMPARATOR);
+
+   /** The deployers */
+   private SortedSet<Deployer> deployers = new TreeSet<Deployer>(Deployer.COMPARATOR);
+   
+   /** The deployments by name */
+   private Map<String, DeploymentContext> topLevelDeployments = new ConcurrentHashMap<String, DeploymentContext>();
+
+   /** The undeploy work */
+   private Set<DeploymentContext> undeploy = new CopyOnWriteArraySet<DeploymentContext>();
+   
+   /** The deploy work */
+   private Set<DeploymentContext> deploy = new CopyOnWriteArraySet<DeploymentContext>();
+   
+   /**
+    * Add a structure deployer
+    * 
+    * @param deployer the deployer
+    */
+   public synchronized void addStructureDeployer(StructureDeployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      StructureDeployerWrapper wrapper = new StructureDeployerWrapper(deployer);
+      structureDeployers.add(wrapper);
+      // TODO recheck failed deployments
+   }
+   
+   /**
+    * Remove a structure deployer
+    * 
+    * @param deployer the deployer
+    */
+   public synchronized void removeStructureDeployer(StructureDeployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      structureDeployers.remove(deployer);
+   }
+   
+   /**
+    * Add a deployer
+    * 
+    * @param deployer the deployer
+    */
+   public synchronized void addDeployer(Deployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      DeployerWrapper wrapper = new DeployerWrapper(deployer);
+      deployers.add(wrapper);
+      // TODO process existing deployments
+   }
+   
+   /**
+    * Remove a deployer
+    * 
+    * @param deployer the deployer
+    */
+   public synchronized void removeDeployer(Deployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      deployers.remove(deployer);
+      // TODO unprocess existing deployments
+   }
+
+   public DeploymentContext getDeploymentContext(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      return topLevelDeployments.get(name);
+   }
+   
+   public synchronized void addDeploymentContext(DeploymentContext context) throws DeploymentException
+   {
+      if (context == null)
+         throw new DeploymentException("Null context");
+      
+      if (shutdown.get())
+         throw new DeploymentException("The main deployer is shutdown");
+
+      if (context.isTopLevel() == false)
+         throw new DeploymentException("Context is not a top level deployment: " + context.getName());
+      
+      context = context.clone();
+
+      if (context.getStructureDetermined() == YES)
+         context.setStructureDetermined(NO);
+      context.setProblem(null);
+      
+      String name = context.getName();
+      DeploymentContext previous = topLevelDeployments.get(name);
+      if (previous != null)
+      {
+         log.debug("Removing previous deployment: " + previous.getName());
+         removeContext(previous);
+      }
+
+      topLevelDeployments.put(name, context);
+      try
+      {
+         determineStructure(context);
+      }
+      catch (Throwable t)
+      {
+         log.error("Unable to determine structure of deployment: " + name, t);
+         context.setState(ERROR);
+         context.setProblem(t);
+      }
+      
+      addContext(context);
+
+      if (context.getProblem() == null)
+      {
+         Set<DeploymentContext> children = context.getChildren();
+         if (children != null)
+         {
+            for (DeploymentContext child : children)
+               addContext(child);
+         }
+      }
+   }
+
+   public synchronized boolean removeDeploymentContext(String name) throws DeploymentException
+   {
+      if (name == null)
+         throw new DeploymentException("Null name");
+
+      if (shutdown.get())
+         throw new IllegalStateException("The main deployer is shutdown");
+      
+      DeploymentContext context = topLevelDeployments.remove(name);
+      if (context == null)
+         return false;
+      
+      removeContext(context);
+      return true;
+   }
+
+   public void process()
+   {
+      if (shutdown.get())
+         throw new IllegalStateException("The main deployer is shutdown");
+
+      Set<DeploymentContext> undeployContexts = null;
+      Set<DeploymentContext> deployContexts = null;
+      Deployer[] theDeployers;
+      synchronized (this)
+      {
+         if (deployers.isEmpty())
+            throw new IllegalStateException("No deployers");
+         if (undeploy.isEmpty() == false)
+         {
+            undeployContexts = new HashSet<DeploymentContext>(undeploy);
+            undeploy.clear();
+         }
+         if (deploy.isEmpty() == false)
+         {
+            deployContexts = new HashSet<DeploymentContext>(deploy);
+            deploy.clear();
+         }
+         theDeployers = deployers.toArray(new Deployer[deployers.size()]); 
+      }
+      
+      if (undeployContexts != null)
+      {
+         for (int i = theDeployers.length-1; i >= 0; --i)
+         {
+            Deployer deployer = theDeployers[i];
+            for (DeploymentContext context : undeployContexts)
+            {
+               DeploymentUnit unit = context.getDeploymentUnit();
+               deployer.undeploy(unit);
+            }
+         }
+         for (DeploymentContext context : undeployContexts)
+            context.setState(UNDEPLOYED);
+      }
+      
+      if (deployContexts != null)
+      {
+         for (int i = 0; i < theDeployers.length; ++i)
+         {
+            Deployer deployer = theDeployers[i];
+
+            Set<DeploymentContext> errors = new HashSet<DeploymentContext>();
+            for (DeploymentContext context : deployContexts)
+            {
+               DeploymentUnit unit = context.getDeploymentUnit();
+               try
+               {
+                  deployer.deploy(unit);
+               }
+               catch (DeploymentException e)
+               {
+                  context.setState(ERROR);
+                  context.setProblem(e);
+                  errors.add(context);
+                  // Unwind the deployment
+                  for (int j = i-1; j >= 0; --j)
+                  {
+                     Deployer other = theDeployers[j];
+                     other.undeploy(unit);
+                  }
+               }
+            }
+            deployContexts.removeAll(errors);
+         }
+         for (DeploymentContext context : undeployContexts)
+            context.setState(DEPLOYED);
+      }
+   }
+
+   public void shutdown()
+   {
+      while (topLevelDeployments.isEmpty() == false)
+      {
+         // Remove all the contexts
+         for (DeploymentContext context : topLevelDeployments.values())
+            removeContext(context);
+         
+         // Do it
+         process();
+      }
+      
+      shutdown.set(true);
+   }
+
+   /**
+    * Determine the deployment structure
+    * 
+    * @param context the context
+    */
+   private void determineStructure(DeploymentContext context) throws DeploymentException
+   {
+      if (context.getStructureDetermined() == PREDETERMINED)
+         return;
+
+      if (context instanceof VFSDeploymentContext == false)
+         throw new DeploymentException("Unable to determine structure for non VFSDeploymentContext " + context.getName());
+      
+      VFSDeploymentContext vfsContext = (VFSDeploymentContext) context;
+      
+      StructureDeployer[] theDeployers;
+      synchronized (this)
+      {
+         if (structureDeployers.isEmpty())
+            throw new IllegalStateException("No structure deployers");
+         theDeployers = structureDeployers.toArray(new StructureDeployer[structureDeployers.size()]);
+      }
+
+      determineStructure(vfsContext, theDeployers);
+   }
+   
+   /**
+    * Determine the structure
+    * 
+    * @param context the context
+    * @param theDeployers the deployers
+    * @return true when determined
+    * @throws DeploymentException for any problem
+    */
+   private boolean determineStructure(VFSDeploymentContext context, StructureDeployer[] theDeployers) throws DeploymentException
+   {
+      boolean result = false;
+      for (StructureDeployer deployer : theDeployers)
+      {
+         if (deployer.determineStructure(context))
+         {
+            result = true;
+            break;
+         }
+      }
+      if (result == false && context.isCandidate() == false)
+         throw new DeploymentException("No structural deployment recognised the deployment. " + context.getName());
+      
+      Set<DeploymentContext> children = context.getChildren();
+      for (DeploymentContext child : children)
+      {
+         if (child instanceof VFSDeploymentContext == false)
+            throw new DeploymentException("Unable to determine structure for non VFSDeploymentContext: " + context.getName());
+         
+         VFSDeploymentContext childContext = (VFSDeploymentContext) child;
+         
+         // This must be a candidate that doesn't match
+         if (determineStructure(childContext, theDeployers) == false)
+            children.remove(child);
+      }
+      
+      return result;
+   }
+   
+   /**
+    * Add a context
+    * 
+    * @param context the context
+    */
+   private void addContext(DeploymentContext context)
+   {
+      if (context.getState() == ERROR)
+      {
+         log.debug("Not scheduling addition of context already in error: " + context.getName());
+         return;
+      }
+      context.setDeploymentUnit(new AbstractDeploymentUnit(context));
+      context.setState(DEPLOYING);
+      log.debug("Scheduling deployment: " + context.getName());
+      deploy.add(context);
+   }
+   
+   /**
+    * Remove a context
+    * 
+    * @param context the context
+    */
+   private void removeContext(DeploymentContext context)
+   {
+      if (context.getState() == ERROR)
+      {
+         log.debug("Not scheduling removal of context already in error: " + context.getName());
+         return;
+      }
+      context.setState(UNDEPLOYING);
+      log.debug("Scheduling undeployment: " + context.getName());
+      undeploy.add(context);
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,260 @@
+/*
+* 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.plugins.structure;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.structure.DeploymentState;
+import org.jboss.deployers.spi.structure.StructureDetermined;
+import org.jboss.logging.Logger;
+import org.jboss.util.UnreachableStatementException;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * AbstractDeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDeploymentContext implements DeploymentContext
+{
+   /** The log */
+   protected Logger log = Logger.getLogger(getClass());
+   
+   /** The name */
+   private String name;
+
+   /** Whether the structure is determined */
+   private StructureDetermined structureDetermined = StructureDetermined.NO;
+
+   /** The deployment state */
+   private DeploymentState state;
+   
+   /** The deployment unit */
+   private DeploymentUnit unit;
+   
+   /** The meta data location */
+   private VirtualFile metaDataLocation;
+   
+   /** The class loader */
+   private ClassLoader classLoader;
+
+   /** The parent context */
+   private DeploymentContext parent;
+
+   /** The child contexts */
+   private Set<DeploymentContext> children = new CopyOnWriteArraySet<DeploymentContext>();
+   
+   /** Throwable */
+   private Throwable problem;
+
+   /**
+    * Create a new AbstractDeploymentContext.
+    * 
+    * @param name the name
+    */
+   public AbstractDeploymentContext(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+
+   public StructureDetermined getStructureDetermined()
+   {
+      return structureDetermined;
+   }
+
+   public void setStructureDetermined(StructureDetermined determined)
+   {
+      if (determined == null)
+         throw new IllegalArgumentException("Null determined");
+      this.structureDetermined = determined;
+   }
+   
+   public boolean isCandidate()
+   {
+      return false;
+   }
+
+   public DeploymentState getState()
+   {
+      return state;
+   }
+
+   public void setState(DeploymentState state)
+   {
+      this.state = 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 VirtualFile getMetaDataLocation()
+   {
+      return metaDataLocation;
+   }
+
+   public void setMetaDataLocation(VirtualFile location)
+   {
+      this.metaDataLocation = location;
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      if (classLoader == null)
+         throw new IllegalStateException("Attempt to retrieve classloader when it has not been set.");
+      return classLoader;
+   }
+   
+   public void setClassLoader(ClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+   }
+
+   public boolean isTopLevel()
+   {
+      return parent == null;
+   }
+
+   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 Set<DeploymentContext> getChildren()
+   {
+      return Collections.unmodifiableSet(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 Throwable getProblem()
+   {
+      return problem;
+   }
+
+   public void setProblem(Throwable problem)
+   {
+      this.problem = problem;
+   }
+
+   public URL getMetaData(String name)
+   {
+      if (metaDataLocation == null)
+         return null;
+      try
+      {
+         VirtualFile child = metaDataLocation.findChild(name);
+         if (child == null)
+            return null;
+         return child.toURL();
+      }
+      catch (Exception e)
+      {
+         log.debug("Error retrieving meta data: " + name, e);
+         return null;
+      }
+   }
+
+   public InputStream getMetaDataAsStream(String name)
+   {
+      URL url = getMetaData(name);
+      if (url == null)
+         return null;
+      try
+      {
+         return url.openStream();
+      }
+      catch (Exception e)
+      {
+         log.debug("Error retrieving meta data: " + name + " from " + url, e);
+         return null;
+      }
+   }
+   
+   public AbstractDeploymentContext clone()
+   {
+      try
+      {
+         return (AbstractDeploymentContext) super.clone();
+      }
+      catch (CloneNotSupportedException e)
+      {
+         throw new UnreachableStatementException();
+      }
+   }
+   
+   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();
+   }
+   
+   public void dump()
+   {
+      log.trace("TODO: dump");
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,68 @@
+/*
+* 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.plugins.structure.vfs;
+
+import org.jboss.deployers.spi.structure.vfs.StructureDeployer;
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.logging.Logger;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * AbstractStructureDeployer.<p>
+ * 
+ * We don't care about the order by default.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractStructureDeployer implements StructureDeployer
+{
+   /** The log */
+   protected Logger log = Logger.getLogger(getClass());
+
+   public int getRelativeOrder()
+   {
+      return Integer.MAX_VALUE;
+   }
+
+   public abstract boolean determineStructure(VFSDeploymentContext context);
+   
+   /**
+    * Add all children as candidates
+    * 
+    * @param context the context
+    * @param ignoreDirectories whether to ignore directories
+    * @throws Exception for any error
+    */
+   protected void addAllChildren(VFSDeploymentContext context, boolean ignoreDirectories) throws Exception
+   {
+      VirtualFile[] childFiles = context.getRoot().getChildren();
+      for (VirtualFile childFile : childFiles)
+      {
+         if (ignoreDirectories == false || childFile.isDirectory() == false)
+         {
+            AbstractVFSDeploymentContext child = new AbstractVFSDeploymentContext(childFile, true);
+            context.addChild(child);
+         }
+      }
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractVFSDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractVFSDeploymentContext.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractVFSDeploymentContext.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,111 @@
+/*
+* 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.plugins.structure.vfs;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * VFSDeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractVFSDeploymentContext extends AbstractDeploymentContext implements VFSDeploymentContext
+{
+   /** The root */
+   private VirtualFile root;
+
+   /** Whether this is a candidate deployment */
+   private boolean candidate;
+   
+   /**
+    * Get the deployment name
+    * 
+    * @param file the file
+    * @return the name;
+    */
+   public static String getDeploymentName(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      try
+      {
+         return file.toURL().toString();
+      }
+      catch (MalformedURLException e)
+      {
+         throw new IllegalArgumentException("File does not have a valid url: " + file, e);
+      }
+   }
+   
+   /**
+    * Create a new AbstractDeploymentContext.
+    * 
+    * @param root the root
+    */
+   public AbstractVFSDeploymentContext(VirtualFile root)
+   {
+      this(root, false);
+   }
+   
+   /**
+    * Create a new AbstractDeploymentContext.
+    * 
+    * @param root the root
+    * @param candidate whether this is a candidate
+    */
+   public AbstractVFSDeploymentContext(VirtualFile root, boolean candidate)
+   {
+      super(getDeploymentName(root));
+      this.root = root;
+      this.candidate = candidate;
+   }
+
+   public VirtualFile getRoot()
+   {
+      return root;
+   }
+
+   public boolean isCandidate()
+   {
+      return candidate;
+   }
+
+   public void setMetaDataPath(String path)
+   {
+      if (path == null)
+         setMetaDataLocation(null);
+      try
+      {
+         setMetaDataLocation(root.findChild(path));
+      }
+      catch (IOException e)
+      {
+         log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
+      }
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/JARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/JARStructure.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/JARStructure.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,83 @@
+/*
+* 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.plugins.structure.vfs;
+
+import java.io.IOException;
+
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * JARStructure.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARStructure extends AbstractStructureDeployer
+{
+   public boolean determineStructure(VFSDeploymentContext context)
+   {
+      try
+      {
+         VirtualFile file = context.getRoot();
+         if (file.isDirectory())
+         {
+            if (file.isArchive() == false)
+            {
+               // For non top level directories we require a META-INF
+               // otherwise each subdirectory would be a subdeployment
+               if  (context.isTopLevel() == false)
+               {
+                  try
+                  {
+                     VirtualFile test = file.findChild("META-INF");
+                     if (test == null)
+                        return false;
+                  }
+                  catch (IOException e)
+                  {
+                     return false;
+                  }
+               }
+            }
+
+            // The metadata path is META-INF
+            context.setMetaDataPath("META-INF");
+
+            // We tentatively try all the children as potential subdeployments
+            // but ignore subdirectories if it is an archive
+            addAllChildren(context, file.isArchive());
+            
+            return true;
+         }
+         else
+         {
+            return false;
+         }
+      }
+      catch (Exception e)
+      {
+         log.warn("Error determining structure: " + context.getName(), e);
+         return false;
+      }
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/StructureDeployerWrapper.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/StructureDeployerWrapper.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/StructureDeployerWrapper.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,96 @@
+/*
+* 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.plugins.structure.vfs;
+
+import org.jboss.deployers.spi.structure.vfs.StructureDeployer;
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.logging.Logger;
+
+/**
+ * StructureDeployerWrapper.
+ * 
+ * To avoid any problems with error handling by the deployers.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureDeployerWrapper implements StructureDeployer
+{
+   /** The log */
+   private Logger log;
+   
+   /** The structure deployer */
+   private StructureDeployer deployer;   
+
+   /**
+    * Create a new StructureDeployerWrapper.
+    * 
+    * @param deployer the deployer
+    */
+   public StructureDeployerWrapper(StructureDeployer deployer)
+   {
+      if (deployer == null)
+         throw new IllegalArgumentException("Null deployer");
+      this.deployer = deployer;
+   }
+   
+   public boolean determineStructure(VFSDeploymentContext context)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null context");
+      
+      try
+      {
+         boolean result = deployer.determineStructure(context);
+         if (log.isTraceEnabled())
+         {
+            if (result == false)
+               log.trace("Not recognised: " + context.getName());
+            else
+               context.dump();
+         }
+         return result;
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during determineStructure: " + context.getName(), t);
+         return false;
+      }
+   }
+   
+   public int getRelativeOrder()
+   {
+      return deployer.getRelativeOrder();
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      return deployer.equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return deployer.hashCode();
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/DeploymentException.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/DeploymentException.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/DeploymentException.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,101 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi;
+
+/**
+ * DeploymentException.
+ * 
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeploymentException extends Exception
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 4495361010574179178L;
+
+   /**
+    * Rethrow a throwable as a deployment exception if it isn't already.
+    *
+    * @param message the message
+    * @param t the throwable
+    * @return never
+    * @throws DeploymentException always
+    */
+   public static DeploymentException rethrowAsDeploymentException(String message, Throwable t) throws DeploymentException
+   {
+      if (t instanceof DeploymentException)
+         throw (DeploymentException) t;
+      else
+         throw new DeploymentException(message, t);
+   }
+
+   /**
+    * Constructs a <code>DeploymentException</code> with <code>null</code>
+    * as its error detail message.
+    */
+   public DeploymentException()
+   {
+   }
+
+   /**
+    * Constructs a <code>DeploymentException</code> with the specified detail
+    * message. The error message string <code>s</code> can later be
+    * retrieved by the <code>{@link java.lang.Throwable#getMessage}</code>
+    * method of class <code>java.lang.Throwable</code>.
+    * 
+    * @param s the message
+    */
+   public DeploymentException(String s)
+   {
+      super(s);
+   }
+   
+   /**
+    * Constructs a <code>DeploymentException</code> with the specified detail message and
+    * cause.  <p>Note that the detail message associated with
+    * <code>cause</code> is <i>not</i> automatically incorporated in
+    * this exception's detail message.
+    * 
+    * @param s the message
+    * @param cause the underlying cause
+    */   
+   public DeploymentException(String s, Throwable cause)
+   {
+      super(s, cause);
+   }
+   
+   /**
+     * Constructs a <code>DeploymentException</code> with the specified cause and a detail
+     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+     * typically contains the class and detail message of <tt>cause</tt>).
+     * This constructor is useful for exceptions that are little more than
+     * wrappers for other throwables (for example, {@link
+     * java.security.PrivilegedActionException}).
+     * 
+     * @param cause the underlying cause
+    */
+   public DeploymentException(Throwable cause)
+   {
+      super(cause);
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployement/MainDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployement/MainDeployer.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployement/MainDeployer.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi.deployement;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+
+/**
+ * MainDeployer.<p>
+ * 
+ * The basic contract is to add and remove deployment
+ * contexts then use process method to actually
+ * bring the deployments to required state. 
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MainDeployer
+{
+   /**
+    * Get a deployment context
+    * 
+    * @param name the name
+    * @return the context or null if not found
+    */
+   DeploymentContext getDeploymentContext(String name);
+   
+   /**
+    * Add a deployment context
+    * 
+    * @param context the deployment context
+    * @throws DeploymentException for any error
+    */
+   void addDeploymentContext(DeploymentContext context) throws DeploymentException;
+
+   /**
+    * Remove a deployment context
+    * 
+    * @param name the name of the context
+    * @return false when the context was previously unknown
+    * @throws DeploymentException for any error
+    */
+   boolean removeDeploymentContext(String name) throws DeploymentException;
+
+   /**
+    * Process the outstanding deployments
+    */
+   void process();
+   
+   /**
+    * Shutdown. Removes all the deployments.
+    */
+   void shutdown();
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/Deployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/Deployer.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/Deployer.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi.deployer;
+
+import java.util.Comparator;
+
+import org.jboss.deployers.spi.DeploymentException;
+
+/**
+ * Deployer.
+ * 
+ * TODO contract for redeployment
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Deployer
+{
+   /**
+    * Whether the deployer is relevant for this unit
+    * 
+    * @param unit the unit
+    * @return true when relevant
+    */
+   boolean isRelevant(DeploymentUnit unit);
+   
+   /**
+    * Deploy a deployment
+    * 
+    * @param unit the unit
+    * @throws DeploymentException for any error
+    */
+   void deploy(DeploymentUnit unit) throws DeploymentException;
+
+   /**
+    * Undeploy a deployment
+    * 
+    * @param unit the unit
+    */
+   void undeploy(DeploymentUnit unit);
+
+   /**
+    * Get the relative order
+    * 
+    * @return the relative order
+    */
+   int getRelativeOrder();
+   
+   /** The comparator for relative ordering of deployers */
+   Comparator<Deployer> COMPARATOR = new DeployerComparator();
+   
+   /**
+    * The comparator for relative ordering of deployers
+    */
+   public class DeployerComparator implements Comparator<Deployer>
+   {
+      public int compare(Deployer o1, Deployer o2)
+      {
+         return o1.getRelativeOrder() - o2.getRelativeOrder();
+      }
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/DeploymentUnit.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/DeploymentUnit.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/deployer/DeploymentUnit.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -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.deployers.spi.deployer;
+
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * DeploymentUnit.<p>
+ * 
+ * A deployment unit represents a single unit
+ * that deployers work with.
+ * 
+ * TODO managed object stuff
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentUnit
+{
+   /**
+    * Get the deployment units name
+    * 
+    *  @return the name;
+    */
+   String getName();
+   
+   /**
+    * Gets some metadata for this deployment unit
+    * 
+    * @param name the resource name
+    * @return the url of the metadata or null if not found
+    */
+   URL getMetaData(String name);
+   
+   /**
+    * Gets some metadata as a stream
+    * 
+    * @param name the resource name
+    * @return the stream or null if not found
+    */
+   InputStream getMetaDataAsStream(String name);
+   
+   /**
+    * Gets the classloader for this deployment unit
+    * 
+    * @return the classloader
+    */
+   ClassLoader getClassLoader();
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,207 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi.structure;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Set;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * DeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentContext extends Cloneable
+{
+   /**
+    * Get the deployment name
+    * 
+    * @return the name
+    */
+   String getName();
+
+   /**
+    * Whether the structure is determined
+    * 
+    * @return true when the structure is determined
+    */
+   StructureDetermined getStructureDetermined();
+   
+   /**
+    * Set whether the structure is determined
+    * 
+    * @param determined true when it is determined
+    */
+   void setStructureDetermined(StructureDetermined determined);
+   
+   /**
+    * Whether this deployment context is a candidate deployment context
+    * 
+    * @return true when it is only a candidate
+    */
+   boolean isCandidate();
+   
+   /**
+    * Get the deployment state
+    * 
+    * @return the state
+    */
+   DeploymentState getState();
+   
+   /**
+    * Set the deployment state
+    * 
+    * @param state the state
+    */
+   void setState(DeploymentState state);
+
+   /**
+    * Get the deployment unit
+    * 
+    * @return the deployment
+    */
+   DeploymentUnit getDeploymentUnit();
+
+   /**
+    * Set the deployment unit
+    * 
+    * @param unit the deployment unit
+    */
+   void setDeploymentUnit(DeploymentUnit unit);
+   
+   /**
+    * Get the meta data location
+    * 
+    * @return the meta data location
+    */
+   VirtualFile getMetaDataLocation();
+   
+   /**
+    * Set the meta data location
+    * 
+    * @param location the meta data location
+    */
+   void setMetaDataLocation(VirtualFile location);
+   
+   /**
+    * Gets some metadata for this deployment unit
+    * 
+    * @param name the resource name
+    * @return the url of the metadata or null if not found
+    */
+   URL getMetaData(String name);
+   
+   /**
+    * Gets some metadata as a stream
+    * 
+    * @param name the resource name
+    * @return the stream or null if not found
+    */
+   InputStream getMetaDataAsStream(String name);
+
+   /**
+    * 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);
+
+   /**
+    * Whether this is a top level deployment
+    * 
+    * @return true when top level
+    */
+   boolean isTopLevel();
+   
+   /**
+    * The parent
+    * 
+    * @return the parent
+    */
+   DeploymentContext getParent();
+   
+   /**
+    * Set the parent
+    * 
+    * @param parent the parent
+    */
+   void setParent(DeploymentContext parent);
+   
+   /**
+    * The children
+    * 
+    * @return the children
+    */
+   Set<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);
+   
+   /**
+    * 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);
+   
+   /**
+    * Clone the context
+    * 
+    * @return the cloned context
+    */
+   DeploymentContext clone();
+   
+   /**
+    * A debug method that dumps the context to the log
+    */
+   void dump();
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentState.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentState.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentState.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi.structure;
+
+/**
+ * DeploymentState.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public enum DeploymentState
+{
+   /** Deploy the deployment */
+   DEPLOYING,
+
+   /** Deployed the deployment */
+   DEPLOYED,
+   
+   /** Undeploy the deployment */
+   UNDEPLOYING,
+   
+   /** Undeployed the deployment */
+   UNDEPLOYED,
+   
+   /** Error */
+   ERROR
+}

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

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/StructureDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/StructureDeployer.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/StructureDeployer.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.spi.structure.vfs;
+
+import java.util.Comparator;
+
+/**
+ * StructureDeployer.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StructureDeployer
+{
+   /**
+    * Determine the structure of a deployment
+    * 
+    * @param context the context
+    * @return true when it is recongnised
+    */
+   boolean determineStructure(VFSDeploymentContext context);
+
+   /**
+    * Get the relative order
+    * 
+    * @return the relative order
+    */
+   int getRelativeOrder();
+
+   /** The comparator for relative ordering of deployers */
+   Comparator<StructureDeployer> COMPARATOR = new StructureComparator();
+   
+   /**
+    * The comparator for relative ordering of deployers
+    */
+   public class StructureComparator implements Comparator<StructureDeployer>
+   {
+      public int compare(StructureDeployer o1, StructureDeployer o2)
+      {
+         return o1.getRelativeOrder() - o2.getRelativeOrder();
+      }
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/VFSDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/VFSDeploymentContext.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/vfs/VFSDeploymentContext.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -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.spi.structure.vfs;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * VFSDeploymentContext.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface VFSDeploymentContext extends DeploymentContext
+{
+   /**
+    * Get the root file
+    * 
+    * @return the root
+    */
+   VirtualFile getRoot();
+
+   /**
+    * Set the meta data path relative to the root
+    * 
+    * @param path the path
+    */
+   void setMetaDataPath(String path);
+}

Added: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.jar
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.zip
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/nested/archive.zip
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.jar
===================================================================
--- projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.jar	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.jar	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1 @@
+empty

Added: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.zip
===================================================================
--- projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.zip	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/NotAnArchive.zip	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1 @@
+empty

Added: projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/simple.txt
===================================================================
--- projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/simple.txt	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/resources/tests/structure/jar/simple/simple.txt	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/BaseDeployersTest.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/BaseDeployersTest.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/BaseDeployersTest.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,67 @@
+/*
+* 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 java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.test.BaseTestCase;
+import org.jboss.vfs.VFSFactory;
+import org.jboss.vfs.VFSFactoryLocator;
+import org.jboss.vfs.spi.ReadOnlyVFS;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * BaseDeployersTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class BaseDeployersTest extends BaseTestCase
+{
+   public BaseDeployersTest(String name)
+   {
+      super(name);
+   }
+   
+   protected VirtualFile getVirtualFile(String root, String path) throws Exception
+   {
+      URL url = getResource(root);
+      assertNotNull(url);
+      VFSFactoryLocator locator = new VFSFactoryLocator();
+      VFSFactory factory = locator.getFactory(url);
+      ReadOnlyVFS vfs = factory.getVFS(url);
+      return vfs.resolveFile(path);
+   }
+   
+   protected void assertContexts(Set<String> expected, Set<DeploymentContext> actual) throws Exception
+   {
+      assertNotNull(expected);
+      assertNotNull(actual);
+      Set<String> contextNames = new HashSet<String>(actual.size());
+      for (DeploymentContext context : actual)
+         contextNames.add(context.getName());
+      assertEquals(expected, contextNames);
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/DependencyAllTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/DependencyAllTestSuite.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/DependencyAllTestSuite.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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 org.jboss.test.deployers.structure.StructureTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Deployers All Test Suite.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class DependencyAllTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Deployers All Tests");
+
+      suite.addTest(StructureTestSuite.suite());
+
+      return suite;
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/StructureTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/StructureTestSuite.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/StructureTestSuite.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.structure.jar.test.JARStructureUnitTestCase;
+
+/**
+ * Structure Test Suite.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class StructureTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Structure Tests");
+
+      suite.addTest(JARStructureUnitTestCase.suite());
+
+      return suite;
+   }
+}

Added: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/JARStructureUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/JARStructureUnitTestCase.java	2006-09-01 15:41:49 UTC (rev 56508)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/JARStructureUnitTestCase.java	2006-09-01 15:58:03 UTC (rev 56509)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.jar.test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.structure.vfs.AbstractVFSDeploymentContext;
+import org.jboss.deployers.plugins.structure.vfs.JARStructure;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.structure.vfs.VFSDeploymentContext;
+import org.jboss.test.deployers.BaseDeployersTest;
+import org.jboss.vfs.spi.VirtualFile;
+
+/**
+ * A ChangeAutomaticControllerTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class JARStructureUnitTestCase extends BaseDeployersTest
+{
+   public static Test suite()
+   {
+      return new TestSuite(JARStructureUnitTestCase.class);
+   }
+   
+   public JARStructureUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testSimple() throws Exception
+   {
+      JARStructure structure = new JARStructure();
+      VirtualFile file = getVirtualFile("/structure/", "jar/simple");
+      AbstractVFSDeploymentContext context = new AbstractVFSDeploymentContext(file);
+      assertTrue(structure.determineStructure(context));
+      
+      // Test it got all the candidates
+      Set<String> expected = new HashSet<String>();
+      expected.add(getResource("/structure/jar/simple/NotAnArchive.jar").toString());
+      expected.add(getResource("/structure/jar/simple/NotAnArchive.zip").toString());
+      expected.add(getResource("/structure/jar/simple/simple.txt").toString());
+      assertContexts(expected, context.getChildren());
+      
+      // Test none of the candidates work
+      for (DeploymentContext child : context.getChildren())
+      {
+         VFSDeploymentContext vfsContext = (VFSDeploymentContext) child;
+         assertFalse(structure.determineStructure(vfsContext));
+      }
+   }
+   
+   public void testNested() throws Exception
+   {
+      JARStructure structure = new JARStructure();
+      VirtualFile file = getVirtualFile("/structure/", "jar/nested");
+      AbstractVFSDeploymentContext context = new AbstractVFSDeploymentContext(file);
+      assertTrue(structure.determineStructure(context));
+      
+      // Test it got all the candidates
+      Set<String> expected = new HashSet<String>();
+      expected.add(getResource("/structure/jar/nested/archive.jar").toString());
+      expected.add(getResource("/structure/jar/nested/archive.zip").toString());
+      assertContexts(expected, context.getChildren());
+      
+      // Test all of the candidates work
+      for (DeploymentContext child : context.getChildren())
+      {
+         VFSDeploymentContext vfsContext = (VFSDeploymentContext) child;
+         assertTrue("Should be valid " + child.getName(), structure.determineStructure(vfsContext));
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list