<project name="configureWebserver" default="configureWebserver" basedir=".">

   <!--
# IBM Confidential OCO Source Material
# 5639-D57, 5630-A36, 5630-A37, 5724-D18 (C) COPYRIGHT International Business Machines Corp. 1997, 2013
# The source code for this program is not published or otherwise divested
# of its trade secrets, irrespective of what has been deposited with the
# U.S. Copyright Office.
   -->


    <taskdef name="wscmtlog"
        classname="com.ibm.ws.install.configmanager.actionengine.ant.utils.AntTaskToLogToConfigManagersLogFiles"/>
    <taskdef name="convertencoding"
        classname="com.ibm.ws.install.configmanager.actionengine.ant.utils.FileEncodingAntTask"/>
    <taskdef name="foreach"
        classname="com.ibm.ws.install.configmanager.actionengine.ant.utils.ForEachAntTask"/>
    <taskdef name="detectlocale"
        classname="com.ibm.ws.install.configmanager.actionengine.ant.utils.DetectLocaleAntTask"/>    

    <target name="defineLocale"
            description="Defines locale">

        <detectlocale property="currentLocale"/>
                            
        <condition property="detectedLocaleFlag" value="true">
              <equals arg1="${currentLocale}" arg2="en_US"/>              
        </condition>       
    </target>
    
    <target name="detectFileEncoding"
            description="Detects the current file encoding">

        <condition property="isFileEncodingCp1252" value="true">
              <equals arg1="${file.encoding}" arg2="Cp1252" casesensitive="false"/>
        </condition>
    </target>

    <target name="convertFileEncoding"
            description="Convert file encoding"
            if="configWindows">

        <fileset dir="${PLUGIN_HOME}\bin" id="batch.fileset">
                       <include name="configure*.bat"/>
        </fileset>

        <pathconvert pathsep=","
                     property="batch.files"
                     refid="batch.fileset"/>

        <foreach list="${batch.files}" propertyName="batch.file" target="convertToCp850"/>
    </target>
    
    <target name="convertToCp850"
            if="isFileEncodingCp1252" unless="detectedLocaleFlag">

        <antcall target="updateLogFile">
           <param name="stringToAppend" value="The batch file ${batch.file} is being converted to Cp850 encoding"/>
        </antcall>        

        <convertencoding path="${batch.file}"
                         from="Cp1252"
                         to="Cp850"/>    
    </target>
    
    <target name="convertCodepageForPluginBatchFiles"
        description="Convert the codepage for batch files in plugin install directory are converted"
        if="configWindows"
        depends="defineLocale,
            detectFileEncoding,                    
            convertFileEncoding" />    
            
    <target name="convertToCRLF"
          description="Converts all batch files to the right CRLF format."
          if="configWindows">

          <fixcrlf srcdir="${PLUGIN_HOME}\bin" 
             eol="crlf"
             includes="**/configure*.bat"/>
     </target>


   <!-- 
   ***************************************************************************
   TARGET: updateLogFile
   Log statement to webserver install log
   ***************************************************************************
   -->      
   <target name="updateLogFile"
        description="Update webserver definition logfile">
      <echo file="${install.log}" append="true">${stringToAppend}${CRLF}</echo>
   </target>

    <!-- 
    ***************************************************************************
    TARGET: logBoth
    Log statement to both webserver install log and cfg manager log
    ***************************************************************************
    -->      
    <target name="logBoth">
       <echo>${logStatement}</echo>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="${logStatement}"/>
        </antcall>            
    </target>    

    <!-- 
    ***************************************************************************
    TARGET: logStartupProperties
    Log startup information to the install log
    ***************************************************************************
    -->      
    <target name="logStartupProperties"
            description="Log properties passed to script">
        <property name="install.log" value="${PLUGIN_HOME}${separatorFile}logs${separatorFile}config${separatorFile}configure_${WEBSERVER_TYPE}_webserver.log"/>
        
        <mkdir dir="${PLUGIN_HOME}${separatorFile}logs${separatorFile}config"/>
        <touch file="${install.log}"/>
        
        <tstamp>
           <format property="timestamp" pattern="MM/dd/yyyy hh:mm aa"/>
        </tstamp>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value=" "/>
        </antcall>        
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="***************************************************************************"/>
        </antcall>        
        
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="** Create Webserver Definition for webserver ${WEBSERVER_NAME} ${timestamp}"/>
        </antcall>     
        
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="***************************************************************************"/>
        </antcall>        
       
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="PLUGIN_HOME              = ${PLUGIN_HOME}"/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WEBSERVER_NAME           = ${WEBSERVER_NAME} "/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WEBSERVER_TYPE           = ${WEBSERVER_TYPE} "/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WEBSERVER_PORT           = ${WEBSERVER_PORT} "/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WEBSERVER_HOSTNAME       = ${WEBSERVER_HOSTNAME} "/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WAS_PLUGIN_CFG_XML       = ${WAS_PLUGIN_CFG_XML}"/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="OS_NAME                  = ${OS_NAME}"/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="PLUGIN_INSTALL_TYPE      = ${PLUGIN_INSTALL_TYPE}"/>
        </antcall>     
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="MAP_DEFAULT_APPLICATIONS = ${MAP_DEFAULT_APPLICATIONS}"/>
        </antcall>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WAS_HOME                 = ${WAS_HOME}"/>
        </antcall>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WASPROFILE_NAME          = ${WASPROFILE_NAME}"/>
        </antcall>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WASPROFILE_LOCATION      = ${WASPROFILE_LOCATION}"/>
        </antcall>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="WS_CMT_NODE_NAME         = ${WS_CMT_NODE_NAME}"/>
        </antcall>
        <antcall target="updateLogFile">
           <param name="stringToAppend" value="INSTALLER_ARCHITECTURE   = ${INSTALL_ARCH}"/>
        </antcall>
        
     
        
    </target>
    
            
    <!--
    ***************************************************************************
    TARGET: setMappingPreference
    ***************************************************************************
    -->      
    <target name="setMappingPreference">
       <condition property="MAPPING_PREFERENCE" value="MAP_ALL">
          <istrue value="${MAP_DEFAULT_APPLICATIONS}"/>
       </condition>
       <condition property="MAPPING_PREFERENCE" value="MAP_NONE">
          <isfalse value="${MAP_DEFAULT_APPLICATIONS}"/>
       </condition>
    </target>    

    <!--
    ***************************************************************************
    TARGET: setWebserverInstallInfo 
    Determine webserver install location.  The install location is the directory
    above the webserver config directory 
    (ie, if config dir = c:\IHS\conf\httpd.conf then the install directory
    would be c:\IHS)
    If WEBSERVER_TYPE is IIS then install location should be set to NULL
    ***************************************************************************
    -->      
    <target name="setWebserverInstallInfo">
    
       <condition property="webserver.config.file" value="${IHS_CONF}">
          <equals arg1="${WEBSERVER_TYPE}" arg2="IHS" trim="true"/>
       </condition>
       
       <condition property="webserver.config.file" value="${APACHE_CONF}">
          <equals arg1="${WEBSERVER_TYPE}" arg2="APACHE" trim="true"/>
       </condition>
       
       <condition property="webserver.config.file" value="${DOMINO6_NAMES_CONF}">
          <and>
             <isset property="DOMINO6_NAMES_CONF"/>               
             <equals arg1="${WEBSERVER_TYPE}" arg2="DOMINO" trim="true"/>
              <not>
                 <equals arg1="${DOMINO6_NAMES_CONF}" arg2=" " trim="true"/>               
              </not>           
          </and>
       </condition>  

       <condition property="webserver.config.file" value="${DOMINO5_NAMES_CONF}">
          <and>
             <isset property="DOMINO5_NAMES_CONF"/>               
             <equals arg1="${WEBSERVER_TYPE}" arg2="DOMINO" trim="true"/>
              <not>
                 <equals arg1="${DOMINO5_NAMES_CONF}" arg2=" " trim="true"/>               
              </not>           
          </and>
       </condition>
       
       <condition property="webserver.config.file" value="${SUNONE_MAGNUS_CONF}">
          <equals arg1="${WEBSERVER_TYPE}" arg2="SUNJAVASYSTEM" trim="true"/>
       </condition>           
       
       <condition property="webserver.config.file" value="NULL">
          <equals arg1="${WEBSERVER_TYPE}" arg2="IIS" trim="true"/>
       </condition> 
       
       <dirname property="webserver.config.dir" file="${webserver.config.file}"/>
       <dirname property="webserver.install.dir" file="${webserver.config.dir}"/>
      

       <condition property="WEBSERVER_INSTALL_ROOT" value="${webserver.install.dir}">       
          <not>
             <equals arg1="${WEBSERVER_TYPE}" arg2="IIS" trim="true"/>
          </not>
       </condition>   
       
       <condition property="WEBSERVER_INSTALL_ROOT" value="NULL">       
          <equals arg1="${WEBSERVER_TYPE}" arg2="IIS" trim="true"/>
       </condition>   
       
       <condition property="WEBSERVER_CONFIG" value="${webserver.config.file}">       
          <not>
             <equals arg1="${WEBSERVER_TYPE}" arg2="IIS" trim="true"/>
          </not>
       </condition>   
       
       <condition property="WEBSERVER_CONFIG" value="NULL">       
          <equals arg1="${WEBSERVER_TYPE}" arg2="IIS" trim="true"/>
       </condition>   
       
       <antcall target="updateLogFile">
          <param name="stringToAppend"  value="WEBSERVER_INSTALL_ROOT   = ${WEBSERVER_INSTALL_ROOT}"/>
       </antcall>     
       
       <antcall target="updateLogFile">
          <param name="stringToAppend"  value="WEBSERVER_CONFIG         = ${WEBSERVER_CONFIG}"/>
       </antcall>     
       
    </target>   
    
   
   
    <!--
    ***************************************************************************
    TARGET: detectCurrentOSFamily
    Detect current OS Family
    ***************************************************************************
    -->      
    <target name="detectCurrentOSFamily"
            description="Detects the current OS family (UNIX or Windows)">
        
        <!-- OS/400 setting must come before the unix setting -->
        <condition property="currentOSFamily" value="os/400">
            <equals arg1="${os.name}" arg2="OS/400"/>
        </condition>

        <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: setWebserverOS
    Set the appropriate webserverOS for the OS
    **************************************************************************
    -->      
    <target name="setWebserverOS"
            description="Sets WEBSERVER_OS for the current platform">
            
        <condition property="WEBSERVER_OS" value="aix">
            <equals arg1="${OS_NAME}" arg2="AIX"/>
        </condition>
        
        <condition property="WEBSERVER_OS" value="linux">
            <equals arg1="${OS_NAME}" arg2="Linux"/>
        </condition>
        
        <condition property="WEBSERVER_OS" value="solaris">
            <equals arg1="${OS_NAME}" arg2="SunOS"/>
        </condition>
        
        <condition property="WEBSERVER_OS" value="hpux">
            <equals arg1="${OS_NAME}" arg2="HP-UX"/>
        </condition>

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

        <condition property="WEBSERVER_OS" value="os400">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>

    </target>
    
    
    <!--
    ***************************************************************************
    TARGET: setOSFileSeparator
    Set the appropriate file separator for the OS
    ***************************************************************************
    -->      
    <target name="setOSFileSeparator"
            description="Sets the current file separator for this platform (file.separator is unreliable on ANT 1.5.4)">

        <condition property="separatorFile" value="/">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>
    
        <condition property="separatorFile" value="/">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>
        
        <condition property="separatorFile" value="\">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
        
        <echo>file separator is ${separatorFile}</echo>
                
        <condition property="CRLF" value="&#13;&#10;">
            <os family="windows"/>
        </condition>
        
        <condition property="CRLF" value="&#10;">
            <os family="unix"/>
        </condition>
    
    </target>
    
    <!--
    ***************************************************************************
    TARGET: setOSQuote
    Set the appropriate file separator for the OS
    ***************************************************************************
    -->      
    <target name="setOSQuote"
            description="Sets the current quote for this platform">

        <condition property="osQuote" value="'">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>
            
        <condition property="osQuote" value="'">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>
        
        <condition property="osQuote" value="&quot;">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
    
    </target>

    <!--
    ***************************************************************************
    TARGET: defineOSSpecificConfigFlag
    ***************************************************************************
    -->      
    <target name="defineOSSpecificConfigFlag"
            description="Defines either configUNIX or configWindows depending on the current OS">
            
        <condition property="configOS400" value="true">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>
        
        <condition property="configUNIX" value="true">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>
        
        <condition property="configWindows" value="true">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>                
            
    </target>
    

    <!--
    ***************************************************************************
    TARGET: convertWASHomeToUNIXStylePath
    ***************************************************************************
    -->      
    <target name="convertWASHomeToUNIXStylePath">
        <path id="id.was.home">
            <pathelement location="${WAS_HOME}"/>
        </path>
    
        <pathconvert targetos="unix" 
            property="WAS_HOME_UNIX_STYLE" 
            refid="id.was.home"/>
    </target>
        
    <!--
    ***************************************************************************
    TARGET: setInstallType
    ***************************************************************************
    -->      
    <target name="setInstallType">
       <condition property="RemoteInstall">
          <equals arg1="${PLUGIN_INSTALL_TYPE}" arg2="remote" trim="true" casesensitive="false"/>
       </condition>    

       <condition property="LocalStandaloneInstall">
          <equals arg1="${PLUGIN_INSTALL_TYPE}" arg2="local_standalone" trim="true" casesensitive="false"/>
       </condition>    

       <condition property="LocalDistributedInstall">
          <equals arg1="${PLUGIN_INSTALL_TYPE}" arg2="local_distributed" trim="true" casesensitive="false"/>
       </condition>    
    </target>
    
    <!--
    ***************************************************************************
    TARGET: resolveWSADMINExecutableForTheCurrentPlatform
    Set wasadmin script depending on the platform
    ***************************************************************************
    -->      
    <target name="resolveWSADMINExecutableForTheCurrentPlatform"
            description="Sets WSADMIN_EXECUTABLE to the WAS Java interpretor for the current platform">
            
        <condition property="WSADMIN_EXECUTABLE" value="${WASPROFILE_LOCATION}/bin/wsadmin">
            <and>
               <equals arg1="${currentOSFamily}" arg2="os/400"/>
               <not>
                  <istrue value="${RemoteInstall}"/>
               </not>
            </and>
        </condition>
        
        <condition property="WSADMIN_EXECUTABLE" value="${WASPROFILE_LOCATION}/bin/wsadmin.sh">
            <and>
               <equals arg1="${currentOSFamily}" arg2="unix"/>
               <not>
                  <istrue value="${RemoteInstall}"/>
               </not>
            </and>
        </condition>
        
        <condition property="WSADMIN_EXECUTABLE" value="&quot;${WASPROFILE_LOCATION}/bin/wsadmin.bat&quot;">
            <and>
               <equals arg1="${currentOSFamily}" arg2="windows"/>
               <not>
                  <istrue value="${RemoteInstall}"/>
               </not>
            </and>
        </condition>

        <condition property="WSADMIN_EXECUTABLE" value="&quot;$binDir/wsadmin&quot;">
            <and>
               <equals arg1="${currentOSFamily}" arg2="os/400"/>
               <istrue value="${RemoteInstall}"/>
            </and>
        </condition>

        <condition property="WSADMIN_EXECUTABLE" value="&quot;$binDir/wsadmin.sh&quot;">
            <and>
               <equals arg1="${currentOSFamily}" arg2="unix"/>
               <istrue value="${RemoteInstall}"/>
            </and>
        </condition>
        
        <condition property="WSADMIN_EXECUTABLE" value="wsadmin.bat">
            <and>
               <equals arg1="${currentOSFamily}" arg2="windows"/>
               <istrue value="${RemoteInstall}"/>
            </and>
        </condition>
        
        <antcall target="logBoth">
            <param name="logStatement" value="wsadmin interpretor set to: ${WSADMIN_EXECUTABLE}"/>
	      </antcall>

    </target>
    
    <!--
    ***************************************************************************
    TARGET: convertPathDblSlash
    Update PLUGIN_HOME and WASPROFILE_LOCATION to contain double slashes.
    Windows Only    
    ***************************************************************************
    -->      
    <target name="convertPathDblSlash"        
            description="Update PLUGIN_HOME and WASPROFILE_LOCATION to contain double slashes.  Windows Only"
            if="configWindows">
            
        <path id="plugin.path">
           <pathelement location="${PLUGIN_HOME}"/>
        </path>
        
        <pathconvert targetos="windows" property="PLUGIN_HOME_DBL_SLASH" refid="plugin.path" dirsep="\\"/>
        
        <path id="profile.path">
           <pathelement location="${WASPROFILE_LOCATION}"/>
        </path>
        <pathconvert targetos="windows" property="WAS_PROFILE_DBL_SLASH" refid="profile.path" dirsep="\\"/>
        
        <path id="webserver.config.path">
           <pathelement location="${WEBSERVER_CONFIG}"/>
        </path>
        <pathconvert targetos="windows" property="WEBSERVER_CFG_DBL_SLASH" refid="webserver.config.path" dirsep="\\"/>
        
        <path id="webserver.install.path">
           <pathelement location="${WEBSERVER_INSTALL_ROOT}"/>
        </path>
        <pathconvert targetos="windows" property="WEBSERVER_INSTALL_DBL_SLASH" refid="webserver.install.path" dirsep="\\"/>
    </target>

    <!--
    **************************************************************************
    TARGET: createCrossPlatformDir
    create directory for cross platform create webserver scripts
    **************************************************************************
    -->
    <target name="createCrossPlatformDir" if="crossPlatform.dir.notfound">
        <antcall target="logBoth">
           <param name="logStatement" value="Creating directory ${crossPlatform.dir}"/>
        </antcall>
        <mkdir dir="${crossPlatform.dir}"/>
    </target>
    
    <!--
    **************************************************************************
    TARGET: createCrossPlatformUnixSubDir
    create directory for cross platform create webserver scripts
    **************************************************************************
    -->
    <target name="createCrossPlatformUnixSubDir">
        <property name="crossPlatformUnix.dir" value="${crossPlatform.dir}${separatorFile}unix"/>     
        <antcall target="logBoth">
           <param name="logStatement" value="Creating unix cross platform directory ${crossPlatformUnix.dir}"/>
        </antcall>
        <mkdir dir="${crossPlatformUnix.dir}"/> 
    </target>
     
   <!--
    **************************************************************************
    TARGET: createCrossPlatformWindowsSubDir
    create directory for cross platform create webserver scripts
    **************************************************************************
    -->
    <target name="createCrossPlatformWindowsSubDir">
        <property name="crossPlatformWindows.dir" value="${crossPlatform.dir}${separatorFile}windows"/>  
        <antcall target="logBoth">
           <param name="logStatement" value="Creating windows cross platform directory ${crossPlatformWindows.dir}"/>
        </antcall>
        <mkdir dir="${crossPlatformWindows.dir}"/> 
    </target>
    
    <!--
    **************************************************************************
    TARGET: createCrossPlatformOS400SubDir
    create directory for cross platform create webserver scripts
    **************************************************************************
    -->
    <target name="createCrossPlatformOS400SubDir">
        <property name="crossPlatformOS400.dir" value="${crossPlatform.dir}${separatorFile}os400"/>  
        <antcall target="logBoth">
           <param name="logStatement" value="Creating os400 cross platform directory ${crossPlatformOS400.dir}"/>
        </antcall>
        <mkdir dir="${crossPlatformOS400.dir}"/> 
    </target>
    
    
   <!--
    **************************************************************************
    TARGET: createCrossPlatformOS390SubDir
    create directory for cross platform create webserver scripts
    **************************************************************************
    -->
    <target name="createCrossPlatformOS390SubDir">
        <property name="crossPlatformOS390.dir" value="${crossPlatform.dir}${separatorFile}os390"/>  
        <antcall target="logBoth">
           <param name="logStatement" value="Creating os390 cross platform directory ${crossPlatformOS390.dir}"/>
        </antcall>
        <mkdir dir="${crossPlatformOS390.dir}"/> 
    </target>

    
    <!--
    **************************************************************************
    TARGET: checkCrossPlatformDir
    Check if PLUGIN_HOME/bin/crossPlatform directory exists
    **************************************************************************
    -->
    <target name="checkCrossPlatformDir" if="RemoteInstall">
       <property name="crossPlatform.dir" value="${PLUGIN_HOME}${separatorFile}bin${separatorFile}crossPlatformScripts"/>  
  
        <condition property="crossPlatform.dir.notfound">
           <not>
              <available file="${crossPlatform.dir}" type="dir"/>
           </not>
        </condition>
  
        <condition property="dirMsg" value="Log directory ${crossPlatform.dir} exists">
           <isfalse value="${crossPlatform.dir.notfound}"/>
        </condition>
        
        <condition property="dirMsg" value="Log directory ${crossPlatform.dir} does not exist">
           <istrue value="${crossPlatform.dir.notfound}"/>
        </condition>
        
        <antcall target="logBoth">
           <param name="logStatement" value="${dirMsg}"/>
        </antcall>
        <antcall target="createCrossPlatformDir" />
        
    </target>
    
    <!--
    ***************************************************************************
    TARGET: createWindowsCrossPlatformScript
    PURPOSE:  Creates Windows, z/OS, and iSeries scripts 
    ***************************************************************************
    -->      
      <target name="createWindowsCrossPlatformScript"  depends="createOS400CrossPlatformScript,createOS390CrossPlatformScript" if="configUNIX">
        <antcall target="createCrossPlatformWindowsSubDir"/>
	      <property name="cp.script.file.windows" value="${crossPlatform.dir}${separatorFile}windows${separatorFile}configure${WEBSERVER_NAME}.bat"/>

        <antcall target="logBoth">
            <param name="logStatement" value="Creating windows cross platform webserver definition script ${cp.script.file.windows}"/>
	      </antcall>
        <antcall target="writeWindowsParameters">
	          <param name="script.file" value="${cp.script.file.windows}"/>
	      </antcall>  
        <echo file="${cp.script.file.windows}" append="true">wsadmin.bat %PROFILE_NAME_PARAMETER% %WSADMIN_USERID_PARAMETER% %WSADMIN_PASSWORD_PARAMETER% -f &quot;%WAS_HOME%\bin\configureWebserverDefinition.jacl&quot; ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${script.webserver.install.root}  ${script.webserver.config.root} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${script.plugin.home} unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
        <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.windows}"/>
	      </antcall>
        <antcall target="writeWindowsScriptEnd">
	          <param name="script.file" value="${cp.script.file.windows}"/>
	      </antcall>  
	      <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.windows}"/>
        </antcall>

	
        <antcall target="logBoth">
            <param name="logStatement" value="Creating os400 cross platform webserver definition script ${cp.script.file.os400}"/>
	      </antcall>
        <antcall target="writeOs400Parameters">
	          <param name="script.file" value="${cp.script.file.os400}"/>
	      </antcall>  
        <echo file="${cp.script.file.os400}" append="true">wsadmin $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f $WAS_HOME/bin/configureWebserverDefinition.jacl ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${script.webserver.install.root} ${script.webserver.config.root} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${script.plugin.home} unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
	      <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.os400}"/>
	      </antcall>
	      <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.os400}"/>
        </antcall>
	
	
        <antcall target="logBoth">             
            <param name="logStatement" value="Creating os390 cross platform webserver definiton script ${cp.script.file.os390}"/>
	      </antcall>
        <antcall target="writeUnixParameters">
	          <param name="script.file" value="${cp.script.file.os390}"/>
	      </antcall>  
        <echo file="${cp.script.file.os390}" append="true">&quot;$binDir/wsadmin.sh&quot; $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f $WAS_HOME/bin/configureWebserverDefinition.jacl ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${script.webserver.install.root} ${script.webserver.config.root} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${script.plugin.home} unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
        <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.os390}"/>
	      </antcall>
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.os390}"/>
        </antcall>
        
    </target>

    <!--
    ***************************************************************************
    TARGET: createUnixCrossPlatformScript
    PURPOSE:  Creates Unix, z/OS, and iSeries scripts
    ***************************************************************************
    -->      
    <target name="createUnixCrossPlatformScript" depends="createOS400CrossPlatformScript,createOS390CrossPlatformScript" if="configWindows">
        <antcall target="createCrossPlatformUnixSubDir"/>
        <property name="cp.script.file.unix" value="${crossPlatform.dir}${separatorFile}unix${separatorFile}configure${WEBSERVER_NAME}.sh"/>
        <antcall target="logBoth">                 
            <param name="logStatement" value="Creating unix cross platform webserver definiton script ${cp.script.file.unix}"/>
	      </antcall>
        <antcall target="writeUnixParameters">
	          <param name="script.file" value="${cp.script.file.unix}"/>
	      </antcall>  
        <echo file="${cp.script.file.unix}" append="true">&quot;$binDir/wsadmin.sh&quot; $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f $WAS_HOME/bin/configureWebserverDefinition.jacl ${WEBSERVER_NAME} ${WEBSERVER_TYPE} '${script.webserver.install.root}' '${script.webserver.config.root}' ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} '${script.plugin.home}' unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
        <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.unix}"/>
	      </antcall>
	      <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.unix}"/>
        </antcall>
        

        <antcall target="logBoth">                 
            <param name="logStatement" value="Creating os400 cross platform webserver definiton script ${cp.script.file.os400}"/>
	      </antcall>
        <antcall target="writeOs400Parameters">
	          <param name="script.file" value="${cp.script.file.os400}"/>
	      </antcall>  
	      <echo file="${cp.script.file.os400}" append="true">wsadmin $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f $WAS_HOME/bin/configureWebserverDefinition.jacl ${WEBSERVER_NAME} ${WEBSERVER_TYPE} '${script.webserver.install.root}' '${script.webserver.config.root}' ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} '${script.plugin.home}' unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
	      <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.os400}"/>
	      </antcall>
	      <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.os400}"/>
        </antcall>
        
	
        <antcall target="logBoth">             
            <param name="logStatement" value="Creating os390 cross platform webserver definiton script ${cp.script.file.os390}"/>
	      </antcall>
        <antcall target="writeUnixParameters">
	          <param name="script.file" value="${cp.script.file.os390}"/>
	      </antcall>  
        <echo file="${cp.script.file.os390}" append="true">&quot;$binDir/wsadmin.sh&quot; $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f $WAS_HOME/bin/configureWebserverDefinition.jacl ${WEBSERVER_NAME} ${WEBSERVER_TYPE} '${script.webserver.install.root}' '${script.webserver.config.root}' ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} '${script.plugin.home}' unmanaged ${WEBSERVER_HOSTNAME}-node ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>
        <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${cp.script.file.os390}"/>
	      </antcall>
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${cp.script.file.os390}"/>
        </antcall>
    </target>
    
   <!--
    ***************************************************************************
    TARGET: createOS400CrossPlatformScript
    ***************************************************************************
    -->      
    <target name="createOS400CrossPlatformScript">
        <antcall target="createCrossPlatformOS400SubDir"/>
        <property name="cp.script.file.os400" value="${crossPlatform.dir}${separatorFile}os400${separatorFile}configure${WEBSERVER_NAME}"/>                        
    </target>
    
    <!--
    ***************************************************************************
    TARGET: createOS390CrossPlatformScript
    ***************************************************************************
    -->      
    <target name="createOS390CrossPlatformScript">
        <antcall target="createCrossPlatformOS390SubDir"/>
        <property name="cp.script.file.os390" value="${crossPlatform.dir}${separatorFile}os390${separatorFile}configure${WEBSERVER_NAME}.sh"/>            
    </target>
   
   <!--
    ***************************************************************************
    TARGET: writeWindowsIHSAdminParameters
    Writes IHSAdmin parameters to be accepted in windows format        
    ***************************************************************************
    -->
    <target name="writeWindowsIHSAdminParameters" if="configService" depends="getWebServerPostInstallProps">  
        <antcall target="logBoth">
            <param name="logStatement" value="Writing Windows service: ${WINSERVICE}"/>
	      </antcall>

        <echo file="${script.file}" append="true"> ${IHS_ADMIN_PORT}  ${IHS_ADMIN_USERID} ${IHS_ADMIN_PASSWORD_PARAMETER} &quot;${WINSERVICE}&quot;</echo>
    </target>  

   <!--
    ***************************************************************************
    TARGET: writeWindowsScriptEnd
    Writes the script end
    ***************************************************************************
    -->
    <target name="writeWindowsScriptEnd" >  

      <echo file="${script.file}" append="true"> 

        :end
        @endlocal

      </echo>
    </target>  

   <!--
    ***************************************************************************
    TARGET: writeUnixIHSAdminParameters
    Writes IHSAdmin parameters to be accepted in unix format    
    ***************************************************************************
    -->
    <target name="writeUnixIHSAdminParameters" if="ConfigIHSAdmin">  

        <echo file="${script.file}" append="true"> ${IHS_ADMIN_PORT}  ${IHS_ADMIN_USERID} ${IHS_ADMIN_PASSWORD_PARAMETER} </echo>
    </target>  

   <!--
    ***************************************************************************
    TARGET: writeWindowsParameters
    Writes parameters to be accepted in windows format
    ***************************************************************************
    -->
    <target name="writeWindowsParameters">  

        <condition property="WRITE_WINDOWS_PARM_TARGET" value="writeWindowsIHSAdminScript">        
           <istrue value="${ConfigIHSAdmin}"/>       
        </condition>

        <condition property="WRITE_WINDOWS_PARM_TARGET" value="writeWindowsNonIHSAdminScript">        
           <isfalse value="${ConfigIHSAdmin}"/>       
        </condition>
        
        <antcall target="${WRITE_WINDOWS_PARM_TARGET}">
	         <param name="script.file" value="${script.file}"/>
	      </antcall>  
   
   </target>  

   <!--
    ***************************************************************************
    TARGET: writeWindowsNonIHSAdminScript
    Writes parameters to be accepted in windows format
    ***************************************************************************
    -->
    <target name="writeWindowsNonIHSAdminScript">  

