KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > types > ResourceLocation


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.types;
19
20 import java.net.URL JavaDoc;
21
22 /**
23  * <p>Helper class to handle the <code>&lt;dtd&gt;</code> and
24  * <code>&lt;entity&gt;</code> nested elements. These correspond to
25  * the <code>PUBLIC</code> and <code>URI</code> catalog entry types,
26  * respectively, as defined in the <a
27  * HREF="http://oasis-open.org/committees/entity/spec-2001-08-06.html">
28  * OASIS "Open Catalog" standard</a>.</p>
29  *
30  * <p>Possible Future Enhancements:
31  * <ul>
32  * <li>Bring the Ant element names into conformance with the OASIS standard</li>
33  * <li>Add support for additional OASIS catalog entry types</li>
34  * </ul>
35  * </p>
36  *
37  * @see org.apache.xml.resolver.Catalog
38  * @since Ant 1.6
39  */

40 public class ResourceLocation {
41
42     //-- Fields ----------------------------------------------------------------
43
/** publicId of the dtd/entity. */
44     private String JavaDoc publicId = null;
45
46     /** location of the dtd/entity - a file/resource/URL. */
47     private String JavaDoc location = null;
48
49     /**
50      * base URL of the dtd/entity, or null. If null, the Ant project
51      * basedir is assumed. If the location specifies a relative
52      * URL/pathname, it is resolved using the base. The default base
53      * for an external catalog file is the directory in which it is
54      * located.
55      */

56     private URL JavaDoc base = null;
57
58     //-- Methods ---------------------------------------------------------------
59

60     /**
61      * @param publicId uniquely identifies the resource.
62      */

63     public void setPublicId(String JavaDoc publicId) {
64         this.publicId = publicId;
65     }
66
67     /**
68      * @param location the location of the resource associated with the
69      * publicId.
70      */

71     public void setLocation(String JavaDoc location) {
72         this.location = location;
73     }
74
75     /**
76      * @param base the base URL of the resource associated with the
77      * publicId. If the location specifies a relative URL/pathname,
78      * it is resolved using the base. The default base for an
79      * external catalog file is the directory in which it is located.
80      */

81     public void setBase(URL JavaDoc base) {
82         this.base = base;
83     }
84
85     /**
86      * @return the publicId of the resource.
87      */

88     public String JavaDoc getPublicId() {
89         return publicId;
90     }
91
92     /**
93      * @return the location of the resource identified by the publicId.
94      */

95     public String JavaDoc getLocation() {
96         return location;
97     }
98
99     /**
100      * @return the base of the resource identified by the publicId.
101      */

102     public URL JavaDoc getBase() {
103         return base;
104     }
105
106 } //-- ResourceLocation
107
Popular Tags