uk.org.ogsadai.engine
Interface ResponseBuilder

All Known Implementing Classes:
ResponseDocumentBuilder

public interface ResponseBuilder

Interface for building a response document. Note that implementations of this interface must be threadsafe.

A response document describes the results of an OGSA-DAI request. An instance is assembled over a series of invocations of the various build methods. The product is then retrievable using the getResponseDocument method.

This is an example of the Builder design pattern. It separates the creation of response documents from the code that processes requests and allows different representations of response documents to be created.

Author:
The OGSA-DAI Project Team

Method Summary
 void buildError(java.lang.String name, java.lang.Throwable cause)
          Assembles part of the response document describing an error that has occurred while processing part of a request.
 void buildRequestError(java.lang.String cause)
          Assembles the part of the response document describing the status of a request that has failed due to an error.
 void buildRequestStatus(ProcessingStatus status)
          Assembles the part of the response document describing the status of the request.
 void buildResult(java.lang.String name, ProcessingStatus status, byte[] data)
          Assembles part of the response document describing the result of processing part of the request.
 void buildResult(java.lang.String name, Status status, byte[] data)
          Assembles part of the response document describing the result of processing part of the request.
 void buildSessionDetails(Session session)
          Assembles the part of the response document identifying the session that the request was joined to.
 

Method Detail

buildSessionDetails

public void buildSessionDetails(Session session)
Assembles the part of the response document identifying the session that the request was joined to.

Parameters:
session - Session the request was joined to
Throws:
java.lang.IllegalArgumentException - If the session is null

buildRequestStatus

public void buildRequestStatus(ProcessingStatus status)
Assembles the part of the response document describing the status of the request.

Parameters:
status - Request status.
Throws:
java.lang.IllegalArgumentException - If the status is null

buildRequestError

public void buildRequestError(java.lang.String cause)
Assembles the part of the response document describing the status of a request that has failed due to an error.

Parameters:
cause - Name of the cause of the failue e.g. an activity name.
Throws:
java.lang.IllegalArgumentException - If the cause is null

buildResult

public void buildResult(java.lang.String name,
                        ProcessingStatus status,
                        byte[] data)
Assembles part of the response document describing the result of processing part of the request.

Parameters:
name - The name associated with the result
status - The status of the result.
data - The result data. This may be null or an empty String if the result contains no result data.
Throws:
java.lang.IllegalArgumentException - If name or status are null

buildResult

public void buildResult(java.lang.String name,
                        Status status,
                        byte[] data)
Assembles part of the response document describing the result of processing part of the request.

Parameters:
name - The name associated with the result
status - The status of the result.
data - The result data. This may be null or an empty array if the result contains no result data.
Throws:
java.lang.IllegalArgumentException - If name or status are null

buildError

public void buildError(java.lang.String name,
                       java.lang.Throwable cause)
Assembles part of the response document describing an error that has occurred while processing part of a request.

Parameters:
name - The name associated with the result
cause - Cause of the error.
Throws:
java.lang.IllegalArgumentException - If name or cause are null