You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/06/14 00:27:50 UTC
svn commit: r667679 -
/maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java
Author: jdcasey
Date: Fri Jun 13 15:27:50 2008
New Revision: 667679
URL: http://svn.apache.org/viewvc?rev=667679&view=rev
Log:
Adding a class that didn't get added initially for this branch.
Added:
maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java (with props)
Added: maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java
URL: http://svn.apache.org/viewvc/maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java?rev=667679&view=auto
==============================================================================
--- maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java (added)
+++ maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java Fri Jun 13 15:27:50 2008
@@ -0,0 +1,37 @@
+package org.apache.maven.project.interpolation;
+
+import org.apache.maven.project.path.PathTranslator;
+import org.codehaus.plexus.interpolation.AbstractFunctionValueSourceWrapper;
+import org.codehaus.plexus.interpolation.ValueSource;
+
+import java.io.File;
+import java.util.List;
+
+public class PathTranslatingValueSource
+ extends AbstractFunctionValueSourceWrapper
+{
+
+ private final List unprefixedPathKeys;
+ private final File projectDir;
+ private final PathTranslator pathTranslator;
+
+ protected PathTranslatingValueSource( ValueSource valueSource, List unprefixedPathKeys, File projectDir, PathTranslator pathTranslator )
+ {
+ super( valueSource );
+ this.unprefixedPathKeys = unprefixedPathKeys;
+ this.projectDir = projectDir;
+ this.pathTranslator = pathTranslator;
+ }
+
+ protected Object executeFunction( String expression,
+ Object value )
+ {
+ if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) )
+ {
+ return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir );
+ }
+
+ return value;
+ }
+
+}
Propchange: maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/john-2.0.x-plxInterpolation/maven-project/src/main/java/org/apache/maven/project/interpolation/PathTranslatingValueSource.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"