001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018: package org.apache.tools.ant.types;
019:
020: import java.net.URL;
021:
022: /**
023: * <p>Helper class to handle the <code><dtd></code> and
024: * <code><entity></code> nested elements. These correspond to
025: * the <code>PUBLIC</code> and <code>URI</code> catalog entry types,
026: * respectively, as defined in the <a
027: * href="http://oasis-open.org/committees/entity/spec-2001-08-06.html">
028: * OASIS "Open Catalog" standard</a>.</p>
029: *
030: * <p>Possible Future Enhancements:
031: * <ul>
032: * <li>Bring the Ant element names into conformance with the OASIS standard</li>
033: * <li>Add support for additional OASIS catalog entry types</li>
034: * </ul>
035: * </p>
036: *
037: * @see org.apache.xml.resolver.Catalog
038: * @since Ant 1.6
039: */
040: public class ResourceLocation {
041:
042: //-- Fields ----------------------------------------------------------------
043: /** publicId of the dtd/entity. */
044: private String publicId = null;
045:
046: /** location of the dtd/entity - a file/resource/URL. */
047: private String location = null;
048:
049: /**
050: * base URL of the dtd/entity, or null. If null, the Ant project
051: * basedir is assumed. If the location specifies a relative
052: * URL/pathname, it is resolved using the base. The default base
053: * for an external catalog file is the directory in which it is
054: * located.
055: */
056: private URL base = null;
057:
058: //-- Methods ---------------------------------------------------------------
059:
060: /**
061: * @param publicId uniquely identifies the resource.
062: */
063: public void setPublicId(String publicId) {
064: this .publicId = publicId;
065: }
066:
067: /**
068: * @param location the location of the resource associated with the
069: * publicId.
070: */
071: public void setLocation(String location) {
072: this .location = location;
073: }
074:
075: /**
076: * @param base the base URL of the resource associated with the
077: * publicId. If the location specifies a relative URL/pathname,
078: * it is resolved using the base. The default base for an
079: * external catalog file is the directory in which it is located.
080: */
081: public void setBase(URL base) {
082: this .base = base;
083: }
084:
085: /**
086: * @return the publicId of the resource.
087: */
088: public String getPublicId() {
089: return publicId;
090: }
091:
092: /**
093: * @return the location of the resource identified by the publicId.
094: */
095: public String getLocation() {
096: return location;
097: }
098:
099: /**
100: * @return the base of the resource identified by the publicId.
101: */
102: public URL getBase() {
103: return base;
104: }
105:
106: } //-- ResourceLocation
|