private static ConfigurationProviderSpi spi() { ConfigurationProviderSpi spi = ServiceContextManager.getServiceContext() .getService(ConfigurationProviderSpi.class); if(spi==null){ throw new IllegalStateException("ConfigurationProviderSpi not available."); } LOG.info("TAMAYA Loaded ConfigurationProviderSpi: " + spi.getClass().getName()); return spi; }
/** * Get all currently available formats, ordered by priority. * * @return the currently available formats, never null. */ public static List<ConfigurationFormat> getFormats() { return ServiceContextManager.getServiceContext().getServices(ConfigurationFormat.class); }
private static ConfigurationProviderSpi loadSpi() { ConfigurationProviderSpi spi = ServiceContextManager.getServiceContext() .getService(ConfigurationProviderSpi.class); if(spi==null){ throw new IllegalStateException("ConfigurationProviderSpi not available."); } return spi; }
@Override public ConfigurationContextBuilder getConfigurationContextBuilder() { ConfigurationContextBuilder contextBuilder = ServiceContextManager.getServiceContext().getService(ConfigurationContextBuilder.class); return contextBuilder; }
/** * Get the current injector instance. * * @return the current injector, not null. */ public static ConfigurationInjector getConfigurationInjector() { return ServiceContextManager.getServiceContext().getService(ConfigurationInjector.class); } }
@Override public Collection<ExpressionResolver> getResolvers() { List<ExpressionResolver> resolvers = new ArrayList<>(); for (ExpressionResolver resolver : ServiceContextManager.getServiceContext().getServices(ExpressionResolver.class)) { resolvers.add(resolver); } Collections.sort(resolvers, RESOLVER_COMPARATOR); return resolvers; }
private List<PropertyFilter> getPropertyFilters(Builder builder) { List<PropertyFilter> provided = new ArrayList<>(); if(builder.loadProvidedPropertyFilters) { provided.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)); } for(PropertyFilter pf:builder.propertyFilters) { if (pf != null) { provided.add(pf); } } return provided; }
/** * Get the validations defined. * * @return the sections defined, never null. */ public static Collection<ConfigModel> getModels() { List<ConfigModel> result = new ArrayList<>(); for (ModelProviderSpi model : ServiceContextManager.getServiceContext().getServices(ModelProviderSpi.class)) { result.addAll(model.getConfigModels()); } return result; }
/** * Loads the properties using the JDK's Property loading mechanism. * @param path the resource classpath, not null. * @return the loaded properties. */ private static Map<String, String> loadProps(String path, ClassLoader cl) { if(cl==null){ cl = PropertiesResourcePropertySource.class.getClassLoader(); } URL url = ServiceContextManager.getServiceContext().getResource(path, cl); return loadProps(url); }
/** * The backing SPI. */ private static final ConfigEventManagerSpi spi(){ ConfigEventManagerSpi spi = ServiceContextManager.getServiceContext() .getService(ConfigEventManagerSpi.class); if(spi==null){ throw new ConfigException("No SPI registered for " + ConfigEventManager.class.getName()); } return spi; }
private final ExpressionEvaluator evaluator(){ ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class); if(evaluator==null){ throw new ConfigException("No ExpressionEvaluator registered."); } return evaluator; }
private static ExpressionEvaluator evaluator() { ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class); if(evaluator==null){ throw new ConfigException("No ExpressionEvaluator registered."); } return evaluator; }
/** * URIs used by this query instance to identify the backends to use for write operations. */ private static MutableConfigurationProviderSpi spi(){ MutableConfigurationProviderSpi spi = ServiceContextManager.getServiceContext().getService( MutableConfigurationProviderSpi.class) ; if(spi==null){ throw new ConfigException("Failed to initialize MutableConfigurationProviderSpi - " + "mutable configuration support."); } return spi; }
@Override public ConfigurationContextBuilder addDefaultPropertySources() { checkBuilderState(); List<PropertySource> propertySources = new ArrayList<>(); addCorePropertyResources(propertySources); propertySources.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class)); for(PropertySourceProvider provider: ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){ propertySources.addAll(provider.getPropertySources()); } Collections.sort(propertySources, PropertySourceComparator.getInstance()); return addPropertySources(propertySources); }
/** * Registers the default converters provided out of the box. */ protected void initConverters() { for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)) { Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0]; register(TypeLiteral.of(type), conv); } }
@Override public ConfigurationContextBuilder addDefaultPropertyFilters() { checkBuilderState(); for(PropertyFilter pf:ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)){ addPropertyFilters(pf); } return this; }
public DefaultConfigurationContextBuilder addDefaultPropertyFilters() { checkBuilderState(); for(PropertyFilter pf:ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)){ addPropertyFilters(pf); } return this; }
/** * Registers the default converters provided out of the box. */ protected void initConverters() { for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)) { Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0]; register(TypeLiteral.of(type), conv); } }
public DefaultConfigurationContextBuilder addDefaultPropertySources() { checkBuilderState(); for(PropertySource ps:ServiceContextManager.getServiceContext().getServices(PropertySource.class)){ addPropertySources(ps); } for(PropertySourceProvider pv:ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){ for(PropertySource ps:pv.getPropertySources()){ addPropertySources(ps); } } return this; }
/** * Registers the default converters provided out of the box. */ protected void initConverters() { for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)) { Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0]; register(TypeLiteral.of(type), conv); } }