<echo file="${script.file}">

@REM Invokes wsadmin to create the web server defintion

@echo off
@setlocal

call "%~dp0setupCmdLine.bat" %*

set  COMMAND_INVOKED=%0

set  PROFILE_NAME_PARAMETER=
set  WSADMIN_USERID_PARAMETER=
set  WSADMIN_PASSWORD_PARAMETER=

:parse
if "%1"=="-profileName"           goto profile.name
if "%1"=="-user"                  goto wsadmin.user
if "%1"=="-password"              goto wsadmin.password
if "%1"=="-help"                  goto error
if "%1"==""                       goto done
goto error

:profile.name
shift
echo Using the profile %1
set  PROFILE_NAME_PARAMETER= -profileName %1
goto recursive

:wsadmin.user
shift
echo Using WebSphere admin userID %1
set  WSADMIN_USERID_PARAMETER= -user %1
goto recursive

:wsadmin.password
shift
set  WSADMIN_PASSWORD_PARAMETER= -password %1
goto recursive

:recursive
shift
goto parse
goto done

:error
echo.
echo.
echo Usage: %COMMAND_INVOKED%
echo          [-profileName      profile_name]
echo          [-user             WAS_Admin_userID]
echo          [-password         WAS_Admin_password^>]
echo          [-help ]
echo.
echo Where:
echo     profileName        is the name of the profile in which
echo                        web server should be created
echo     user               is the WebSphere Administration userID
echo     password           is the WebSphere Administration password
echo.
echo Example: 
echo     %COMMAND_INVOKED% -profileName AppSrv01 -user admin -password admin1
echo.
echo.

