| 1 | |
package org.apache.maven.shared.io.location; |
| 2 | |
|
| 3 | |
import java.io.File; |
| 4 | |
|
| 5 | |
import org.apache.maven.shared.io.logging.MessageHolder; |
| 6 | |
|
| 7 | 3 | public class FileLocatorStrategy |
| 8 | |
implements LocatorStrategy |
| 9 | |
{ |
| 10 | |
|
| 11 | |
public Location resolve( String locationSpecification, MessageHolder messageHolder ) |
| 12 | |
{ |
| 13 | 2 | File file = new File( locationSpecification ); |
| 14 | |
|
| 15 | 2 | Location location = null; |
| 16 | |
|
| 17 | 2 | if ( file.exists() ) |
| 18 | |
{ |
| 19 | 1 | location = new FileLocation( file, locationSpecification ); |
| 20 | |
} |
| 21 | |
else |
| 22 | |
{ |
| 23 | 1 | messageHolder.addMessage( "File: " + file.getAbsolutePath() + " does not exist." ); |
| 24 | |
} |
| 25 | |
|
| 26 | 2 | return location; |
| 27 | |
} |
| 28 | |
|
| 29 | |
} |