Package uk.ac.starlink.vo

# Class TapCapabilitiesDoc

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

public class TapCapabilitiesDoc extends Object
Encapsulates useful information found in the capabilities document describing a TAP service. The static method `readCapabilities(java.net.URL)` can construct an instance of this class by parsing a suitable XML document.

Since:
  26 Sep 2018
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`TapCapabilitiesDoc(TapCapability tapCapability, StdCapabilityInterface[] intfs)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static URL`
`getCapabilitiesUrl(URL baseUrl)`
Provides the URL to use for the capabilities endpoint, given the TAP service base URL.
`StdCapabilityInterface[]`
`getInterfaces()`
Returns a list of capability,interface pairs found associated with this capabilities document.
`static StdCapabilityInterface[]`
`getInterfaces(Element capsEl)`
Extracts a list of zero or more standard interfaces from the capabilities element.
`TapCapability`
`getTapCapability()`
Returns the object that describes the TAP services capabilities as defined by TAPRegExt.
`static TapCapability`
`getTapCapability(Element capsEl)`
Extracts a TapCapability from the top-level capabilities element, in accordance with the TAPRegExt standard.
`static TapCapabilitiesDoc`
`readCapabilities(URL capsUrl)`
Reads a TAP capabilities document from a given URL and returns a TapCapabilitiesDoc object based on it.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TapCapabilitiesDoc

public TapCapabilitiesDoc(TapCapability tapCapability, StdCapabilityInterface[] intfs)
Constructor.

Parameters:
  `tapCapability` - describes TAPRegExt information
  `intfs` - enumerates all known capability+interface pairs

## Method Details

### getTapCapability

public TapCapability getTapCapability()
Returns the object that describes the TAP services capabilities as defined by TAPRegExt.

Returns:
  TAP-specific capability description, or null if none found

### getInterfaces

public StdCapabilityInterface[] getInterfaces()
Returns a list of capability,interface pairs found associated with this capabilities document. Note this may include an entry associated with the TAPRegExt capability.

Returns:
  array of zero or more capability/interface specifications

### getCapabilitiesUrl

public static URL getCapabilitiesUrl(URL baseUrl)
Provides the URL to use for the capabilities endpoint, given the TAP service base URL. This method basically just adds "/capabilities" on the end of the URL string, but it takes care of inserting a slash when required etc.

Parameters:
  `baseUrl` - service URL
Returns:
  capabilities endpoint URL

### readCapabilities

public static TapCapabilitiesDoc readCapabilities(URL capsUrl) throws IOException, SAXException
Reads a TAP capabilities document from a given URL and returns a TapCapabilitiesDoc object based on it. If it looks like there's no suitable document there, an exception is thrown.

Parameters:
  `capsUrl` - location of capabilities document
Returns:
  capabilities object, not null
Throws:
  `IOException`
  `SAXException`

### getTapCapability

public static TapCapability getTapCapability(Element capsEl) throws XPathExpressionException
Extracts a TapCapability from the top-level capabilities element, in accordance with the TAPRegExt standard.

Parameters:
  `capsEl` - capabilities element
Throws:
  `XPathExpressionException`

### getInterfaces

public static StdCapabilityInterface[] getInterfaces(Element capsEl)
Extracts a list of zero or more standard interfaces from the capabilities element.

Parameters:
  `capsEl` - capabilities element
Returns:
  capability/interface objects