protected Interpolator createInterpolator() { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.setCacheAnswers( true ); return interpolator; }
@Override protected Interpolator createInterpolator() { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.setCacheAnswers( true ); return interpolator; }
protected Interpolator createInterpolator() { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.setCacheAnswers( true ); return interpolator; }
if ( interpolatedModel.getParent() != null ) StringSearchInterpolator ssi = new StringSearchInterpolator(); ssi.addValueSource( new MapBasedValueSource( request.getUserProperties() ) );
@Override protected Interpolator createInterpolator() { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.setCacheAnswers( true ); return interpolator; }
private Map<String, String> resolve(final Map<String, String> source) { Map<String, String> result = Maps.newHashMapWithExpectedSize(source.size()); Interpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(source)); for (Entry<String, String> entry : source.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (value == null) { log.warn("Ignoring null property: {}", key); continue; } // skip unless value contains an expression if (value.contains(StringSearchInterpolator.DEFAULT_START_EXPR)) { try { value = interpolator.interpolate(value); log.trace("Resolved: {} -> '{}'", key, value); } catch (InterpolationException e) { log.warn("Failed to interpolate: {}, using original value: {}", key, value); } } result.put(key, value); } return result; } }
/** * Helper to interpolate given input. */ public static String interpolate(final String input) throws InterpolationException { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(tokens.get())); return interpolator.interpolate(input); }
public String resolve( final String value ) throws InterpolationException { if ( value == null || value.trim() .length() < 1 ) { return null; } if ( bootProps == null ) { if ( indyHome == null ) { return value; } else { bootProps = new Properties(); } } bootProps.setProperty( "indy.home", indyHome ); if ( interp == null ) { interp = new StringSearchInterpolator(); interp.addValueSource( new PropertiesBasedValueSource( bootProps ) ); } return interp.interpolate( value ); }
/** * Constructs a new {@link ModelInterpolator} object. * * @param properties * map supplying properties for interpolation. */ public ModelInterpolator(final Map<String, String> properties) { this.interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new PropertiesValueSource(properties)); interpolator.setCacheAnswers(true); }
protected final String resolve( final String value ) throws InterpolationException { if ( value == null || value.trim().length() < 1 ) { return null; } if ( bootProps == null ) { if ( homeDir == null ) { return value; } else { bootProps = new Properties(); } } bootProps.setProperty( getHomeSystemProperty(), homeDir ); if ( interp == null ) { interp = new StringSearchInterpolator(); interp.addValueSource( new PropertiesBasedValueSource( bootProps ) ); } return interp.interpolate( value ); }
@Nonnull private String interpolate(@Nonnull final String str) throws IOException, InterpolationException { Interpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(this.getProject().getProperties())); interpolator.addValueSource(new MapBasedValueSource(System.getProperties())); interpolator.addValueSource(new EnvarBasedValueSource()); return interpolator.interpolate(str); }
private StringSearchInterpolator getInterpolator() { final Properties props = new Properties(); props.setProperty( KeycloakConfig.KEYCLOAK_REALM, config.getRealm() ); props.setProperty( KeycloakConfig.KEYCLOAK_URL, config.getUrl() ); if ( config.getUiResource() != null ) { props.setProperty( KeycloakConfig.KEYCLOAK_UI_RESOURCE, config.getUiResource() ); } if ( config.getRealmPublicKey() != null ) { props.setProperty( KeycloakConfig.KEYCLOAK_REALM_PUBLIC_KEY, config.getRealmPublicKey() ); } final StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource( new PropertiesBasedValueSource( props ) ); return interpolator; }
private StringSearchInterpolator getInterpolator() { final Properties props = new Properties(); props.setProperty( KeycloakConfig.KEYCLOAK_REALM, config.getRealm() ); props.setProperty( KeycloakConfig.KEYCLOAK_URL, config.getUrl() ); if ( config.getUiResource() != null ) { props.setProperty( KeycloakConfig.KEYCLOAK_UI_RESOURCE, config.getUiResource() ); } if ( config.getRealmPublicKey() != null ) { props.setProperty( KeycloakConfig.KEYCLOAK_REALM_PUBLIC_KEY, config.getRealmPublicKey() ); } final StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource( new PropertiesBasedValueSource( props ) ); return interpolator; }
private void interpolate() throws Exception { Interpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(properties)); interpolator.addValueSource(new MapBasedValueSource(System.getProperties())); interpolator.addValueSource(new EnvarBasedValueSource()); for (Entry<String, String> entry : properties.entrySet()) { properties.put(entry.getKey(), interpolator.interpolate(entry.getValue())); } }
public Reader getReader( Reader reader ) { StringSearchInterpolator propertiesInterpolator = new StringSearchInterpolator( startExp, endExp ); propertiesInterpolator.addValueSource( valueSource ); propertiesInterpolator.setEscapeString( escapeString ); InterpolatorFilterReaderLineEnding interpolatorFilterReader = new InterpolatorFilterReaderLineEnding( reader, propertiesInterpolator, startExp, endExp, multiLineFiltering ); interpolatorFilterReader.setInterpolateWithPrefixPattern( false ); return interpolatorFilterReader; } } );
private void interpolate() throws Exception { Interpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(properties)); interpolator.addValueSource(new MapBasedValueSource(System.getProperties())); interpolator.addValueSource(new EnvarBasedValueSource()); for (Entry<String, String> entry : properties.entrySet()) { properties.put(entry.getKey(), interpolator.interpolate(entry.getValue())); } }
public static Interpolator createInterpolator(MavenProject project, MavenSession mavenSession) { StringSearchInterpolator interpolator = new StringSearchInterpolator(); final Properties props = new Properties(); props.putAll(project.getProperties()); props.putAll(mavenSession.getSystemProperties()); props.putAll(mavenSession.getUserProperties()); interpolator.addValueSource(new PropertiesBasedValueSource(props)); // add ${project.foo} interpolator.addValueSource(new PrefixedObjectValueSource(Arrays.asList("project", "pom"), project, true)); // add ${session.foo} interpolator.addValueSource(new PrefixedObjectValueSource("session", mavenSession)); // add ${settings.foo} final Settings settings = mavenSession.getSettings(); if (settings != null) { interpolator.addValueSource(new PrefixedObjectValueSource("settings", settings)); } return interpolator; }
public Reader getReader(Reader reader) { StringSearchInterpolator propertiesInterpolator = new StringSearchInterpolator(startExp, endExp); propertiesInterpolator.addValueSource(new MapBasedValueSource(values)); propertiesInterpolator.setEscapeString(escapeString); InterpolatorFilterReader interpolatorFilterReader = new InterpolatorFilterReader(reader, propertiesInterpolator, startExp, endExp); interpolatorFilterReader.setInterpolateWithPrefixPattern(false); return interpolatorFilterReader; } };
public void render(final PrintWriter out) { assert out != null; // // FIXME: Really need a little bit more of a help page language here to simplify the formatting of things // Interpolator interp = new StringSearchInterpolator("@{", "}"); interp.addValueSource(new PrefixedObjectValueSource("command.", new Helper())); interp.addValueSource(new PrefixedObjectValueSource("branding.", ShellHolder.get().getBranding())); interp.addValueSource(new AbstractValueSource(false) { public Object getValue(final String expression) { return ShellHolder.get().getVariables().get(expression); } }); interp.addValueSource(new PropertiesBasedValueSource(System.getProperties())); try { String text = loader.load(command.getClass().getName(), command.getClass().getClassLoader()); out.println(interp.interpolate(text)); } catch (Exception e) { throw new RuntimeException(e); } } }
public void render(final PrintWriter out) { assert out != null; Interpolator interp = new StringSearchInterpolator("@{", "}"); interp.addValueSource(new PrefixedObjectValueSource("command.", this)); interp.addValueSource(new PrefixedObjectValueSource("branding.", ShellHolder.get().getBranding())); interp.addValueSource(new AbstractValueSource(false) { public Object getValue(final String expression) { return ShellHolder.get().getVariables().get(expression); } }); interp.addValueSource(new PropertiesBasedValueSource(System.getProperties())); try { String text = loader.load(desc.getResource(), Thread.currentThread().getContextClassLoader()); out.println(interp.interpolate(text)); } catch (Exception e) { throw new RuntimeException(e); } } }