uk.org.ogsadai.client.toolkit.wsrf
Class WSRFDataTransport

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.wsrf.WSRFDataTransport
All Implemented Interfaces:
DataTransport

public class WSRFDataTransport
extends java.lang.Object
implements DataTransport

Client-side stub for OGSA-DAI WSRF data services transport operations. This class handles the details of SOAP request building, submission and response parsing.

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  SOAPCallFactory mCallFactory
          Factory for creating SOAPCall objects with the correct settings.
private  ResourceID mResource
          ID of the current resource of interest
private  SessionStreamID mSessionStreamID
          ID of the current session and stream of interest
private  java.net.URL mURL
          URL of the service
 
Constructor Summary
WSRFDataTransport(java.net.URL url)
          Construct a new OGSA-DAI WSRF data service stub from the given URL.
WSRFDataTransport(java.net.URL url, ResourceID resourceID, SessionStreamID stream, SOAPCallFactory callFactory)
          Construct a new OGSA-DAI WSRF data transport service from the given URL, resource ID, stream ID and the SOAP call factory.
WSRFDataTransport(java.net.URL url, ResourceID id, SOAPCallFactory callFactory)
          Construct a new OGSA-DAI WSRF data service stub from the given URL configured to communicate with the given resource.
 
Method Summary
private  void addAddressingHeaders(SOAPCall call, ResourceID id)
          Generates headers with the given resource ID for a SOAP request.
private  void generateHeaders(SOAPCall call)
          Generates WSRF headers for a SOAP request.
 java.lang.Object getBlock()
          Gets a single block of data from the output stream of a data service resource.
 java.net.URL getDataTransportURL()
          Obtain the URL of the data service.
 java.lang.Object getFully()
          Gets an entire data set from the output stream of a data service resource in one go.
 java.lang.Object getNBlocks(int numberOfBlocks)
          Gets an number of blocks of data from the output stream of a data service resource in one go.
 ResourceID getResourceID()
          Gets the default resource.
 SessionStreamID getSessionStreamID()
          Gets the session stream ID - the session and stream of that session exposed by the data service resource of interest.
 void putBlock(java.lang.Object data)
          Puts one block of data onto a data service resource input stream.
 void putClosingBlock()
          Inform a data service resource that it can close an input stream as all data has been forwarded.
 void putFully(java.lang.Object data)
          Puts an entire data set onto a data service resource input stream in one go.
 void setConnectionProperty(ConnectionProperty property)
          Configure the service stub with the specified ConnectionProperty.
 void setResourceID(ResourceID id)
          Sets the default resource.
 void setSessionStreamID(SessionStreamID sessionStreamID)
          Sets the session stream ID - the session and stream of that session exposed by the data service resource of interest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mURL

private java.net.URL mURL
URL of the service


mSessionStreamID

private SessionStreamID mSessionStreamID
ID of the current session and stream of interest


mResource

private ResourceID mResource
ID of the current resource of interest


mCallFactory

private final SOAPCallFactory mCallFactory
Factory for creating SOAPCall objects with the correct settings.

Constructor Detail

WSRFDataTransport

public WSRFDataTransport(java.net.URL url)
                  throws java.lang.IllegalArgumentException
Construct a new OGSA-DAI WSRF data service stub from the given URL.

Parameters:
url - URL of the service
Throws:
java.lang.IllegalArgumentException - if url is null

WSRFDataTransport

public WSRFDataTransport(java.net.URL url,
                         ResourceID id,
                         SOAPCallFactory callFactory)
                  throws java.lang.IllegalArgumentException
Construct a new OGSA-DAI WSRF data service stub from the given URL configured to communicate with the given resource.

Parameters:
url - URL of the service
id - Resource ID.
callFactory -
Throws:
java.lang.IllegalArgumentException - if url or id is null

WSRFDataTransport

public WSRFDataTransport(java.net.URL url,
                         ResourceID resourceID,
                         SessionStreamID stream,
                         SOAPCallFactory callFactory)
Construct a new OGSA-DAI WSRF data transport service from the given URL, resource ID, stream ID and the SOAP call factory.

Parameters:
url - URL of the service
resourceID - Resource ID
stream - Stream identifier
callFactory - SOAP call factory
Method Detail

setSessionStreamID

public void setSessionStreamID(SessionStreamID sessionStreamID)
                        throws java.lang.IllegalArgumentException
Description copied from interface: DataTransport
Sets the session stream ID - the session and stream of that session exposed by the data service resource of interest.

Specified by:
setSessionStreamID in interface DataTransport
Parameters:
sessionStreamID - Session stream identifier
java.lang.IllegalArgumentException

getSessionStreamID

public SessionStreamID getSessionStreamID()
Description copied from interface: DataTransport
Gets the session stream ID - the session and stream of that session exposed by the data service resource of interest.

Specified by:
getSessionStreamID in interface DataTransport
Returns:
session stream ID

setResourceID

public void setResourceID(ResourceID id)
                   throws java.lang.IllegalArgumentException
Description copied from interface: DataTransport
Sets the default resource. Any resource-specific requests will be targetted at the resource with this ID.

Specified by:
setResourceID in interface DataTransport
Parameters:
id - Resource ID
java.lang.IllegalArgumentException

getResourceID

public ResourceID getResourceID()
Description copied from interface: DataTransport
Gets the default resource. Any resource-specific requests will be targetted at the resource with this ID.

Specified by:
getResourceID in interface DataTransport
Returns:
resource ID.

getDataTransportURL

public java.net.URL getDataTransportURL()
Description copied from interface: DataTransport
Obtain the URL of the data service.

