<?xml version="1.0" encoding="UTF-8"?>
<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.ibm.urbancode.air.plugin.RTCSCM" name="RTC SCM" version="3"/>
    <description>
     This source config plugin allows for downloading artifacts from RTC.
      </description>
    <tag>SCM/RTC</tag>
    <server:plugin-type>Source</server:plugin-type>
  </header>
  <step-type name="Import Version">
    <description>Creates a new component version and imports artifacts</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="${JAVA_HOME}/bin/java">
      <arg value="-Dfile.encoding=${DS_SYSTEM_ENCODING}"/>
      <arg value="-Dconsole.encoding=${DS_SYSTEM_ENCODING}"/>
      <arg value="-jar"/>
      <arg file="air-plugin-RTC-scm.jar"/>
      <arg value="ImportVersion"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <!-- ==================================== -->
  <server:property-group type="Component" name="RTCSCMProperties">

      <server:property name="serverUrl" required="true">
        <server:property-ui label="RTC Server URL"
                            type="textBox"
                            description="The URL of the RTC server."
                            placeholder= "https://www.mycompany.com:9443/jazz"/>
      </server:property>

      <server:property name="username" required="true">
        <server:property-ui label="RTC Username"
                            type="textBox"
                            description="The username used to connect to the RTC server."/>
      </server:property>

      <server:property name="password">
        <server:property-ui label="RTC Password"
                            type="secureBox"
                            description="The password used to connect to the RTC server."/>
      </server:property>

      <server:property name="stream" required="true">
        <server:property-ui label="Stream"
                            type="textBox"
                            description="The name or alias of the default flow target stream."
                            placeholder="DevStream"/>
      </server:property>

      <server:property name="autoGenerateName" >
        <server:property-ui type="selectBox"
                          label="Version Naming Convention"
                          default-value="ID"
                          description="Use the ID or Name for the Version's Name when Importing Versions Automatically, Importing Stream, or when Import Version's name is left blank." />
                          <value label="ID">ID</value>
                          <value label="NAME">NAME</value>
      </server:property>

      <server:property name="includes">
          <server:property-ui label="Includes"
                          type="textAreaBox"
                          default-value="**/*"
                          description="New line separated list of ant style include patterns."/>
      </server:property>

      <server:property name="excludes">
          <server:property-ui label="Excludes"
                          type="textAreaBox"
                          description="New line separated list of ant style exclude patterns."/>
      </server:property>

      <server:property name="isIncludeRoot">
          <server:property-ui label="Include Root"
                          type="checkBox"
                          description="Select Include Root to load the component names in the Rational Team Concert stream as top-level folders in the IBM UrbanCode Deploy component."/>
      </server:property>

      <server:property name="commandPath" required="true">
        <server:property-ui label="Command Path"
                            type="textBox"
                            default-value="scm"
                            description="The full path to the scm executable on the IBM UrbanCode Deploy agent, including the file name. For example, D:\IBM\RTCClient\scmtools\eclipse\scm.exe."/>
      </server:property>
    </server:property-group>

  <server:property-group type="Import" name="RTCSCMImportProperties">
    <server:property name="workspaceHistoryType" >
      <server:property-ui type="selectBox"
                          label="Workspace History"
                          default-value="Snapshot"
                          description="Use a snapshot or stream as the initial workspace history." />
                          <value label="Snapshot">SNAPSHOT</value>
                          <value label="Stream">STREAM</value>
    </server:property>
    <server:property name="version" >
      <server:property-ui type="textBox"
                          label="Version Name"
                          placeholder = "v10000"
                          description="The name given to the imported component version. If snapshot is selected, it will search RTC for this snapshot name. If left blank, the latest snapshot's name or ID will be used." />
    </server:property>
  </server:property-group>


</plugin>
