Activity - readFile

Activity Type: Indexed File

Description

Reads data from one or more binary or text files stored on the server. The file data is then written to an output which can be connected to another activity or delivered back to the user in the response document.

Examples

To read 9 bytes from the some/file.ext file, starting immediately after byte number 3, and to output the file data as a string without base-64 encoding it:

<readFile name="read">
  <file>some/file.ext</file>
  <bytes offset="3" length="9"/>
  <output name="fileAccessOutput" base64encode="false"/>
</readFile>

To read 5 lines from the some/file.ext text file, starting immediately after line number 2, and to output the data as a base-64 encoded string:

<readFile name="read">
  <file>some/file.ext</file>
  <lines offset="2" length="5"/>
  <output name="fileAccessOutput" base64encode="true"/>
</readFile>

To read data from one or more files and to base-64 encode the resulting data. The description of what data to read must be produced by another activity and connected to the fromLocal input:

<readFile name="read">
  <fromLocal from="searchOutput"/>
  <output name="fileAccessOutput" base64encode="true"/>
</readFile>

Specification

Element readFile:

Input and Output Types

Warning to Service Deployers

This activity can be used by clients to potentially access any directory on your server below that exposed by the associated OGSA-DAI service.

Data Resource Accessor

This activity requires a data resource accessor that implements the following interface: uk.org.ogsadai.dataresource.FileAccessProvider

XML Schema

OGSA-DAI/schema/ogsadai/xsd/activities/file_reading.xsd

Class

uk.org.ogsadai.activity.indexedfiles.FileReadingActivity

Client Toolkit Class

uk.org.ogsadai.client.toolkit.activity.indexedfiles.ReadFile