<?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.uDeploySystem" name="IBM UrbanCode Deploy System" version="65"/>
    <description>
      Plugin for managing IBM UrbanCode Deploy system properties and global settings.
      </description>
    <tag>IBM UrbanCode Deploy/System</tag>
  </header>
  <step-type name="Create System Property">
    <description>Creates a system-wide property.</description>
    <properties>
      <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/securedata.jar:lib/jettison-1.1.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="systemprop.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Get System Configuration">
    <description>Get all system configuration values</description>
    <properties>
    </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="getSystemConfiguration.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Set System Configuration">
    <description>Set some system configuration values.</description>
    <properties>
      <property name="properties" required="true">
        <property-ui type="textAreaBox"
                     label="Values to Set"
                     description="Values to set, using Java property file syntax. The names of the values must match those returned by the Get System Configuration step. Any settings not provided here will be left unchanged."/>
      </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="setSystemConfiguration.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Add User To Team">
    <description>Adds a user to a team for a given type classification.</description>
    <properties>
      <property name="user" required="true">
        <property-ui type="textBox"
                     label="User"/>
      </property>
      <property name="team" required="true">
        <property-ui type="textBox"
                     label="Team"/>
      </property>
      <property name="type" required="true">
        <property-ui type="textBox"
                     label="Type"
                     description="The type classification to add."/>
      </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="addUserToTeam.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <step-type name="Add Group To Team">
    <description>Adds a group to a team for a given type classification.</description>
    <properties>
      <property name="group" required="true">
        <property-ui type="textBox"
                     label="Group"/>
      </property>
      <property name="team" required="true">
        <property-ui type="textBox"
                     label="Team"/>
      </property>
      <property name="type" required="true">
        <property-ui type="textBox"
                     label="Type"
                     description="The type classification to add."/>
      </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="addGroupToTeam.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
</plugin>
