uk.org.ogsadai.client.toolkit
Class GenericServiceFetcher

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.GenericServiceFetcher
All Implemented Interfaces:
ServiceFetcher

public class GenericServiceFetcher
extends java.lang.Object
implements ServiceFetcher

Generic service fetcher class which creates proxies for managing communications with data services depending upon the OGSA-DAI distribution used to deploy the service. This information is deduced by accessing namespaces within the service's WSDL which is accessed via its URL.

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static GenericServiceFetcher mInstance
          Singleton instance of the service fetcher
 
Constructor Summary
GenericServiceFetcher()
           
 
Method Summary
private  ConfigurableDataService findConfigurableDataService(java.lang.String url, java.lang.String resourceID)
          Returns a proxy managing communications with a configurable data service.
private  DataService findDataService(java.lang.String url, java.lang.String resourceID)
          Returns a proxy managing communications with a configurable data service.
 ConfigurableDataService getConfigurableDataService(java.lang.String url, java.lang.String resourceID)
          Returns a proxy managing communications with a configurable data service.
 DataService getDataService(java.lang.String url, java.lang.String resourceID)
          Create a proxy for the data service specified by the given URL and data service resource ID.
static GenericServiceFetcher getInstance()
          Returns the singleton instance of this service fetcher.
private  java.lang.String getWSDL(java.net.URL url)
          Reads the WSDL of a service at the given URL.
 WSIDataService getWSIDataService(java.lang.String url, java.lang.String resourceID)
          Returns a proxy managing communications with an OGSA-DAI WSI data service.
 WSRFDataService getWSRFDataService(java.lang.String url, java.lang.String resourceID)
          Returns a proxy managing communications with an OGSA-DAI WSRF data service.
private  boolean isWSI(java.lang.String wsdl)
          Indicates whether the given WSDL document specifies an OGSA-DAI WSI service.
private  boolean isWSRF(java.lang.String wsdl)
          Indicates whether the given WSDL document specifies an OGSA-DAI WSRF service.
 
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

mInstance

private static GenericServiceFetcher mInstance
Singleton instance of the service fetcher

Constructor Detail

GenericServiceFetcher

public GenericServiceFetcher()
Method Detail

getInstance

public static GenericServiceFetcher getInstance()
Returns the singleton instance of this service fetcher.

Returns:
service fetcher.

getDataService

public DataService getDataService(java.lang.String url,
                                  java.lang.String resourceID)
                           throws java.net.MalformedURLException,
                                  java.lang.IllegalArgumentException,
                                  ServiceCommsException,
                                  ServiceTypeException
Description copied from interface: ServiceFetcher
Create a proxy for the data service specified by the given URL and data service resource ID.

Specified by:
getDataService in interface ServiceFetcher
Parameters:
url - URL of a data service
resourceID - Data service resource ID. The method does not check whether the service exposes the resource.
Returns:
a proxy for data service
Throws:
java.net.MalformedURLException - if URL is malformed.
ServiceCommsException - if there is a problem contacting the service.
java.lang.IllegalArgumentException - if either of the arguments are null.
ServiceTypeException - if the service at url is either not an OGSA-DAI service or is not implemented in a version of OGSA-DAI compatible with this version of the client toolkit.

getConfigurableDataService

public ConfigurableDataService getConfigurableDataService(java.lang.String url,
                                                          java.lang.String resourceID)
                                                   throws java.net.MalformedURLException,
                                                          java.lang.IllegalArgumentException,
                                                          ServiceCommsException,
                                                          ServiceTypeException
Returns a proxy managing communications with a configurable data service. This method connects to the service at the given URL, retrieves its WSDL and determines the OGSA-DAI distribution used to implement the service. A data service resource ID is taken so that the comminications object can be configured to manage interaction with this resource exposed by the service.

Parameters:
url - Service URL
resourceID - Data service resource ID. The method does not check whether the service exposes this resource.
Returns:
ConfigurableWSIDataService or ConfigurableWSRFDataService.
Throws:
java.lang.IllegalArgumentException - if url is null
java.net.MalformedURLException - if the service URL is malformed.
ServiceCommsException - if there is a problem in communicating with the service.
ServiceTypeException - if the service at url is either not an OGSA-DAI service or is not implemented in a version of OGSA-DAI compatible with this version of the client toolkit.

getWSRFDataService

