Class AbstractRegistryClient<R>

  • Direct Known Subclasses:
    BasicRegistryClient

    public abstract class AbstractRegistryClient<R>
    extends java.lang.Object
    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:
    IVOA Registry Interfaces
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractRegistryClient​(SoapClient soapClient)
      Constructs a AbstractRegistryClient given a SOAP client.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract org.xml.sax.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.
      java.net.URL getEndpoint()
      Returns the SOAP endpoint this client talks to.
      java.util.Iterator<R> getResourceIterator​(SoapRequest request)
      Returns an iterator over resources corresponding to a given SOAP request.
      java.util.List<R> getResourceList​(SoapRequest request)
      Returns a list of resources corresponding to a given SOAP request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractRegistryClient

        public AbstractRegistryClient​(SoapClient soapClient)
        Constructs a AbstractRegistryClient given a SOAP client.
        Parameters:
        soapClient - SOAP client which talks to an RI-compliant registry service
    • Method Detail

      • createResourceHandler

        protected abstract org.xml.sax.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. R presumably represents a resource.
        Parameters:
        sink - receiver of resource objects
        Returns:
        new resource handler
      • getEndpoint

        public java.net.URL getEndpoint()
        Returns the SOAP endpoint this client talks to.
        Returns:
        registry endpoint
      • getResourceList

        public java.util.List<R> getResourceList​(SoapRequest request)
                                          throws java.io.IOException
        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 by createResourceHandler(uk.ac.starlink.registry.ResourceSink<R>).
        Parameters:
        request - SOAP request
        Returns:
        list of resources
        Throws:
        java.io.IOException
      • getResourceIterator

        public java.util.Iterator<R> getResourceIterator​(SoapRequest request)
                                                  throws java.io.IOException
        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 by createResourceHandler(uk.ac.starlink.registry.ResourceSink<R>).

        The iterator's next or hasNext method may throw a RegistryQueryException.

        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 a RegistryQueryException
        Throws:
        java.io.IOException