author | thartmann |
Fri, 24 Aug 2018 08:17:23 +0200 | |
changeset 51514 | 1e332d63bd96 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
33542 | 1 |
/* |
43121
e73af7b6ce47
8171243: CatalogManager.catalogResolver throws FileSystemNotFoundException with jar
joehw
parents:
33542
diff
changeset
|
2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
33542 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
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 |
import java.net.URI; |
|
28 |
import java.net.URISyntaxException; |
|
29 |
import java.net.URL; |
|
30 |
||
31 |
/** |
|
32 |
* Represents an alternative catalog entry. |
|
33 |
* |
|
34 |
* @since 9 |
|
35 |
*/ |
|
36 |
class AltCatalog extends BaseEntry { |
|
37 |
URI catalogURI; |
|
38 |
||
39 |
AltCatalog(CatalogEntryType type, String base) { |
|
40 |
super(type, base); |
|
41 |
} |
|
42 |
||
43 |
/** |
|
44 |
* Set the catalog attribute. If the value of the catalog attribute is relative, it |
|
45 |
* must be made absolute with respect to the base URI currently in effect. |
|
46 |
* |
|
47 |
* @param catalog The catalog attribute value. |
|
48 |
* @throws CatalogException if converting to catalog URI failed |
|
49 |
*/ |
|
50 |
void setCatalog(String catalog) { |
|
51 |
URL url = verifyURI("catalog", baseURI, catalog); |
|
52 |
try { |
|
53 |
catalogURI = url.toURI(); |
|
54 |
} catch (URISyntaxException ex) { |
|
55 |
CatalogMessages.reportRunTimeError(CatalogMessages.ERR_OTHER, ex); |
|
56 |
} |
|
57 |
||
58 |
} |
|
59 |
||
60 |
/** |
|
43121
e73af7b6ce47
8171243: CatalogManager.catalogResolver throws FileSystemNotFoundException with jar
joehw
parents:
33542
diff
changeset
|
61 |
* Returns the catalog attribute as a URI String. |
33542 | 62 |
* @return The value of the catalog attribute |
63 |
*/ |
|
64 |
String getCatalogId() { |
|
65 |
return catalogURI.toASCIIString(); |
|
66 |
} |
|
67 |
||
68 |
/** |
|
43121
e73af7b6ce47
8171243: CatalogManager.catalogResolver throws FileSystemNotFoundException with jar
joehw
parents:
33542
diff
changeset
|
69 |
* Returns the catalog attribute as a URI. |
33542 | 70 |
* @return The value of the catalog attribute |
71 |
*/ |
|
72 |
URI getCatalogURI() { |
|
73 |
return catalogURI; |
|
74 |
} |
|
75 |
||
76 |
/** |
|
77 |
* Matches the specified id with the entry. Returns the match if it |
|
78 |
* is successful and the length of the start String is longer than the |
|
79 |
* longest of any previous match. |
|
80 |
* |
|
81 |
* @param id The id to be matched. |
|
82 |
* @param currentMatch The length of start String of previous match if any. |
|
83 |
* @return The replacement URI if the match is successful, null if not. |
|
84 |
*/ |
|
85 |
public URI matchURI(String id, int currentMatch) { |
|
86 |
return null; |
|
87 |
} |
|
88 |
} |