# Class ServiceDescriptorFactory

java.lang.Object
uk.ac.starlink.votable.datalink.ServiceDescriptorFactory

public class ServiceDescriptorFactory extends Object
Contains methods to parse service descriptor elements in a VOTable document.

Since:
  7 Dec 2017
Author:
  Mark Taylor
See Also:
  - DataLink 1.0 or 1.1, Sec 4

## Constructor Summary

Constructors
Constructor
Description
`ServiceDescriptorFactory()`

## Method Summary

Modifier and Type
Method
Description
`ServiceDescriptor`
`createServiceDescriptor(VOElement resourceEl)`
Parses a DOM element as a ServiceDescriptor.
`ServiceParam`
`createServiceParam(ParamElement paramEl)`
Parses a VOTable DOM element as a ServiceParam.
`ServiceDescriptor[]`
`readAllServiceDescriptors(VOElement el)`
Reads ServiceDescriptor descendants of a given element.
`ServiceDescriptor[]`
`readTableServiceDescriptors(TableElement tableEl)`
Locates all the service descriptors that correspond to a given TABLE element.

### Methods inherited from class Object

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

## Constructor Details

### ServiceDescriptorFactory

public ServiceDescriptorFactory()

## Method Details

### readAllServiceDescriptors

public ServiceDescriptor[] readAllServiceDescriptors(VOElement el)
Reads ServiceDescriptor descendants of a given element. These are constructed from any RESOURCE element with with @type="meta" and @utype="adhoc:service".

Parameters:
  `el` - container element
Returns:
  list of zero or more service descriptors found

### readTableServiceDescriptors

public ServiceDescriptor[] readTableServiceDescriptors(TableElement tableEl)
Locates all the service descriptors that correspond to a given TABLE element.

This is not elegant. We are looking for SDs in the following positions:

      SomeElement
        RESOURCE
          TABLE
        RESOURCE-with-ServiceDescriptor

or

      RESOURCE
        TABLE
        RESOURCE-with-ServiceDescriptor

but we don't know which. First, find the widest scope within which an SD for this tableEl might be found. That is the parent of this TABLE's RESOURCE parent. Then, look for all the SDs in this scope, but discount any which have TABLE siblings apart from the supplied tableEl.

Parameters:
  `tableEl` - target TABLE element
Returns:
  service descriptors corresponding to `tableEl`

### createServiceDescriptor

public ServiceDescriptor createServiceDescriptor(VOElement resourceEl)
Parses a DOM element as a ServiceDescriptor. The supplied element will normally be a RESOURCE with with @type="meta" and utype="adhoc:service".

Parameters:
  `resourceEl` - DOM element
Returns:
  service descriptor

### createServiceParam

public ServiceParam createServiceParam(ParamElement paramEl)
Parses a VOTable DOM element as a ServiceParam. The supplied PARAM element will normally be a child of a GROUP element with @name="inputParams".

Parameters:
  `paramEl` - PARAM element
Returns:
  serviceParam object