<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed Materials - Property of IBM Corp.
- IBM UrbanCode Deploy
- (c) Copyright IBM Corporation 2011, 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">
  <header>
    <identifier id="com.urbancode.air.plugin.uDeployResource" name="IBM UrbanCode Deploy Resources" version="71"/>
    <description>
      Manages IBM UrbanCode Deploy Resources
    </description>
    <tag>IBM UrbanCode Deploy/Resources</tag>
  </header>
  <step-type name="Install Agent with SSH">
    <description>Installs an agent to a remote system over SSH.</description>
    <properties>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Agent Name"
                     description="A unique name for the new agent and its resource."/>
      </property>
      <property name="host" required="true">
        <property-ui type="textBox"
                     label="Hostname/IP"
                     description="The hostname or IP of the remote system to target."/>
      </property>
      <property name="sshUsername">
        <property-ui type="textBox"
                     label="SSH Username"
                     description="Username to provide for SSH authentication."/>
      </property>
      <property name="sshPassword">
        <property-ui type="secureBox"
                     label="SSH Password"
                     description="Password to provide for SSH authentication."/>
      </property>
      <property name="installDir" required="true">
        <property-ui type="textBox"
                     label="Agent Install Directory"
                     default-value="/opt/ibm-ucd/agent"
                     description="Directory to install the agent to."/>
      </property>
      <property name="javaHomePath">
        <property-ui type="textBox"
                     label="Java Home"
                     default-value=""
                     description="Path to the JRE/JDK on the target system. If blank, uses target machine's JAVA_HOME"/>
      </property>
      <property name="serverHost" required="true">
        <property-ui type="textBox"
                     label="Server Hostname/IP"
                     description="Hostname or IP for the agent to connect to the server."/>
      </property>
      <property name="mutualAuth">
        <property-ui type="checkBox"
                     label="Mutual Authentication"
                     description="If this is checked, the agent will be configured to use mutual authentication."/>
      </property>
      <property name="waitForOnline">
        <property-ui type="checkBox"
                     label="Wait for Agent Connection"
                     default-value="true"
                     description="If this is checked, step will wait until the agent has connected or has timed out."/>
      </property>


      <property name="port" required="true">
        <property-ui type="textBox"
                     label="SSH Port"
                     default-value="22"
                     hidden="true"
                     description="SSH port of the target system."/>
      </property>
      <property name="serverPort" required="true">
        <property-ui type="textBox"
                     label="Server JMS Port"
                     default-value="7918"
                     hidden="true"
                     description="JMS listen port on the server."/>
      </property>
      <property name="proxyHost">
        <property-ui type="textBox"
                     label="Agent Relay Hostname/IP"
                     default-value=""
                     hidden="true"
                     description="Hostname or IP to an agent relay to use."/>
      </property>
      <property name="proxyPort">
        <property-ui type="textBox"
                     label="Agent Relay Proxy Port"
                     default-value="20080"
                     hidden="true"
                     description="Port of the agent's HTTP proxy."/>
      </property>
      <property name="tempDirPath" required="true">
        <property-ui type="textBox"
                     label="Staging Directory"
                     default-value="/tmp"
                     hidden="true"
                     description="A directory to use to store agent install files during installation."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="installAgentSSH.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Create Resource">
    <description>Creates a resource. The resource could be a group, component resource, agent resource, or agent pool resource.</description>
    <properties>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="New Resource Name"
                     description="The resource name must be unique under its parent resource."/>
      </property>
      <property name="parent">
        <property-ui type="textBox"
                       label="Parent Resource Path"
                       description="The parent object of this resource. Leave blank to create a Top Level Resource"/>
      </property>
      <property name="agent">
        <property-ui type="textBox"
                     label="Agent Name"
                     description="If this is an agent resource, enter the agent name here."/>
      </property>
      <property name="agentPool">
        <property-ui type="textBox"
                     label="Agent Pool Name"
                     description="If this is an agent pool resource, enter the agent pool name here."/>
      </property>
      <property name="role">
        <property-ui type="textBox"
                     label="Role Name"
                     description="Associate a resource role with this resource. If this is going to be a component resource, enter the component name here."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="create.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Set Agent Property">
    <description>Sets a property for an agent.</description>
    <properties>
      <property name="agent" required="true">
        <property-ui type="textBox"
                     label="Agent"
                     description="name/ID of the agent"/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="name of the property to set"/>
      </property>
      <property name="value">
        <property-ui type="textBox"
                     label="Property Value"
                     description="value of the property to set"/>
      </property>
      <property name="isSecure">
        <property-ui type="checkBox"
                     label="Secure?"
                     description="check if the property should be secure"/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="setAgentProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Set Resource Property">
    <description>Sets a property for a resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="path/ID of the resource."/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="name of the property to set."/>
      </property>
      <property name="value">
        <property-ui type="textBox"
                     label="Property Value"
                     description="value of the property to set."/>
      </property>
      <property name="isSecure">
        <property-ui type="checkBox"
                     label="Secure?"
                     description="check if the property should be secure."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="setResourceProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Set Resource Role Property">
    <description>Sets a property for a resource role. Property must be pre-defined on the role.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="path/ID of the resource."/>
      </property>
      <property name="role" required="true">
        <property-ui type="textBox"
                     label="Role"
                     description="name/ID of the role."/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="name of the property to set."/>
      </property>
      <property name="value">
        <property-ui type="textBox"
                     label="Property Value"
                     description="value of the property to set."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="setResourceRoleProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Check If Resource Has Role">
    <description>Step succeeds if resource has the specified role and fails if it doesn't.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="path/ID of the resource."/>
      </property>
      <property name="role" required="true">
        <property-ui type="textBox"
                     label="Role"
                     description="name/ID of the role."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="checkrole.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <!-- step-type name="Add Role To Resource">
    <description>Adds the specified role to the specified resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="name/ID of the resource."/>
      </property>
      <property name="role" required="true">
        <property-ui type="textBox"
                     label="Role"
                     description="name/ID of the role."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="addrole.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type -->

    <!-- step-type name="Remove Role From Resource">
    <description>Removes the specified role from the specified resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="name/ID of the resource."/>
      </property>
      <property name="role" required="true">
        <property-ui type="textBox"
                     label="Role"
                     description="name/ID of the role."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="removerole.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type -->

  <step-type name="Delete Resource">
    <description>Deletes the specified resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="The path of the resource to delete. (e.g. ResourceFolder/ResourcePath"/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="deleteResource.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Delete Agent">
    <description>Delete the specified agent.</description>
    <properties>
      <property name="agent" required="true">
        <property-ui type="textBox"
                     label="Agent Name"
                     description="The name of the agent to delete."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="deleteAgent.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Delete Many Resources">
    <description>Deletes resources, specified as a comma-separated list.</description>
    <properties>
      <property name="resources" required="true">
        <property-ui type="textBox"
                     label="Resource Path List"
                     description="The list of resources, separated by commas."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="deleteManyResources.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

    <step-type name="Delete Many Agents">
    <description>Deletes agents, specified as a comma-separated list.</description>
    <properties>
      <property name="agents" required="true">
        <property-ui type="textBox"
                     label="Agent Name List"
                     description="The list of agents, separated by commas."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="deleteManyAgents.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Get Agent Property">
    <description>Gets an agent property, given an agent and a property name. Name/value pair is outputted on this step.</description>
    <properties>
      <property name="agent" required="true">
        <property-ui type="textBox"
                     label="Agent"
                     description="Name/ID of the agent"/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="The name of the property."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="getAgentProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Get Resource Property">
    <description>Get a resource property, given a resource and a property name. Name/value pair is outputted on this step.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="The name of the property."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="getResourceProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Get Resource Role Property">
    <description>Get a resource role property value, given a resource, role name and a property name. Name/value pair is outputted on this step.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="The path of the resource. (e.g. ResourcePath/Resource)"/>
      </property>
      <property name="role" required="true">
        <property-ui type="textBox"
                     label="Role Name"
                     description="The name of the role."/>
      </property>
      <property name="name" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="The name of the property."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="getResourceRoleProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Delete Resource Inventory For Component">
    <description>Deletes all inventory entries on a resource for a given component. Can filter by version and version status.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
      <property name="component" required="true">
        <property-ui type="textAreaBox"
                     description="Component Name or newline separated list of components"
                     label="Component Name"/>
      </property>
      <property name="version">
        <property-ui type="textBox"
                     label="Version Filter"
                     description="Only inventory matching this version will be deleted.
                     If left blank, inventory with any version that matches the other criteria will be deleted."/>
      </property>
      <property name="status">
        <property-ui type="textBox"
                     label="Status Filter"
                     description="Only inventory matching this version status (such as Active) will be deleted.
                     If left blank, inventory with any statuses that matches the other criteria will be deleted."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="deleteResourceInventoryForComponent.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

    <step-type name="Check If Resource Exists">
    <description>This step will succeed if the resource exists and fail if it does not.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else if (properties.get("exists").equals("false")) {
            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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="resourceExists.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Get Component Version For Resource">
  <description>Takes a component and a resource, shows what version of that component exists on that resource.</description>
  <properties>
    <property name="component" required="true">
    <property-ui type="textBox"
           label="Component"
           default-value="${p:component.id}"
           description="Component name or id. Default is set to use a property called 'component.id'"/>
    </property>
    <property name="resource" required="true">
    <property-ui type="textBox"
           label="Resource"
           default-value="${p:resource.id}"
           description="Resource path or id. Default is set to use a property called 'resource.id'"/>
    </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
    <arg file="getComponentVersionForResource.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
  </command>

  </step-type>

  <step-type name="Wait for Resources">
  <description>Wait for one or more resources to be online.</description>
  <properties>
    <property name="resources" required="true">
    <property-ui type="textAreaBox"
           label="Resources"
           description="Resource paths or IDs to check, one per line."/>
    </property>
    <property name="timeout">
    <property-ui type="textBox"
           label="Timeout (s)"
           default-value="60"
           description="Seconds to wait for resources to be online. The step will run without a timeout if this is 0 or blank."/>
    </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
    <arg file="waitForResources.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
  </command>
  </step-type>

  <step-type name="Add Resource To Team">
    <description>Adds a resource to a team for a given type classification.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
      <property name="team" required="true">
        <property-ui type="textBox"
                     label="Team"/>
      </property>
      <property name="type">
        <property-ui type="textBox"
                     label="Type"
                     description="The type classification to add. Leave blank to use the type Standard Resource."/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="addResourceToTeam.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Add Tag to Resource">
    <description>Add a tag to a resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
      <property name="tag" required="true">
        <property-ui type="textBox"
                     label="Tag Name"/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="addTagToResource.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Remove Tag From Resource">
    <description>Remove a tag from a resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource Path"
                     description="Path to your resource (e.g. ResourceFolder/Resource)"/>
      </property>
      <property name="tag" required="true">
        <property-ui type="textBox"
                     label="Tag Name"/>
      </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/jettison-1.1.jar:lib/securedata.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="removeTagFromResource.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Get Agent Details">
    <description>Retrieve basic configuration information about a agent.</description>
    <properties>
      <property name="agent" required="true">
        <property-ui type="textBox"
                     label="Agent"
                     description="Agent name or ID"/>
      </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/securedata.jar:lib/jettison-1.1.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="getAgentInfo.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Synchronize Resources">
    <description>Synchronize one resource tree with another.</description>
    <properties>
      <property name="sourceResourceTree" required="true">
        <property-ui type="textBox"
                     label="Source Resource"
                     description="The resource tree that will be the basis of the sync."/>
      </property>
      <property name="targetResourceTree" required="true">
        <property-ui type="textBox"
                     label="Target Resource"
                     description="The resource tree to apply changes to."/>
      </property>
      <property name="doAdds">
        <property-ui type="checkBox"
                     default-value="true"
                     label="Perform Adds"
                     description="If this is checked, resources may be added to the target tree to achieve synchronization."/>
      </property>
      <property name="doDeletes">
        <property-ui type="checkBox"
                     default-value="true"
                     label="Perform Deletes"
                     description="If this is checked, resources may be deleted from the target to achieve synchronization."/>
      </property>
      <property name="doPropertyChanges">
        <property-ui type="checkBox"
                     default-value="true"
                     label="Perform Property Changes"
                     description="If this is checked, properties in the target tree may be changed to achieve synchronization."/>
      </property>
      <property name="resourceIncludes" required="true">
        <property-ui type="textAreaBox" default-value="**/*" label="Include Resources"
                     description="Comma- or space-separated list of patterns of resources that must be included."/>
      </property>
      <property name="resourceExcludes" required="false">
        <property-ui type="textAreaBox" label="Exclude Resources"
                     description="Comma- or space-separated list of patterns of resources that must be excluded."/>
      </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/securedata.jar:lib/jettison-1.1.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="syncResourceTree.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Apply Resource Template">
    <description>Applies a resource template to a resource.</description>
    <properties>
      <property name="resource" required="true">
        <property-ui type="textBox"
                     label="Resource"
                     description="The id or path of the resource to apply the template to."/>
      </property>
      <property name="resourceTemplate" required="true">
        <property-ui type="textBox"
                     label="Resource Template"
                     description="The id of the resource template to apply."/>
      </property>
      <property name="properties" required="true">
        <property-ui type="textAreaBox"
                     label="Properties"
                     description="The properties used by the template. This should be a newline separated list of name value pairs of the form name=value."/>
      </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/securedata.jar:lib/jettison-1.1.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="applyTemplate.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
</plugin>
