private static Map<String, String> getContextSettingsWithNameMatchingRegExpPattern(ConfiguredObject<?> object, Pattern pattern) { Map<String, String> targetMap = new HashMap<>(); for (String name : object.getContextKeys(false)) { if (pattern.matcher(name).matches()) { String contextValue = object.getContextValue(String.class, name); targetMap.put(name, contextValue); } } return targetMap; }
public static <T> T getContextValue(final ConfiguredObject<?> parent, final Class<T> paremeterClass, final String parameterName, final T defaultValue) { if (parent.getContextKeys(false).contains(parameterName)) { return parent.getContextValue(paremeterClass, parameterName); } else { return defaultValue; } }
public static <T> T getContextValue(final ConfiguredObject<?> parent, final Class<T> paremeterClass, final Type type, final String parameterName, final T defaultValue) { if (parent.getContextKeys(false).contains(parameterName)) { return parent.getContextValue(paremeterClass, type, parameterName); } else { return defaultValue; } } }
public static CacheMode getCacheMode(final ConfiguredObject<?> object) { if (object.getContextKeys(false).contains(EnvironmentFacade.CACHE_MODE_PROPERTY_NAME)) { try { return object.getContextValue(CacheMode.class, EnvironmentFacade.CACHE_MODE_PROPERTY_NAME); } catch (IllegalArgumentException iae) { LOGGER.warn("Failed to parse {} as {}", object.getContextValue(String.class, EnvironmentFacade.CACHE_MODE_PROPERTY_NAME), CacheMode.class, iae); } } return EnvironmentFacade.CACHE_MODE_DEFAULT; }
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); } } }
public static JDBCDetails getJdbcDetails(final String vendor, final ConfiguredObject<?> object) final Set<String> contextKeys = object.getContextKeys(false); Map<String,String> mapConversion = new AbstractMap<String, String>()
final Set<String> contextVariables = object.getContextKeys(false);
if(object.getContextKeys(false).contains(ENCRYPTER_KEY_FILE))
providerAttributeNames.retainAll(parent.getContextKeys(false)); for (String attr : providerAttributeNames)