01: /******************************************************************
02: Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: ...
18: *****************************************************************/package org.jpox.jdo.metadata;
19:
20: import org.jpox.util.AbstractXMLEntityResolver;
21:
22: /**
23: * Implementation of an entity resolver for JDO metadata files.
24: * Handles JDO1, JDO2, JDO2 ORM, and JDO2 Query entity resolution.
25: *
26: * @version $Revision: 1.1 $
27: */
28: public class JDOEntityResolver extends AbstractXMLEntityResolver {
29: /** Public Key for JDO 1.0 */
30: private static final String PUBLIC_ID_KEY_JDO_1_0 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN";
31:
32: /** Public Key for JDO 2.0 */
33: private static final String PUBLIC_ID_KEY_JDO_2_0 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN";
34:
35: /** Public Key for JDO 2.1 */
36: private static final String PUBLIC_ID_KEY_JDO_2_1 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.1//EN";
37:
38: /** Public Key for ORM 2.0 */
39: private static final String PUBLIC_ID_KEY_ORM_2_0 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Mapping Metadata 2.0//EN";
40:
41: /** Public Key for ORM 2.1 */
42: private static final String PUBLIC_ID_KEY_ORM_2_1 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Mapping Metadata 2.1//EN";
43:
44: /** Public Key for JDOQUERY 2.0 */
45: private static final String PUBLIC_ID_KEY_JDOQUERY_2_0 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Query Metadata 2.0//EN";
46:
47: /** Public Key for JDOQUERY 2.1 */
48: private static final String PUBLIC_ID_KEY_JDOQUERY_2_1 = "-//Sun Microsystems, Inc.//DTD Java Data Objects Query Metadata 2.1//EN";
49:
50: public JDOEntityResolver() {
51: // Add definitions for internally supported URLs
52: publicIdEntities.put(PUBLIC_ID_KEY_JDO_1_0,
53: "/org/jpox/jdo/jdo_1_0.dtd");
54: publicIdEntities.put(PUBLIC_ID_KEY_JDO_2_0,
55: "/org/jpox/jdo/jdo_2_0.dtd");
56: publicIdEntities.put(PUBLIC_ID_KEY_JDO_2_1,
57: "/org/jpox/jdo/jdo_2_0.dtd"); // No JDO 2.1 DTD
58: publicIdEntities.put(PUBLIC_ID_KEY_ORM_2_0,
59: "/org/jpox/jdo/jdo_orm_2_0.dtd");
60: publicIdEntities.put(PUBLIC_ID_KEY_ORM_2_1,
61: "/org/jpox/jdo/jdo_orm_2_0.dtd"); // No JDO 2.1 DTD
62: publicIdEntities.put(PUBLIC_ID_KEY_JDOQUERY_2_0,
63: "/org/jpox/jdo/jdoquery_2_0.dtd");
64: publicIdEntities.put(PUBLIC_ID_KEY_JDOQUERY_2_1,
65: "/org/jpox/jdo/jdoquery_2_0.dtd"); // No JDO 2.1 DTD
66:
67: systemIdEntities.put(PUBLIC_ID_KEY_JDO_1_0,
68: "/org/jpox/jdo/jdo_1_0.dtd");
69: systemIdEntities.put(PUBLIC_ID_KEY_JDO_2_0,
70: "/org/jpox/jdo/jdo_2_0.dtd");
71: systemIdEntities.put(PUBLIC_ID_KEY_JDO_2_1,
72: "/org/jpox/jdo/jdo_2_0.dtd"); // No JDO 2.1 DTD
73: systemIdEntities.put("file:/javax/jdo/jdo.dtd",
74: "/org/jpox/jdo/jdo_2_0.dtd");
75: systemIdEntities.put("file:/javax/jdo/orm.dtd",
76: "/org/jpox/jdo/jdo_orm_2_0.dtd");
77: systemIdEntities.put("file:/javax/jdo/jdoquery.dtd",
78: "/org/jpox/jdo/jdoquery_2_0.dtd");
79: systemIdEntities.put(
80: "http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd",
81: "/org/jpox/jdo/jdo_2_0.xsd");
82: systemIdEntities.put(
83: "http://java.sun.com/xml/ns/jdo/jdo_2_1.xsd",
84: "/org/jpox/jdo/jdo_2_1.xsd");
85: systemIdEntities.put(
86: "http://java.sun.com/xml/ns/jdo/orm_2_0.xsd",
87: "/org/jpox/jdo/jdo_orm_2_0.xsd");
88: systemIdEntities.put(
89: "http://java.sun.com/xml/ns/jdo/orm_2_1.xsd",
90: "/org/jpox/jdo/jdo_orm_2_1.xsd");
91: systemIdEntities.put(
92: "http://java.sun.com/xml/ns/jdo/jdoquery_2_0.xsd",
93: "/org/jpox/jdo/jdoquery_2_0.xsd");
94: systemIdEntities.put(
95: "http://java.sun.com/xml/ns/jdo/jdoquery_2_1.xsd",
96: "/org/jpox/jdo/jdoquery_2_1.xsd");
97: }
98: }
|