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