org.openxml.source
Interface HolderFinder


public abstract interface HolderFinder

Interface for holder finder mechanism. Used for finding suitable holders for document sources, and for registering new holder factories.

Given a document source, the finder will attempt to locate a holder most suitable for retrieving, caching and otherwise presenting that source. The finder will query any number of registered holder factories, until a factory capable of retrieving the source document will create and return a document holder.

Precedence is given to the last registered factory, so application defined factories will override the default implementation factories. The implementation will likely offer holder factories for network and file system sources. Some factories may implement mapping from public identifiers or remapping of URIs.

Version:
$Revision: 1.1 $ $Date: 1999/02/20 02:19:00 $
Author:
Assaf Arkin
See Also:
Source, Holder, HolderFactory, XCatalog

Method Summary
 Holder findHolder(Source source)
          Finds and returns an holder for the url.
 Holder findHolder(Source source, boolean refresh)
          Finds and returns an holder for the url.
 void registerFactory(HolderFactory factory)
          Registers a new holder factory which is capable of producing holders for specific protocols or storage locations.
 void useCatalog(java.lang.String uri)
          Use the specified XCatalog document as a catalog for mapping public identifiers to system identifiers and for remapping system identifiers.
 

Method Detail

useCatalog

public void useCatalog(java.lang.String uri)
Use the specified XCatalog document as a catalog for mapping public identifiers to system identifiers and for remapping system identifiers. uri should be an accessible XCatalog document conforming to the XCatalog DTD.
Parameters:
uri - The XCatalog document URI

registerFactory

public void registerFactory(HolderFactory factory)
Registers a new holder factory which is capable of producing holders for specific protocols or storage locations. The factories are queried in the reverse order in which they were registered, giving precedence to factories registered by the application.
Parameters:
factory - The factory to register

findHolder

public Holder findHolder(Source source)
Finds and returns an holder for the url. The url is interpreted based on the installed holder factories and a suitable holder object is returned. Factories are queried in the reverse order in which they were registered, thus, the generic URL holder factory is the last to be queried. If the source could not be found or accessed, null is returned.

This method is equivalent to calling findHolder(Source,boolean) with refresh = false.

Parameters:
source - The document source
Returns:
A new holder, or null

findHolder

public Holder findHolder(Source source,
                         boolean refresh)
Finds and returns an holder for the url. The url is interpreted based on the installed holder factories and a suitable holder object is returned. Factories are queried in the reverse order in which they were registered, thus, the generic URL holder factory is the last to be queried.If the source could not be found or accessed, null is returned.

refresh is true if the source must be reloaded and not obtain from the cache. If refresh is false, the source is only loaded it it cannot be cached, or if it has been modified since it was cached.

Parameters:
source - The document source
refresh - True if source must be reloaded
Returns:
A new holder, or null