/** * Resolves the given property string either from system properties or given * properties. and returns the replacement of the property found in available * properties. If no string replacement is found then {@link IllegalArgumentException} * would be thrown based on <code>ignoreUnresolvedProperties</code> flag being set by * {@link CacheXmlParser}. * * @param replaceString * @return resolvedString */ public String resolveReplaceString(String replaceString) { String replacement = null; //Get System property first. replacement = System.getProperty(replaceString); //Override system property if replacement is null or we want to override system property. if((replacement == null || getPropertyOverridden() == SYSTEM_PROPERTIES_OVERRIDE) && props != null){ String userDefined = props.getProperty(replaceString); if(userDefined != null){ replacement = userDefined; } } return replacement; }
public String processUnresolvableString(String stringWithPrefixAndSuffix) { return processUnresolvableString(stringWithPrefixAndSuffix, null, null); } }
resolver = new CacheXmlPropertyResolver(false, PropertyResolver.NO_SYSTEM_PROPERTIES_OVERRIDE, userProps); } else { resolver = new CacheXmlPropertyResolver(false, PropertyResolver.NO_SYSTEM_PROPERTIES_OVERRIDE, null);
/** * @param stringWithPrefixAndSuffix * @param prefix * @param suffix * @return string */ public String processUnresolvableString(String stringWithPrefixAndSuffix, String prefix, String suffix){ String resolvedString = null; try{ if (helper == null){ helper = new CacheXmlPropertyResolverHelper(prefix, suffix); } /** A <code>resolvedString</code> can be same as <code>stringWithPrefixAndSuffix</code> if * <code>ignoreUnresolvedProperties</code> is set true and we just return it as is. */ resolvedString = helper.parseResolvablePropString(stringWithPrefixAndSuffix, this, new HashSet<String>()); } catch (IllegalArgumentException e) { if(ignoreUnresolvedProperties) { //Do Nothing } else { if(getLogWriter() != null) { logWriter.error(LocalizedStrings.CacheXmlPropertyResolver_UNSEROLVAVLE_STRING_FORMAT_ERROR__0, stringWithPrefixAndSuffix); } else { throw e; } } } return resolvedString; }
resolver = new CacheXmlPropertyResolver(false, PropertyResolver.NO_SYSTEM_PROPERTIES_OVERRIDE, userProps); } else { resolver = new CacheXmlPropertyResolver(false, PropertyResolver.NO_SYSTEM_PROPERTIES_OVERRIDE, null);
public String processUnresolvableString(String stringWithPrefixAndSuffix) { return processUnresolvableString(stringWithPrefixAndSuffix, null, null); } }
/** * Resolves the given property string either from system properties or given * properties. and returns the replacement of the property found in available * properties. If no string replacement is found then {@link IllegalArgumentException} * would be thrown based on <code>ignoreUnresolvedProperties</code> flag being set by * {@link CacheXmlParser}. * * @param replaceString * @return resolvedString */ public String resolveReplaceString(String replaceString) { String replacement = null; //Get System property first. replacement = System.getProperty(replaceString); //Override system property if replacement is null or we want to override system property. if((replacement == null || getPropertyOverridden() == SYSTEM_PROPERTIES_OVERRIDE) && props != null){ String userDefined = props.getProperty(replaceString); if(userDefined != null){ replacement = userDefined; } } return replacement; }