1 | /*
|
---|
2 | * Copyright 2002-2005 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant.types;
|
---|
18 |
|
---|
19 | import java.net.URL;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * <p>Helper class to handle the <code><dtd></code> and
|
---|
23 | * <code><entity></code> nested elements. These correspond to
|
---|
24 | * the <code>PUBLIC</code> and <code>URI</code> catalog entry types,
|
---|
25 | * respectively, as defined in the <a
|
---|
26 | * href="http://oasis-open.org/committees/entity/spec-2001-08-06.html">
|
---|
27 | * OASIS "Open Catalog" standard</a>.</p>
|
---|
28 | *
|
---|
29 | * <p>Possible Future Enhancements:
|
---|
30 | * <ul>
|
---|
31 | * <li>Bring the Ant element names into conformance with the OASIS standard</li>
|
---|
32 | * <li>Add support for additional OASIS catalog entry types</li>
|
---|
33 | * </ul>
|
---|
34 | * </p>
|
---|
35 | *
|
---|
36 | * @see org.apache.xml.resolver.Catalog
|
---|
37 | * @since Ant 1.6
|
---|
38 | */
|
---|
39 | public class ResourceLocation {
|
---|
40 |
|
---|
41 | //-- Fields ----------------------------------------------------------------
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * name of the catalog entry type, as per OASIS spec.
|
---|
45 | */
|
---|
46 | private String name = null;
|
---|
47 |
|
---|
48 | /** publicId of the dtd/entity. */
|
---|
49 | private String publicId = null;
|
---|
50 |
|
---|
51 | /** location of the dtd/entity - a file/resource/URL. */
|
---|
52 | private String location = null;
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * base URL of the dtd/entity, or null. If null, the Ant project
|
---|
56 | * basedir is assumed. If the location specifies a relative
|
---|
57 | * URL/pathname, it is resolved using the base. The default base
|
---|
58 | * for an external catalog file is the directory in which it is
|
---|
59 | * located.
|
---|
60 | */
|
---|
61 | private URL base = null;
|
---|
62 |
|
---|
63 | //-- Methods ---------------------------------------------------------------
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * @param publicId uniquely identifies the resource.
|
---|
67 | */
|
---|
68 | public void setPublicId(String publicId) {
|
---|
69 | this.publicId = publicId;
|
---|
70 | }
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * @param location the location of the resource associated with the
|
---|
74 | * publicId.
|
---|
75 | */
|
---|
76 | public void setLocation(String location) {
|
---|
77 | this.location = location;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * @param base the base URL of the resource associated with the
|
---|
82 | * publicId. If the location specifies a relative URL/pathname,
|
---|
83 | * it is resolved using the base. The default base for an
|
---|
84 | * external catalog file is the directory in which it is located.
|
---|
85 | */
|
---|
86 | public void setBase(URL base) {
|
---|
87 | this.base = base;
|
---|
88 | }
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * @return the publicId of the resource.
|
---|
92 | */
|
---|
93 | public String getPublicId() {
|
---|
94 | return publicId;
|
---|
95 | }
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * @return the location of the resource identified by the publicId.
|
---|
99 | */
|
---|
100 | public String getLocation() {
|
---|
101 | return location;
|
---|
102 | }
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * @return the base of the resource identified by the publicId.
|
---|
106 | */
|
---|
107 | public URL getBase() {
|
---|
108 | return base;
|
---|
109 | }
|
---|
110 |
|
---|
111 | } //-- ResourceLocation
|
---|