Interface ResourceResolver

  • All Known Implementing Classes:
    CatalogResolver

    public interface ResourceResolver
    The resource resolver interface.

    On the one hand, the Resolver class in this API is a concrete class, not suitable for independent implementation. But on the other, it's widely used and can be instantiated from just its class name. (So it's handy as the name of a resolver class passed on the command line or in a configuration file.)

    Further complicating matters, there are conflicting interfaces for doing resolution. In particular, the XMLResolver and EntityResolver2 interfaces can't be implemented by the same class.

    This interface is an attempt to abstract away from the existing interfaces and expose something that could be implemented independently that provides enough functionality t implement all of the common resolver interfaces.

    • Method Detail

      • resolveURI

        ResolvedResource resolveURI​(java.lang.String href,
                                    java.lang.String baseURI)
        Resolve a URI.

        Attempts to resolve the specified href URI. If resolution fails, the href URI is not already absolute, and the baseURI is not null, the href value is made absolute against the baseURI and resolution is attempted with the resulting absolute URI.

        Parameters:
        href - The possibly relative URI to resolve.
        baseURI - The possibly null base URI to use if href is relative and not resolved.
        Returns:
        The resolved resource, or null if resolution fails.
      • resolveNamespace

        ResolvedResource resolveNamespace​(java.lang.String href,
                                          java.lang.String base,
                                          java.lang.String nature,
                                          java.lang.String purpose)
        Resolve a namespace URI.

        Attempts to resolve the specified href URI, optionally employing the baseURI as described in the resolveURI method. This method may take the namespace nature and purpose into consideration, for example by examining a RDDL document, if its returned.

        Parameters:
        href - The possibly relative URI to resolve.
        base - The possibly null base URI to use if href is relative and not resolved.
        nature - The possibly null nature URI.
        purpose - The possilby null purpose URI.
        Returns:
        The resolved resource, or null if resolution fails.
      • resolveEntity

        ResolvedResource resolveEntity​(java.lang.String name,
                                       java.lang.String publicId,
                                       java.lang.String systemId,
                                       java.lang.String baseURI)
        Resolve external identifiers and other entity-like resources.

        If the systemId is null and the baseURI is not, the systemId is taken to be the baseURI and the baseURI is treated as if it were null.

        If name, publicId and systemId are all null, null is returned.

        If systemId or publicId are not null, the method attempts to resolve an external identifier with the specified external identifier and the (possibly null) name and publicId. (Because public identifiers can be encoded in URNs, it's possible for this method to receive a publicId and not a systemId, even in XML systems.)

        If name is not null, but systemId is, name is assumed to be document type name and the method attempts to resolve an external identifier that matches. A doctype catalog entry, for example.

        If the systemId is relative, resolution fails, and baseURI is not null, the systemId is made absolute with respect to the baseURI and resolution is attempted a second time.

        Parameters:
        name - The possibly null entity (or document type) name.
        publicId - The possibly null public identifier.
        systemId - The possibly relative system identifier to resolve.
        baseURI - The possibly null base URI to use if systemId is relative and not resolved.
        Returns:
        The resolved resource, or null if resolution fails.
      • getConfiguration

        ResolverConfiguration getConfiguration()
        The resolver configuration.

        Returns the configuration of this resolver.

        Returns:
        The resolver configuration.