public String run() { return StringPropertyReplacer.replaceProperties(input); } });
public String run() { return StringPropertyReplacer.replaceProperties(input); } });
public void setInvokerURL(String invokerURL) { // Replace any system properties in the URL String tmp = StringPropertyReplacer.replaceProperties(invokerURL); this.invokerURL = tmp; log.debug("Set invokerURL to "+this.invokerURL); }
/** * Go through the input string and replace any occurance of ${p} with * the System.getProperty(p) value. If there is no such property p defined, * then the ${p} reference will remain unchanged. * * If the property reference is of the form ${p:v} and there is no such property p, * then the default value v will be returned. * * If the property reference is of the form ${p1,p2} or ${p1,p2:v} then * the primary and the secondary properties will be tried in turn, before * returning either the unchanged input, or the default value. * * The property ${/} is replaced with System.getProperty("file.separator") * value and the property ${:} is replaced with System.getProperty("path.separator"). * * @param string - the string with possible ${} references * @return the input string with all property references replaced if any. * If there are no valid references the input string will be returned. */ public static String replaceProperties(final String string) { return replaceProperties(string, null); }
/** * Beside querying the element for its attribute value, it will look into the value, if any, and replace the * jboss properties(e.g. ${someValue:defaultValue}. * <p/> * {@link org.jboss.util.StringPropertyReplacer#replaceProperties(String)} */ protected String getAttributeValue(Element element, String attrName) { if (element == null || attrName == null) return null; String value = element.getAttribute(attrName); return value == null ? null : StringPropertyReplacer.replaceProperties(value); }
public void setInvokerURL(String invokerURL) { // Replace any system properties in the URL String tmp = StringPropertyReplacer.replaceProperties(invokerURL); this.invokerURL = tmp; log.debug("Set invokerURL to "+this.invokerURL); }
public void setScanPeriod(String ms) { if (ms != null) { //this.scanPeriod = ms; this.scanPeriod = Long.parseLong(StringPropertyReplacer.replaceProperties(ms)); } else { this.scanPeriod = 300000L; } }
public void setUserPluginDir(String dir) { if (dir == null) { return; } //this.userPluginDir = dir; this.userPluginDir = new File(StringPropertyReplacer.replaceProperties(dir)); }
/** * If running inside JBoss, it replace any occurrence of ${p} with the System.getProperty(p) value. * If there is no such property p defined, then the ${p} reference will remain unchanged. * If the property reference is of the form ${p:v} and there is no such property p, then * the default value v will be returned. If the property reference is of the form ${p1,p2} * or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before * returning either the unchanged input, or the default value. The property ${/} is replaced * with System.getProperty("file.separator") value and the property ${:} is replaced with * System.getProperty("path.separator"). * * @param str the input string that substitution will be performed upon. * @param props the properties to be used instead of System.getProerty() * @return the output string that had been replaced */ static public String replaceWithProperties(final String str, final Properties props){ String result = null; switch (IMPL_TYPE){ case JBOSS_IMPL: result = StringPropertyReplacer.replaceProperties(str, props); break; default: result = str; } return result; }
protected String getValue(String name, String value) { if (value.startsWith("${") && value.endsWith("}")) { String replacement = StringPropertyReplacer.replaceProperties(value); if (replacement != null) value = replacement; } return value; } }
protected String getValue(String name, String value) { if (value.startsWith("${") && value.endsWith("}")) { String replacement = StringPropertyReplacer.replaceProperties(value); if (replacement != null) value = replacement; } return value; }
protected String getValue(String name, String value) { if (value.startsWith("${") && value.endsWith("}")) { String replacement = StringPropertyReplacer.replaceProperties(value); if (replacement != null) value = replacement; } return value; }
private String replaceProperties(String str) { if (str == null) { return null; } // keep replacing properties until no more ${} tokens are left that are replaceable String newValue = ""; String oldValue = str; while (!newValue.equals(oldValue)) { oldValue = str; newValue = StringPropertyReplacer.replaceProperties(str); str = newValue; } return newValue; } }
public ControlFlag getControlFlag(String flag) { ControlFlag controlFlag = null; if(flag != null) { flag = StringPropertyReplacer.replaceProperties(flag.trim()); controlFlag = this.controlFlags.get(flag.toUpperCase()); } if (controlFlag == null) controlFlag = ControlFlag.REQUIRED; return controlFlag; }
protected String getValue(String name, String value) { if (value.startsWith("${") && value.endsWith("}")) { String replacement = StringPropertyReplacer.replaceProperties(value); if (replacement != null) value = replacement; } return value; } }
private File getDistributionFileBitsLocalFilesystemFile(String distLabel, String fileName) { String filesystem = System.getProperty(FILESYSTEM_PROPERTY); if (filesystem == null) { throw new IllegalStateException("Server is misconfigured - missing system property '" + FILESYSTEM_PROPERTY + "'. Don't know where distribution bits are stored."); } // allow the configuration to use ${} system property replacement strings filesystem = StringPropertyReplacer.replaceProperties(filesystem); String loc = "dists/" + distLabel; File parentDir = new File(filesystem, loc); File distBitsFile = new File(parentDir, fileName); return distBitsFile; }
public void setValue(ModuleOption option, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if ("module-option".equals(localName)) { String valueWithReplacement = StringPropertyReplacer.replaceProperties(value.trim()); option.setValue(valueWithReplacement); if (trace) log.trace("setValue.ModuleOption, name: " + localName + ":valueWithReplacement:" + valueWithReplacement); } }
/** * Parse an object name from the given element attribute 'name'. * * @param mbeanElement the element to parse name from. * @return the ObjectName * @throws Exception for any error */ private ObjectName parseObjectName(final Element mbeanElement, boolean replace) throws Exception { String name = mbeanElement.getAttribute("name"); if (name == null || name.trim().length() == 0) throw new RuntimeException("Missing or empty 'name' attribute for mbean."); if (replace) name = StringPropertyReplacer.replaceProperties(name); return new ObjectName(name); }
/** * Parse an object name from the given element attribute 'name'. * * @param mbeanElement the element to parse name from. * @return the ObjectName * @throws Exception for any error */ private ObjectName parseObjectName(final Element mbeanElement, boolean replace) throws Exception { String name = mbeanElement.getAttribute("name"); if (name == null || name.trim().length() == 0) throw new RuntimeException("Missing or empty 'name' attribute for mbean."); if (replace) name = StringPropertyReplacer.replaceProperties(name); return new ObjectName(name); }
public void setServerPluginDir(String dir) { if (dir == null) { return; } //this.serverPluginScanner.setServerPluginDir(dir); this.serverPluginScanner.setServerPluginDir(new File(StringPropertyReplacer.replaceProperties(dir))); }