[jboss-svn-commits] JBL Code SVN: r36949 - in labs/jbossesb/workspace/tcunning/as6/product: rosetta and 13 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Apr 18 15:26:15 EDT 2011


Author: tcunning
Date: 2011-04-18 15:26:14 -0400 (Mon, 18 Apr 2011)
New Revision: 36949

Added:
   labs/jbossesb/workspace/tcunning/as6/product/install/esb-deployers-jboss-beans-as6.xml
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivy-build.xml
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivysettings.xml
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConfigParser.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConstants.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployer.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployment.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeploymentMBean.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbMetaData.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/GroupingStructure.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsFileFilter.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsUtil.java
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/ivy.xml
   labs/jbossesb/workspace/tcunning/as6/product/services/jbpm/as6/
   labs/jbossesb/workspace/tcunning/as6/product/services/jbpm/as6/jbpm-identity-3.2.7.jar
Modified:
   labs/jbossesb/workspace/tcunning/as6/product/install/build.xml
   labs/jbossesb/workspace/tcunning/as6/product/rosetta/build.xml
Log:
Commit AS6 deployment work to workspace.


Modified: labs/jbossesb/workspace/tcunning/as6/product/install/build.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/install/build.xml	2011-04-18 18:55:29 UTC (rev 36948)
+++ labs/jbossesb/workspace/tcunning/as6/product/install/build.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -43,6 +43,10 @@
         <property name="wise.includes" value="jaxb-xjc.jar"/>
 
 	<!-- Check for JBossAS5 -->
+    <condition property="jbossas6">
+        <available file="${server.dir}/deployers/weld.deployer"/>
+    </condition>
+
     <condition property="jbossas5">
         <available file="${server.dir}/deployers"/>
     </condition>
@@ -115,7 +119,8 @@
             <copy todir="${plugin.dir}" file="${jopr.plugin.jar}"/>
         </target>
 
-	<target name="deploy" depends="undeploy, internal.deploy, internal.deploy.jbossas5, deploy.console, deploy.bindings, update.modfilter"   description="Wrapper for internal.deploy"/>
+	<target name="deploy" depends="undeploy, internal.deploy, internal.deploy.jbossas5, internal.deploy.jbossas6,
+		deploy.console, deploy.bindings, update.modfilter"   description="Wrapper for internal.deploy"/>
 
 	<target name="check.tomcat.props">
 		<fail unless="org.jboss.esb.tomcat.home" message="Cannot determine target deployment, please check deployment.properties"/>
@@ -420,8 +425,23 @@
 		<delete file="${deploy.dir}/${esbModuleName}/META-INF/deployment.xml" failonerror="false" />
 		<move file="${deploy.dir}/${esbModuleName}/META-INF/deployment.xml.transformed" tofile="${deploy.dir}/${esbModuleName}/META-INF/deployment.xml" />
 	</target>	
+
+    <target name="internal.deploy.jbossas6" if="jbossas6" description="Deploys Internal Services to the JBossAS6">
+	<copy tofile="${deployers.dir}/esb.deployer/META-INF/esb-deployers-jboss-beans.xml" overwrite="true"
+		file="esb-deployers-jboss-beans-as6.xml"/>
+	<copy todir="${deployers.dir}/esb.deployer/lib">
+		<fileset dir="${org.jboss.esb.dist.lib}/ext" includes="jbossts-common.jar"/>
+	</copy>
+	<move file="${deploy.dir}/jbossesb.sar"
+		tofile="${deploy.dir}/jboss-esb.sar"/> 	
+	<!-- Remove old jbpm-identity.jar, replace with the one 
+	     built against hibernate-3.6.0 			-->
+	<delete file="${deploy.dir}/jbpm.esb/jbpm-identity.jar"/>
+	<copy todir="${deploy.dir}/jbpm.esb"
+		file="${basedir}/../services/jbpm/as6/jbpm-identity-3.2.7.jar"/>	
+    </target>
 	
-    <target name="undeploy" depends="check.deploy.props, undeploy.bindings, undeploy.jbossas5" description="Undeploy ESB components.">
+    <target name="undeploy" depends="check.deploy.props, undeploy.bindings, undeploy.jbossas5, undeploy.jbossas6" description="Undeploy ESB components.">
         <delete dir="${deploy.dir}/jbossesb.sar" quiet="true"/>
         <delete dir="${deploy.dir}/jbossesb-registry.sar" quiet="true"/>
         <delete dir="${deploy.dir}/jbossesb.esb" quiet="true"/>
@@ -445,7 +465,7 @@
         </delete>
     </target>
 	
-	<target name="undeploy.jbossas5" if="jbossas5" >
+    <target name="undeploy.jbossas5" if="jbossas5" >
         <delete dir="${server.dir}/deployers/esb.deployer" quiet="true"/>
         <delete quiet="false">
             <fileset dir="${server.lib.dir}" >
@@ -454,6 +474,11 @@
         </delete>
     </target>
 
+    <target name="undeploy.jbossas6" if="jbossas6" >
+        <delete dir="${server.dir}/jboss-esb.sar" quiet="true"/>
+    </target>
+
+
         <property name="org.jboss.esb.tomcat.55lib"
             location="${org.jboss.esb.tomcat.home}/common/lib"/>
         <property name="org.jboss.esb.tomcat.60lib"

Added: labs/jbossesb/workspace/tcunning/as6/product/install/esb-deployers-jboss-beans-as6.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/install/esb-deployers-jboss-beans-as6.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/install/esb-deployers-jboss-beans-as6.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+    
+    <bean name="EsbPropertyService" class="org.jboss.soa.esb.common.JBossESBPropertyService">
+        <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.esb:service=PropertyService", exposedInterface=org.jboss.soa.esb.common.JBossESBPropertyServiceMBean.class, registerDirectly=true)</annotation>
+        <property name="propertyFile">
+            <!-- Use the ServiceBindingManager to process (xslt) jbossesb-properties.xml and set the result to the PropertyFile attribute.-->
+            <value-factory bean="ServiceBindingManager" method="getResourceBinding">
+                <!-- serviceName -->
+                <parameter>EsbPropertyService</parameter>
+                <!-- input -->
+                <parameter>jbossesb-properties.xml</parameter>
+            </value-factory>
+        </property>
+        <property name="propertiesFileDir">${jboss.server.data.dir}</property>
+    </bean>
+
+    <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.as6.GroupingStructure">
+        <property name="shortCircuitFilter">
+            <inject bean="EsbFilter"/>
+        </property>
+        <property name="metaDataPaths">
+            <array elementClass="java.lang.String">
+                <value>META-INF</value>
+                <value>.</value>
+            </array>
+        </property>
+        <property name="libs">
+            <set elementClass="java.lang.String">
+                <value>.</value>
+                <value>jars</value>
+                <value>lib</value>
+            </set>
+        </property>
+        <property name="libFilter">
+            <inject bean="JarFilter"/>
+        </property>
+        <property name="groups">
+            <set elementClass="java.lang.String">
+                <value>.</value>
+                <value>wars</value>
+            </set>
+        </property>
+        <property name="groupFilter">
+            <inject bean="WarFilter"/>
+        </property>
+    </bean>
+	
+	<bean name="EsbConfigParser" class="org.jboss.soa.esb.listeners.deployers.mc.as6.EsbConfigParser">
+		<property name="esbArtifactName">jbossesb</property>
+		<property name="esbDeploymentPrefix">jboss.esb:deployment=</property>
+		<property name="warDeploymentPrefix">jboss.web.deployment:war=</property>
+		<property name="actionArtifactsFile">/actionArtifactMap.properties</property>
+	</bean>
+
+	<bean name="EsbDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.as6.EsbDeployer">
+		<property name="esbBeanPrefix">jboss.esb</property>
+		<property name="mainDeployer"><inject bean="MainDeployer"/></property>
+		<property name="warFilesDir">${jboss.server.temp.dir}</property>
+		<depends>EsbPropertyService</depends>
+	</bean>
+	
+	<bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.as6.util.VfsFileFilter">
+        <constructor>
+            <parameter>.esb</parameter>
+        </constructor>
+    </bean>
+    
+    <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.as6.util.VfsFileFilter">
+        <constructor>
+            <parameter>.jar</parameter>
+        </constructor>
+    </bean>
+    
+    <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.as6.util.VfsFileFilter">
+        <constructor>
+            <parameter>.war</parameter>
+        </constructor>
+    </bean>
+
+</deployment>

Modified: labs/jbossesb/workspace/tcunning/as6/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/build.xml	2011-04-18 18:55:29 UTC (rev 36948)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/build.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <project name="BuildJbossEsbRosetta" default="org.jboss.esb.rosetta.compile" basedir=".">
 