Specified by:
getDataTransportURL in interface DataTransport
Returns:
URL

getFully

public java.lang.Object getFully()
                          throws ServerException,
                                 AuthorisationException,
                                 RequestException,
                                 ResourceUnknownException,
                                 ResourceBusyException,
                                 ServiceCommsException
Description copied from interface: DataTransport
Gets an entire data set from the output stream of a data service resource in one go.

Specified by:
getFully in interface DataTransport
Returns:
entire data set
Throws:
ResourceUnknownException - If the resource is unknown to the service.
ResourceBusyException - If the resource is busy.
RequestException - If there is a problem with the client's request e.g there is no such session.
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ServiceCommsException - If there was an error communicating with the service.
ServerException - If there was an error server-side.

getNBlocks

public java.lang.Object getNBlocks(int numberOfBlocks)
                            throws ServerException,
                                   AuthorisationException,
                                   RequestException,
                                   ResourceUnknownException,
                                   ResourceBusyException,
                                   ServiceCommsException
Description copied from interface: DataTransport
Gets an number of blocks of data from the output stream of a data service resource in one go. The blocks are aggregated to form a single larger block.

Specified by:
getNBlocks in interface DataTransport
Parameters:
numberOfBlocks - Number of blocks to get.
Returns:
the aggregated block of data retrieved or ServiceConstants.NO_MORE_DATA if there is no more data to retrieve.
Throws:
RequestException - If there is a problem with the client's request e.g there is no such session.
ResourceUnknownException - If the resource is unknown to the service.
ServerException - If there was an error server-side.
ServiceCommsException - If there was an error communicating with the service.
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ResourceBusyException - If the resource is busy.

getBlock

public java.lang.Object getBlock()
                          throws ServerException,
                                 AuthorisationException,
                                 RequestException,
                                 ResourceUnknownException,
                                 ResourceBusyException,
                                 ServiceCommsException
Description copied from interface: DataTransport
Gets a single block of data from the output stream of a data service resource.

Specified by:
getBlock in interface DataTransport
Returns:
the block of data retrieved or ServiceConstants.NO_MORE_DATA if there is no more data to retrieve.
Throws:
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ResourceUnknownException - If the resource is unknown to the service.
RequestException - If there is a problem with the client's request e.g there is no such session.
ServiceCommsException - If there was an error communicating with the service.
ServerException - If there was an error server-side.
ResourceBusyException - If the resource is busy.

putFully

public void putFully(java.lang.Object data)
              throws ServerException,
                     AuthorisationException,
                     RequestException,
                     ResourceUnknownException,
                     ResourceBusyException,
                     ServiceCommsException
Description copied from interface: DataTransport
Puts an entire data set onto a data service resource input stream in one go.

Specified by:
putFully in interface DataTransport
Parameters:
data - The complete set of data.
Throws:
ServiceCommsException - If there was an error communicating with the service.
ResourceUnknownException - If the resource is unknown to the service.
RequestException - if there is a problem with the client's request e.g there is no such session.
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ServerException - If there was an error server-side.
ResourceBusyException - if the resource is busy.

putBlock

public void putBlock(java.lang.Object data)
              throws ServerException,
                     AuthorisationException,
                     RequestException,
                     ResourceUnknownException,
                     ResourceBusyException,
                     ServiceCommsException
Description copied from interface: DataTransport
Puts one block of data onto a data service resource input stream. Once all blocks have been submitted using this method, the putClosingBlock method should be called to signal to the data service resource that all the data has been forwarded.

Specified by:
putBlock in interface DataTransport
Parameters:
data - Block of data.
Throws:
ServerException - If there was an error server-side.
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ResourceBusyException - if the resource is busy.
ResourceUnknownException - If the resource is unknown to the service.
ServiceCommsException - If there was an error communicating with the service.
RequestException - if there is a problem with the client's request e.g there is no such session.

putClosingBlock

public void putClosingBlock()
                     throws ServerException,
                            AuthorisationException,
                            RequestException,
                            ResourceUnknownException,
                            ResourceBusyException,
                            ServiceCommsException
Description copied from interface: DataTransport
Inform a data service resource that it can close an input stream as all data has been forwarded. After a call to this method the putBlock method should no longer be called.

Specified by:
putClosingBlock in interface DataTransport
Throws:
ResourceBusyException - if the resource is busy.
ServerException - If there was an error server-side.
ResourceUnknownException - If the resource is unknown to the service.
AuthorisationException - If the client is not authorised to access the service, resource, session or stream.
ServiceCommsException - If there was an error communicating with the service.
RequestException - if there is a problem with the client's request e.g there is no such session.

setConnectionProperty

public void setConnectionProperty(ConnectionProperty property)
Configure the service stub with the specified ConnectionProperty.

Specified by:
setConnectionProperty in interface DataTransport
Parameters:
property - A connection property
Throws:
java.lang.IllegalArgumentException - if property is null

generateHeaders


private void generateHeaders(SOAPCall call)
                      throws java.net.MalformedURLException
Generates WSRF headers for a SOAP request.

Parameters:
call - SOAPCall object managing SOAP invocations.
Throws:
java.net.MalformedURLException - If the service URL is malformed.

addAddressingHeaders

private void addAddressingHeaders(SOAPCall call,
                                  ResourceID id)
                           throws java.net.MalformedURLException
Generates headers with the given resource ID for a SOAP request.

Parameters:
call - SOAP call to be configured
id - Resource ID
Throws:
java.net.MalformedURLException - If the service URL is malformed.