org.apache.maven.model.building
Class FileModelSource

java.lang.Object
  extended by org.apache.maven.model.building.FileModelSource
All Implemented Interfaces:
ModelSource, ModelSource2

public class FileModelSource
extends Object
implements ModelSource2

Wraps an ordinary File as a model source.

Author:
Benjamin Bentmann

Constructor Summary
FileModelSource(File pomFile)
          Creates a new model source backed by the specified file.
 
Method Summary
 InputStream getInputStream()
          Gets a byte stream to the POM contents.
 String getLocation()
          Provides a user-friendly hint about the location of the POM.
 URI getLocationURI()
          Returns location of the POM, never null.
 File getPomFile()
          Gets the POM file of this model source.
 ModelSource2 getRelatedSource(String relPath)
          Returns model source identified by a path relative to this model source POM.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileModelSource

public FileModelSource(File pomFile)
Creates a new model source backed by the specified file.

Parameters:
pomFile - The POM file, must not be null.
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from interface: ModelSource
Gets a byte stream to the POM contents. Closing the returned stream is the responsibility of the caller.

Specified by:
getInputStream in interface ModelSource
Returns:
A byte stream to the POM contents, never null.
Throws:
IOException

getLocation

public String getLocation()
Description copied from interface: ModelSource
Provides a user-friendly hint about the location of the POM. This could be a local file path, a URI or just an empty string. The intention is to assist users during error reporting.

Specified by:
getLocation in interface ModelSource
Returns:
A user-friendly hint about the location of the POM, never null.

getPomFile

public File getPomFile()
Gets the POM file of this model source.

Returns:
The underlying POM file, never null.

toString

public String toString()
Overrides:
toString in class Object

getRelatedSource

public ModelSource2 getRelatedSource(String relPath)
Description copied from interface: ModelSource2
Returns model source identified by a path relative to this model source POM. Implementation MUST be able to accept relPath parameter values that

Specified by:
getRelatedSource in interface ModelSource2
Parameters:
relPath - is the path of the requested model source relative to this model source POM.
Returns:
related model source or null if no such model source.

getLocationURI

public URI getLocationURI()
Description copied from interface: ModelSource2
Returns location of the POM, never null.

Specified by:
getLocationURI in interface ModelSource2


Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.