-	<property name="org.jboss.esb.rosetta.jar.name" value="jbossesb-rosetta"/>
-	<property name="org.jboss.esb.registry.jar.name" value="jbossesb-registry"/>
-	<property name="org.jboss.esb.registry.war.name" value="juddiv3.war"/>
-	<property name="org.jboss.esb.rosetta.distrib.dir" location="${org.jboss.esb.internal.dest}/jbossesb"/>
-	<property name="org.jboss.esb.rosetta.classes.dir" location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
+    <property name="org.jboss.esb.rosetta.jar.name" value="jbossesb-rosetta"/>
+    <property name="org.jboss.esb.registry.jar.name" value="jbossesb-registry"/>
+    <property name="org.jboss.esb.registry.war.name" value="juddiv3.war"/>
+    <property name="org.jboss.esb.rosetta.distrib.dir" location="${org.jboss.esb.internal.dest}/jbossesb"/>
+    <property name="org.jboss.esb.rosetta.classes.dir" location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
 
     <property name="uddi.webservices.jar" value="uddi-ws-3.0.4.jar"/>
     <property name="juddi.v3.war" value="juddiv3-3.0.2.war"/>
@@ -17,13 +17,17 @@
     <property name="org.jboss.esb.registry.war.resources.dir" location="${org.jboss.esb.registry.war.dir}/resources"/>
     <property name="org.jboss.esb.registry.war.classes.dir" location="${org.jboss.esb.internal.dest}/classes/registry"/>
 
+    <property name="org.jboss.esb.rosetta.as6.dir" location="deployer-as6"/>
+    <property name="org.jboss.esb.rosetta.as6.build.dir" location="${org.jboss.esb.internal.dest}/as6"/>
+    <property name="org.jboss.esb.rosetta.as6.src.dir" location="${org.jboss.esb.rosetta.as6.dir}/src"/>
+
     <property name="org.jboss.esb.rosetta.src.dir" location="src"/>
-	<property name="org.jboss.esb.root.dir" location="../"/>
-	<property name="gendir" location="${org.jboss.esb.internal.dest}/schema-model" />
-	<property name="schema101.src.dir" location="${gendir}/src" />
-	<property name="schema101.classes.dir" location="${gendir}/classes" />
-	<property name="schema110.src.dir" location="${gendir}/src110" />
-	<property name="schema110.classes.dir" location="${gendir}/classes110" />
+    <property name="org.jboss.esb.root.dir" location="../"/>
+    <property name="gendir" location="${org.jboss.esb.internal.dest}/schema-model" />
+    <property name="schema101.src.dir" location="${gendir}/src" />
+    <property name="schema101.classes.dir" location="${gendir}/classes" />
+    <property name="schema110.src.dir" location="${gendir}/src110" />
+    <property name="schema110.classes.dir" location="${gendir}/classes110" />
     <property name="schema120.src.dir" location="${gendir}/src120" />
     <property name="schema120.classes.dir" location="${gendir}/classes120" />
     <property name="schema130.src.dir" location="${gendir}/src130" />
@@ -31,23 +35,42 @@
     <property environment="env"/>
 
     <property name="org.jboss.esb.lib.dir" location="${org.jboss.esb.internal.dest}/lib"/>
-	<property name="org.jboss.esb.ext.lib.dir" location="${org.jboss.esb.root.dir}/lib/ext"/>
+    <property name="org.jboss.esb.ext.lib.dir" location="${org.jboss.esb.root.dir}/lib/ext"/>
 	
-	<property name="security.jars" value="jboss-security-spi*.jar jbosssx*.jar"/>
+    <property name="security.jars" value="jboss-security-spi*.jar jbosssx*.jar"/>
 
-	<path id="org.jboss.esb.rosetta.base.classpath">
+    <path id="org.jboss.esb.rosetta.base.classpath">
         <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar"/>
         <fileset dir="${org.jboss.esb.ext.lib.dir}/endorsed" includes="jboss-saaj.jar"/>
         <fileset dir="${org.jboss.esb.lib.dir}" includes="${security.jars}"/>
         <fileset dir="${org.jboss.esb.lib.dir}" includes="*.jar" excludes="${security.jars}"/>
         <fileset dir="../../testlib" includes="emma*.jar"/>
         <fileset dir="${org.jboss.esb.ext.lib.dir}/standalone" includes="*.jar"/>
-		<pathelement location="${schema101.classes.dir}"/>
-		<pathelement location="${schema110.classes.dir}"/>
+	<pathelement location="${schema101.classes.dir}"/>
+	<pathelement location="${schema110.classes.dir}"/>
         <pathelement location="${schema120.classes.dir}"/>
         <pathelement location="${schema130.classes.dir}"/>
-	</path>
+    </path>
 
+    <path id="org.jboss.esb.rosetta.as6.classpath">
+        <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar"/>
+        <fileset dir="${org.jboss.esb.ext.lib.dir}/endorsed" includes="jboss-saaj.jar"/>
+	<fileset dir="${org.jboss.esb.rosetta.as6.build.dir}/lib" includes="*.jar"/>
+        <fileset dir="${org.jboss.esb.lib.dir}">
+          <patternset id="as6.jars">
+	    <include name="*.jar"/>
+            <exclude name="*jboss-deployers*"/>
+ 	    <exclude name="*vfs*"/>
+          </patternset>
+	</fileset>
+        <fileset dir="../../testlib" includes="emma*.jar"/>
+        <fileset dir="${org.jboss.esb.ext.lib.dir}/standalone" includes="*.jar"/>
+	<pathelement location="${schema101.classes.dir}"/>
+	<pathelement location="${schema110.classes.dir}"/>
+        <pathelement location="${schema120.classes.dir}"/>
+        <pathelement location="${schema130.classes.dir}"/>
+    </path>
+
     <target name="org.jboss.esb.rosetta.init">
         <tstamp>
             <format property="TODAY" pattern="dd-MM-yy"/>
@@ -65,12 +88,36 @@
     <target name="clean" description="Remove classes directory">
         <ant dir="tests" target="clean"/>
     	<delete dir="${org.jboss.esb.rosetta.classes.dir}"/>
+	<delete dir="${org.jboss.esb.rosetta.as6.build.dir}"/>
     </target>
 
-    <target name="org.jboss.esb.rosetta.compile" depends="generate-config-model, org.jboss.esb.rosetta.internal.compile, war">
+    <target name="org.jboss.esb.rosetta.compile" depends="generate-config-model, org.jboss.esb.rosetta.internal.compile, as6.compile, war">
         <ant inheritAll="true" dir="tests" target="org.jboss.esb.rosetta.tests.compile"/>
     </target>
 