goto end

:done

</echo>
   </target>  
    
   <!--
    ***************************************************************************
    TARGET: writeWindowsIHSAdminScript
    Writes parameters to be accepted in windows format
    ***************************************************************************
    -->
    <target name="writeWindowsIHSAdminScript">  

<echo file="${script.file}">

@REM Invokes wsadmin to create the web server defintion

@echo off
@setlocal

call "%~dp0setupCmdLine.bat" %*

set  COMMAND_INVOKED=%0

set  PROFILE_NAME_PARAMETER=
set  WSADMIN_USERID_PARAMETER=
set  WSADMIN_PASSWORD_PARAMETER=
set  IHS_ADMIN_PASSWORD_PARAMETER=

:parse
if "%1"=="-profileName"           goto profile.name
if "%1"=="-user"                  goto wsadmin.user
if "%1"=="-password"              goto wsadmin.password
if "%1"=="-ihsAdminPassword"      goto ihs.admin.password
if "%1"=="-help"                  goto error
if "%1"==""                       goto done
goto error

:profile.name
shift
echo Using the profile %1
set  PROFILE_NAME_PARAMETER= -profileName %1
goto recursive

:wsadmin.user
shift
echo Using WebSphere admin userID %1
set  WSADMIN_USERID_PARAMETER= -user %1
goto recursive

