
<!-- Licensed Material - Property of IBM                               -->
<!--                                                                   -->
<!-- 5724-J37 Copyright IBM Corp. 2007                                 -->
<!-- All Rights Reserved.                                              -->
<!-- U.S. Government users - RESTRICTED RIGHTS - Use, Duplication, or  -->
<!-- Disclosure restricted by GSA-ADP schedule contract with IBM Corp. -->
<!-- Status = JEJO610                                                  -->

<project name="defaultWorkClassesProject" default="defaultWorkClasses" basedir=".">

    <target name="detectDmgrProfile">

        <condition property="isDmgrProfile" value="true">
            <equals arg1="${XD_MIGRATION_IS_DMGR_PROFILE}" arg2="${XD_MIGRATION_TRUE}"/>
        </condition>

    </target>

    <target name="detectCurrentOSFamily"
            description="Detecs the current OS family (UNIX or Windows)"
	     if="isDmgrProfile">

        <condition property="currentOSFamily" value="windows">
            <os family="windows"/>
        </condition>

        <condition property="currentOSFamily" value="unix">
            <os family="unix"/>
        </condition>

        <echo>Detected current OS family to be: ${currentOSFamily}</echo>
    </target>

    <target name="convertWASHomeToUNIXStylePath"
	     if="isDmgrProfile">
        <path id="id.was.home">
            <pathelement location="${XD_MIGRATION_TARGET_WAS_HOME}"/>
        </path>

        <pathconvert targetos="unix"
            property="WAS_HOME_UNIX_STYLE"
            refid="id.was.home"/>
    </target>

    <target name="setScriptExtension"
            description="Sets the current script  for this platform (file.separator is unreliable on ANT 1.5.4)">

        <condition property="scriptExtension" value="sh">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>

        <condition property="scriptExtension" value="bat">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
    </target>


    <target name="resolveWSADMINExecutableForTheCurrentPlatform"
            description="Sets WSADMIN_EXECUTABLE to the WAS Java interpretor for the current platform"
	     if="isDmgrProfile">

        <condition property="WSADMIN_EXECUTABLE" value="${XD_MIGRATION_TARGET_PROFILE_PATH}/bin/wsadmin.sh">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>

        <condition property="WSADMIN_EXECUTABLE" value="${XD_MIGRATION_TARGET_PROFILE_PATH}/bin/wsadmin.bat">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>

        <echo>wsadmin interpretor set to: ${WSADMIN_EXECUTABLE}</echo>
    </target>

    <target name="defaultWorkClasses"
            description="setup java.awt.headless property"
            depends="detectDmgrProfile,
            detectCurrentOSFamily,
            convertWASHomeToUNIXStylePath,
            resolveWSADMINExecutableForTheCurrentPlatform"
	     if="isDmgrProfile">

        <exec executable="${WSADMIN_EXECUTABLE}"
                output="${XD_MIGRATION_TARGET_PROFILE_PATH}/logs/LRAWorkClassMigration.log">
            <arg value="-conntype"/>
            <arg value="NONE"/>
            <arg value="-lang"/>
            <arg value="jython"/>
            <arg value="-f"/>
            <arg value="${basedir}/lraworkclassMigration.py"/>
        </exec>
    </target>

</project>
