XnatDataClient, or XDC, is an application that helps perform data transactions with an XNAT server. In its simplest functions, it basically acts like curl or other command-line HTTP client. But XDC provides XNAT-specific operations on top of this basic query/response functionality, including the ability to resolve and retrieve multiple files and URIs from a single XNAT REST API call.
XDC is provided as a Java archive or jar file. The jar file is packaged as a Java application, with the required classpath included in the archive manifest. The practical result of this is that you can run the application just by specifying the XDC jar file (named data-client-version.jar; as of this writing, version is 1.6.2-SNAPSHOT) with the JVM call:
java -jar lib/data-client-1.6.5.jar -h
The pipeline engine also provides a script wrapper named XnatDataClient for this function. This script is located in the xnat-tools folder of the configured pipeline engine installation.
XDC has the following command options (you can also see these options by running XDC with the -h option).
Usage Here are some handy use cases for XDC. Batch Copy
The ability to do a batch copy by symlink using the -k or --useSymlinks parameters. This is obviously very dependent on platform and hasn’t been tested extensively. It actually uses the Runtime.exec() method to run ln on the OS (Java 7 has a Files.createSymbolicLink() function, but we’re still compatible back to Java 6 so I can’t use that), so I’m not sure what performance will be on this. It should definitely be better than copying a whole bunch of files though. Listing output with the -ls or --listUris parameters. Instead of doing anything with the files found in a REST result, XDC just lists them. If you specify the absolutePath option, this will be listed by path, otherwise by server-relative URI. This is handy for piping the query results to other processing tools.