Package uk.ac.starlink.util

# Class StarEntityResolver

java.lang.Object
uk.ac.starlink.util.StarEntityResolver

All Implemented Interfaces:
  `EntityResolver`

public class StarEntityResolver extends Object implements EntityResolver
Provides specialised XML entity resolution. This resolver knows about some entities which starjava applications are likely to want to retrieve; it keeps copies of them so that no network connection is required for them.

Use `getInstance()` to obtain an instance of this class without a parent.

Author:
  Mark Taylor (Starlink)

## Constructor Summary

Constructors
Constructor
Description
`StarEntityResolver(EntityResolver parent)`
Constructs a resolver which will resolve entities this class knows about, and for those it doesn't it will defer resolution to a supplied parent resolver.

## Method Summary

Modifier and Type
Method
Description
`static StarEntityResolver`
`getInstance()`
Returns the sole instance of this class.
`protected String`
`getLocalResource(String publicId, String systemId)`
Returns a resource name locating the entity referenced by a given public/system ID pair.
`InputSource`
`resolveEntity(String publicId, String systemId)`
Resolves an entity if it is one of the ones that we keep on hand.

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

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

## Constructor Details

### StarEntityResolver

public StarEntityResolver(EntityResolver parent)
Constructs a resolver which will resolve entities this class knows about, and for those it doesn't it will defer resolution to a supplied parent resolver.

Parameters:
  `parent` - fallback resolver (may be `null`)

## Method Details

### getInstance

public static StarEntityResolver getInstance()
Returns the sole instance of this class.

Returns:
  StarEntityResolver instance

### resolveEntity

public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
Resolves an entity if it is one of the ones that we keep on hand.

Specified by:
  `resolveEntity` in interface `EntityResolver`
Throws:
  `SAXException`
  `IOException`

### getLocalResource

protected String getLocalResource(String publicId, String systemId)
Returns a resource name locating the entity referenced by a given public/system ID pair. If there is a local copy of this entity, its path relative to this class is returned, otherwise `null` is returned.

Parameters:
  `publicId` - the entity's public ID
  `systemId` - the entity's system ID
Returns:
  path to the resource, or `null` if it is unknown