Coverage Report - org.apache.tapestry.IAsset
 
Classes in this File Line Coverage Branch Coverage Complexity
IAsset
N/A
N/A
1
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry;
 16  
 
 17  
 import java.io.InputStream;
 18  
 
 19  
 import org.apache.hivemind.ApplicationRuntimeException;
 20  
 import org.apache.hivemind.Locatable;
 21  
 import org.apache.hivemind.Resource;
 22  
 
 23  
 /**
 24  
  * Representation of a asset (GIF, JPEG, etc.) that may be owned by a {@link IComponent}.
 25  
  * <p>
 26  
  * Assets may be completely external (i.e., on some other web site), contained by the
 27  
  * {@link javax.servlet.ServletContext}, or stored somewhere in the classpath.
 28  
  * <p>
 29  
  * In the latter two cases, the resource may be localized.
 30  
  * 
 31  
  * @author Howard Lewis Ship
 32  
  */
 33  
 
 34  
 public interface IAsset extends Locatable
 35  
 {
 36  
     /**
 37  
      * Returns a URL for the asset, ready to be inserted into the output HTML. If the asset can be
 38  
      * localized, the localized version (matching the {@link java.util.Locale}of the current
 39  
      * {@link IPage page}) is returned.
 40  
      * 
 41  
      * @throws ApplicationRuntimeException
 42  
      *             if the asset does not exist.
 43  
      */
 44  
 
 45  
     String buildURL();
 46  
 
 47  
     /**
 48  
      * Accesses the localized version of the resource (if possible) and returns it as an input
 49  
      * stream. A version of the resource localized to the current {@link IPage page}is returned.
 50  
      * 
 51  
      * @throws ApplicationRuntimeException
 52  
      *             if the asset does not exist, or can't be read.
 53  
      */
 54  
 
 55  
     InputStream getResourceAsStream();
 56  
 
 57  
     /**
 58  
      * Returns the underlying location of the asset.
 59  
      */
 60  
 
 61  
     Resource getResourceLocation();
 62  
 }