org.apache.maven.project.interpolation
Class AbstractStringBasedModelInterpolator

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.project.interpolation.AbstractStringBasedModelInterpolator
All Implemented Interfaces:
ModelInterpolator, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Direct Known Subclasses:
RegexBasedModelInterpolator, StringSearchModelInterpolator

public abstract class AbstractStringBasedModelInterpolator
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements ModelInterpolator, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable

Use a regular expression search to find and resolve expressions within the POM.

Version:
$Id: AbstractStringBasedModelInterpolator.java 767323 2009-04-21 22:53:31Z jdcasey $
Author:
jdcasey Created on Feb 3, 2005

Field Summary
 
Fields inherited from interface org.apache.maven.project.interpolation.ModelInterpolator
BUILD_TIMESTAMP_FORMAT_PROPERTY, DEFAULT_BUILD_TIMESTAMP_FORMAT, ROLE
 
Constructor Summary
protected AbstractStringBasedModelInterpolator()
           
protected AbstractStringBasedModelInterpolator(PathTranslator pathTranslator)
           
 
Method Summary
protected abstract  org.codehaus.plexus.interpolation.Interpolator createInterpolator()
           
protected  List<org.codehaus.plexus.interpolation.InterpolationPostProcessor> createPostProcessors(Model model, File projectDir, ProjectBuilderConfiguration config)
           
protected  List<org.codehaus.plexus.interpolation.ValueSource> createValueSources(Model model, File projectDir, ProjectBuilderConfiguration config)
           
protected  org.codehaus.plexus.interpolation.Interpolator getInterpolator()
           
protected  org.codehaus.plexus.interpolation.RecursionInterceptor getRecursionInterceptor()
           
 void initialize()
           
 Model interpolate(Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled)
           
 Model interpolate(Model model, Map<String,?> context)
           
 Model interpolate(Model model, Map<String,?> context, boolean strict)
          Deprecated. Use ModelInterpolator.interpolate(Model, File, ProjectBuilderConfiguration, boolean) instead.
 String interpolate(String src, Model model, File projectDir, ProjectBuilderConfiguration config, boolean debug)
          Interpolates all expressions in the src parameter.
protected  String interpolateInternal(String src, List<org.codehaus.plexus.interpolation.ValueSource> valueSources, List<org.codehaus.plexus.interpolation.InterpolationPostProcessor> postProcessors, boolean debug)
           
protected  void setRecursionInterceptor(org.codehaus.plexus.interpolation.RecursionInterceptor recursionInterceptor)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStringBasedModelInterpolator

protected AbstractStringBasedModelInterpolator(PathTranslator pathTranslator)

AbstractStringBasedModelInterpolator

protected AbstractStringBasedModelInterpolator()
Throws:
IOException - This exception is not thrown any more, and needs to be removed.
Method Detail

interpolate

public Model interpolate(Model model,
                         Map<String,?> context)
                  throws ModelInterpolationException
Specified by:
interpolate in interface ModelInterpolator
Throws:
ModelInterpolationException

interpolate

public Model interpolate(Model model,
                         Map<String,?> context,
                         boolean strict)
                  throws ModelInterpolationException
Deprecated. Use ModelInterpolator.interpolate(Model, File, ProjectBuilderConfiguration, boolean) instead.

Serialize the inbound Model instance to a StringWriter, perform the regex replacement to resolve POM expressions, then re-parse into the resolved Model instance.
NOTE: This will result in a different instance of Model being returned!!!

Specified by:
interpolate in interface ModelInterpolator
Parameters:
model - The inbound Model instance, to serialize and reference for expression resolution
context - The other context map to be used during resolution
Returns:
The resolved instance of the inbound Model. This is a different instance!
Throws:
ModelInterpolationException

interpolate

public Model interpolate(Model model,
                         File projectDir,
                         ProjectBuilderConfiguration config,
                         boolean debugEnabled)
                  throws ModelInterpolationException
Specified by:
interpolate in interface ModelInterpolator
Throws:
ModelInterpolationException

interpolate

public String interpolate(String src,
                          Model model,
                          File projectDir,
                          ProjectBuilderConfiguration config,
                          boolean debug)
                   throws ModelInterpolationException
Interpolates all expressions in the src parameter.

The algorithm used for each expression is:


createValueSources

protected List<org.codehaus.plexus.interpolation.ValueSource> createValueSources(Model model,
                                                                                 File projectDir,
                                                                                 ProjectBuilderConfiguration config)

createPostProcessors

protected List<org.codehaus.plexus.interpolation.InterpolationPostProcessor> createPostProcessors(Model model,
                                                                                                  File projectDir,
                                                                                                  ProjectBuilderConfiguration config)

interpolateInternal

protected String interpolateInternal(String src,
                                     List<org.codehaus.plexus.interpolation.ValueSource> valueSources,
                                     List<org.codehaus.plexus.interpolation.InterpolationPostProcessor> postProcessors,
                                     boolean debug)
                              throws ModelInterpolationException
Throws:
ModelInterpolationException

getRecursionInterceptor

protected org.codehaus.plexus.interpolation.RecursionInterceptor getRecursionInterceptor()

setRecursionInterceptor

protected void setRecursionInterceptor(org.codehaus.plexus.interpolation.RecursionInterceptor recursionInterceptor)

createInterpolator

protected abstract org.codehaus.plexus.interpolation.Interpolator createInterpolator()

initialize

public void initialize()
                throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
Specified by:
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException

getInterpolator

protected final org.codehaus.plexus.interpolation.Interpolator getInterpolator()


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.