The plugin was built according to instructions in Creation of Plugins (DPUs).
It uses Jersey client library to access the server REST API. First it uploads the file provided as the input to the DPU under a unique ID and follows it by formatting it according to the DPU instance configuration.
The task configuration uploaded to the DPU is used as a template, where the actual file identifier is injected before the DPU sends the task configuration to the processing server. The file identifier injection exploits the fact that the configuration is a serialized RDF. It builds RDF model from it with UnifiedViews internal Sesame library and replaces the subject of the property that relates the file identifier to the task. Then it serializes the model again and sends it to the server under unique ID.
The execution is done in a manner similar to the web client: the DPU gives command to start it and then periodically polls the execution state until it is terminal. In case of success, the DPU requests export of the outputs and redirects the InputStream
s from the response to FileOutputStream
s that are defined for the outputs of the DPU. In case of failure or success with warnings, DPU extracts error message or messages from the response. Server responses are parsed by mapping them to objects of classes annotated with JAXB annotations, employing Jackson library integrated to the Jersey. Only in the case of warnings, it would be impractical to map the whole, potentially large and complicated result, so a partial mapping via JsonCreator is defined.