public Builder addPropertySourceProviders(Collection<PropertySourceProvider> propertySourceProviders) { for (PropertySourceProvider ps : propertySourceProviders) { if (ps != null) { this.propertySources.addAll(ps.getPropertySources()); } } return this; }
public Builder addPropertySourceProviders(PropertySourceProvider... propertySourceProviders) { for (PropertySourceProvider ps : propertySourceProviders) { if (ps != null) { this.propertySources.addAll(ps.getPropertySources()); } } return this; }
/** * Pick up all {@link org.apache.tamaya.spi.PropertySourceProvider}s and return all the * {@link org.apache.tamaya.spi.PropertySource}s they like to register. */ private Collection<? extends PropertySource> evaluatePropertySourcesFromProviders() { List<PropertySource> propertySources = new ArrayList<>(); List<PropertySourceProvider> propertySourceProviders = ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class); for (PropertySourceProvider propertySourceProvider : propertySourceProviders) { Collection<PropertySource> sources = propertySourceProvider.getPropertySources(); LOG.finer("PropertySourceProvider " + propertySourceProvider.getClass().getName() + " provided the following property sources: " + sources); propertySources.addAll(sources); } return propertySources; }
private List<PropertySource> getAllPropertySources(Builder builder) { List<PropertySource> provided = new ArrayList<>(); if(builder.loadProvidedPropertySources) { provided.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class)); } for(PropertySource ps:builder.propertySources){ if(ps!=null){ provided.add(ps); } } if (builder.loadProvidedPropertySourceProviders) { List<PropertySourceProvider> providers = ServiceContextManager.getServiceContext() .getServices(PropertySourceProvider.class); for (PropertySourceProvider provider : providers) { for(PropertySource ps:provider.getPropertySources()) { if(ps!=null) { provided.addAll(provider.getPropertySources()); } } } } return provided; }
@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); }
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; }