:wsadmin.password
shift
set  WSADMIN_PASSWORD_PARAMETER= -password %1
goto recursive

:ihs.admin.password
shift
set  IHS_ADMIN_PASSWORD_PARAMETER=%1
goto recursive

:recursive
shift
goto parse
goto done

:error
echo.
echo.
echo Usage: %COMMAND_INVOKED%
echo          [-profileName      profile_name]
echo          [-user             WAS_Admin_userID]
echo          [-password         WAS_Admin_password]
echo          [-ihsAdminPassword IHS_Admin_password]
echo          [-help ]
echo.
echo Where:
echo     profileName        is the name of the profile in which
echo                        web server should be created
echo     user               is the WebSphere Administration userID
echo     password           is the WebSphere Administration password
echo     ihsAdminPassword   is the password to access the IHS Adminstration server
echo.
echo Example: 
echo     %COMMAND_INVOKED% -profileName AppSrv01 -user admin -password admin1
echo.
echo.

goto end

:done

</echo>       
   </target>  

   <!--
    ***************************************************************************
    TARGET: writeOs400Parameters
    Writes parameters to be accepted in Os400 format
    ***************************************************************************
    -->
    <target name="writeOs400Parameters">  

<echo file="${script.file}">#!/usr/bin/qsh

. $(/usr/bin/dirname $0)/setupCmdLine

