Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 156   Methods: 6
NCLOC: 27   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ResourceLocation.java - 100% 100% 100%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2002 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 package org.apache.tools.ant.types;
 55   
 
 56   
 import java.net.URL;
 57   
 
 58   
 /**
 59   
  * <p>Helper class to handle the <code>&lt;dtd&gt;</code> and
 60   
  * <code>&lt;entity&gt;</code> nested elements.  These correspond to
 61   
  * the <code>PUBLIC</code> and <code>URI</code> catalog entry types,
 62   
  * respectively, as defined in the <a
 63   
  * href="http://oasis-open.org/committees/entity/spec-2001-08-06.html">
 64   
  * OASIS "Open Catalog" standard</a>.</p>
 65   
  *
 66   
  * <p>Possible Future Enhancements:
 67   
  * <ul>
 68   
  * <li>Bring the Ant element names into conformance with the OASIS standard</li>
 69   
  * <li>Add support for additional OASIS catalog entry types</li>
 70   
  * </ul>
 71   
  * </p>
 72   
  *
 73   
  * @see org.apache.xml.resolver.Catalog
 74   
  * @author Conor MacNeill
 75   
  * @author dIon Gillard
 76   
  * @author <a href="mailto:cstrong@arielpartners.com">Craeg Strong</a>
 77   
  * @version $Id: ResourceLocation.java,v 1.4 2003/02/10 14:14:31 bodewig Exp $
 78   
  * @since Ant 1.6
 79   
  */
 80   
 
 81   
 import java.net.URL;
 82   
 
 83   
 public class ResourceLocation {
 84   
 
 85   
     //-- Fields ----------------------------------------------------------------
 86   
 
 87   
     /** 
 88   
      * name of the catalog entry type, as per OASIS spec.
 89   
      */
 90   
     protected String name = null;
 91   
 
 92   
     /** publicId of the dtd/entity. */
 93   
     private String publicId = null;
 94   
 
 95   
     /** location of the dtd/entity - a file/resource/URL. */
 96   
     private String location = null;
 97   
 
 98   
     /** 
 99   
      * base URL of the dtd/entity, or null. If null, the Ant project
 100   
      * basedir is assumed.  If the location specifies a relative
 101   
      * URL/pathname, it is resolved using the base.  The default base
 102   
      * for an external catalog file is the directory in which it is
 103   
      * located.
 104   
      */
 105   
     private URL base = null;
 106   
 
 107   
     //-- Methods ---------------------------------------------------------------
 108   
 
 109   
     /**
 110   
      * @param publicId uniquely identifies the resource.
 111   
      */
 112  32
     public void setPublicId(String publicId) {
 113  32
         this.publicId = publicId;
 114   
     }
 115   
 
 116   
     /**
 117   
      * @param location the location of the resource associated with the
 118   
      *      publicId.
 119   
      */
 120  32
     public void setLocation(String location) {
 121  32
         this.location = location;
 122   
     }
 123   
 
 124   
     /**
 125   
      * @param base the base URL of the resource associated with the
 126   
      * publicId.  If the location specifies a relative URL/pathname,
 127   
      * it is resolved using the base.  The default base for an
 128   
      * external catalog file is the directory in which it is located.
 129   
      */
 130  5
     public void setBase(URL base) {
 131  5
         this.base = base;
 132   
     }
 133   
 
 134   
     /**
 135   
      * @return the publicId of the resource.
 136   
      */
 137  46
     public String getPublicId() {
 138  46
         return publicId;
 139   
     }
 140   
 
 141   
     /**
 142   
      * @return the location of the resource identified by the publicId.
 143   
      */
 144  52
     public String getLocation() {
 145  52
         return location;
 146   
     }
 147   
 
 148   
     /**
 149   
      * @return the base of the resource identified by the publicId.
 150   
      */
 151  21
     public URL getBase() {
 152  21
         return base;
 153   
     }
 154   
 
 155   
 } //-- ResourceLocation
 156