uk.org.ogsadai.client.toolkit.wsi
Class WSIDataTransport

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

public class WSIDataTransport
extends java.lang.Object
implements DataTransport

Client-side stub for OGSA-DAI WSI 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 mResourceID
          ID of the current resource of interest
private  java.net.URL mServiceURL
          URL of the service
private  SessionStreamID mSessionStreamID
          ID of the current session and stream of interest
 
Constructor Summary
WSIDataTransport(java.net.URL url, ResourceID resourceID, SessionStreamID sessionStreamID, SOAPCallFactory factory)
          Construct a new OGSA-DAI WSI data service stub from the given URL configured to communicate with the given resource, in particular the given stream of the given session.
WSIDataTransport(java.net.URL url, ResourceID id, SOAPCallFactory callFactory)
          Construct a new OGSA-DAI WSI data service stub from the given URL configured to communicate with the given resource.
WSIDataTransport(java.net.URL serviceURL, SOAPCallFactory callFactory)
          Construct a new OGSA-DAI WSI data service stub from the given URL.
 
Method Summary
 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.
private  java.lang.String getServiceURL()
          Generates the full service URL using the resource ID.
 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)
          Sets a connection property for the service stub.
 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

mServiceURL

private java.net.URL mServiceURL
URL of the service


mSessionStreamID

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


mResourceID

private ResourceID mResourceID
ID of the current resource of interest


mCallFactory

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

Constructor Detail

WSIDataTransport

public WSIDataTransport(java.net.URL serviceURL,
                        SOAPCallFactory callFactory)
                 throws java.lang.IllegalArgumentException
Construct a new OGSA-DAI WSI data service stub from the given URL.

Parameters:
serviceURL - URL of the service
callFactory - the factory to use for creating SOAP calls
Throws:
java.lang.IllegalArgumentException - if url is null

WSIDataTransport

public WSIDataTransport(java.net.URL url,
                        ResourceID id,
                        SOAPCallFactory callFactory)
                 throws java.lang.IllegalArgumentException
Construct a new OGSA-DAI WSI 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

WSIDataTransport

public WSIDataTransport(java.net.URL url,
                        ResourceID resourceID,
                        SessionStreamID sessionStreamID,
                        SOAPCallFactory factory)
                 throws java.lang.IllegalArgumentException
Construct a new OGSA-DAI WSI data service stub from the given URL configured to communicate with the given resource, in particular the given stream of the given session.

Parameters:
url - URL of the service
resourceID - Resource ID.
sessionStreamID - Session and stream ID.
factory - factory for creating SOAP calls
Throws:
java.lang.IllegalArgumentException - if url, id or sessionStreamID are null.
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)
Sets a connection property for the service stub.

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

getServiceURL

private java.lang.String getServiceURL()
Generates the full service URL using the resource ID.

Returns:
full service URL of form ServiceURL/DAIid.getName()