21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package javax.xml.catalog; 26 27 28 /** 29 * The Catalog Manager manages the creation of XML Catalogs and Catalog Resolvers. 30 * 31 * @since 9 32 */ 33 public final class CatalogManager { 34 /** 35 * Creating CatalogManager instance is not allowed. 36 */ 37 private CatalogManager() { 38 } 39 40 /** 41 * Creates a Catalog object using the specified feature settings and path to 42 * a catalog file. If the features is null, the default features will be used. 43 * If the path is empty, System property {@code javax.xml.catalog.files} will 44 * be read to locate the initial list of catalog files. 45 * <p> 46 * If more than one catalog files are specified through the path argument or 47 * {@code javax.xml.catalog.files} property, the first entry is considered 48 * the main catalog, while others are treated as alternative catalogs after 49 * those referenced by the {@code nextCatalog} elements in the main catalog. 50 * 51 * @param features the catalog features 52 * @param path path(s) to one or more catalogs. 53 * 54 * @return a catalog instance 55 * @throws CatalogException If no catalog can be found whether through the 56 * specified path or the System property {@code javax.xml.catalog.files}, or 57 * an error occurs while parsing the catalog 58 */ 59 public static Catalog catalog(CatalogFeatures features, String... path) { 60 return new CatalogImpl(features, path); 61 } 62 63 /** 64 * Creates an instance of a CatalogResolver using the specified catalog. 65 * 66 * @param catalog the catalog instance 67 * @return an instance of a CatalogResolver 68 */ 69 public static CatalogResolver catalogResolver(Catalog catalog) { 70 if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null); 71 return new CatalogResolverImpl(catalog); 72 } 73 74 /** 75 * Creates an instance of a CatalogUriResolver using the specified catalog. 76 * 77 * @param catalog the catalog instance 78 * @return an instance of a CatalogResolver 79 */ 80 public static CatalogUriResolver catalogUriResolver(Catalog catalog) { 81 if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null); 82 return new CatalogUriResolverImpl(catalog); 83 } 84 85 /** 86 * Creates an instance of a CatalogResolver using the specified feature settings 87 * and path to a catalog file. If the features is null, the default features will 88 * be used. If the path is empty, System property {@code javax.xml.catalog.files} 89 * will be read to locate the initial list of catalog files. 90 * <p> 91 * If more than one catalog files are specified through the path argument or 92 * {@code javax.xml.catalog.files} property, the first entry is considered 93 * the main catalog, while others are treated as alternative catalogs after 94 * those referenced by the {@code nextCatalog} elements in the main catalog. 95 * 96 * @param features the catalog features 97 * @param path the path(s) to one or more catalogs 98 * 99 * @return an instance of a CatalogResolver 100 * @throws CatalogException If no catalog can be found whether through the 101 * specified path or the System property {@code javax.xml.catalog.files}, or 102 * an error occurs while parsing the catalog 103 */ 104 public static CatalogResolver catalogResolver(CatalogFeatures features, String... path) { 105 Catalog catalog = catalog(features, path); 106 return new CatalogResolverImpl(catalog); 107 } 108 109 /** 110 * Creates an instance of a CatalogUriResolver using the specified feature settings 111 * and path to a catalog file. If the features is null, the default features will 112 * be used. If the path is empty, System property {@code javax.xml.catalog.files} 113 * will be read to locate the initial list of catalog files. 114 * <p> 115 * If more than one catalog files are specified through the path argument or 116 * {@code javax.xml.catalog.files} property, the first entry is considered 117 * the main catalog, while others are treated as alternative catalogs after 118 * those referenced by the {@code nextCatalog} elements in the main catalog. 119 * 120 * @param features the catalog features 121 * @param path the path(s) to one or more catalogs 122 * 123 * @return an instance of a CatalogResolver 124 * @throws CatalogException If no catalog can be found whether through the 125 * specified path or the System property {@code javax.xml.catalog.files}, or 126 * an error occurs while parsing the catalog 127 */ 128 public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... path) { 129 Catalog catalog = catalog(features, path); 130 return new CatalogUriResolverImpl(catalog); 131 } 132 } | 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package javax.xml.catalog; 26 27 28 /** 29 * The Catalog Manager manages the creation of XML Catalogs and Catalog Resolvers. 30 * 31 * @since 9 32 */ 33 public final class CatalogManager { 34 /** 35 * Creating CatalogManager instance is not allowed. 36 */ 37 private CatalogManager() { 38 } 39 40 /** 41 * Creates a {@code Catalog} object using the specified feature settings and 42 * path to one or more catalog files. 43 * <p> 44 * If {@code paths} is empty, system property {@code javax.xml.catalog.files} 45 * will be read to locate the initial list of catalog files. 46 * <p> 47 * If more than one catalog files are specified through the paths argument or 48 * {@code javax.xml.catalog.files} property, the first entry is considered 49 * the main catalog, while others are treated as alternative catalogs after 50 * those referenced by the {@code nextCatalog} elements in the main catalog. 51 * <p> 52 * As specified in 53 * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail"> 54 * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored. 55 * No error will be reported. In case all entries are invalid, the resolver 56 * will return as no mapping is found. 57 * 58 * @param features the catalog features 59 * @param paths path(s) to one or more catalogs. 60 * 61 * @return an instance of a {@code Catalog} 62 * @throws CatalogException If an error occurs while parsing the catalog 63 */ 64 public static Catalog catalog(CatalogFeatures features, String... paths) { 65 return new CatalogImpl(features, paths); 66 } 67 68 /** 69 * Creates an instance of a {@code CatalogResolver} using the specified catalog. 70 * 71 * @param catalog the catalog instance 72 * @return an instance of a {@code CatalogResolver} 73 */ 74 public static CatalogResolver catalogResolver(Catalog catalog) { 75 if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null); 76 return new CatalogResolverImpl(catalog); 77 } 78 79 /** 80 * Creates an instance of a {@code CatalogUriResolver} using the specified catalog. 81 * 82 * @param catalog the catalog instance 83 * @return an instance of a {@code CatalogResolver} 84 */ 85 public static CatalogUriResolver catalogUriResolver(Catalog catalog) { 86 if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null); 87 return new CatalogUriResolverImpl(catalog); 88 } 89 90 /** 91 * Creates an instance of a {@code CatalogResolver} using the specified feature 92 * settings and path to one or more catalog files. 93 * <p> 94 * If {@code paths} is empty, system property {@code javax.xml.catalog.files} 95 * will be read to locate the initial list of catalog files. 96 * <p> 97 * If more than one catalog files are specified through the paths argument or 98 * {@code javax.xml.catalog.files} property, the first entry is considered 99 * the main catalog, while others are treated as alternative catalogs after 100 * those referenced by the {@code nextCatalog} elements in the main catalog. 101 * <p> 102 * As specified in 103 * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail"> 104 * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored. 105 * No error will be reported. In case all entries are invalid, the resolver 106 * will return as no mapping is found. 107 * 108 * @param features the catalog features 109 * @param paths the path(s) to one or more catalogs 110 * 111 * @return an instance of a {@code CatalogResolver} 112 * @throws CatalogException If an error occurs while parsing the catalog 113 */ 114 public static CatalogResolver catalogResolver(CatalogFeatures features, String... paths) { 115 Catalog catalog = catalog(features, paths); 116 return new CatalogResolverImpl(catalog); 117 } 118 119 /** 120 * Creates an instance of a {@code CatalogUriResolver} using the specified 121 * feature settings and path to one or more catalog files. 122 * <p> 123 * If {@code paths} is empty, system property {@code javax.xml.catalog.files} 124 * will be read to locate the initial list of catalog files. 125 * <p> 126 * If more than one catalog files are specified through the paths argument or 127 * {@code javax.xml.catalog.files} property, the first entry is considered 128 * the main catalog, while others are treated as alternative catalogs after 129 * those referenced by the {@code nextCatalog} elements in the main catalog. 130 * <p> 131 * As specified in 132 * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail"> 133 * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored. 134 * No error will be reported. In case all entries are invalid, the resolver 135 * will return as no mapping is found. 136 * 137 * @param features the catalog features 138 * @param paths the path(s) to one or more catalogs 139 * 140 * @return an instance of a {@code CatalogUriResolver} 141 * @throws CatalogException If an error occurs while parsing the catalog 142 */ 143 public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... paths) { 144 Catalog catalog = catalog(features, paths); 145 return new CatalogUriResolverImpl(catalog); 146 } 147 } |