uk.org.ogsadai.client.toolkit.service
Interface DataTransport

All Known Subinterfaces:
DataService
All Known Implementing Classes:
WSRFDataService, WSRFDataTransport

public interface DataTransport

Provides access to the getBlock, getNBlocks and getFully operations and putBlock, putNBlocks and putFully operations on the Data Transport port type. A data service implements DataTransport operations, with the DT operations enabled by the submission of a Request containing an OutputStreamActivity to the Data Service.

Author:
The OGSA-DAI Project Team

Method Summary
 java.lang.Object getBlock()
          Gets one block from the complete data set from the DT output stream.
 java.net.URL getDataTransportURL()
          Obtain the URL of the data service implementing the data transport interface
 java.lang.Object getFully()
          Gets the entire data set from the Data Transport output stream in one operation.
 java.lang.Object getNBlocks(int numberOfBlocks)
          Gets a number of blocks from the complete data set from the DT output stream as a single block.
 ResourceID getResourceID()
          Obtain the resource ID of the resource this service is interacting with
 java.lang.String getStreamID()
          Obtain the stream ID of the input or output stream
 boolean putBlock(java.lang.Object data)
          Puts one block from a larger data set in to the DT input stream.
 boolean putClosingBlock()
          Signals to the DT input stream that all blocks have been sent, so processing at the data service can be completed.
 boolean putFully(java.lang.Object data)
          Puts the entire data set in to the DT input stream in one operation.
 

Method Detail

getFully

public java.lang.Object getFully()
                          throws ResourceException,
                                 ServiceCommsException,
                                 ServerException,
                                 AuthorisationException
Gets the entire data set from the Data Transport output stream in one operation. Uses the DT getFully operation.

Returns:
The entire data set
Throws:
DataFormatException - If there is a problem with the data.
ServiceCommsException - If there is a problem communicating with the data service
ServerException
ResourceException
AuthorisationException

getNBlocks

public java.lang.Object getNBlocks(int numberOfBlocks)
                            throws DataFormatException,
                                   ResourceException,
                                   ServiceCommsException
Gets a number of blocks from the complete data set from the DT output stream as a single block. Uses the DT getNBlocks operation. Returns null if there are no more blocks to retrieve.

Parameters:
numberOfBlocks - The number of blocks to fetch from the DT output stream at once. These blocks will be amalgamated into a single block
Returns:
The block of data retrieved from the DT output stream, null if there are no more blocks to retrieve
Throws:
DataFormatException - If there is a problem with the data.
ServiceCommsException - If there is a problem communicating with the service.
ResourceException

getBlock

public java.lang.Object getBlock()
                          throws ResourceException,
                                 ServiceCommsException,
                                 ServerException,
                                 AuthorisationException
Gets one block from the complete data set from the DT output stream. Uses the DT getBlock operation. Returns null if there are no more blocks to retrieve.

Returns:
The block of data retrieved from the DT output stream, null if there are no more blocks to retrieve
Throws:
DataFormatException - If there is a problem with the data
ServiceCommsException - If there is a problem communicating with the service.
ServerException - If there is a problem at the server
AuthorisationException
ResourceException

putFully

public boolean putFully(java.lang.Object data)
                 throws DataFormatException,
                        ResourceException,
                        ServiceCommsException,
                        ServerException,
                        AuthorisationException
Puts the entire data set in to the DT input stream in one operation. Uses the DT putFully operation.

Parameters:
data - The data set to put in to the DataTransport input stream
Returns:
true if the data was successfully put, false otherwise.
Throws:
DataFormatException - If there is a problem with the data.
ServiceCommsException - If there is a problem communicating with the DataTransport input stream
ResourceException
ServerException
AuthorisationException

putBlock

public boolean putBlock(java.lang.Object data)
                 throws DataFormatException,
                        ResourceException,
                        ServiceCommsException,
                        ServerException,
                        AuthorisationException
Puts one block from a larger data set in to the DT input stream. Uses the DT putBlock operation. Once all blocks have been submitted using this method, the putClosingBlock method should be called to signal to the data service that all the data has been sent.

Parameters:
data - The block to put in to the DataTransport input stream
Returns:
true if the data was successfully put, false otherwise.
Throws:
DataFormatException - If there is a problem with the data, or the putClosingBlock method has already been called.
ServiceCommsException - If there is a problem communicating with the DataTransport input stream
ResourceException
ServerException
AuthorisationException

putClosingBlock

public boolean putClosingBlock()
                        throws ResourceException,
                               ServiceCommsException,
                               ServerException,
                               AuthorisationException
Signals to the DT input stream that all blocks have been sent, so processing at the data service can be completed. After putClosingBlock has been called, the putBlock method should no longer be used.

Returns:
true if the closing block was successfully put, false otherwise.
Throws:
ServiceCommsException - If there is a problem communicating with the DataTransport input stream
ServerException
AuthorisationException
ResourceException

getDataTransportURL

public java.net.URL getDataTransportURL()
                                 throws ServiceCommsException
Obtain the URL of the data service implementing the data transport interface

Returns:
URL
Throws:
ServiceCommsException - If an error occurs commicating with a service to obtain the transport URL. This exception will only be thrown by the OGSI implementation.

getStreamID

public java.lang.String getStreamID()
Obtain the stream ID of the input or output stream

Returns:
stream ID

getResourceID

public ResourceID getResourceID()
Obtain the resource ID of the resource this service is interacting with

Returns:
resource ID