public WSRFDataService getWSRFDataService(java.lang.String url,
                                          java.lang.String resourceID)
                                   throws java.lang.IllegalArgumentException,
                                          java.net.MalformedURLException
Returns a proxy managing communications with an OGSA-DAI WSRF data service.

The method does not check whether the client toolkit is compatible with the service type.

Parameters:
url - Service URL
resourceID - Data service resource ID. The method does not check whether the service exposes this resource.
Returns:
proxy
Throws:
java.lang.IllegalArgumentException - if url is null
java.net.MalformedURLException - if the service URL is malformed.

getWSIDataService

public WSIDataService getWSIDataService(java.lang.String url,
                                        java.lang.String resourceID)
                                 throws java.lang.IllegalArgumentException,
                                        java.net.MalformedURLException
Returns a proxy managing communications with an OGSA-DAI WSI data service.

The method does not check whether the client toolkit is compatible with the service type.

Parameters:
url - Service URL
resourceID - Data service resource ID. The method does not check whether the service exposes this resource.
Returns:
proxy
Throws:
java.lang.IllegalArgumentException - if url is null
java.net.MalformedURLException - if the service URL is malformed.

findDataService

private DataService findDataService(java.lang.String url,
                                    java.lang.String resourceID)
                             throws java.net.MalformedURLException,
                                    java.lang.IllegalArgumentException,
                                    ServiceCommsException,
                                    ServiceTypeException
Returns a proxy managing communications with a configurable data service. This method connects to the service at the given URL, retrieves its WSDL and determines the OGSA-DAI distribution used to implement the service. A data service resource ID is taken so that the comminications object can be configured to manage interaction with this resource exposed by the service.

Parameters:
url - Service URL
resourceID - Data service resource ID. The method does not check whether the service exposes this resource.
Returns:
ConfigurableWSIDataService or ConfigurableWSRFDataService.
Throws:
java.net.MalformedURLException - if the service URL is malformed.
ServiceCommsException - if there is a problem in communicating with the service.
ServiceTypeException - if the service at url is either not an OGSA-DAI service or is not implemented in a version of OGSA-DAI compatible with this version of the client toolkit.
java.lang.IllegalArgumentException

findConfigurableDataService

private ConfigurableDataService findConfigurableDataService(java.lang.String url,
                                                            java.lang.String resourceID)
                                                     throws java.net.MalformedURLException,
                                                            java.lang.IllegalArgumentException,
                                                            ServiceCommsException,
                                                            ServiceTypeException
Returns a proxy managing communications with a configurable data service. This method connects to the service at the given URL, retrieves its WSDL and determines the OGSA-DAI distribution used to implement the service. A data service resource ID is taken so that the comminications object can be configured to manage interaction with this resource exposed by the service.

Parameters:
url - Service URL
resourceID - Data service resource ID. The method does not check whether the service exposes this resource.
Returns:
ConfigurableWSIDataService or ConfigurableWSRFDataService.
Throws:
java.net.MalformedURLException - if the service URL is malformed.
ServiceCommsException - if there is a problem in communicating with the service.
ServiceTypeException - if the service at url is either not an OGSA-DAI service or is not implemented in a version of OGSA-DAI compatible with this version of the client toolkit.
java.lang.IllegalArgumentException

getWSDL

private java.lang.String getWSDL(java.net.URL url)
                          throws java.io.IOException
Reads the WSDL of a service at the given URL.

Parameters:
url - URL of the service
Returns:
WSDL document as a string.
Throws:
java.io.IOException - if there was a problem reading the remote document

isWSRF

private boolean isWSRF(java.lang.String wsdl)
Indicates whether the given WSDL document specifies an OGSA-DAI WSRF service.

This is the case if the service WSDL is defined in the https://ogsadai.org.uk/namespaces/2005/10/service/wsrf/dataservice/service namespace.

Parameters:
wsdl - WSDL document as a string.
Returns:
true if the service is an OGSA-DAI WSRF one, false otherwise

isWSI

private boolean isWSI(java.lang.String wsdl)
Indicates whether the given WSDL document specifies an OGSA-DAI WSI service.

This is the case if the service WSDL is defined in the https://ogsadai.org.uk/namespaces/2005/10/service/wsi/dataservice/service namespace.

Parameters:
wsdl - WSDL document as a string.
Returns:
true if the service is an OGSA-DAI WSI one, false otherwise