1. /*
  2. * Copyright 2002-2004 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. import java.net.URL;
  19. /**
  20. * <p>Helper class to handle the <code><dtd></code> and
  21. * <code><entity></code> nested elements. These correspond to
  22. * the <code>PUBLIC</code> and <code>URI</code> catalog entry types,
  23. * respectively, as defined in the <a
  24. * href="http://oasis-open.org/committees/entity/spec-2001-08-06.html">
  25. * OASIS "Open Catalog" standard</a>.</p>
  26. *
  27. * <p>Possible Future Enhancements:
  28. * <ul>
  29. * <li>Bring the Ant element names into conformance with the OASIS standard</li>
  30. * <li>Add support for additional OASIS catalog entry types</li>
  31. * </ul>
  32. * </p>
  33. *
  34. * @see org.apache.xml.resolver.Catalog
  35. * @version $Id: ResourceLocation.java,v 1.6.2.4 2004/03/09 17:01:55 peterreilly Exp $
  36. * @since Ant 1.6
  37. */
  38. public class ResourceLocation {
  39. //-- Fields ----------------------------------------------------------------
  40. /**
  41. * name of the catalog entry type, as per OASIS spec.
  42. */
  43. private String name = null;
  44. /** publicId of the dtd/entity. */
  45. private String publicId = null;
  46. /** location of the dtd/entity - a file/resource/URL. */
  47. private String location = null;
  48. /**
  49. * base URL of the dtd/entity, or null. If null, the Ant project
  50. * basedir is assumed. If the location specifies a relative
  51. * URL/pathname, it is resolved using the base. The default base
  52. * for an external catalog file is the directory in which it is
  53. * located.
  54. */
  55. private URL base = null;
  56. //-- Methods ---------------------------------------------------------------
  57. /**
  58. * @param publicId uniquely identifies the resource.
  59. */
  60. public void setPublicId(String publicId) {
  61. this.publicId = publicId;
  62. }
  63. /**
  64. * @param location the location of the resource associated with the
  65. * publicId.
  66. */
  67. public void setLocation(String location) {
  68. this.location = location;
  69. }
  70. /**
  71. * @param base the base URL of the resource associated with the
  72. * publicId. If the location specifies a relative URL/pathname,
  73. * it is resolved using the base. The default base for an
  74. * external catalog file is the directory in which it is located.
  75. */
  76. public void setBase(URL base) {
  77. this.base = base;
  78. }
  79. /**
  80. * @return the publicId of the resource.
  81. */
  82. public String getPublicId() {
  83. return publicId;
  84. }
  85. /**
  86. * @return the location of the resource identified by the publicId.
  87. */
  88. public String getLocation() {
  89. return location;
  90. }
  91. /**
  92. * @return the base of the resource identified by the publicId.
  93. */
  94. public URL getBase() {
  95. return base;
  96. }
  97. } //-- ResourceLocation