Tabnine Logo
ConfigServiceImpl.replaceTokens
Code IndexAdd Tabnine to your IDE (free)

How to use
replaceTokens
method
in
com.oculusinfo.tile.rest.config.ConfigServiceImpl

Best Java code snippets using com.oculusinfo.tile.rest.config.ConfigServiceImpl.replaceTokens (Showing top 2 results out of 315)

origin: unchartedsoftware/aperture-tiles

@Override
public String replaceProperties(File configFile) throws ConfigException {
  try {
    LOGGER.info("Processing configFile {}", configFile);
    Map<String, String> replacements = buildReplacements();
    String configFileContent = new String(Files.readAllBytes(Paths.get(configFile.getPath())), StandardCharsets.UTF_8);
    // Do configuration file replacements
    String replacedContent = configFileContent;
    if (replacements != null) {
      replacedContent = replaceTokens(configFileContent, replacements, PROPERTIES_FILE_REPLACEMENT_REGEX, false);
    } else {
      LOGGER.warn("No config properties found, using file as is {}", configFile.getAbsolutePath());
    }
    // Do environment variable replacements
    // Replace undefined environment variables with empty string
    // (Windows doesn't allow you to set empty environment variables - it just deletes them)
    return replaceTokens(replacedContent, System.getenv(), ENV_VAR_REPLACEMENT_REGEX, true);
  } catch (IOException e) {
    throw new ConfigException(String.format("Unable to read config file %s", configFile), e);
  }
}
origin: unchartedsoftware/aperture-tiles

@Test
public void testReplaceTokens() {
  String text = "The ${some.animal} jumped over the ${some.object}";
  Map<String, String> replacements = new HashMap<>();
  replacements.put("some.animal", "cow");
  replacements.put("some.object", "moon");
  String replaced = _configService.replaceTokens(text, replacements, ConfigServiceImpl.PROPERTIES_FILE_REPLACEMENT_REGEX, false);
  assertEquals("The cow jumped over the moon", replaced);
}
com.oculusinfo.tile.rest.configConfigServiceImplreplaceTokens

Popular methods of ConfigServiceImpl

  • <init>
  • buildReplacements
  • findResourceConfig
  • replaceProperties

Popular in Java

  • Reading from database using SQL prepared statement
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • findViewById (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Join (org.hibernate.mapping)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now