<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="../plugin.xsl" type="text/xsl"?>
<plugin name="CsvProvider">
  <object class="org.ow2.isac.plugin.csvprovider.SessionObject">
    <params>
      <param name="filename" type="String" />
      <param name="separator" type="String" />
      <param name="macintosh_line_separator" type="String" />
      <param name="shared" type="String" />
      <param name="loop" type="String" />
      <param name="fields" type="String" />
      <param name="comment" type="String" />
      <param name="bigfile" type="String" />
    </params>
    <help>Provides a data set whose data are read from a CSV (comma-separated values) file.
Call the "next" control to get the next line from the file. It must be called at least once prior to getting any data. Control "skip" gets the nth next line. The "reset" control goes back to the first line.
For each line, fields/values are available through variables:
- either with array-like notation [0], [1] etc. (e.g. ${plugin_id:[0]})
- or with chosen names when defined in plug-in import parameters (e.g. {plugin_id:phone_field})
The number of lines is available through a variable named # (e.g. ${pluginId:#}), unless the "load at runtime" option is enabled, in which case this variable is not available.
Parameters are:
- filename (required): the full path to the CSV file.
- separator (optional): the separator character. The default separator is the comma (',').
- fields (optional): names for the variables, separated by the defined separator.
- macintosh_line_separator: use CR instead of LF as line separator.
- shared: when set, progression in the lines is shared by all session objects. In other words,
each session object will get a different line instead of all getting the same sequence of lines.
- loop: if set, the line sequence wraps up to the first line when the end of file is
reached. Otherwise, an alarm is thrown when trying to get a field value while the end of file has been reached, and the empty string is used as value.
- load at runtime: when enabled, lines are read from the file one-by-one, when the "next" or "skip" control is called. Otherwise, all lines are read at once at deployment time. This option is recommended for very big files, in order to save deployment time and memory space. But then, it is recommended to enable the "shared" mode in order to avoid a proliferation of file descriptors, especially when you run a great number of virtual users.</help>
  </object>
  <test name="endOfFile" number="0">
    <params />
    <help>True if there is no more line available (including at current position), false if current line has a value. Always false when loop option is enabled.</help>
  </test>
  <test name="notEndOfFile" number="1">
    <params />
    <help>True if current line has a value, false if the end of the CSV file has been reached. Always true when loop option is enabled.</help>
  </test>
  <test name="isDefined" number="2">
    <params>
      <param name="field" type="String" />
    </params>
    <help>True if the given field or column number was present in the latest line read, false if it was absent</help>
  </test>
  <test name="isNotDefined" number="3">
    <params>
      <param name="field" type="String" />
    </params>
    <help>True if the given field or column number was absent from the latest line read, false if it was present</help>
  </test>
  <control name="next" number="2">
    <params />
    <help>Go to next line. When loop is enabled, wraps up to the first line once the last line has been read.</help>
  </control>
  <control name="reset" number="3">
    <params />
    <help>Jump to the first line.</help>
  </control>
  <control name="skip" number="4">
    <params>
      <param name="n" type="String" />
    </params>
    <help>Skips the given number of lines (equivalent to n 'next' calls), looping to the first line if the loop option has been set for this CsvProvider.</help>
  </control>
</plugin>

