@Override public Map getProperties() { return mgmt.getConfig().asMapWithStringKeys(); }
public String processTemplateContents(String templateContents, Map<String,? extends Object> extraSubstitutions) { Map<String, Object> config = getEntity().getApplication().getManagementContext().getConfig().asMapWithStringKeys(); Map<String, Object> substitutions = ImmutableMap.<String, Object>builder() .putAll(config) .put("entity", entity) .put("driver", this) .put("location", getLocation()) .putAll(extraSubstitutions) .build(); return TemplateProcessor.processTemplateContents(templateContents, substitutions); /* try { Configuration cfg = new Configuration(); StringTemplateLoader templateLoader = new StringTemplateLoader(); templateLoader.putTemplate("config", templateContents); cfg.setTemplateLoader(templateLoader); Template template = cfg.getTemplate("config"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(baos); template.process(substitutions, out); out.flush(); return new String(baos.toByteArray()); } catch (Exception e) { log.warn("Error creating configuration file for "+entity, e); throw Exceptions.propagate(e); } */ }
Map<String, String> subconfig = filterAndStripPrefix(config.asMapWithStringKeys(), DOWNLOAD_CONF_PREFIX);