1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
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
68 * Builds a DOM forest and maintains association from
69 * system IDs to DOM trees.
70 *
71 * <p>
72 * A forest is a transitive reflexive closure of referenced documents.
73 * IOW, if a document is in a forest, all the documents referenced from
74 * it is in a forest, too. To support this semantics, {@link DOMForest}
75 * uses {@link InternalizationLogic} to find referenced documents.
76 *
77 * <p>
78 * Some documents are marked as "root"s, meaning those documents were
79 * put into a forest explicitly, not because it is referenced from another
80 * document. (However, a root document can be referenced from other
81 * documents, too.)
82 *
83 * @author
84 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
85 */
86 public final class DOMForest {
87 /** actual data storage {@code map<SystemId,Document>}. */
88 private final Map<String,Document> core = new HashMap<String,Document>();
89
90 /**
91 * To correctly feed documents to a schema parser, we need to remember
92 * which documents (of the forest) were given as the root
93 * documents, and which of them are read as included/imported
94 * documents.
95 *
96 * <p>
97 * Set of system ids as strings.
98 */
99 private final Set<String> rootDocuments = new LinkedHashSet<String>();
100
101 /** Stores location information for all the trees in this forest. */
102 public final LocatorTable locatorTable = new LocatorTable();
103
104 /** Stores all the outer-most {@code <jaxb:bindings>} customizations. */
105 public final Set<Element> outerMostBindings = new HashSet<Element>();
106
107 /** Used to resolve references to other schema documents. */
108 private EntityResolver entityResolver = null;
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
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
68 * Builds a DOM forest and maintains association from
69 * system IDs to DOM trees.
70 *
71 * <p>
72 * A forest is a transitive reflexive closure of referenced documents.
73 * IOW, if a document is in a forest, all the documents referenced from
74 * it is in a forest, too. To support this semantics, {@link DOMForest}
75 * uses {@link InternalizationLogic} to find referenced documents.
76 *
77 * <p>
78 * Some documents are marked as "root"s, meaning those documents were
79 * put into a forest explicitly, not because it is referenced from another
80 * document. (However, a root document can be referenced from other
81 * documents, too.)
82 *
83 * @author
84 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
85 */
86 public final class DOMForest {
87 /** actual data storage {@code map<SystemId,Document>}. */
88 private final Map<String,Document> core = new LinkedHashMap<>();
89
90 /**
91 * To correctly feed documents to a schema parser, we need to remember
92 * which documents (of the forest) were given as the root
93 * documents, and which of them are read as included/imported
94 * documents.
95 *
96 * <p>
97 * Set of system ids as strings.
98 */
99 private final Set<String> rootDocuments = new LinkedHashSet<String>();
100
101 /** Stores location information for all the trees in this forest. */
102 public final LocatorTable locatorTable = new LocatorTable();
103
104 /** Stores all the outer-most {@code <jaxb:bindings>} customizations. */
105 public final Set<Element> outerMostBindings = new HashSet<Element>();
106
107 /** Used to resolve references to other schema documents. */
108 private EntityResolver entityResolver = null;
|