Package org.codehaus.plexus.interpolation

Examples of org.codehaus.plexus.interpolation.RegexBasedInterpolator.interpolate()


            }
        } );

        try
        {
            serializedSettings = interpolator.interpolate( serializedSettings, "settings" );
        }
        catch ( InterpolationException e )
        {
            problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1,
                          e );
View Full Code Here


  @Test
  public void testInterpolation_withoutSource() throws Exception {
    String s = "Hello ${name}";
   
    Interpolator i = new RegexBasedInterpolator();
    Assert.assertEquals("Hello ${name}", i.interpolate(s));
  }
 
  @Test
  public void testInterpolation_withPropertiesSource() throws Exception {
    String s = "Hello ${name}";
View Full Code Here

    props.put("name", "World");
    ValueSource vs = new PropertiesBasedValueSource(props);
   
    Interpolator i = new RegexBasedInterpolator();
    i.addValueSource(vs);
    Assert.assertEquals("Hello World", i.interpolate(s));
  }
 
  @Test
  public void testInterpolation_withCustomValueSource() throws Exception {
    String s = "Hello ${name}";
View Full Code Here

      }
    };
   
    Interpolator i = new RegexBasedInterpolator();
    i.addValueSource(vs);
    Assert.assertEquals("Hello World", i.interpolate(s));
  }
}
View Full Code Here

            try
            {
                RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
                interpolator.addValueSource( new EnvarBasedValueSource() );

                rawInput = interpolator.interpolate( rawInput, "settings" );
            }
            catch ( Exception e )
            {
                log( "Failed to initialize environment variable resolver. Skipping environment substitution in "
                     + "settings." );
View Full Code Here

        interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) );

        try
        {
            path = interpolator.interpolate( path, "" );
        }
        catch ( Exception e )
        {
            problems.add( Severity.ERROR, "Failed to interpolate file location " + path + " for profile "
                + profile.getId() + ": " + e.getMessage(), file.getLocation( missing ? "missing" : "exists" ), e );
View Full Code Here

                try
                {
                    RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
                    interpolator.addValueSource( new EnvarBasedValueSource() );

                    rawInput = interpolator.interpolate( rawInput, "settings" );
                }
                catch ( Exception e )
                {
                    getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment "
                                          + "substitution in " + PROFILES_XML_FILE + "." );
View Full Code Here

            try
            {
                if ( StringUtils.isNotEmpty( fileString ) )
                {
                    fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
                    return FileUtils.fileExists( fileString );
                }

                // check if the file is missing, if it is then the profile will be active
                fileString = actFile.getMissing();
View Full Code Here

                // check if the file is missing, if it is then the profile will be active
                fileString = actFile.getMissing();

                if ( StringUtils.isNotEmpty( fileString ) )
                {
                    fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
                    return !FileUtils.fileExists( fileString );
                }
            }
            catch ( InterpolationException e )
            {
View Full Code Here

            }
        } );

        try
        {
            serializedSettings = interpolator.interpolate( serializedSettings, "settings" );
        }
        catch ( InterpolationException e )
        {
            problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1,
                          e );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.