DataHandler

SCI uses MTOM (Message Transmission Optimization Mechanism) when uploading or downloading files. For methods that upload or download content, the client must provide a "DataHandler" that performs the client side actions.

Downloading means transferring a file, such as a log file, from the library to the machine where the SCI client is running. The DataHandler receives the data from the library and must store it locally. Methods that download data will return a DataHandler object. The caller must then get an input stream from the returned data handler. The caller then loops, reading data from the input stream constructed from the Data Handler and writing the read data to the desired location.

Uploading means transferring a file to the library, such as for a firmware upgrade. The DataHandler reads the file from a location that is accessible on the machine where the SCI client is running and sends the contents. Methods that upload data require that the caller construct a DataHandler and pass this into the upload call. Typically this data handler would be associated with the file that is to be read. The library will then use the DataHandler to read the contents of the file.

The details of the DataHandler are language specific. Java provides an implementation for a DataHandler. The Java DataHandler can be constructed with a DataSource. A DataSource can be used to read and write files, which is the appropriate usage of MTOM for these SCI methods. A DataSource requires an InputStream or OutputStream. A client must open the input or output file as a FileInputStream or FileOutputStream. The InputStream or OutputStream is then used to create a DataSource which is in turn used to create the DataHandler that is an input to the methods that transfer files.