Package uk.ac.starlink.registry
Class AbstractRegistryClient<R>
java.lang.Object
uk.ac.starlink.registry.AbstractRegistryClient<R>
- Direct Known Subclasses:
BasicRegistryClient
Can submit ADQL queries to a registry and return the result as a
list of resources.
This class uses custom SAX parsing of the SOAP response
to ensure that even a large response (not uncommon)
can be processed without large client-side resource usage.
For this reason, no use is made of the maximum record limit
options provided by RI 1.0; there's no client-side need for it.
- Author:
- Mark Taylor
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractRegistryClient
(SoapClient soapClient) Constructs a AbstractRegistryClient given a SOAP client. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ContentHandler
createResourceHandler
(ResourceSink<R> sink) Returns a SAX ContentHandler which can parse a VOResources element and feed items of some type R to a ResourceSink object.Returns the SOAP endpoint this client talks to.getResourceIterator
(SoapRequest request) Returns an iterator over resources corresponding to a given SOAP request.getResourceList
(SoapRequest request) Returns a list of resources corresponding to a given SOAP request.
-
Constructor Details
-
AbstractRegistryClient
Constructs a AbstractRegistryClient given a SOAP client.- Parameters:
soapClient
- SOAP client which talks to an RI-compliant registry service
-
-
Method Details
-
createResourceHandler
Returns a SAX ContentHandler which can parse a VOResources element and feed items of some type R to a ResourceSink object. R presumably represents a resource.- Parameters:
sink
- receiver of resource objects- Returns:
- new resource handler
-
getEndpoint
Returns the SOAP endpoint this client talks to.- Returns:
- registry endpoint
-
getResourceList
Returns a list of resources corresponding to a given SOAP request. The list is the result of feeding the SOAP response to the handler created bycreateResourceHandler(uk.ac.starlink.registry.ResourceSink<R>)
.- Parameters:
request
- SOAP request- Returns:
- list of resources
- Throws:
IOException
-
getResourceIterator
Returns an iterator over resources corresponding to a given SOAP request. The resources are the result of feeding the SOAP response to the handler created bycreateResourceHandler(uk.ac.starlink.registry.ResourceSink<R>)
.The iterator's
next
orhasNext
method may throw aRegistryQueryException
.The writing thread will only read resources from the SAX response as they are read out by the thread iterating over this iterator, so memory used by this class remains very small regardless of the number of records processed.
- Parameters:
request
- SOAP request- Returns:
- iterator over resources; its
next
method may throw aRegistryQueryException
- Throws:
IOException
-