</echo>

        <condition property="WRITE_UNIX_PARM_TARGET" value="writeUnixIHSAdminScript">        
           <istrue value="${ConfigIHSAdmin}"/>       
        </condition>

        <condition property="WRITE_UNIX_PARM_TARGET" value="writeUnixNonIHSAdminScript">        
           <isfalse value="${ConfigIHSAdmin}"/>       
        </condition>
        
        <antcall target="${WRITE_UNIX_PARM_TARGET}">
	         <param name="script.file" value="${script.file}"/>
	      </antcall>  
   
   </target>  


   <!--
    ***************************************************************************
    TARGET: writeUnixParameters
    Writes parameters to be accepted in unix format
    ***************************************************************************
    -->
    <target name="writeUnixParameters">  
    
<echo file="${script.file}">#!/bin/sh

binDir=`dirname "$0"`
. "$binDir/setupCmdLine.sh"

</echo>

        <condition property="WRITE_UNIX_PARM_TARGET" value="writeUnixIHSAdminScript">        
           <istrue value="${ConfigIHSAdmin}"/>       
        </condition>

        <condition property="WRITE_UNIX_PARM_TARGET" value="writeUnixNonIHSAdminScript">        
           <isfalse value="${ConfigIHSAdmin}"/>       
        </condition>
        
        <antcall target="${WRITE_UNIX_PARM_TARGET}">
	         <param name="script.file" value="${script.file}"/>
	      </antcall>  
   
   </target>  

   <!--
    ***************************************************************************
    TARGET: writeUnixIHSAdminScript
    Writes parameters to be accepted in unix format
    ***************************************************************************
    -->
    <target name="writeUnixIHSAdminScript">  
    
<echo file="${script.file}" append="true">

COMMAND_INVOKED="$0"

PROFILE_NAME_PARAMETER=
WSADMIN_USERID_PARAMETER=
WSADMIN_PASSWORD_PARAMETER=
IHS_ADMIN_PASSWORD_PARAMETER=

printUsage()
{
        echo ""
        echo ""
        echo "Usage: $COMMAND_INVOKED"
        echo "    [ -profileName profile_name  ] "
        echo "    [ -user WAS_Admin_userID  ] "
        echo "    [ -password WAS_Admin_password ] "
        echo "    [ -ihsAdminPassword IHS_Admin_password ]"
        echo "    [ -help | -? ]"
        echo " "
        echo "Where:"
        echo "    \"profileName\" is the name of the profile in which "
        echo "    web server should be created"
        echo "    \"user\" is the WebSphere Administration userID"
        echo "    \"password\" is the WebSphere Administration password"
        echo "    \"ihsAdminPassword\" is the password to access the IHS Adminstration server" 
        echo " "
        echo "Example: "
        echo "    $COMMAND_INVOKED -profileName AppSrv01 -user admin -password admin1"
        echo " "
        echo " "

        exit 0
}

printError()
{
        echo "ERROR: $1"
        printUsage
}

while [ $# -gt 0 ]; do
    case $1 in
              -help|-?) printUsage 
                        exit 0                
                        ;;
          -profileName) shift
                        echo "Using the profile $1"
                        PROFILE_NAME_PARAMETER="-profileName $1"
                        ;;
                 -user) shift
                        echo "Using WAS admin userID $1"
                        WSADMIN_USERID_PARAMETER="-user $1"
                        ;;
             -password) shift
                        WSADMIN_PASSWORD_PARAMETER="-password $1"
                        ;;
     -ihsAdminPassword) shift
                        IHS_ADMIN_PASSWORD_PARAMETER="$1"
                        ;;
                    -*) echo "Unsupported option"
                        echo "$1"
                        printUsage 
                        exit 0                
                        ;;
   esac
   shift
done


</echo>
</target>  

   <!--
    ***************************************************************************
    TARGET: writeUnixNonIHSAdminScript
    Writes parameters to be accepted in unix format
    ***************************************************************************
    -->
    <target name="writeUnixNonIHSAdminScript">  
    
<echo file="${script.file}" append="true">

COMMAND_INVOKED="$0"

PROFILE_NAME_PARAMETER=
WSADMIN_USERID_PARAMETER=
WSADMIN_PASSWORD_PARAMETER=

printUsage()
{
        echo ""
        echo ""
        echo "Usage: $COMMAND_INVOKED"
        echo "    [ -profileName profile_name  ] "
        echo "    [ -user WAS_Admin_userID  ] "
        echo "    [ -password WAS_Admin_password ] "
        echo "    [ -help | -? ]"
        echo " "
        echo "Where:"
        echo "    \"profileName\" is the name of the profile in which "
        echo "    web server should be created"
        echo "    \"user\" is the WebSphere Administration userID"
        echo "    \"password\" is the WebSphere Administration password"
        echo " "
        echo "Example: "
        echo "    $COMMAND_INVOKED -profileName AppSrv01 -user admin -password admin1"
        echo " "
        echo " "

        exit 0
}

printError()
{
        echo "ERROR: $1"
        printUsage
}

while [ $# -gt 0 ]; do
    case $1 in
              -help|-?) printUsage 
                        exit 0                
                        ;;
          -profileName) shift
                        echo "Using the profile $1"
                        PROFILE_NAME_PARAMETER="-profileName $1"
                        ;;
                 -user) shift
                        echo "Using WAS admin userID $1"
                        WSADMIN_USERID_PARAMETER="-user $1"
                        ;;
             -password) shift
                        WSADMIN_PASSWORD_PARAMETER="-password $1"
                        ;;
                    -*) echo "Unsupported option"
                        echo "$1"
                        printUsage 
                        exit 0                
                        ;;
   esac
   shift
done

