Check Out

Get files from a specified repository.

checkout takes files from the specified repository and places them into the current DropZone. checkout only places the files into the DropZone. This allows the files to be processed, manipulated, renamed, or removed before the files in the DropZone are transferred to the target Endpoint.

If checkout is called from a Pre-Action on a Component then the files are added into the existing DropZone for the Component. You can create a dedicated DropZone for the checkout by placing the checkout into a using DropZone block.

checkout can place files in the DropZone that are not associated with any Component Item.

checkout takes a number of named parameters.

Parameter Description
repository Mandatory. The name of the repository to use as a source of files. The repository name can be prepended with as many domain names as necessary to uniquely identify the repository.

The remaining parameters will depend on the chosen repository. The parameters specified will either override the defined properties (if the property is defined as overridable) or will be appended to them (if the property is defined as appendable). If a parameter attempts to override a property which is not defined as overridable then a runtime error is thrown.

Example

A custom action for a _Component_ to post a configuration change to a DataPower web appliance:

using stream $config; // create streams

using stream $payload;

using _DropZone_ "dp" {

// get the XML Soap Wrapper from the repository

checkout(repository: "sourcerep", pattern: "soma-config-import.xml");

// checkout the configuration (ZIP file)

checkout(repository: "sourcerep", pattern: "config.zip");

// Convert the config zip to base 64

read(file: "config.zip", stream: $config);

set b64 = ${config.base64encode()};

// place the base64 encoded zip file into the XML wrapper

modify(file: "soma-config-import.xml", modifier: "xml") {

set\_text("/Envelope/Body/request/import/input-file", value: $b64);

}

// Now send the file to the soap interface

read(file: "soma-config-import.xml", stream: $payload);

set res = soap($DP\_TGTURL, $payload);

}

The above example is a custom action for a Component which represents a configuration change to be applied to the DataPower web appliance. Such changes are delivered over the appliance’s SOAP API and do not involve conventional file transfers. In order to implement this, the custom action first checks out the XML soap body (soma-config-import.xml) and places it into the DropZone. It then does the same for the config.zip file (taking the latest version from the specified repository). It converts this config file into a base64 encoded stream and then uses an XML modifier to add this base64 encoded data into the XML SOAP message. Finally, the modified file is read into a stream and sent to the DataPower Web UI (DP_TGTURL is the URL of the DataPower WebUI and is set as an attribute for the target Environment).