Coverage Report - org.codehaus.plexus.resource.ResourceManager
 
Classes in this File Line Coverage Branch Coverage Complexity
ResourceManager
N/A
N/A
1
 
 1  
 package org.codehaus.plexus.resource;
 2  
 
 3  
 /*
 4  
  * The MIT License
 5  
  *
 6  
  * Copyright (c) 2004, The Codehaus
 7  
  *
 8  
  * Permission is hereby granted, free of charge, to any person obtaining a copy of
 9  
  * this software and associated documentation files (the "Software"), to deal in
 10  
  * the Software without restriction, including without limitation the rights to
 11  
  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 12  
  * of the Software, and to permit persons to whom the Software is furnished to do
 13  
  * so, subject to the following conditions:
 14  
  *
 15  
  * The above copyright notice and this permission notice shall be included in all
 16  
  * copies or substantial portions of the Software.
 17  
  *
 18  
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 19  
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 20  
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 21  
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 22  
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 23  
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 24  
  * SOFTWARE.
 25  
  */
 26  
 
 27  
 import java.io.InputStream;
 28  
 import java.io.File;
 29  
 import java.io.IOException;
 30  
 
 31  
 import org.codehaus.plexus.resource.loader.ResourceNotFoundException;
 32  
 import org.codehaus.plexus.resource.loader.FileResourceCreationException;
 33  
 
 34  
 /**
 35  
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 36  
  * @author Jason van Zyl
 37  
  * @version $Id$
 38  
  */
 39  
 public interface ResourceManager
 40  
 {
 41  
     String ROLE = ResourceManager.class.getName();
 42  
 
 43  
     InputStream getResourceAsInputStream( String name )
 44  
         throws ResourceNotFoundException;
 45  
 
 46  
     File getResourceAsFile( String name )
 47  
         throws ResourceNotFoundException, FileResourceCreationException;
 48  
 
 49  
     File getResourceAsFile( String name, String outputFile )
 50  
         throws ResourceNotFoundException, FileResourceCreationException;
 51  
 
 52  
     void setOutputDirectory( File outputDirectory );
 53  
 
 54  
     void addSearchPath( String resourceLoaderId, String searchPath );
 55  
 
 56  
     /**
 57  
      * Provides compatibility with the Locator utility used by several Maven Plugins.
 58  
      * 
 59  
      * @deprecated
 60  
      */
 61  
     File resolveLocation( String location, String localfile )
 62  
         throws IOException;
 63  
 
 64  
     /**
 65  
      * Provides compatibility with the Locator utility used by several Maven Plugins.
 66  
      * 
 67  
      * @deprecated
 68  
      */
 69  
     File resolveLocation( String location )
 70  
         throws IOException;
 71  
 
 72  
     /**
 73  
      * Searches for a resource with the given name.
 74  
      * 
 75  
      * @since 1.0-alpha-5
 76  
      */
 77  
     PlexusResource getResource( String name )
 78  
         throws ResourceNotFoundException;
 79  
 
 80  
     /**
 81  
      * Returns a file with the given resources contents. If the resource is already available as a file, returns that
 82  
      * file. Otherwise, a file in the resource managers output directory is created and the resource is downloaded to
 83  
      * that file.
 84  
      * 
 85  
      * @since 1.0-alpha-5
 86  
      */
 87  
     File getResourceAsFile( PlexusResource resource )
 88  
         throws FileResourceCreationException;
 89  
 
 90  
     /**
 91  
      * Downloads the resource to the given output file.
 92  
      * 
 93  
      * @since 1.0-alpha-5
 94  
      */
 95  
     void createResourceAsFile( PlexusResource resource, File outputFile )
 96  
         throws FileResourceCreationException;
 97  
 }