Package uk.ac.starlink.vo
Class TapServiceKit
java.lang.Object
uk.ac.starlink.vo.TapServiceKit
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 Summary
ConstructorsConstructorDescriptionTapServiceKit
(TapService service, String ivoid, TapMetaPolicy metaPolicy, uk.ac.starlink.util.ContentCoding coding, int queueLimit) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireCapability
(ResultHandler<TapCapability> handler) Asynchronously acquires TAP capability information.void
acquireExamples
(ResultHandler<DaliExample[]> handler) Asynchronously acquires a list of service-specific query examples, if available.void
acquireResource
(ResultHandler<Map<String, String>> handler) Asynchronously acquires information about the registry resource corresponding to this service.void
acquireRoles
(ResultHandler<RegRole[]> handler) Asynchronously acquires information from the RegTAP rr.res_role table corresponding to this service.void
acquireSchemas
(ResultHandler<SchemaMeta[]> handler) Asynchronously acquires TAP database schema list.getIvoid()
Returns the resource identifier for this kit if known.Returns the TapMetaReader in use by this kit.Returns a RegTAP service that can be queried for information about this service's registry record.Returns the TAP service used by this kit.boolean
Invokes a runnable on the Event Dispatch Thread when the column metadata is available for a given table metadata object.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.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.void
shutdown()
Releases resources and terminates any currently running asynchronous metadata reads.
-
Constructor Details
-
TapServiceKit
public TapServiceKit(TapService service, String ivoid, TapMetaPolicy metaPolicy, uk.ac.starlink.util.ContentCoding coding, int queueLimit) Constructor.- Parameters:
service
- TAP service descriptionivoid
- IVORN of TAP service, if known (may be null)metaPolicy
- implementation for reading table metadatacoding
- configures HTTP compressionqueueLimit
- maximum number of table metadata requests queued to service; more than that and older ones will be dropped
-
-
Method Details
-
getTapService
Returns the TAP service used by this kit.- Returns:
- service description
-
getIvoid
Returns the resource identifier for this kit if known.- Returns:
- IVORN for TAP service resource, or null
-
onTables
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 itemcallback
- runnable to be invoked on the EDT when smeta.getTables() has a non-null return- Returns:
- true iff callback has been called synchronously
-
onColumns
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 itemcallback
- runnable to be invoked on the EDT when tmeta.getColumns() has a non-null return- Returns:
- true iff callback has been called synchronously
-
onForeignKeys
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 itemcallback
- runnable to be invoked on the EDT when tmeta.getForeignKeys() has a non-null return- Returns:
- true iff callback has been called synchronously
-
acquireSchemas
Asynchronously acquires TAP database schema list.- Parameters:
handler
- receiver for schema information
-
acquireCapability
Asynchronously acquires TAP capability information.- Parameters:
handler
- receiver for TAP capability object
-
acquireResource
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
Asynchronously acquires information from the RegTAP rr.res_role table corresponding to this service.- Parameters:
handler
- receiver for role list
-
acquireExamples
Asynchronously acquires a list of service-specific query examples, if available.- Parameters:
handler
- receiver for example list
-
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
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
-