public static final String expand(String input) { return expand(input, SYSTEM_RESOLVER); }
public static final String expand(String input, Resolver resolver) { return expand(input, resolver, new Stack<String>(),true); } public static final String expand(String input, boolean failOnUnresolved, Resolver... resolvers)
public static final String expand(String input, boolean failOnUnresolved, Resolver... resolvers) { return expand(input, chain(resolvers), new Stack<String>(), failOnUnresolved); }
static String interpolate(Model model, String value) { return Strings.expand(value, false, JSON_SUBSTITUTION_RESOLVER, Strings.JAVA_SYS_PROPS_RESOLVER, Strings.ENV_VARS_RESOLVER, model.getTypeRegistry().getDefaultContextResolver()); }
private URI getUriForAddressSpace(URI uri, final NamedAddressSpace addressSpace) { try { String vhostName = URLEncoder.encode(addressSpace == null ? "" : addressSpace.getName(), UTF_8.name()); final Strings.MapResolver virtualhostResolver = new Strings.MapResolver(Collections.singletonMap("virtualhost", vhostName)); String substitutedURI = Strings.expand(uri.toString(), false, virtualhostResolver); uri = new URI(substitutedURI); } catch (UnsupportedEncodingException | URISyntaxException e) { LOGGER.error("Error when attempting to build URI from address space: ", e); } return uri; }
try return expand(result, resolver, stack, failOnUnresolved);
private void reportStatisticsForObject(final ConfiguredObject<?> object) { final String statisticsReportPatternContextKey = String.format("qpid.%s.statisticsReportPattern", object.getCategoryClass().getSimpleName().toLowerCase()); if (object.getContextKeys(false).contains(statisticsReportPatternContextKey)) { String reportPattern = object.getContextValue(String.class, statisticsReportPatternContextKey); String formattedStatistics = Strings.expand(reportPattern, false, new FormattingStatisticsResolver(object)); String loggerName = String.format("qpid.statistics.%s", object.getCategoryClass().getSimpleName()); Logger logger = LoggerFactory.getLogger(loggerName); logger.info("Statistics: {}", formattedStatistics); } } }
static String interpolate(ConfiguredObject<?> object, String value) { if(object == null) { return value; } else { Map<String, String> inheritedContext = new HashMap<String, String>(); generateInheritedContext(object.getModel(), object, inheritedContext); return Strings.expand(value, false, JSON_SUBSTITUTION_RESOLVER, getOwnAttributeResolver(object), getAncestorAttributeResolver(object), new Strings.MapResolver(inheritedContext), Strings.JAVA_SYS_PROPS_RESOLVER, Strings.ENV_VARS_RESOLVER, object.getModel().getTypeRegistry().getDefaultContextResolver()); } }