Class TapServiceKit

java.lang.Object
uk.ac.starlink.vo.TapServiceKit

public class TapServiceKit extends Object
Handles asynchronous population of the TAP metadata hierarchy. It owns a TapMetaReader and invokes its methods as required to populate the metadata hiearchy objects, providing methods that allow callbacks to be invoked when the relevant items are available.

This class is intended for use with Swing; some methods must be invoked from the Event Dispatch Thread as documented.

Since:
23 Mar 2015
Author:
Mark Taylor
  • Constructor Details

    • TapServiceKit

      public TapServiceKit(TapService service, String ivoid, TapMetaPolicy metaPolicy, uk.ac.starlink.util.ContentCoding coding, int queueLimit)
      Constructor.
      Parameters:
      service - TAP service description
      ivoid - IVORN of TAP service, if known (may be null)
      metaPolicy - implementation for reading table metadata
      coding - configures HTTP compression
      queueLimit - maximum number of table metadata requests queued to service; more than that and older ones will be dropped
  • Method Details

    • getTapService

      public TapService getTapService()
      Returns the TAP service used by this kit.
      Returns:
      service description
    • getIvoid

      public String getIvoid()
      Returns the resource identifier for this kit if known.
      Returns:
      IVORN for TAP service resource, or null
    • onTables

      public boolean onTables(SchemaMeta smeta, Runnable callback)
      Invokes a runnable on the Event Dispatch Thread when the table metadata is available for a given schema metadata object. This method, and the supplied callback, are invoked on the EDT.
      Parameters:
      smeta - schema metadata item
      callback - runnable to be invoked on the EDT when smeta.getTables() has a non-null return
      Returns:
      true iff callback has been called synchronously
    • onColumns

      public boolean onColumns(TableMeta tmeta, Runnable callback)
      Invokes a runnable on the Event Dispatch Thread when the column metadata is available for a given table metadata object. This method, and the supplied callback, are invoked on the EDT.
      Parameters:
      tmeta - table metadata item
      callback - runnable to be invoked on the EDT when tmeta.getColumns() has a non-null return
      Returns:
      true iff callback has been called synchronously
    • onForeignKeys

      public boolean onForeignKeys(TableMeta tmeta, Runnable callback)
      Invokes a runnable on the Event Dispatch Thread when the foreign key metadata is available for a given table metadata object. This method, and the supplied callback, are invoked on the EDT.
      Parameters:
      tmeta - table metadata item
      callback - runnable to be invoked on the EDT when tmeta.getForeignKeys() has a non-null return
      Returns:
      true iff callback has been called synchronously
    • acquireSchemas

      public void acquireSchemas(ResultHandler<SchemaMeta[]> handler)
      Asynchronously acquires TAP database schema list.
      Parameters:
      handler - receiver for schema information
    • acquireCapability

      public void acquireCapability(ResultHandler<TapCapability> handler)
      Asynchronously acquires TAP capability information.
      Parameters:
      handler - receiver for TAP capability object
    • acquireResource

      public void acquireResource(ResultHandler<Map<String,String>> handler)
      Asynchronously acquires information about the registry resource corresponding to this service. The result is a map of standard RegTAP resource column names to their values.
      Parameters:
      handler - receiver for resource metadata map
    • acquireRoles

      public void acquireRoles(ResultHandler<RegRole[]> handler)
      Asynchronously acquires information from the RegTAP rr.res_role table corresponding to this service.
      Parameters:
      handler - receiver for role list
    • acquireExamples

      public void acquireExamples(ResultHandler<List<Tree<DaliExample>>> handler)
      Asynchronously acquires a list of service-specific query examples, if available.
      Parameters:
      handler - receiver for example list
    • acquireAuthStatus

      public void acquireAuthStatus(ResultHandler<uk.ac.starlink.auth.AuthStatus> handler, boolean forceLogin)
      Asynchronously attempts to contact the authcheck endpoint of the TAP service to determine authentication information. This acquires the authentication status, but also sets up the authenticated connection, including acquiring credentials from the user, so that the user does not get asked on subsequent occasions.

      On completion, the supplied handler is messaged with either the authentication status (which may represent anonymous usage) meaning that subsequent interactions with this service via the AuthManager may be successful, or with an IOException, meaning that authorization was denied and further interaction with the service is likely to fail.

      Parameters:
      handler - receives authentication information; either an authentication status or an authentication error
      forceLogin - if true, the user will be asked to (re-)login if authentication is available; otherwise existing or anonymous interaction is preferred
    • getRegTapService

      public TapService getRegTapService()
      Returns a RegTAP service that can be queried for information about this service's registry record.

      The default implementation returns the default value from TapServices.getRegTapService().

      Returns:
      RegTAP service description
    • shutdown

      public void shutdown()
      Releases resources and terminates any currently running asynchronous metadata reads. Calling this method does not prevent future use of this object.
    • getMetaReader

      public TapMetaReader getMetaReader()
      Returns the TapMetaReader in use by this kit. This method will not block, but may return null if the reader to use has not yet been determined.
      Returns:
      metaReader in use, or null