+    <target name="as6.dependencies.get">
+        <ant antfile="${org.jboss.esb.rosetta.as6.dir}/ivy-build.xml"/>
+	<property name="as6.jar.files" refid="org.jboss.esb.rosetta.as6.classpath"/>
+        <echo>as6.jar.files=${as6.jar.files}</echo>
+	<echo/>
+	<echo/>
+	<property name="base.classpath" refid="org.jboss.esb.rosetta.base.classpath"/>
+        <echo>base.classpath=${base.classpath}</echo>
+
+    </target>
+    
+    <target name="as6.compile" depends="org.jboss.esb.rosetta.prepare, as6.dependencies.get"
+        description="Compile the AS6 deployer">
+        <javac
+            destdir="${org.jboss.esb.rosetta.classes.dir}"
+            classpathref="org.jboss.esb.rosetta.as6.classpath"
+            debug="${org.jboss.esb.debug}"
+            optimize="${org.jboss.esb.optimize}"
+            >
+            <src path="${org.jboss.esb.rosetta.as6.src.dir}"/>
+        </javac>
+    </target>
+
     <target name="org.jboss.esb.rosetta.internal.compile" depends="org.jboss.esb.rosetta.prepare"
         description="Compile all classes">
 

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivy-build.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivy-build.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivy-build.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,30 @@
+<project name="as6.dependencies" default="retrieve" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
+
+    <property name="ivy.lib.dir" value="${basedir}/../build/as6/lib" />
+    <path id="classpath.ivy">
+        <fileset dir="${basedir}/../../antlib" includes="ivy-*.jar" />
+    </path>
+    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="classpath.ivy" />
+
+    <target name="ivy.init">
+	<mkdir dir="${ivy.lib.dir}"/>
+        <ivy:settings file="${basedir}/deployer-as6/ivysettings.xml"/>
+    </target>
+
+    <target name="retrieve" depends="ivy.init">
+        <ivy:retrieve log="quiet"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${ivy.lib.dir}" quiet="true"/>
+    </target>
+
+    <target name="cleancache" depends="ivy.init">
+        <ivy:cleancache />
+    </target>
+
+    <target name="report" depends="retrieve" description="--> generates a report of dependencies">
+        <ivy:report todir="${ivy.lib.dir}"/>
+    </target>
+
+</project>

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivysettings.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivysettings.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/ivysettings.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,17 @@
+<ivysettings>
+
+    <settings defaultResolver="chained"/>
+    <resolvers>
+        <chain name="chained">
+            <url name="jboss" m2compatible="true">
+                <artifact pattern="http://repository.jboss.org/maven2/[organisation]/[artifact]/[revision]/[artifact]-[revision].[ext]"/>
+            </url>
+            <url name="jboss-nexus" m2compatible="true">
+                <artifact pattern="https://repository.jboss.org/nexus/content/groups/public/[organisation]/[artifact]/[revision]/[artifact]-[revision].[ext]"/>
+            </url>
+            <ibiblio name="ibiblio" m2compatible="true"/> 
+        </chain>
+    </resolvers>
+    <modules>
+    </modules>
+</ivysettings>

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConfigParser.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConfigParser.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConfigParser.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,385 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+    
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.metadata.MetaData;
+import org.jboss.metadata.XmlFileLoader;
+import org.jboss.mx.util.ObjectNameConverter;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.w3c.dom.Element;
+
+/**
+ * EsbConfigParser is a Microcontainer deployer that picks up jboss-esb.xml files, parses the content
+ * and produces an {@link EsbMetaData} instance.
+ * <p/>
+ * Other implementations could read/parse a configuration form another source, for example store
+ * the configurations in a database. As long as they produce the EsbMetaData they will be able to
+ * be deployed.
+ * 
+ * Sample configuration:
+ * <pre>{@code
+ *  <bean name="EsbConfigParser" class="org.jboss.soa.esb.listeners.deployers.mc.EsbConfigParser">
+ *   <property name="esbDeploymentPrefix">jboss.esb:deployment=</property>
+ *   <property name="warDeploymentPrefix">jboss.web.deployment:war=</property>
+ *   <property name="actionArtifactsFile">/actionArtifactMap.properties</property>
+ * </bean>
+ * }</pre>
+ * 
+ * <lu>
+ *  <li><i>esbDeploymentPrefix</i> This is the prefix that a ESB archive deployments will have in JBoss AS. Defaults to 'jboss.esb:deployment='.</li>
+ *  <li><i>warDeploymentPrefix</i> This is the prefix that a war archive deployments will have in JBoss AS. These  
+ *      are used for .war archives specified in the 'esb-depends' section of a deployment.xml file. Defaults to 'jboss.web.deployment:war='
+ *  </li>
+ *  <li><i>actionArtifactsFile</i> Properties file containing an action name to .esb archive mapping. Defaults to '/actionArtifactMap.properties'.  
+ *  <br>
+ *  For example, and entry in the file could look like this: <br>
+ *  org.jboss.soa.esb.smooks.SmooksAction=smooks.esb
+ *  <br>
+ *  This says that the SmooksAction exists in the smooks.esb archive. Adding these mappings means that commonly 
+ *  used actions don't need to be explicetely added to the deployment.xml of all deployments. These will be implicit
+ *  instead.
+ *  </li>
+ * </lu>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class EsbConfigParser extends AbstractVFSParsingDeployer<EsbMetaData>
+{
+    /**
+     * Name and path of the esb deployment.xml file.
+     */
+    private static final String ESB_DEPLOYMENT_XML = "META-INF/deployment.xml";
+    
+    /**
+     * File filter for esb config files.
+     */
+    private static EsbConfigFileFilter configFileFilter = new EsbConfigFileFilter();
+    
+    /**
+     * Default actions file name.
+     */
+    private String actionArtifactsFile = "/actionArtifactMap.properties";
+    
+    /**
+     * The actions to .esb archive mappings file.
+     */
+    private Properties actionArtifactProperties;
+    
+    /**
+     * Deployment prefix for esb deployments.
+     */
+    private String esbDeploymentPrefix = "jboss.esb:deployment=";
+    
+    /**
+     * The simple name of the jbossesb.esb deployment.
+     */
+    private String esbArtifactName = "jbossesb" ;
+    
+    /**
+     * Deployment prefix for war deployments. The are for the war declared in the 'esb-depends' section
+     * of deployment.xml.
+     */
+    private String warDeploymentPrefix = "jboss.web.deployment:war=";
+
+    /**
+     * Logger.
+     */
+    private Logger log = Logger.getLogger(EsbConfigParser.class);
+
+    /**
+     * Sole constructor that performs the following steps:
+     * <lu>
+     *  <li>Sets the output of this deployer to be {@link EsbMetaData}.</li>
+     *  <li>Sets the suffix to {@link EsbConfigParser#ESB_FILE_SUFFIX}.</li>
+     *  <li>Sets the jar extension to {@link EsbConfigParser#ESB_ARCHIVE_SUFFIX}.</li>
+     *  <li>Sets this deployers deployment stage to {@link DeploymentStages#PARSE}./li>
+     * </lu>
+     */
+    public EsbConfigParser()
+    {
+        super(EsbMetaData.class);
+        setSuffix(EsbConstants.ESB_FILE_SUFFIX);
+        setJarExtension(EsbConstants.ESB_ARCHIVE_SUFFIX);
+        setStage(DeploymentStages.PARSE);
+    }
+
+    /**
+     * Create will load the action artifacts file configured.
+     * 
+     * @throws Exception If the action artifacts files cannot be loaded.
+     */
+    public void create() throws Exception
+    {
+        log.info("Created");
+        actionArtifactProperties = JBossDeployerUtil.getArtifactProperties(actionArtifactsFile);
+    }
+
+    /**
+     * Will parse the VirtualFile representing the deployment and parse the esb configuration xml and extract information from 
+     * the archive to create an {@link EsbMetaData} instance that will be returned.
+     */
+    @Override
+    protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metadata) throws Exception
+    {
+        VirtualFile configFile = findEsbConfigFile(file);
+        final String esbConfigXml = JBossDeployerUtil.readEsbConfig(configFile.openStream());
+        final String archiveName = deploymentUnit.getSimpleName();
+        final String deploymentName = getDeploymentName(deploymentUnit);
+
+        //This model is used only to add the action dependecies, later the model is recreated in EsbDeployment destroy/create cycle.
+        final ModelAdapter model = JBossDeployerUtil.getJbossEsbModel(esbConfigXml);
+        
+        // Get dependencies from deployment.xml.
+        final Set<ObjectName> dependencies = getDependenciesFromDeploymentXml(deploymentUnit);
+        
+        // Get implicit action dependencies.
+        final Set<ObjectName> actionDependencies = getActionDependencies(deploymentName, model, actionArtifactProperties);
+        
+        // Add all dependencies to set.
+        dependencies.addAll(actionDependencies);
+        
+        final EsbMetaData esbMetaData = new EsbMetaData(configFile, archiveName, deploymentName, dependencies);
+        esbMetaData.setModel(model);
+        log.debug("Parsed ESB configuration'" + esbMetaData + "'");
+        return esbMetaData;
+    }
+    
+    /**
+     * Tries to rescursively find a file that ends with "-esb.xml".
+     *
+     * @param file          The virtual file. Can point to a file or a directory which will be searched.
+     * @return VirtualFile  VirtualFile representing a found configuration file.
+     * @throws DeploymentException If not configuration file could be found, or more than one was found.
+     * @throws IOException 
+     */
+    private VirtualFile findEsbConfigFile(final VirtualFile file) throws DeploymentException, IOException
+    {
+        if (file.getName().endsWith(EsbConstants.ESB_FILE_SUFFIX))
+        {
+            return file;
+        }
+        
+        VirtualFile child = file.getChild("META-INF");
+        log.info("META-INF : " + child);
+
+        List<VirtualFile> esbConfigFiles;
+        try
+        {
+            esbConfigFiles = file.getChildrenRecursively(configFileFilter);
+        }
+        catch (final IOException e)
+        {
+            throw new DeploymentException(e.getMessage(), e);
+        }
+
+        if (esbConfigFiles.size() == 0)
+        {
+            throw new DeploymentException("No JBossESB configuration could be located the archive '" + file + "'");
+        }
+        else if (esbConfigFiles.size() > 1)
+        {
+            throw new DeploymentException("Only one JBossESB configuration can exist in an archive. Please check '" + file + "'");
+        }
+        else
+        {
+            return esbConfigFiles.get(0);
+        }
+    }
+    
+    Set<ObjectName> getDependenciesFromDeploymentXml(final VFSDeploymentUnit unit) throws DeploymentException
+    {
+        final Set<ObjectName> dependencies = new HashSet<ObjectName>();
+        final VirtualFile deploymentXml = unit.getFile(ESB_DEPLOYMENT_XML);
+        
+        try
+        {
+            if (deploymentXml != null && deploymentXml.exists())
+            {
+                try
+                {
+                    XmlFileLoader xfl = new XmlFileLoader();
+                    Element jboss = xfl.getDocument(deploymentXml.openStream(), ESB_DEPLOYMENT_XML).getDocumentElement();
+                    // Check for a ejb level class loading config
+                    @SuppressWarnings("unchecked")
+                    Iterator depends = MetaData.getChildrenByTagName(jboss, "depends");
+                    if (depends != null)
+                    {
+                        while (depends.hasNext())
+                        {
+                            Element depend = (Element) depends.next();
+                            dependencies.add(new ObjectName(MetaData.getElementContent(depend)));
+                        }
+                    }
+                    @SuppressWarnings("unchecked")
+                    Iterator esbDepends = MetaData.getChildrenByTagName(jboss, "esb-depends");
+                    if ((esbDepends != null) && esbDepends.hasNext())
+                    {
+                        Element depend = (Element) esbDepends.next();
+                        final String deployable = MetaData.getElementContent(depend);
+                        if (deployable.endsWith(".war"))
+                        {
+                            String objectName = warDeploymentPrefix + "/" + deployable.substring(0, deployable.indexOf('.'));
+                            dependencies.add(new ObjectName(objectName));
+                        }
+                    }
+                }
+                catch (final MalformedObjectNameException e)
+                {
+                    throw new org.jboss.deployment.DeploymentException(e.getMessage(), e);
+                } 
+            }
+        } 
+        catch (final IOException e)
+        {
+            throw new DeploymentException(e.getMessage(), e);
+        }
+        return dependencies;
+    }
+    
+    
+    /**
+     * Will go through the actions defined in the model (model of the esb configuration) and for every
+     * action that is defined in action artifacts properties adds that action as a dependency.
+     * This way there is no need to explicetely define dependencies in a separate deployment.xml file.
+     * 
+     * @param deploymentName The name of the deployment
+     * @param model The {@link ModelAdapter} representing the esb configuration.
+     * @param actionArtifactProperties The predefined actions that are to be automatically included as dependencies.
+     * @return Set<ObjectName> A set of {@link ObjectName}s that this esb deployment depends on.
+     * @throws DeploymentException
+     */
+    private Set<ObjectName> getActionDependencies(final String deploymentName, final ModelAdapter model, final Properties actionArtifactProperties) throws DeploymentException
+    {
+        final Set<ObjectName> deps = new HashSet<ObjectName>();
+        
+        final Set<String> artifacts = new HashSet<String>() ;
+        
+        if (!deploymentName.equals(esbArtifactName))
+        {
+            artifacts.add(esbArtifactName + EsbConstants.ESB_ARCHIVE_SUFFIX) ;
+        }
+        
+        final Set<String> actionClasses = model.getActions() ;
+          
+        if (actionArtifactProperties != null)
+        {
+            final int numActionClasses = (actionClasses == null ? 0 : actionClasses.size()) ;
+            if (numActionClasses > 0)
+            {
+                for(final String actionClass: actionClasses)
+                {
+                    final String artifact = (String) actionArtifactProperties.get(actionClass) ;
+                    if (artifact != null)
+                    {
+                        artifacts.add(artifact) ;
+                    }
+                }
+            }
+        }
+          
+        for(final String artifact: artifacts)
+        {
+            if (!deploymentName.equals(artifact))
+            {
+                final String canonicalName = esbDeploymentPrefix + artifact ;
+                try
+                {
+                    ObjectName on = ObjectNameConverter.convert(canonicalName);
+                    deps.add(on) ;
+                } 
+                catch (MalformedObjectNameException e)
+                {
+                    throw new DeploymentException(e.getMessage(), e);
+                }
+            }
+        }
+        return deps;
+    }
+    
+    String getDeploymentName(final VFSDeploymentUnit deploymentUnit)
+    {
+        final String simpleName = deploymentUnit.getSimpleName();
+        int idx = simpleName.indexOf(EsbConstants.ESB_ARCHIVE_SUFFIX);
+        if (idx == -1)
+        {
+            return simpleName;
+        }
+        return simpleName.substring(0, simpleName.indexOf(EsbConstants.ESB_ARCHIVE_SUFFIX));
+    }
+
+    public void setActionArtifactsFile(final String actionArtifactsFile)
+    {
+        this.actionArtifactsFile = actionArtifactsFile;
+    }
+    
+    public void setEsbDeploymentPrefix(final String deploymentPrefix)
+    {
+        this.esbDeploymentPrefix = deploymentPrefix;
+    }
+    
+    public void setEsbArtifactName(final String esbArtifactName)
+    {
+        this.esbArtifactName = esbArtifactName;
+    }
+    
+    public void setWarDeploymentPrefix(final String deploymentPrefix)
+    {
+        this.warDeploymentPrefix = deploymentPrefix;
+    }
+
+    /**
+     * Filter for filtering out ESB configuration files.
+     *
+     */
+    private static class EsbConfigFileFilter implements VirtualFileFilter
+    {
+        /**
+         * Accepts only files ending with the ESB_FILE_SUFFIX.
+         * 
+         * @param file  The file to filter.
+         * @return true If the file name ends with "-esb.xml".
+         */
+        public boolean accepts(final VirtualFile file)
+        {
+            return file.getName().endsWith(EsbConstants.ESB_FILE_SUFFIX);
+        }
+    }
+
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConstants.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConstants.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbConstants.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+
+/**
+ * Contstants for ESB Microecontainer Deployers.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class EsbConstants
+{
+    /**
+     * The default suffix of JBossESB configuration files that should be picked up.
+     */
+    public static final String ESB_FILE_SUFFIX = "-esb.xml";
+    
+    /**
+     * The default suffix of JBossESB archives that should be accepted.
+     */
+    public static final String ESB_ARCHIVE_SUFFIX = ".esb";
+
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployer.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployer.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployer.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.apache.log4j.Logger;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * EsbDeployer takes care of the deployment of an {@link EsbDeployment}.
+ * <p/>
+ * 
+ * This deployer actually only creates a BeanMetaData object describing a
+ * {@link EsbDeployment}. The MicroContainer will take care of the actual
+ * creation and starting of the deployment using it's lifecycle callbacks. <p/>
+ * 
+ * Example configuration:
+ * 
+ * <pre>{@code
+ *     <bean name="EsbDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbDeployer">
+ *        <property name="esbBeanPrefix">jboss.esb</property>
+ *        <property name="defaultDependencies">
+ *           <list elementClass="java.lang.String">
+ *              <value>jboss.esb:service=ESBRegistry</value>
+ *              <value>jboss.esb:service=JuddiRMI</value>
+ *            </list>
+ *        </property>
+ *     </bean>
+ * }</pre>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class EsbDeployer extends AbstractSimpleVFSRealDeployer<EsbMetaData>
+{
+    /**
+     * Logger.
+     */
+    private Logger log = Logger.getLogger(EsbDeployer.class);
+    
+    /**
+     * Prefix used for the BeanMetaData and for the managenment bean name.
+     */
+    private String esbBeanPrefix = "jboss.esb";
+    
+    /**
+     * Default dependencies that will be added to all {@link EsbDeployment}s.
+     */
+    private List<String> defaultDeps = new ArrayList<String>();
+
+    private DeployerClient mainDeployer;
+    
+    /**
+     * The path the the directory that will be used to generate the war file
+     * for all web gateway deployments (EBWS and HTTP Gateways).
+     */
+    private String warFilesDir;
+    
+    /**
+     * No args constructor.
+     */
+    public EsbDeployer()
+    {
+        super(EsbMetaData.class);
+        // Tell the MicroContainer that we are producing BeanMetaData.
+        setOutput(BeanMetaData.class);
+        // Need access to classloaders
+        setStage(DeploymentStages.POST_CLASSLOADER);
+    }
+
+    public void setMainDeployer(DeployerClient mainDeployer)
+    {
+        this.mainDeployer = mainDeployer;
+    }
+    
+    /**
+     * Sets the directory that will be used for generating ESWS wars.
+     * @param dir The directory to be used.
+     */
+    public void setWarFilesDir(final String dir)
+    {
+        this.warFilesDir = dir;
+    }
+
+    /**
+     * Creates an {@link BeanMetaData} instance that describes the JBossESB
+     * deployment. The BeanMetaData is created using the information from the
+     * EsbMetaData object, such as the contents of jboss-esb.xml, archive name etc.
+     * 
+     * The BeanMeatData is then attached to the Microcontainers deployment unit
+     * and will be picked up by the BeanMetaDataDeployer.
+     * 
+     * @param deploymentUnit The deployment unit to deploy.
+     * @param esbMetaData The ESB MetaData that is associated with the deployment unit.
+     */
+    @Override
+    public final void deploy(final VFSDeploymentUnit deploymentUnit, final EsbMetaData esbMetaData) throws org.jboss.deployers.spi.DeploymentException
+    {
+        try
+        {
+            final BeanMetaData beanMetaData = createBeanMetaData(deploymentUnit, esbMetaData);
+            deploymentUnit.addAttachment(BeanMetaData.class.getName() + "_ESB", beanMetaData);
+            log.debug("Created beanMetaData : " + beanMetaData);
+        } 
+        catch (final DeploymentException e)
+        {
+            throw new org.jboss.deployers.spi.DeploymentException(e.getMessage(), e);
+        } 
+        catch (final IOException e)
+        {
+            throw new org.jboss.deployers.spi.DeploymentException(e.getMessage(), e);
+        }
+    }
+    
+    /**
+     * Creates a {@link BeanMetaData} that describes the
+     * 
+     * @param deploymentUnit The deployment unit to deploy.
+     * @param esbMetaData The ESB MetaData that is associated with the deployment unit.
+     * @return BeanMetaData The {@link BeanMetaData} describing the EsbDeployment.
+     * 
+     * @throws IOException
+     * @throws DeploymentException
+     */
+    private BeanMetaData createBeanMetaData(final VFSDeploymentUnit deploymentUnit, final EsbMetaData esbMetaData) throws DeploymentException, IOException
+    {
+        log.debug(esbMetaData);
+        BeanMetaDataBuilder bmdBuilder = BeanMetaDataBuilder.createBuilder(esbBeanPrefix + "." + deploymentUnit.getName(), EsbDeployment.class.getName());
+        // Setup the first constructor argument (esb meta data).
+        bmdBuilder.addConstructorParameter(EsbMetaData.class.getName(), esbMetaData);
+        // Setup the second constructor argument (the name of the mbean).
+        final String mbeanName = esbBeanPrefix + ":deployment=" + deploymentUnit.getSimpleName();
+        bmdBuilder.addConstructorParameter(String.class.getName(), mbeanName);
+        // Setup the third constructor argument (vfs deployment unit).
+        bmdBuilder.addConstructorParameter(VFSDeploymentUnit.class.getName(), deploymentUnit);
+        if (warFilesDir == null)
+        {
+            final String errorMsg = String.format("No property named '%s' was configured in jbossesb.sar/META-INF/jboss-service.xml for %s", "warFilesDir", getClass().getName());
+            throw new DeploymentException(errorMsg);
+        }
+        
+        final File tmpDir = new File(warFilesDir);
+        if (!tmpDir.exists())
+        {
+            final String errorMsg = String.format("The directory configured for %s='%s' does not exist.", "warFilesDir", tmpDir);
+            throw new DeploymentException(errorMsg);
+        }
+        // Setup the fourth constructor argument (temp war directory).
+        File esbWarFiles = JBossDeployerUtil.createDir(tmpDir, "esbwarfiles");
+        bmdBuilder.addConstructorParameter(File.class.getName(), esbWarFiles);
+        // Add management annotation.
+        bmdBuilder.addAnnotation("@org.jboss.aop.microcontainer.aspects.jmx.JMX(registerDirectly=true, exposedInterface=void.class, name=\"" + mbeanName + "\")");
+
+        // Add default dependencies.
+        for (String dependency : defaultDeps)
+        {
+            bmdBuilder.addDependency(dependency);
+        }
+
+        // Add the dependencies for this deployment.
+        Set<ObjectName> dependencies = esbMetaData.getDependencies();
+        for (ObjectName objectName : dependencies)
+        {
+            // The dependencies are added as demands. If we add them as dependencies
+            // they will get undeployed when this unit is undeployed.
+            log.debug("Adding depend " + objectName.toString() + " for " + esbMetaData.getDeploymentName());
+            bmdBuilder.addDemand(objectName.toString(), ControllerState.PRE_INSTALL, ControllerState.INSTALLED, null);
+        }
+
+        if (esbMetaData.getPublishers().size() > 0)
+        {
+            // set publishers on the deployment instance, or rather tell MC to do this for us.
+            log.debug("Adding publishers : " + esbMetaData.getPublishers());
+            bmdBuilder.addPropertyMetaData("publishers", esbMetaData.getPublishers());
+        }
+        
+        if (esbMetaData.getServlets().size() > 0)
+        {
+            // set servlets on the deployment instance, or rather tell MC to do this for us.
+            log.debug("Adding servlets : " + esbMetaData.getServlets());
+            bmdBuilder.addPropertyMetaData("servlets", esbMetaData.getServlets());
+        }
+        
+        bmdBuilder.addPropertyMetaData("mainDeployer", mainDeployer);
+        return bmdBuilder.getBeanMetaData();
+    }
+    
+    public void setEsbBeanPrefix(final String prefix)
+    {
+        this.esbBeanPrefix = prefix;
+    }
+    
+    public String getEsbBeanPrefix()
+    {
+        return esbBeanPrefix;
+    }
+    
+    public void setDefaultDependencies(final List<String> deps)
+    {
+        if (deps != null)
+        {
+            defaultDeps.addAll(deps);
+        }
+    }
+    
+    public List<String> getDefaultDependencies()
+    {
+        return Collections.unmodifiableList(defaultDeps);
+    }
+    
+    
+    
+}
+        

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployment.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployment.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeployment.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,313 @@
+/*
+ * 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.soa.esb.listeners.deployers.mc.as6;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.management.JMException;
+import javax.management.ObjectName;
+import javax.management.MBeanServer;
+
+import org.apache.log4j.Logger;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.listeners.war.Filter;
+import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.listeners.war.WebDeploymentArchive;
+import org.jboss.internal.soa.esb.listeners.war.WebModel;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.soa.esb.listeners.config.ModelUtil;
+import org.jboss.soa.esb.listeners.config.ServicePublisher;
+import org.jboss.soa.esb.listeners.config.WebGatewayBuilder;
+import org.jboss.soa.esb.listeners.config.WebserviceInfo;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
+import org.jboss.soa.esb.util.DeploymentArchive;
+
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * EsbDeployment for the Microcontainer. 
+ * <p/> 
+ * 
+ * Microcontainer will call the lifecycle methods:
+ * <lu>
+ *  <li><i>create</i> will create the ESB deployment.</i>
+ *  <li><i>start</i> will start the ESB deployment.</i>
+ *  <li><i>stop</i> will stop the ESB deployment.</i>
+ *  <li><i>destroy</i> will destroy the ESB deployment.</i>
+ * </lu>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class EsbDeployment implements EsbDeploymentMBean
+{
+    private Logger log = Logger.getLogger(EsbDeployment.class);
+    
+    private int state = CREATED;
+
+    private String jbossEsbXml;
+    private String deploymentName;
+    private List<ContractReferencePublisher> publishers;
+    private List<Servlet> servlets;
+    private ManagedLifecycleController controller;
+    private final String mbeanName;
+    //private File subDeployment;
+    private ClassLoader localCl;
+
+    /** The meta data */
+    private EsbMetaData esbMetaData;
+
+    private VFSDeployment deployment;
+    private DeploymentFactory factory = new DeploymentFactory();
+
+    private DeployerClient mainDeployer;
+    private File esbWarFiles;
+    private File esbArchive;
+        
+    public EsbDeployment(final EsbMetaData esbMetaData, final String mbeanName, final VFSDeploymentUnit deploymentUnit, final File esbWarFiles) throws Exception
+    {
+        this.deploymentName = esbMetaData.getArchiveName();
+        this.mbeanName = mbeanName;
+        this.esbMetaData = esbMetaData;
+        this.esbWarFiles = esbWarFiles;
+        this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(esbMetaData.getFile().openStream());
+        this.esbArchive = new File(deploymentUnit.getRoot().toURL().getPath());
+        this.localCl = deploymentUnit.getClassLoader();
+    }
+    
+    public String getJbossEsbXml()
+    {
+        return jbossEsbXml;
+    }
+
+    public String getJbossEsbXmlAsHtml()
+    {
+        return jbossEsbXml.replace("<", "&lt;").replace(">", "&gt;");
+    }
+
+    public void setPublishers(final List<ContractReferencePublisher> publishers)
+    {
+        this.publishers = publishers;
+    }
+    
+    public void setServlets(final List<Servlet> servlets)
+    {
+ 	   this.servlets = servlets;
+    }
+    
+    public List<Servlet> getServlets()
+    {
+ 	   return servlets;
+    }
+
+    public void setMainDeployer(final DeployerClient mainDeployer)
+    {
+        this.mainDeployer = mainDeployer;
+    }
+
+    public ManagedLifecycleController getController()
+    {
+        return controller;
+    }
+
+    public String getDeploymentName()
+    {
+        return deploymentName;
+    }
+
+    public void setDeploymentName(final String deploymentName)
+    {
+        this.deploymentName = deploymentName;
+    }
+
+    public List<ContractReferencePublisher> getPublishers()
+    {
+        return publishers;
+    }
+
+    public void create() throws Exception
+    {
+    	state = CREATING;
+    	
+        // Redo initialization as the properties could have changed
+        this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(esbMetaData.getFile().openStream());
+        esbMetaData.setModel(JBossDeployerUtil.getJbossEsbModel(jbossEsbXml));
+
+        LifecycleResourceManager.getSingleton().associateDeployment(deploymentName);
+        LifecycleResourceManager.deactivateHook();
+
+        WebGatewayBuilder builder = new WebGatewayBuilder(esbWarFiles, esbArchive, deploymentName, localCl, esbMetaData.getModel());
+        File subDeployment = builder.build();
+        if (subDeployment != null)
+        {
+            VFSDeployment vfsDeployment = null;
+            try
+            {
+                vfsDeployment = createVFSDeployment(subDeployment);
+                mainDeployer.deploy(vfsDeployment);
+                log.info("Deploying '" + vfsDeployment.getName() + "'");
+                this.setPublishers(builder.getPublishers());
+                this.setServlets(builder.getServlets());
+                this.deployment = vfsDeployment;
+            }
+            catch (Throwable throwable)
+            {
+                if (vfsDeployment != null)
+                {
+                    VirtualFile deploymentFile = vfsDeployment.getRoot();
+                    if(deploymentFile.exists())
+                    {
+                        log.info("Deleting '" + vfsDeployment.getSimpleName() + "'");
+                        deploymentFile.delete();
+                    }
+                }
+                throw new ConfigurationException("Error deploying '" + vfsDeployment.getName() + "'.", throwable);
+            }
+        }
+        this.state = CREATED;
+    }
+
+    public void start() throws Exception
+    {    
+    	if ((state == STARTING) || (state == STARTED))
+    		return;
+    	state = STARTING;
+
+    	try {
+	        if (controller == null)
+	        {
+	        	log.info("Starting ESB Deployment '" + deploymentName + "'");
+	            controller = Configuration.create(jbossEsbXml, new ObjectName(mbeanName), publishers, servlets);
+	            controller.start();
+	        }
+	        state = STARTED;
+    	} catch (Exception e) {
+    		state = FAILED;
+    		throw e;
+    	}
+    }
+
+	public boolean isStarted() {
+		return (controller != null);
+	}
+
+	public String getStateString() {
+		return states[state];
+	}
+	
+	public int getState() {
+		return state;
+	}
+	
+    public void stop() throws Exception
+    {        
+    	if (state != STARTED)
+    		return;
+    	
+    	state = STOPPING;
+    	try {
+	        if (controller != null)
+	        {
+	        	log.info("Stopping '" + deploymentName + "'");
+		        ServicePublisher.removeServicePublishers(controller);
+		        controller.stop();
+		        controller = null;
+		        state = STOPPED;
+	        }
+    	} catch (Exception e) {
+    		throw e;
+    	}
+    }
+
+    public void destroy() throws Exception
+    {
+    	if (state == DESTROYED)
+    		return;
+    	
+        log.info("Destroying '" + deploymentName + "'");
+        state = DESTROYING;
+        
+        try {
+	        if (deployment != null)
+	        {
+	            log.info("Undeploying '" + deployment.getSimpleName() + "'");
+	            mainDeployer.undeploy(deployment);
+	            VirtualFile deploymentFile = deployment.getRoot();
+	            if(deploymentFile.exists())
+	            {
+	                log.info("Deleting '" + deployment.getSimpleName() + "'");
+	                if(!deploymentFile.delete())
+	                {
+	                    log.debug("Failed to delete sub deployment '" + deployment.getName() + "'.");
+	                }
+	            }
+	        }
+	
+	        LifecycleResourceManager.getSingleton().disassociateDeployment(deploymentName);
+	        LifecycleResourceManager.getSingleton().destroyResources();
+	        state = DESTROYED;
+        } catch (Exception e) {
+        	throw e;
+        }
+    }
+    
+    private VFSDeployment createVFSDeployment(File war) throws IOException, URISyntaxException
+    {
+        VirtualFile webAppVFS = VFS.getChild(war.toURL());
+        //VirtualFile webAppVFS = VFS.getRoot(war.toURL());
+        return VFSDeploymentFactory.getInstance().createVFSDeployment(webAppVFS);
+    }
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeploymentMBean.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeploymentMBean.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbDeploymentMBean.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+
+/**
+ * Interface for exposing JMX operations.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public interface EsbDeploymentMBean
+{
+    /**
+     * Start a deployment.
+     * 
+     * @throws Exception  If an exception occurs while starting.
+     */
+    void start() throws Exception;
+
+    /**
+     * Is the deployment started.
+     * 
+     * @return True if the deployment is started, otherwise false.
+     */
+    boolean isStarted();
+
+    /**
+     * Stop a deployment.
+     * 
+     * @throws Exception  If an exeption occurs while stoping.
+     */
+    void stop() throws Exception;
+
+    /**
+     * Gets the jboss-esb.xml configuration.
+     * 
+     * @return String   The jboss-esb.xml files content.
+     */
+    String getJbossEsbXml();
+
+    /**
+     * Gets the jboss-esb.xml configuration as html.
+     * 
+     * @return String   The jboss-esb.xml files content as html.
+     */
+    String getJbossEsbXmlAsHtml();
+    
+	String getStateString();
+	
+	int getState();
+
+    public static final String[] states = {
+        "Stopped", "Stopping", "Starting", "Started", "Failed",
+        "Destroying", "Destroyed", "Creating", "Created", 
+        "Initializing", "Initialized", "Unregistered"
+     };
+
+     /** stop has completed */
+     public static final int STOPPED  = 0;
+     /** stop has been invoked */
+     public static final int STOPPING = 1;
+     /** start has been invoked */
+     public static final int STARTING = 2;
+     /** start has completed */
+     public static final int STARTED  = 3;
+     /** There has been an error during some operation */
+     public static final int FAILED  = 4;
+     /** destroy has been invoked */ 
+     public static final int DESTROYING = 5;
+     /** destroy has completed */
+     public static final int DESTROYED = 6;
+     /** create has been invoked */
+     public static final int CREATING = 7;
+     /** create has completed */
+     public static final int CREATED = 8;
+     /** initialize has been invoked */
+     public static final int INITIALIZING = 9;
+     /** initialize has completed */
+     public static final int INITIALIZED = 10;
+     /** not yet created */
+     public static final int UNREGISTERED = 11;
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbMetaData.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbMetaData.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/EsbMetaData.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * Metadata for an ESB deployment.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class EsbMetaData implements Serializable
+{
+    /** Serial version unique identifier. */
+    private static final long serialVersionUID = 0L;
+
+    /** The name of the .esb archive. */
+    private String archiveName;
+
+    /** The adapter for querying the model */
+    private ModelAdapter model;
+
+    /** The virtual file. */
+    private final VirtualFile file;
+    
+    /** The deployments dependencies */
+    private final Set<ObjectName> dependencies ;
+    
+    /** The deployment name. The .esb archive name without the .esb suffix */
+    private final String deploymentName;
+    
+    /** The publishers for this deployment */
+    private List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>();
+    
+    /** The servlets for this deployment */
+    private List<Servlet> servlets = new ArrayList<Servlet>();
+    
+    /**
+     * Sole constructor.
+     *
+     * @param file              The virtual file. Can point to a file or a directory which will be searched..
+     * @param archiveName       The name of the .esb archive from which this deployment comes from.
+     * @param dependencies      Dependencies of this deployment. This might be object names or simply bean names.
+     */
+    public EsbMetaData(final VirtualFile file, final String archiveName, final String deploymentName, final Set<ObjectName> dependencies)
+    {
+        AssertArgument.isNotNull(file, "file");
+        AssertArgument.isNotNullAndNotEmpty(archiveName, "archiveName");
+        AssertArgument.isNotNullAndNotEmpty(deploymentName, "deploymentName");
+        
+        this.file = file;
+        this.archiveName = archiveName;
+        this.deploymentName = deploymentName;
+        this.dependencies = dependencies;
+    }
+
+    /**
+     * Gets the name of the archive that this metadata came from.
+     *
+     * @return String   The name of the archive that this metadata came from.
+     */
+    public final String getArchiveName()
+    {
+        return archiveName;
+    }
+
+    /**
+     * Gets the The virtual file. This is a file path
+     * @return String The esb xml configuration.
+     */
+    public VirtualFile getFile()
+    {
+        return file;
+    }
+    
+    /**
+     * Gets a set of dependencies of this deployment.
+     * 
+     * @return Set<ObjectName> A set of object names that the deployment represented by this instance depends on.
+     */
+    public Set<ObjectName> getDependencies()
+    {
+        return Collections.unmodifiableSet(dependencies);
+    }
+    
+    /**
+     * The deployment name is the name of the .esb archive without the .esb suffix.
+     * 
+     * @return String The name of the deployment. This is the archive name without the .esb suffix.
+     */
+    public String getDeploymentName()
+    {
+        return deploymentName;
+    }
+    
+    /**
+     * The model adapter for the configuration.
+     * 
+     * @return ModelAdapter The model adapter for the configuration.
+     */
+    public ModelAdapter getModel()
+    { 
+        return model;
+    }
+    
+    /**
+     * Set the model adapter for the configuration.
+     * 
+     * @param model The model adapter for the configuration.
+     */
+    public void setModel(ModelAdapter model)
+    { 
+        this.model = model;
+    }
+    
+    /**
+     * Sets the publishers for this deployment.
+     * 
+     * @param publishers The publishers for this deployment.
+     */
+    public void setPublishers(final List<ContractReferencePublisher> publishers)
+    {
+        this.publishers = publishers;
+    }
+    
+    /**
+     * Gets the publishers for this deployment.
+     * 
+     * @return List<ContractReferencePublishers> List of publishers for this deployment.
+     */
+    public List<ContractReferencePublisher> getPublishers()
+    {
+        return Collections.unmodifiableList(publishers);
+    }
+    
+    /**
+     * Sets the servlets for this deployment.
+     * 
+     * @param servlets The servlets for this deployment.
+     */
+    public void setServlets(final List<Servlet> servlets)
+    {
+        this.servlets = servlets;
+    }
+    
+    /**
+     * Gets the servlets for this deployment.
+     * 
+     * @return List<Servlet> List of servlets for this deployment.
+     */
+    public List<Servlet> getServlets()
+    {
+        return Collections.unmodifiableList(servlets);
+    }
+
+    /**
+     * @return String   String representation of this metadata.
+     */
+    @Override
+    public final String toString()
+    {
+        return String.format("EsbMetaData [archiveName='%s', deploymentName='%s', dependencies='%s']", archiveName, deploymentName, dependencies);
+    }
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/GroupingStructure.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/GroupingStructure.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/GroupingStructure.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,258 @@
+package org.jboss.soa.esb.listeners.deployers.mc.as6;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.util.collection.CollectionsFactory;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+
+/**
+ * Similar to jar or directory structure, being able to handle sub-dirs, but a
+ * bit more strict then dir structure. Only listed sub-directories are
+ * candidates for potential sub-deployments.
+ * 
+ * It also allows you to set metadata paths, libs and should the root be part of
+ * classpath. Each of sub-dirs can be filtered per path or by default per lib or
+ * group.
+ * 
+ * In order to accept anything one must first set shortCircuitFilter instance.
+ * 
+ * @see org.jboss.deployers.vfs.plugins.structure.jar.JARStructure
+ * @see org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GroupingStructure extends AbstractVFSStructureDeployer
+{
+    private static final String[] META_INF = { "META-INF" };
+
+    private VirtualFileFilter shortCircuitFilter; // by default null, so we
+                                                  // don't accept anything
+    private boolean rootClasspathEntry;
+
+    // paths
+    private String[] metaDataPaths;
+    private Set<String> libs;
+    private Set<String> groups;
+
+    // filters
+    private VirtualFileFilter libFilter;
+    private VirtualFileFilter groupFilter;
+    private Map<String, VirtualFileFilter> filters; // filter per path
+
+    public GroupingStructure()
+    {
+        setRelativeOrder(9000); // before jar structure
+        setRootClasspathEntry(true); // by default root is part of classpath
+        setLibs(Collections.<String> emptySet()); // empty libs
+        setMetaDataPaths(META_INF); // default metadata locations
+        setGroups(CollectionsFactory.<String> createLazySet()); // lazy groups
+        setFilters(Collections.<String, VirtualFileFilter> emptyMap()); // empty
+                                                                        // filters
+    }
+
+    public boolean determineStructure(StructureContext structureContext) throws DeploymentException
+    {
+        VirtualFile file = structureContext.getFile();
+
+        if (shortCircuitFileCheck(file) == false)
+            return false;
+        
+        ContextInfo context = null;
+        try
+        {
+            context = createContext(structureContext, metaDataPaths);
+            
+            if (rootClasspathEntry)
+                addClassPath(structureContext, file, true, true, context);
+            
+            // add any archives in libs
+            for (String lib : libs)
+            {
+                VirtualFile libVF = file.getChild(lib);
+                if (libVF != null)
+                {
+                    VirtualFileFilter lf = filters.get(lib);
+                    if (lf == null)
+                        lf = libFilter;
+
+                    List<VirtualFile> archives = libVF.getChildren(lf);
+                    for (VirtualFile archive : archives)
+                        addClassPath(structureContext, archive, true, true, context);
+                } else
+                {
+                    if (log.isTraceEnabled())
+                        log.info("No such lib: " + lib + ", " + file);
+                }
+            }
+
+            // check only children of defined sub-dirs / groups
+            for (String group : groups)
+            {
+                VirtualFile groupVF = file.getChild(group);
+                if (groupVF != null)
+                {
+                    VirtualFileFilter gf = filters.get(group);
+                    if (gf == null)
+                        gf = groupFilter;
+
+                    List<VirtualFile> children = groupVF.getChildren(gf);
+                    for (VirtualFile child : children)
+                        structureContext.determineChildStructure(child);
+                } else
+                {
+                    if (log.isTraceEnabled())
+                        log.info("No such group: " + group + ", " + file);
+                }
+            }
+
+            return true;
+        } 
+        catch (Exception e)
+        {
+            // Remove the invalid context
+            if (context != null)
+                structureContext.removeChild(context);
+
+            throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+        }
+    }
+
+    /**
+     * Do short circuit file check.
+     * 
+     * @param file
+     *            the file
+     * @return true if we accept the file
+     */
+    protected boolean shortCircuitFileCheck(VirtualFile file)
+    {
+        return shortCircuitFilter != null && shortCircuitFilter.accepts(file);
+    }
+
+    /**
+     * Set short circuit file filter.
+     * 
+     * @param shortCircuitFilter
+     *            the short circuit file filter
+     */
+    public void setShortCircuitFilter(VirtualFileFilter shortCircuitFilter)
+    {
+        this.shortCircuitFilter = shortCircuitFilter;
+    }
+
+    /**
+     * Is root part of classpath.
+     * 
+     * @param rootClasspathEntry
+     *            root cp flag
+     */
+    public void setRootClasspathEntry(boolean rootClasspathEntry)
+    {
+        this.rootClasspathEntry = rootClasspathEntry;
+    }
+
+    /**
+     * Set libs; added as cp entries.
+     * 
+     * @param libs
+     *            the libs
+     */
+    public void setLibs(Set<String> libs)
+    {
+        if (libs == null)
+            throw new IllegalArgumentException("Null libs");
+
+        this.libs = libs;
+    }
+
+    /**
+     * Set default lib filter.
+     * 
+     * @param libFilter
+     *            the filter
+     */
+    public void setLibFilter(VirtualFileFilter libFilter)
+    {
+        this.libFilter = libFilter;
+    }
+
+    /**
+     * Set the default metadata paths.
+     * 
+     * @param metaDataPaths
+     *            the meta data paths
+     */
+    public void setMetaDataPaths(String[] metaDataPaths)
+    {
+        this.metaDataPaths = metaDataPaths;
+    }
+
+    /**
+     * Set groups. Aka grouping sub-directories.
+     * 
+     * @param groups
+     *            the groups
+     */
+    public void setGroups(Set<String> groups)
+    {
+        if (groups == null)
+            throw new IllegalArgumentException("Null groups");
+
+        this.groups = groups;
+    }
+
+    /**
+     * Add group.
+     * 
+     * @param group
+     *            the group
+     */
+    public void addGroup(String group)
+    {
+        groups.add(group);
+    }
+
+    /**
+     * Remove group.
+     * 
+     * @param group
+     *            the group
+     */
+    public void removeGroup(String group)
+    {
+        groups.remove(group);
+    }
+
+    /**
+     * Set default group filter.
+     * 
+     * @param groupFilter
+     *            the filter
+     */
+    public void setGroupFilter(VirtualFileFilter groupFilter)
+    {
+        this.groupFilter = groupFilter;
+    }
+
+    /**
+     * Set filter per path.
+     * 
+     * @param filters
+     *            the filters
+     */
+    public void setFilters(Map<String, VirtualFileFilter> filters)
+    {
+        if (filters == null)
+            throw new IllegalArgumentException("Null filters");
+
+        this.filters = filters;
+    }
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsFileFilter.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsFileFilter.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsFileFilter.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6.util;
+
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+
+/**
+ * A {@link VirtualFileFilter} implementation that takes a suffix as a parameter to its 
+ * constructor.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class VfsFileFilter implements VirtualFileFilter
+{
+    private final String suffix;
+    
+    /**
+     * Creates a instance using the passed in suffix
+     * @param suffix The suffix for this filter. 
+     * 
+     * @throws IllegalArgumentException If the passed in suffix is null.
+     */
+    public VfsFileFilter(final String suffix)
+    {
+        if (suffix == null)
+            throw new IllegalArgumentException("suffix argument must not be null");
+            
+        this.suffix = suffix;
+        
+    }
+    
+    /**
+     * Accepts only files ending with the suffix.
+     * 
+     * @param file  The file to filter.
+     * @return true If the file name ends with suffix.
+     */
+    public boolean accepts(final VirtualFile file)
+    {
+        return file.getName().endsWith(suffix);
+    }
+    
+    public String getSuffix()
+    {
+        return suffix;
+    }
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsUtil.java
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsUtil.java	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/util/VfsUtil.java	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.deployers.mc.as6.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+//import org.jboss.vfs.MemoryFileFactory;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * Util methods for interacting with JBoss VFS
+ * <p/>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class VfsUtil
+{
+    /**
+     * Protocol for VFS in-memory URLs.
+     */
+    private static final String IN_MEMORY_PROTOCOL = "vfsmemory";
+    
+    private VfsUtil() {}
+    
+    /**
+     * Creates a new in-memory virtual file system or returns an already existing one..
+     * 
+     * @param url The url which of which this host property will be the root of the fs.
+     * @return VirtualFile The {@link VirtualFile} that represents the root of the fs.
+     * @throws IOException
+     */
+    /*
+    public static VirtualFile createInMemoryFs(final VirtualFile inMemRootDir, final URL rootUrl) throws IOException
+    {
+    	
+    	VirtualFile file = inMemRootDir.getChild(rootUrl);
+        
+    	return file;
+    	//return MemoryFileFactory.createRoot(rootUrl).getRoot();
+    }
+    */
+    
+    /**
+     * Will add the fileContent to the in-memory rootUrl a the location specified by filePath. 
+     * </p>
+     * 
+     * @param rootUrl The root of the in-memory fs.
+     * @param filePath The path relative to the rootUrl.
+     * @param fileContent The contents of the file to add.
+     * @return {@link VirtualFile} A reference to the newly created file in the in-memory file system.
+     * @throws MalformedURLException
+     */
+    /*
+    public static VirtualFile addFile(final URL rootUrl, final String filePath, final byte[] fileContent) throws MalformedURLException
+    {
+        final URL fileUrl = new URL(rootUrl + "/" + filePath);
+        return MemoryFileFactory.putFile(fileUrl, fileContent);
+    }
+    */
+
+    /**
+     * A simple method that creates a new url with a protocol of 'vfsmemory'.
+     * 
+     * @param root Will be the name (hostname) of the root in-memory file system. 
+     * @return {@link URL} An url that represents a root of an in-memory file system.
+     * @throws MalformedURLException
+     */
+    public static URL createInMemUrl(final String root) throws MalformedURLException
+    {
+        return new URL(IN_MEMORY_PROTOCOL, root, "");
+    }
+    
+    public static URL createInMemUrl(final String root, final String path) throws MalformedURLException
+    {
+        return new URL(IN_MEMORY_PROTOCOL, root, "/" + path);
+    }
+    
+    public static URL createInMemUrl(final URL root, final String path) throws MalformedURLException
+    {
+        return new URL(IN_MEMORY_PROTOCOL, root.getHost(), root.getPath() + "/" + path);
+    }
+    /*
+    public static void addFiles(final List<VirtualFile> files, final URL destUrl, final String subPath) throws IOException, URISyntaxException
+    {
+        addFiles(files, destUrl, subPath, null);
+    }
+    
+    public static void addFiles(final List<VirtualFile> files, final URL destUrl, final String subPath, final String pathPrefix) throws IOException, URISyntaxException
+    {
+        for (final VirtualFile file : files)
+        {
+            String path = subpath(file.getPathName(), subPath, pathPrefix);
+            addFile(file, destUrl, path);
+        }
+    }
+    
+    public static void addFiles(final Map<VirtualFile, String> filesToNamesMap, final URL destUrl, final String pathPrefix) throws IOException, URISyntaxException
+    {
+        Set<Entry<VirtualFile, String>> entrySet = filesToNamesMap.entrySet();
+        for (Entry<VirtualFile, String> entry : entrySet)
+        {
+            VirtualFile file = entry.getKey();
+            String path = entry.getValue();
+            addFile(file, destUrl, pathPrefix + path);
+        }
+    }
+    
+    private static void addFile(final VirtualFile file, final URL destUrl, final String path) throws IOException
+    {
+        InputStream in = null;
+        try
+        {
+            in = file.openStream();
+            final URL newUrl = createInMemUrl(destUrl.getHost(), path);
+            MemoryFileFactory.putFile(newUrl, StreamUtils.readStream(in));
+        }
+        finally
+        {
+            in.close();
+        }
+    }
+
+*/
+    
+    static String subpath(final String path, final String pathName, final String pathPrefix)
+    {
+        if (path == null || pathName == null)
+        {
+            return path;
+        }
+        
+        final int idx = path.indexOf(pathName);
+        final String subpath ;
+        if (idx != -1)
+        {
+            subpath = path.substring(idx + pathName.length());
+        }
+        else
+        {
+            subpath = path ;
+        }
+        if (pathPrefix == null)
+        {
+            return subpath;
+        }
+        else if (subpath.startsWith("/")) 
+        {
+            return pathPrefix + subpath;
+        }
+        else
+        {
+            return pathPrefix + "/" + subpath;
+        }
+    }
+    
+    static String subpath(final String path, final String pathName)
+    {
+        return subpath(path, pathName, null);
+    }
+
+}

Added: labs/jbossesb/workspace/tcunning/as6/product/rosetta/ivy.xml
===================================================================
--- labs/jbossesb/workspace/tcunning/as6/product/rosetta/ivy.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tcunning/as6/product/rosetta/ivy.xml	2011-04-18 19:26:14 UTC (rev 36949)
@@ -0,0 +1,22 @@
+<ivy-module version="2.0">
+    <info organisation="org.jboss" module="jbossesb"/>    
+    <dependencies>
+
+        <!-- JBoss Microcontainer dependencies -->
+        <dependency org="org.jboss.deployers" name="jboss-deployers-vfs-spi" rev="2.2.0.GA">
+            <exclude org="jboss" module="jboss-vfs"/>
+        </dependency>
+
+        <dependency org="org.jboss.deployers" name="jboss-deployers-vfs" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-spi" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-core-spi" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-core" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-impl" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-structure-spi" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-client" rev="2.2.0.GA"/>
+        <dependency org="org.jboss.deployers" name="jboss-deployers-client-spi" rev="2.2.0.GA"/>
+
+        <dependency org="org.jboss" name="jboss-vfs" rev="3.0.0.GA"/>
+        
+    </dependencies>
+</ivy-module>

Added: labs/jbossesb/workspace/tcunning/as6/product/services/jbpm/as6/jbpm-identity-3.2.7.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/workspace/tcunning/as6/product/services/jbpm/as6/jbpm-identity-3.2.7.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the jboss-svn-commits mailing list