</echo>
</target>  
   
    <!--
    ***************************************************************************
    TARGET: createLocalStandaloneWindows
    Create script which creates the webserver definition for local standalone profile
    ***************************************************************************
    -->      
    <target name="createLocalStandaloneWindows" if="LocalStandaloneInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for LOCAL STANDALONE Profile"/>
        </antcall>
        
        <property name="jacl.script" value="${osQuote}${WAS_HOME}${separatorFile}bin${separatorFile}configureWebserverDefinition.jacl${osQuote}"/>
        
        <antcall target="writeWindowsParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  

        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} %PROFILE_NAME_PARAMETER% %WSADMIN_USERID_PARAMETER% %WSADMIN_PASSWORD_PARAMETER% -conntype NONE -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} managed ${WS_CMT_NODE_NAME} ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="writeWindowsScriptEnd">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${script.file}"/>
        </antcall>
    </target>

    <!--
    ***************************************************************************
    TARGET: createLocalStandaloneUnix
    Create script which creates the webserver definition for local standalone profile
    ***************************************************************************
    -->      
    <target name="createLocalStandaloneUnix" if="LocalStandaloneInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for LOCAL STANDALONE Profile"/>
	      </antcall>
        
        <property name="jacl.script" value="${osQuote}${WAS_HOME}${separatorFile}bin${separatorFile}configureWebserverDefinition.jacl${osQuote}"/>

        <antcall target="writeUnixParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  

        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -conntype NONE -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} managed ${WS_CMT_NODE_NAME} ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${script.file}"/>
        </antcall>
    </target>

    <!--
    ***************************************************************************
    TARGET: createLocalDistributedWindows
    Create script which creates the webserver definition for local distributed profile
    ***************************************************************************
    -->      
    <target name="createLocalDistributedWindows" if="LocalDistributedInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for LOCAL DISTRIBUTED Profile"/>
	      </antcall>
        
        <property name="jacl.script" value="${osQuote}${WAS_HOME}${separatorFile}bin${separatorFile}configureWebserverDefinition.jacl${osQuote}"/>
        
        <antcall target="writeWindowsParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  

        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} %PROFILE_NAME_PARAMETER% %WSADMIN_USERID_PARAMETER% %WSADMIN_PASSWORD_PARAMETER% -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} managed ${WS_CMT_NODE_NAME} ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="writeWindowsScriptEnd">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${script.file}"/>
        </antcall>

    </target>

    <!--
    ***************************************************************************
    TARGET: createLocalDistributedUnix
    Create script which creates the webserver definition for local distributed profile
    ***************************************************************************
    -->      
    <target name="createLocalDistributedUnix" if="LocalDistributedInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for LOCAL DISTRIBUTED Profile"/>
	      </antcall>
        
        <property name="jacl.script" value="${osQuote}${WAS_HOME}${separatorFile}bin${separatorFile}configureWebserverDefinition.jacl${osQuote}"/>

        <antcall target="writeUnixParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  

        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} managed ${WS_CMT_NODE_NAME} ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${script.file}"/>
        </antcall>

    </target>
    
    <!--
    ***************************************************************************
    TARGET: createRemoteStandaloneWindows
    Create script which creates the webserver definition for remote profile
    ***************************************************************************
    -->      
    <target name="createRemoteStandaloneWindows" if="RemoteInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for REMOTE Profile"/>
	      </antcall>
        <property name="jacl.script" value="&quot;%WAS_HOME%\bin\configureWebserverDefinition.jacl&quot;"/>

        <antcall target="writeWindowsParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  
        
        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} %PROFILE_NAME_PARAMETER% %WSADMIN_USERID_PARAMETER% %WSADMIN_PASSWORD_PARAMETER% -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} unmanaged ${WEBSERVER_HOSTNAME}-node  ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeWindowsIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="writeWindowsScriptEnd">
	         <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${script.file}"/>
        </antcall>

    </target>

    <!--
    ***************************************************************************
    TARGET: createRemoteStandaloneUnix
    Create script which creates the webserver definition for remote profile
    ***************************************************************************
    -->      
    <target name="createRemoteStandaloneUnix" if="RemoteInstall">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating webserver definiton script ${script.file} for REMOTE Profile"/>
	      </antcall>
        <property name="jacl.script" value="$WAS_HOME/bin/configureWebserverDefinition.jacl"/>

        <antcall target="writeUnixParameters">
            <param name="script.file" value="${script.file}"/>
        </antcall>  

        <echo file="${script.file}" append="true">${WSADMIN_EXECUTABLE} $PROFILE_NAME_PARAMETER $WSADMIN_USERID_PARAMETER $WSADMIN_PASSWORD_PARAMETER -f ${jacl.script} ${WEBSERVER_NAME} ${WEBSERVER_TYPE} ${osQuote}${script.webserver.install.root}${osQuote} ${osQuote}${script.webserver.config.root}${osQuote} ${WEBSERVER_PORT} ${MAPPING_PREFERENCE} ${osQuote}${script.plugin.home}${osQuote} unmanaged ${WEBSERVER_HOSTNAME}-node  ${WEBSERVER_HOSTNAME} ${WEBSERVER_OS}</echo>

        <antcall target="writeUnixIHSAdminParameters">
	          <param name="script.file" value="${script.file}"/>
	      </antcall>  
        <antcall target="changeFilePermissions">
            <param name="chmod.file" value="${script.file}"/>
        </antcall>

    </target>
    
      
    <!--
    ***************************************************************************
    TARGET: createSetupGSKitLibPathScript
    Create OS script that can be executed to add local GSKit install location
    to Operating System environment PATH variable
    ***************************************************************************
    -->      
    <target name="createSetupGSKitLibPathScriptForWindows" if="configWindows">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating setupGSkitLibPath script"/>
	      </antcall>
        <property name="gskit.lib.script" value="${PLUGIN_HOME}${separatorFile}bin${separatorFile}setupGSKitLibPath.bat"/>

        <property name="lib.envVar" value="PATH=$PATH;"/>
        
        <condition property="export.val" value="${lib.envVar}${PLUGIN_HOME}${separatorFile}gsk7${separatorFile}lib64">
             <equals arg1="${INSTALL_ARCH}" arg2="64" trim="true"/>
        </condition>
        
        <condition property="export.val" value="${lib.envVar}${PLUGIN_HOME}${separatorFile}gsk7${separatorFile}lib">
             <equals arg1="${INSTALL_ARCH}" arg2="32" trim="true"/>
        </condition>
        
        <echo file="${gskit.lib.script}" append="true">set ${export.val}</echo>
        
        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${gskit.lib.script}"/>
        </antcall>

    </target>
    
    <!--
    ***************************************************************************
    TARGET: createSetupGSKitLibPathScript
    Create OS script that can be executed to add local GSKit install location
    to Operating System environment PATH variable
    ***************************************************************************
    -->      
    <target name="createSetupGSKitLibPathScriptForUnix" if="configUNIX">
        <antcall target="logBoth">
            <param name="logStatement" value="Creating setupGSkitLibPath script"/>
	      </antcall>
	      
        <property name="gskit.lib.script" value="${PLUGIN_HOME}${separatorFile}bin${separatorFile}setupGSKitLibPath.sh"/>
        
        <condition property="lib.envVar" value="LIBPATH=$LIBPATH:">
            <equals arg1="${OS_NAME}" arg2="AIX"/>        
        </condition>
        
        <condition property="lib.envVar" value="SHLIB_PATH=$SHLIB_PATH:">
            <equals arg1="${OS_NAME}" arg2="HP-UX"/>        
        </condition>
        
        <condition property="lib.envVar" value="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:">
          <or>
            <equals arg1="${OS_NAME}" arg2="SunOS"/> 
            <equals arg1="${OS_NAME}" arg2="Linux"/> 
          </or>       
        </condition>
        
        <condition property="export.val" value="${lib.envVar}${PLUGIN_HOME}${separatorFile}gsk7${separatorFile}lib64">
             <equals arg1="${INSTALL_ARCH}" arg2="64" trim="true"/>
        </condition>
        
        <condition property="export.val" value="${lib.envVar}${PLUGIN_HOME}${separatorFile}gsk7${separatorFile}lib">
             <equals arg1="${INSTALL_ARCH}" arg2="32" trim="true"/>
        </condition>
        
        <echo file="${gskit.lib.script}" append="true">export ${export.val}</echo>

        <antcall target="changeFilePermissions">
           <param name="chmod.file" value="${gskit.lib.script}"/>
        </antcall>

    </target>

    <!--
    ***************************************************************************
    TARGET: changeFilePermissions
    Change file permissions on UNIX
    ***************************************************************************
    -->      
    <target name="changeFilePermissions" if="configUNIX">
        <exec executable="chmod" failonerror="false">  
           <arg value="ugo+rx"/>
           <arg value="${chmod.file}"/>
        </exec>
    </target>

    <!--
    ***************************************************************************
    TARGET: executeScriptUnix
    Execute the web definition creation script.   Only perform for
    local standalone
    ***************************************************************************
    -->      
    <target name="executeScriptUnix" if="LocalStandaloneInstall">

        <antcall target="logBoth">
            <param name="logStatement" value="Executing script ${script.file}"/>
	      </antcall>

        <antcall target="logBoth">
            <param name="logStatement" value="Using the profile ${WASPROFILE_NAME}"/>
	      </antcall>
        
        <antcall target="logBoth">
            <param name="logStatement" value="Profile location ${WASPROFILE_LOCATION}${separatorFile}bin"/>
	      </antcall>

        <exec executable="/bin/sh" dir="${WASPROFILE_LOCATION}${separatorFile}bin"
           output="${PLUGIN_HOME}${separatorFile}logs${separatorFile}config${separatorFile}configure_${WEBSERVER_TYPE}_webserver.log"
           append="true"
           failonerror="true">
           <arg value="-c"/>
           <arg value="${script.file} -profileName ${WASPROFILE_NAME}"/>
        </exec>
        
        <antcall target="logBoth">
            <param name="logStatement" value="Executing script to generate plugin-cfg.xml for webserver ${WEBSERVER_NAME}"/>
	      </antcall>
        <exec executable="/bin/sh" dir="${WASPROFILE_LOCATION}${separatorFile}bin"
           output="${PLUGIN_HOME}${separatorFile}logs${separatorFile}config${separatorFile}configure_${WEBSERVER_TYPE}_webserver.log"
           append="true"
           failonerror="true">
           <arg value="-c"/>
           <arg value="./GenPluginCfg.sh -webserver.name ${WEBSERVER_NAME} -node.name ${WS_CMT_NODE_NAME} -propagate yes"/>
        </exec>
	      <antcall target="logBoth">
           <param name="logStatement" value="Application server can be started now. If the application server was already running, please restart the server."/>
        </antcall>   
    

    </target>

    <!--
    ***************************************************************************
    TARGET: executeScriptWindows
    Execute the web definition creation script.   Only perform for
    local standalone.  Add  exit statement to script before executing (only on
    windows)
    ***************************************************************************
    -->      
    <target name="executeScriptWindows" if="LocalStandaloneInstall">

        <antcall target="logBoth">
            <param name="logStatement" value="Executing script ${script.file}"/>
	      </antcall>
        
        <antcall target="logBoth">
            <param name="logStatement" value="Using the profile ${WASPROFILE_NAME}"/>
	      </antcall>
        
        <antcall target="logBoth">
            <param name="logStatement" value="Profile location ${WASPROFILE_LOCATION}${separatorFile}bin"/>
	      </antcall>

        <echo file="${script.file}" append="true">
           exit /B %ERRORLEVEL%
        </echo>

        <exec executable="cmd" dir="${WASPROFILE_LOCATION}${separatorFile}bin"
           output="${PLUGIN_HOME}/logs/config/configure_${WEBSERVER_TYPE}_webserver.log"
           append="true"
           failonerror="true">
           <arg value="/c"/>
           <arg value="&quot;${script.file}&quot;"/>
           <arg value="-profileName"/>           
           <arg value="${WASPROFILE_NAME}"/>           
        </exec>
           
        <antcall target="logBoth">
            <param name="logStatement" value="Executing script to generate plugin-cfg.xml for webserver ${WEBSERVER_NAME}"/>
	      </antcall>
        
        <exec executable="cmd" dir="${WASPROFILE_LOCATION}${separatorFile}bin"
           output="${PLUGIN_HOME}/logs/config/configure_${WEBSERVER_TYPE}_webserver.log"
           append="true"
           failonerror="true">
           <arg value="/c"/>
           <arg value="GenPluginCfg.bat"/>
           <arg value="-wasprofile"/>
           <arg value="${WASPROFILE_NAME}"/>
           <arg value="-webserver.name"/>
           <arg value="${WEBSERVER_NAME}"/>
           <arg value="-node.name"/>
           <arg value="${WS_CMT_NODE_NAME}"/>
           <arg value="-propagate"/>
           <arg value="yes"/>                     
        </exec>
        <antcall target="logBoth">
           <param name="logStatement" value="Application server can be started now. If the application server was already running, please restart the server."/>
        </antcall>   
        
    </target>

    <!--
    ***************************************************************************
    TARGET: configureWebServerUNIX
    ***************************************************************************
    -->      
    <target name="configureWebServerUNIX"
            description="Configure web server definition for UNIX"
            if="configUNIX">
            
        <antcall target="logBoth">
            <param name="logStatement" value="Configuring web server, the output will be recorded in: ${PLUGIN_HOME}/logs/config/configure_${WEBSERVER_TYPE}_webserver.log"/>
	      </antcall>
        
        <property name="script.file" value="${PLUGIN_HOME}${separatorFile}bin${separatorFile}configure${WEBSERVER_NAME}.sh"/> 
        <property name="script.plugin.home" value="${PLUGIN_HOME}"/>
        <property name="script.webserver.install.root" value="${WEBSERVER_INSTALL_ROOT}"/>
        <property name="script.webserver.config.root" value="${webserver.config.file}"/>

        <condition property="CREATE_TARGET" value="createLocalStandaloneUnix"> 
           <istrue value="${LocalStandaloneInstall}"/>       
        </condition>
        
        <condition property="CREATE_TARGET" value="createLocalDistributedUnix">        
           <istrue value="${LocalDistributedInstall}"/>       
        </condition>

        <condition property="CREATE_TARGET" value="createRemoteStandaloneUnix">        
           <istrue value="${RemoteInstall}"/>       
        </condition>

        <antcall target="${CREATE_TARGET}"/>
        <antcall target="executeScriptUnix"/>
    </target>
    

    <!--
    ***************************************************************************
    TARGET: configureWebServerWindows
    ***************************************************************************
    -->      
    <target name="configureWebServerWindows"
            description="Configure web server definition for Windows"
            if="configWindows">
            
        <antcall target="logBoth">
            <param name="logStatement" value="Configuring web server, the output will be recorded in: ${PLUGIN_HOME}/logs/config/configure_${WEBSERVER_TYPE}_webserver.log"/>
	      </antcall>
        
        <property name="script.file" value="${PLUGIN_HOME}${separatorFile}bin${separatorFile}configure${WEBSERVER_NAME}.bat"/> 
        <property name="script.plugin.home" value="${PLUGIN_HOME_DBL_SLASH}"/>
        <property name="script.webserver.install.root" value="${WEBSERVER_INSTALL_DBL_SLASH}"/>
        <property name="script.webserver.config.root" value="${WEBSERVER_CFG_DBL_SLASH}"/>

        <condition property="CREATE_TARGET" value="createLocalStandaloneWindows"> 
           <istrue value="${LocalStandaloneInstall}"/>       
        </condition>
        
        <condition property="CREATE_TARGET" value="createLocalDistributedWindows">        
           <istrue value="${LocalDistributedInstall}"/>       
        </condition>

        <condition property="CREATE_TARGET" value="createRemoteStandaloneWindows">        
           <istrue value="${RemoteInstall}"/>       
        </condition>

        <antcall target="${CREATE_TARGET}"/>  
        <antcall target="convertCodepageForPluginBatchFiles"/>          
        <antcall target="convertToCRLF"/>                  
        <antcall target="executeScriptWindows"/>
    </target>

    <!--
    ***************************************************************************
    TARGET: createCrossPlatformScripts
    ***************************************************************************
    -->      
    <target name="createCrossPlatformScripts" if="RemoteInstall">
    
       <antcall target="createUnixCrossPlatformScript"/>
       <antcall target="createWindowsCrossPlatformScript"/>  
    </target>
    
    <!--
    ***************************************************************************
    TARGET: startWebserverConfig
    ***************************************************************************
    -->      
    <target name="startWebserverConfig"
        description="Configures web server definition"
        depends="detectCurrentOSFamily,
            setOSFileSeparator,
            setOSQuote,
            logStartupProperties,
            setWebserverInstallInfo,
            setMappingPreference,
            defineOSSpecificConfigFlag,            
            convertWASHomeToUNIXStylePath,
            setInstallType,
            setWebserverOS,
            resolveWSADMINExecutableForTheCurrentPlatform,
            convertPathDblSlash,
            configureWebServerUNIX,
            configureWebServerWindows,
            checkCrossPlatformDir,
            createCrossPlatformScripts,
            createSetupGSKitLibPathScriptForWindows,
	          createSetupGSKitLibPathScriptForUnix,
            logComplete"/>    

    <!--
    ***************************************************************************
    
    ***************************************************************************
    -->
    <target name="logComplete">
        <antcall target="logBoth">
            <param name="logStatement" value="Configuration Completed Successfully."/>
	      </antcall>    
    </target>

    <!--
    ***************************************************************************
    TARGET: locateWebServerPostInstallProps
    ***************************************************************************
    -->      
    <target name="locateWebServerPostInstallProps">
        <condition property="config.ihs">
	             <equals arg1="${WEBSERVER_TYPE}" arg2="IHS" trim="true"/>
        </condition>

       <property name="propFile.test.loc1" value="${WEBSERVER_INSTALL_ROOT}${separatorFile}properties${separatorFile}postinst.properties"/>  
  
        <condition property="propFile.notfound.1">
           <not>
              <available file="${propFile.test.loc1}" type="file"/>
           </not>
        </condition>
        
        <condition property="propFile.test.loc2" value="${WEBSERVER_INSTALL_ROOT}${separatorFile}conf${separatorFile}postinst.properties">
           <istrue value="${propFile.notfound.1}"/>
        </condition>
        
        <condition property="propFile.notfound">
           <not>
            <and>
              <available file="${propFile.test.loc2}" type="file"/>
              <istrue value="${propFile.notfound.1}"/>
            </and>
           </not>
        </condition>

        <condition property="propFile.loc" value="${propFile.test.loc1}">
              <isfalse value="${propFile.notfound.1}"/>
        </condition>
        
        <condition property="propFile.loc" value="${propFile.test.loc2}">
           <and>
              <istrue value="${propFile.notfound.1}"/>
              <isfalse value="${propFile.notfound.2}"/>
           </and>
        </condition>
        
      <!--  <condition property="propFilefound" value="true">
           <isfalse value="${propFile.notfound}"/>
        </condition> -->
        
        <condition property="configService" value="true">
         <and>
          <or>
              <available file="${propFile.test.loc1}" type="file"/>
              <available file="${propFile.test.loc2}" type="file"/>
          </or>
             <istrue value="${config.ihs}"/>          
         </and>
        </condition>

        <condition property="propFile.msg" value="Unable to locate propfile in either IHS_Root/conf or IHS_Root/properties directories">
         <and>
           <istrue value="${propFile.notfound}"/>
           <istrue value="${config.ihs}"/>
         </and>
        </condition>
        
        <condition property="propFile.msg" value="Propfile found at: ${propFile.loc}">
         <and>
           <isfalse value="${propFile.notfound}"/>
           <istrue value="${config.ihs}"/>
         </and>
        </condition>
        
        <condition property="propFile.msg" value="Propfile file not relavent here.">
           <isfalse value="${config.ihs}"/>
        </condition>
        
        <antcall target="logBoth">
            <param name="logStatement" value="propFilefound = ${propFilefound}   config.ihs = ${config.ihs}"/>
	      </antcall>
        
        <antcall target="logBoth">
            <param name="logStatement" value="${propFile.msg}"/>
	      </antcall>

    </target>    
    <!--
    ***************************************************************************
    TARGET: getWebServerPostInstallProps
    ***************************************************************************
    -->      
    <target name="getWebServerPostInstallProps" if="configService" depends="locateWebServerPostInstallProps">
        

			<loadproperties srcFile="${propFile.loc}">
				<filterchain>
        	<linecontains>
          	<contains value="WINSERVICE="/>
        	</linecontains>
      	</filterchain>
			</loadproperties>
			<loadproperties srcFile="${propFile.loc}">
				<filterchain>
        	<linecontains>
          	<contains value="WINADMINSERVICE="/>
        	</linecontains>
      	</filterchain>
			</loadproperties>
        <antcall target="logBoth">
            <param name="logStatement" value="WINSERVICE=${WINSERVICE}"/>
	      </antcall>
        <antcall target="logBoth">
            <param name="logStatement" value="WINADMINSERVICE=${WINADMINSERVICE}"/>
	      </antcall>

    </target>

   
    <!--
    ***************************************************************************
    TARGET: stopWebserverConfig
    ***************************************************************************
    -->      
    <target name="stopWebserverConfig"
            depends="detectCurrentOSFamily,
            setOSFileSeparator,
            setOSQuote,
            logStartupProperties">
            
        <antcall target="logBoth">
            <param name="logStatement" value=" "/>
        </antcall>     

        <antcall target="logBoth">
            <param name="logStatement" value="98SConfigureWebserverDefinition Failed."/>
	      </antcall>    
        <antcall target="logBoth">
            <param name="logStatement" value="One or more of your input parameters was wrong."/>
	      </antcall>    
        <antcall target="logBoth">
            <param name="logStatement" value="Webserver definition was not created"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value=" "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="The following parameters must be passed to have this ANT script work. "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="-profileName"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="-user"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="-password"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="-help"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="The rest require a -D prefix.  "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="Example:  -DPLUGIN_HOME=c:\programfiles\ibm\plugin home"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value=" "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WAS_PLUGIN_CFG_XML       "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="PLUGIN_INSTALL_TYPE      "/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="PLUGIN_HOME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WEBSERVER_INSTALL_ROOT"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WEBSERVER_NAME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WEBSERVER_HOSTNAME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WEBSERVER_TYPE"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WEBSERVER_PORT"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="IHS_CONF"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="IHS_ADMIN_USERID"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="IHS_ADMIN_PORT"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="MAPPING_PREFERENCE"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="OS_NAME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WAS_HOME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WASPROFILE_NAME"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WASPROFILE_LOCATION"/>
        </antcall>     
        <antcall target="logBoth">
            <param name="logStatement" value="WS_CMT_NODE_NAME"/>
        </antcall>     
           
    
    
    
    
    
    <!-- Echoing to command prompt -->
        <echo> Webserver definition not created</echo>
        <echo> It appears that not all information was passed at the command prompt. </echo>
        
        <echo> The following parameters must be passed to have this ANT script work. </echo>
        <echo> -profileName        </echo>
        <echo> -user               </echo>
        <echo> -password           </echo>
        <echo> -help               </echo>
        <echo> The rest require a -D prefix.  </echo>
        <echo> Example:  -DPLUGIN_HOME="c:\program files\ibm\plugin home" </echo>
        <echo/>
        <echo> WAS_PLUGIN_CFG_XML       </echo>
        <echo> PLUGIN_INSTALL_TYPE      </echo>
        <echo> PLUGIN_HOME              </echo>
        <echo> WEBSERVER_INSTALL_ROOT   </echo>
        <echo> WEBSERVER_NAME           </echo>
        <echo> WEBSERVER_HOSTNAME       </echo>
        <echo> WEBSERVER_TYPE           </echo>
        <echo> WEBSERVER_PORT           </echo>
        <echo> IHS_CONF                 </echo>
        <echo> IHS_ADMIN_USERID         </echo>
        <echo> IHS_ADMIN_PORT           </echo>
        <echo> MAPPING_PREFERENCE       </echo>
        <echo> OS_NAME                  </echo>
        <echo> WAS_HOME                 </echo>
        <echo> WASPROFILE_NAME          </echo>
        <echo> WASPROFILE_LOCATION      </echo>
        <echo> WS_CMT_NODE_NAME         </echo>
        
    </target>

    <!--
    ***************************************************************************
    TARGET: configureWebserver
    ***************************************************************************
    -->      
    <target name="configureWebserver"
        description="Configures web server definition">
        <condition property="ConfigWebserver">
           <and>
              <isset property="WAS_PLUGIN_CFG_XML"/>             
              <isset property="PLUGIN_INSTALL_TYPE"/>
              <isset property="PLUGIN_HOME"/>
              <isset property="WEBSERVER_NAME"/>
              <isset property="WEBSERVER_HOSTNAME"/>
              <isset property="WEBSERVER_TYPE"/>
              <not>
                 <equals arg1="${WEBSERVER_HOSTNAME}"  arg2=" " trim="true"/>
              </not>
              <not>
                 <equals arg1="${WEBSERVER_NAME}"      arg2=" " trim="true"/>
              </not>
              <not>
                 <equals arg1="${PLUGIN_INSTALL_TYPE}" arg2=" " trim="true"/>
              </not>
              <not>
                 <equals arg1="${WEBSERVER_TYPE}"      arg2=" " trim="true"/>
              </not>
              <not>
                 <equals arg1="${WAS_PLUGIN_CFG_XML}"  arg2=" " trim="true"/>
              </not> 
           </and>
        </condition>
        
        <condition property="ConfigIHSAdmin">
           <and>
	           <equals arg1="${WEBSERVER_TYPE}" arg2="IHS" trim="true"/>
               <isset property="IHS_ADMIN_PORT"/> 
	             <isset property="IHS_ADMIN_USERID"/> 
              <not>
                 <equals arg1="${IHS_ADMIN_PORT}" arg2=" " trim="true"/>
              </not>
              <not>
                 <equals arg1="${IHS_ADMIN_USERID}" arg2=" " trim="true"/>
              </not>
	         </and>
        </condition>
	
        
        <condition property="WebserverTarget" value="startWebserverConfig">
           <istrue value="${ConfigWebserver}"/>
        </condition>
        
        <condition property="WebserverTarget" value="stopWebserverConfig">
           <isfalse value="${ConfigWebserver}"/>
        </condition>
               
        <antcall target="${WebserverTarget}"/>  

    </target>
</project>


