org.ops4j.pax.runner.platform.internal
Class RelativeFilePathStrategy

java.lang.Object
  extended by org.ops4j.pax.runner.platform.internal.RelativeFilePathStrategy
All Implemented Interfaces:
FilePathStrategy

public class RelativeFilePathStrategy
extends java.lang.Object
implements FilePathStrategy

A relative FilePathStrategy that normalizes the paths relative to a base directory.

Since:
0.20.0, may 10, 2009
Author:
Alin Dreghiciu (adreghiciu@gmail.com)

Constructor Summary
RelativeFilePathStrategy(java.io.File baseDirectory)
          Constructor.
 
Method Summary
 java.lang.String normalizeAsPath(java.io.File file)
          Returns the file in relative form (compared to working directory)
 java.lang.String normalizeAsUrl(java.io.File file)
          Returns the file in relative form as url (compared to working directory)
 java.lang.String normalizeAsUrl(java.net.URL url)
          Returns the url in relative form as url (compared to working directory).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelativeFilePathStrategy

public RelativeFilePathStrategy(java.io.File baseDirectory)
Constructor.

Parameters:
baseDirectory - base directory that normalized paths are relative to (cannot be null)
Throws:
java.lang.IllegalArgumentException - - If baseDirectory is null
Method Detail

normalizeAsPath

public java.lang.String normalizeAsPath(java.io.File file)
Returns the file in relative form (compared to working directory)

Specified by:
normalizeAsPath in interface FilePathStrategy
Parameters:
file - file to normalize
Returns:
the file in relative form (compared to working directory)

normalizeAsUrl

public java.lang.String normalizeAsUrl(java.io.File file)
Returns the file in relative form as url (compared to working directory)

Specified by:
normalizeAsUrl in interface FilePathStrategy
Parameters:
file - file to normalize
Returns:
the file in relative form as url (compared to working directory)

normalizeAsUrl

public java.lang.String normalizeAsUrl(java.net.URL url)
Returns the url in relative form as url (compared to working directory). The normalization is done only in case that the url is a file url.

Specified by:
normalizeAsUrl in interface FilePathStrategy
Parameters:
url - url to normalize
Returns:
the url in relative form as url (compared to working directory)


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.