<?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, 2014. 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:server="http://www.urbancode.com/PluginServerXMLSchema_v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <identifier id="com.urbancode.plugin.source.TFS" name="TFS" version="4"/>
    <description>
      The TFS plugins automates import version artifacts from a TFS server.
	  </description>
    <tag>Source and Repositories/Team Foundation Server</tag>
    <server:plugin-type>Source</server:plugin-type>
  </header>
  <step-type name="Import Version">
    <description>Import new Version from TFS</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=UTF-8"/>
      <arg value="-jar"/>
      <arg file="TFS-SourceConfig.jar"/>
      <arg value="ImportVersion"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  
    <!-- ==================================== -->
    <!--   Properties                         -->
    <!-- ==================================== -->
    <server:property-group type="Component" name="TFSComponentProperties">
      <server:property name="url" required="true">
        <server:property-ui type="textBox"
                            label="TFS URL"
                            description="TFS Server URL. Ex http://tfs2010:8080/tfs/mygroup" />
      </server:property>
      <server:property name="tfsVersion" required="true">
        <server:property-ui type="selectBox"
                            label="TFS Version"
                            description="The version of the TFS libraries installed." />
        <server:value label="2008">2008</server:value>
        <server:value label="2010">2010</server:value>
        <server:value label="2012">2012</server:value>
        <server:value label="2013">2013</server:value>
      </server:property>
      <server:property name="user">
        <server:property-ui type="textBox"
                            label="TFS Username"
                            description="Specify a username if you need to use different credentials than the one used for the uDeploy process." />
      </server:property>
      <server:property name="password">
        <server:property-ui type="secureBox"
                            label="TFS Password"
                            description="Specify a password if you specified a user above." />
      </server:property>
      <server:property name="project" required="true">
        <server:property-ui type="textBox"
                            label="TFS Team Project"
                            description="The name of the TFS Team Project where the build definition resides." />
      </server:property>
      <server:property name="buildDefinition" required="true">
        <server:property-ui type="textBox"
                            label="Build Definition"
                            description="The name of the build definition to monitor for new builds." />
      </server:property>
      <server:property name="buildStatus" required="true">
        <server:property-ui type="selectBox"
                            label="Build Status"
                            description="Limit builds to certain status." />
        <server:value label="Succeeded">Succeeded</server:value>
        <server:value label="PartiallySucceeded">PartiallySucceeded</server:value>
        <server:value label="None">None</server:value>
        <server:value label="InProgress">InProgress</server:value>
        <server:value label="Failed">Failed</server:value>
        <server:value label="Stopped">Stopped</server:value>
        <server:value label="NotStarted">NotStarted</server:value>
        <server:value label="All">All</server:value>
      </server:property>
      <server:property name="buildQuality">
        <server:property-ui type="textBox"
                            label="Build Quality"
                            description="Limit builds to certain build quality." />
      </server:property>
      <server:property name="dirOffset">
        <server:property-ui type="textBox"
                            label="Directory Offset"
                            description="Directory offset within the root of the build artifacts." />
      </server:property>
      <server:property name="includes">
        <server:property-ui type="textAreaBox"
                            label="File Includes"
                            description="A new-line-separated list of files to include. Leave blank or use **/* to include all." />
      </server:property>
      <server:property name="excludes">
        <server:property-ui type="textBox"
                            label="File Excludes"
                            description="A new-line-separated list of files to exclude." />
      </server:property>
      <server:property name="extensions">
      <server:property-ui type="textBox" 
                          label="Text File Extensions" 
                          description="The comma separated list of extensions of text files which need to be
                          converted to a new Charset on download (e.g. txt,properties,log)." />
    </server:property>
    </server:property-group>
    
    <server:property-group type="Import" name="TFSImportProperties">
      <server:property name="buildNumber" >
        <server:property-ui type="textBox"
                            label="Build Number"
                            description="Provide a build number if you want to import a specific build. Be aware that 
                            if there are multiple builds with that number we will import the latest one no matter what status 
                            it has. Example: My_BuildDefinition_20120401.12 if using default build definition template." />
      </server:property>
      <server:property name="buildURI" >
        <server:property-ui type="textBox"
                            label="Build URI" 
                            description="Provide a build Uri in the form of vstfs:///Build/Build/176 if you want to import a specific build."/>
      </server:property>
    </server:property-group>
</plugin>
