<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed Materials - Property of IBM Corp.
- IBM UrbanCode Build
- IBM UrbanCode Deploy
- IBM UrbanCode Release
- IBM AnthillPro
- (c) Copyright IBM Corporation 2002, 2016. All Rights Reserved.
-
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
- GSA ADP Schedule Contract with IBM Corp.
-->
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1">
  <header>
    <identifier id="com.urbancode.air.plugin.WinRSAgentInstall" name="WinRS Agent Install" version="8"/>
    <description>
Plugin for installing agents to remote machine using WinRS
      </description>
    <tag>IBM UrbanCode Deploy/Agent/Install</tag>
    <server:required-server-version>6.1.1.1</server:required-server-version>
  </header>
  <step-type name="WinRS Agent Install">
    <description>Install agent to remote machine using WinRS</description>
    <properties>
      <property name="agentName" required="true">
        <property-ui type="textBox"
                     label="Agent Name"
                     description="The name that the agent should show up as in IBM UCD."/>
      </property>
      <property name="installDirectory" required="true">
        <property-ui type="textBox"
                     label="Installation Directory"
                     description="The directory that the agent should be installed to."
                     default-value="C:\Program Files\ibm-ucd\agent"/>
      </property>
      <property name="javaHome" required="true">
        <property-ui type="textBox"
                     label="Java Home"
                     description="The directory that java is pre-installed to."/>
      </property>
      <property name="tempDirectory" required="true">
        <property-ui type="textBox"
                     label="Temporary Directory"
                     description="The directory that should be used for a temporary workspace."
                     default-value="C:\Temp"/>
      </property>
      <property name="serverHost" required="true">
        <property-ui type="textBox"
                     label="Server Host"
                     description="The hostname of the IBM UCD server"/>
      </property>
      <property name="serverPort" required="true">
        <property-ui type="textBox"
                     label="Server Port"
                     description="The JMS Port the server listens on"/>
      </property>
      <property name="mutualAuth" required="true">
        <property-ui type="checkBox"
                     label="Mutual Authentication"
                     description="Use mutual authentication?"
                     default-value="false"/>
      </property>
      <property name="proxyHost">
        <property-ui type="textBox"
                     label="Proxy Host"
                     description="The hostname of any proxy between the agent and IBM UCD server"/>
      </property>
      <property name="proxyPort">
        <property-ui type="textBox"
                     label="Proxy Port"
                     description="The JMS Port of any proxy between the agent and IBM UCD server"/>
      </property>
      <property name="installService" required="true">
        <property-ui type="checkBox" hidden="true"
                     label="Install Service"
                     description="Install a service for the agent?"
                     default-value="true"/>
      </property>
      <property name="serviceName">
        <property-ui type="textBox" hidden="true"
                     label="Service Name"
                     description="If Install Service is selected, this is the name of the service to be created."
                     default-value="ibm-ucdagent"/>
      </property>
      <property name="serviceLogin">
        <property-ui type="textBox" hidden="true"
                     label="Service Login"
                     description="If Install Service is selected, this is the user that the service will login as."
                     default-value=".\localsystem"/>
      </property>
      <property name="servicePassword">
        <property-ui type="secureBox" hidden="true"
                     label="Service Password"
                     description="If Install Service is selected, this is the password that the service will use for login. Leave as nopass if it should not use a password."
                     default-value="nopass"/>
      </property>
      <property name="autoStartService">
        <property-ui type="checkBox" hidden="true"
                     label="Auto Start Service"
                     description="Set the service to automatically start?"
                     default-value="true"/>
      </property>
      <property name="agentHost" required="true">
        <property-ui type="textBox"
                     label="Agent Host"
                     description="The hostname or IP address of the machine to install an agent to."/>
      </property>
      <property name="username" required="true">
        <property-ui type="textBox"
                     label="Username"
                     description="The username of the machine to install an agent to."/>
      </property>
      <property name="password" required="true">
        <property-ui type="secureBox"
                     label="Password"
                     description="The password of the machine to install an agent to."/>
      </property>
      <property name="serverUrl" required="true">
        <property-ui type="textBox"
                     label="Server Url"
                     hidden="true"
                     description="The server url."
                     default-value="${p:server.url}"/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/uDeployRestClient.jar:lib/air-ssh-agent-installer.jar:lib/securedata.jar:lib/jettison-1.1.jar:lib/commons-codec.jar:lib/CommonsUtil.jar"/>
      <arg file="install.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
</plugin>
