<?xml version="1.0" encoding="UTF-8"?>

<!-- ====================================================================== -->
<!--                                                                        -->
<!--  JBoss, the OpenSource J2EE webOS                                      -->
<!--                                                                        -->
<!--  Distributable under LGPL license.                                     -->
<!--  See terms of license at http://www.gnu.org.                           -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- $Id: build-deploy.xml 12109 2010-04-23 11:23:18Z richard.opalka@jboss.com $ -->

<project>

	<import file="${core.dir}/ant-import/macros-deploy-framework.xml"/>
	<import file="${core.dir}/ant-import/macros-deploy-native.xml"/>

  <!-- Check availability of container integration -->
  <available property="jbossws.jboss42.available" file="${jboss42.home}/server/${jboss.server.instance}/lib/jbossws-jboss42.jar"/>
  
	<!-- ================================================================== -->
	<!-- Deployment  JBoss50                                                -->
	<!-- ================================================================== -->

	<!-- Deploy jbossws to jboss50 -->
	<target name="deploy-jboss50" depends="jars-jboss50,undeploy-jboss50,deploy-jboss50-endorsed" description="Deploy jbossws to jboss50">
		<macro-deploy-native50
				stacklibs="${core.dir}/output/lib"
				thirdpartylibs="${core.dir}/thirdparty"/>
		<macro-deploy-framework
				thirdpartylibs="${core.dir}/thirdparty"
				jbosshome="${jboss50.home}"/>
  </target>
  
	<target name="deploy-jboss50-endorsed" depends="prepare">
		<macro-deploy-endorsed
				jbosshome="${jboss50.home}"
				stacklibs="${core.dir}/output/lib"
				thirdpartylibs="${core.dir}/thirdparty"/>
	</target>

	<!-- Remove jbossws from jboss50 -->
	<target name="undeploy-jboss50" depends="prepare,undeploy-jboss50-endorsed" description="Remove jbossws from jboss50">		
		<macro-undeploy-native50/>
		<macro-undeploy-framework jbosshome="${jboss50.home}"/>
	</target>
  
	<target name="undeploy-jboss50-endorsed" depends="prepare">		
		<macro-undeploy-endorsed jbosshome="${jboss50.home}"/>
	</target>

	<!-- Deploy jbossws to jboss42 -->
	<target name="deploy-jboss42" depends="jars-jboss42,undeploy-jboss42,deploy-jboss42-endorsed, deploy-jboss421" description="Deploy jbossws to jboss42">
		<macro-deploy-native42
				stacklibs="${core.dir}/output/lib"
				thirdpartylibs="${core.dir}/thirdparty"/>
		<macro-deploy-framework
				thirdpartylibs="${core.dir}/thirdparty"
				jbosshome="${jboss42.home}"/>
  </target>
  
	<target name="deploy-jboss42-endorsed" depends="prepare">
		<macro-deploy-endorsed
				jbosshome="${jboss42.home}"
				stacklibs="${core.dir}/output/lib"
				thirdpartylibs="${core.dir}/thirdparty"/>
	</target>

  <!-- Container integration is not contained in the jbossws.sar -->
	<target name="deploy-jboss421" depends="prepare" unless="jbossws.jboss42.available">
    <copy file="${thirdparty.dir}/jbossws-jboss421.jar" tofile="${jboss42.home}/server/${jboss.server.instance}/lib/jbossws-jboss42.jar"/>
    <copy file="${thirdparty.dir}/jbossws-jboss421.jar" tofile="${jboss42.home}/client/jbossws-jboss42.jar"/>
	</target>

	<!-- Remove jbossws from jboss42 -->
	<target name="undeploy-jboss42" depends="prepare,undeploy-jboss42-endorsed" description="Remove jbossws from jboss42">
		<macro-undeploy-native42/>
		<macro-undeploy-framework jbosshome="${jboss42.home}"/>
	</target>
	<target name="undeploy-jboss42-endorsed" depends="prepare">		
		<macro-undeploy-endorsed jbosshome="${jboss42.home}"/>
	</target>
  
	<!-- Deploy jbossws to jboss40 -->
	<target name="deploy-jboss40" depends="jars-jboss40,undeploy-jboss40,deploy-jboss40-no-ejb3" description="Deploy jbossws to jboss40"/>
  
	<target name="deploy-jboss40-ejb3">
		<macro-deploy-native40
				stacklibs="${core.dir}/output/lib"
				thirdpartylibs="${core.dir}/thirdparty"/>
		<macro-deploy-framework
				thirdpartylibs="${core.dir}/thirdparty"
				jbosshome="${jboss40.home}"/>
	</target>
  
	<target name="deploy-jboss40-no-ejb3" depends="deploy-jboss40-ejb3" unless="jboss40.ejb3.available">
		<macro-setup-native40-no-ejb3/>
    <echo>
      ***********************************
      * JBossWS EJB3 support disabled   *
      * All EJB3 tests will fail.       *
      ***********************************
    </echo>
	</target>
  
	<!-- Remove jbossws from jboss40 -->
	<target name="undeploy-jboss40" depends="prepare" description="Remove jbossws from jboss40">
		<macro-undeploy-native40/>
		<macro-undeploy-framework jbosshome="${jboss40.home}"/>
	</target>
</project>
