6
|
1 |
/*
|
26516
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3 |
* contributor license agreements. See the NOTICE file distributed with
|
|
4 |
* this work for additional information regarding copyright ownership.
|
|
5 |
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6 |
* (the "License"); you may not use this file except in compliance with
|
|
7 |
* the License. You may obtain a copy of the License at
|
6
|
8 |
*
|
|
9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10 |
*
|
|
11 |
* Unless required by applicable law or agreed to in writing, software
|
|
12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14 |
* See the License for the specific language governing permissions and
|
|
15 |
* limitations under the License.
|
|
16 |
*/
|
|
17 |
|
|
18 |
package com.sun.org.apache.xml.internal.resolver.readers;
|
|
19 |
|
|
20 |
import java.io.IOException;
|
|
21 |
import java.net.MalformedURLException;
|
|
22 |
import com.sun.org.apache.xml.internal.resolver.CatalogException;
|
|
23 |
|
|
24 |
import java.io.InputStream;
|
|
25 |
import com.sun.org.apache.xml.internal.resolver.Catalog;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* The CatalogReader interface.
|
|
29 |
*
|
|
30 |
* <p>The Catalog class requires that classes implement this interface
|
|
31 |
* in order to be used to read catalogs. Examples of CatalogReaders
|
|
32 |
* include the TextCatalogReader, the SAXCatalogReader, and the
|
|
33 |
* DOMCatalogReader.</p>
|
|
34 |
*
|
|
35 |
* @see Catalog
|
|
36 |
*
|
|
37 |
* @author Norman Walsh
|
|
38 |
* <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
|
|
39 |
*
|
|
40 |
*/
|
|
41 |
public interface CatalogReader {
|
|
42 |
/**
|
|
43 |
* Read a catalog from a file.
|
|
44 |
*
|
|
45 |
* <p>This class reads a catalog from a URL.</p>
|
|
46 |
*
|
|
47 |
* @param catalog The catalog for which this reader is called.
|
|
48 |
* @param fileUrl The URL of a document to be read.
|
|
49 |
* @throws MalformedURLException if the specified URL cannot be
|
|
50 |
* turned into a URL object.
|
|
51 |
* @throws IOException if the URL cannot be read.
|
|
52 |
* @throws UnknownCatalogFormatException if the catalog format is
|
|
53 |
* not recognized.
|
|
54 |
* @throws UnparseableCatalogException if the catalog cannot be parsed.
|
|
55 |
* (For example, if it is supposed to be XML and isn't well-formed.)
|
|
56 |
*/
|
|
57 |
public void readCatalog(Catalog catalog, String fileUrl)
|
|
58 |
throws MalformedURLException, IOException, CatalogException;
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Read a catalog from an input stream.
|
|
62 |
*
|
|
63 |
* <p>This class reads a catalog from an input stream.</p>
|
|
64 |
*
|
|
65 |
* @param catalog The catalog for which this reader is called.
|
|
66 |
* @param is The input stream that is to be read.
|
|
67 |
* @throws IOException if the URL cannot be read.
|
|
68 |
* @throws UnknownCatalogFormatException if the catalog format is
|
|
69 |
* not recognized.
|
|
70 |
* @throws UnparseableCatalogException if the catalog cannot be parsed.
|
|
71 |
* (For example, if it is supposed to be XML and isn't well-formed.)
|
|
72 |
*/
|
|
73 |
public void readCatalog(Catalog catalog, InputStream is)
|
|
74 |
throws IOException, CatalogException;
|
|
75 |
}
|