Example usage for org.apache.commons.lang.text StrSubstitutor replace

List of usage examples for org.apache.commons.lang.text StrSubstitutor replace

Introduction

In this page you can find the example usage for org.apache.commons.lang.text StrSubstitutor replace.

Prototype

public String replace(Object source) 

Source Link

Document

Replaces all the occurrences of variables in the given source object with their matching values from the resolver.

Usage

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePt2Block() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(pt2Template);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePt3Block() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(pt3Template);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePt4Block() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(pt4Template);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePt5Block() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(pt5Template);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePt6Block() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(pt6Template);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePtCitationBlock() {
    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(citationTemplate);
}

From source file:edu.harvard.iq.dvn.ingest.dsb.impl.DvnReplicationREADMEFileWriter.java

public String generatePtSupportBlock() {
    String dvnGuidesUrl = "";
    String hostName = System.getProperty("dvn.inetAddress");
    dvnGuidesUrl = "http://" + hostName + "/guides";

    String datausersGuideUrl = dvnGuidesUrl + "/dataverse-user-main.html#finding-and-using-data";
    String tabdataGuideUrl = dvnGuidesUrl + "/dataverse-user-main.html#tabular-data";

    valueMap.put("datausersGuideUrl", datausersGuideUrl);
    valueMap.put("tabdataGuideUrl", tabdataGuideUrl);

    // TODO: -? //from  w w  w  .java 2 s  .c  o  m
    // These URLs, for the data guides, should probably be put on the map
    // in the code that normally calls this class to generate the README 
    // file, where the rest of valueMap is populated. -- L.A., v3.6

    StrSubstitutor sub = new StrSubstitutor(valueMap);
    return sub.replace(supportTemplate);
}

From source file:io.gatling.jenkins.targetenvgraphs.envgraphs.graphite.TrendGraphBuilder.java

protected String fillInTemplate(String template, Map<String, String> values) {
    if (values == null)
        return null;
    StrSubstitutor sub = new StrSubstitutor(values);
    return sub.replace(template);
}

From source file:com.datatorrent.lib.io.HdfsOutputOperator.java

private Path subFilePath(int index) {
    Map<String, String> params = new HashMap<String, String>();
    params.put(FNAME_SUB_PART_INDEX, String.valueOf(index));
    params.put(FNAME_SUB_CONTEXT_ID, Integer.toString(contextId));
    params.put(FNAME_SUB_OPERATOR_ID, this.getName());
    StrSubstitutor sub = new StrSubstitutor(params, "%(", ")");
    return new Path(sub.replace(filePath.toString()));
}

From source file:com.jaspersoft.jasperserver.war.amazon.client.AwsDataSourceServiceImpl.java

private void updateWithConnectionUrl(AwsDBInstanceDTO awsDBInstanceDTO) {
    for (String dbType : jdbcConnectionMap.keySet()) {
        if (awsDBInstanceDTO.getEngine().startsWith(dbType)) {
            Map<String, Object> dbProperties = jdbcConnectionMap.get(dbType);

            awsDBInstanceDTO.setJdbcTemplate((String) dbProperties.get(jdbcUrl));

            Map<String, String> values = new HashMap<String, String>();
            values.put("dbHost", awsDBInstanceDTO.getAddress());
            values.put("dbPort", String.valueOf(awsDBInstanceDTO.getPort()));
            values.put("dbName", awsDBInstanceDTO.getdBName());
            StrSubstitutor sub = new StrSubstitutor(values, "$[", "]");
            awsDBInstanceDTO.setJdbcUrl(sub.replace(dbProperties.get(jdbcUrl)));

            awsDBInstanceDTO.setJdbcDriverClass((String) dbProperties.get(jdbcDriverClass));
            break;
        }/*  w w  w .j  a  va  2  s  . c  o  m*/
    }
}