| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.lib; |
| 9 | |
| 10 | import net.sf.saxon.expr.XPathContext; |
| 11 | import net.sf.saxon.trans.XPathException; |
| 12 | |
| 13 | /** |
| 14 | * An instance of CollectionFinder can be registered with the Saxon configuration; it is called in response |
| 15 | * to calls on the fn:collection() and fn:uri-collection() functions. |
| 16 | * |
| 17 | * When these functions are called, the {@link #findCollection(XPathContext, String)} method is |
| 18 | * called to get a {@link ResourceCollection} object representing the collection of resources identified by |
| 19 | * the supplied collection URI. |
| 20 | * |
| 21 | * @since 9.7: Supersedes URICollectionResolver. |
| 22 | * The interface was changed to return Resource objects, to allow streamed |
| 23 | * processing of the documents in a collection; and to pass a properties object that |
| 24 | * can be used to indicate whether the collection is stable (that is, repeated requests |
| 25 | * return the same result) |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | public interface CollectionFinder { |
| 30 | |
| 31 | /** |
| 32 | * Locate the collection of resources corresponding to a collection URI. |
| 33 | * @param context The XPath dynamic evaluation context |
| 34 | * @param collectionURI The collection URI: an absolute URI, formed by resolving the argument |
| 35 | * supplied to the fn:collection or fn:uri-collection against the static |
| 36 | * base URI |
| 37 | * @return a ResourceCollection object representing the resources in the collection identified |
| 38 | * by this collection URI. Result should not be null. |
| 39 | * @throws XPathException if the collection was not found |
| 40 | */ |
| 41 | |
| 42 | ResourceCollection findCollection(XPathContext context, String collectionURI) throws XPathException; |
| 43 | |
| 44 | } |