Breaks down the {@link Configuration} annotation into
the segments to look for configuration files

@param configuration annotation to use to find configuration files

@return List of InputStreams representing the configuration found
325512
protected List<ISource> locate(ConfigurationWrapper configuration) {
				
		if(configuration == null) {
			throw new IllegalArgumentException("A non-null Configuration annotation must be provided");
		}
		
		// create resolver from configuration annotation's resolver element
		ResolverWrapper resolverWrapper = configuration.resolver();
		PropertyResolver resolver = this.resolverFactory.createPropertyResolver(resolverWrapper);
		Map<Object,Object> bootstrapMap = this.resolverFactory.getBootstrapProperties(resolverWrapper);
		Map<Object,Object> defaultMap = this.resolverFactory.getDefaultProperties(resolverWrapper);
		
		// found sources
		List<ISource> foundSources = new ArrayList<ISource>(0);
		
		// create sources
		List<Source> sources = new ArrayList<Source>(Arrays.asList(configuration.sources()));
		
		// resolve sources as normal
		for(Source source : sources) {
			ISource found = this.resloveSource(source, resolver, bootstrapMap, defaultMap);
			if(found != null) {
				foundSources.add(found);
			}
		}
		
		// fix no sources found, a source SHOULD always be returned
		if(foundSources.isEmpty()) {
			foundSources.add(new UnfoundSource());
		}
		
		return foundSources;
	}
256803
@RequestMapping(value = "configurations", method = RequestMethod.GET)
    public Resources<StashConfiguration> getConfigurations() {
        return Resources.of(
                configurationService.getConfigurations(),
                uri(on(getClass()).getConfigurations())
        )
                .with(Link.CREATE, uri(on(getClass()).getConfigurationForm()))
                .with("_test", uri(on(getClass()).testConfiguration(null)), securityService.isGlobalFunctionGranted(GlobalSettings.class))
                ;
    }
788003
private static JCorsConfig loadFromFileStream(InputStream fileStream) {

		try {

			JAXBContext context = JAXBContext.newInstance(ConfigBuilder.class);
			
			Unmarshaller unmarshaller = context.createUnmarshaller();
			unmarshaller.setSchema(loadXmlSchema());

			ConfigBuilder configBuilder = (ConfigBuilder) unmarshaller.unmarshal(fileStream);
			Constraint.ensureNotNull(configBuilder, "It was not possible to get a valid configuration builder instance");

			return configBuilder.buildConfig();

		} catch (Exception e) {

			log.error("Failed loading configuration file", e);
			return null;
		}

	}
1216198
public ServiceCall<Configuration> getConfiguration(GetConfigurationOptions getConfigurationOptions) {
    Validator.notNull(getConfigurationOptions, "getConfigurationOptions cannot be null");
    String[] pathSegments = { "v1/environments", "configurations" };
    String[] pathParameters = { getConfigurationOptions.environmentId(), getConfigurationOptions.configurationId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    builder.query("version", versionDate);
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getConfiguration");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Configuration.class));
  }
881424
private void loadConfigurationFiles() {

        // Parse the first annotation found (manage overriding)
        final Configuration conf = ClassUtility.getLastClassAnnotation(this.getClass(), Configuration.class);

        // Conf variable cannot be null because it was defined in this class
        // It's possible to discard default behaviour by setting an empty string to the value.

        // launch the configuration search engine
        ResourceBuilders.PARAMETER_BUILDER.searchConfigurationFiles(conf.value(), conf.extension());

    }
84205
@RequestMapping(value = "configurations/descriptors", method = RequestMethod.GET)
    public Resources<ConfigurationDescriptor> getConfigurationsDescriptors() {
        return Resources.of(
                jenkinsService.getConfigurationDescriptors(),
                uri(on(getClass()).getConfigurationsDescriptors())
        );
    }
1299258
public static List<ExecutableElement> getSortedAnnotationMembers(TypeElement annotation) {
    List<ExecutableElement> members = Lists.newArrayList(getMethods(annotation));
    Collections.sort(members, (m1, m2) -> getName(m1).compareTo(getName(m2)));
    return members;
  }
967205
private List<Resource> getConfigurations() {
		List<Resource> result = new ArrayList<Resource>();
		for (String delimitedConfigurationUrl : configurationUrls) {
			String[] tokens = StringUtils.commaDelimitedListToStringArray(delimitedConfigurationUrl);
			tokens = StringUtils.trimArrayElements(tokens);
			for (String configurationUrl : tokens) {
				configurationUrl = configurationUrl.trim();
				Resource configuration = resourceLoader.getResource(configurationUrl);
				if (configuration != null && configuration.exists()) {
					result.add(configuration);
				} else if (ignoreConfigurationNotFound) {
					logger.debug("Ignore missing configuration file {}", configuration);
				} else {
					throw new EmbeddedJmxTransException("Configuration file " + configuration + " not found");
				}
			}
		}
		return result;
	}
840502
@SuppressWarnings("unchecked")
    public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
        return (List<T>) foundAnnotations.get(clazz);
    }
232681
@Nonnull
    public Configuration filter(Configuration config) {
        final Map<String, Object> values = Maps.newHashMap();

        for (final ConfigurationField field : fields.values()) {
            final String name = field.getName();
            final String type = field.getFieldType();
            switch (type) {
                case BooleanField.FIELD_TYPE:
                    if (config.booleanIsSet(name)) {
                        values.put(name, config.getBoolean(name));
                    }
                    break;
                case NumberField.FIELD_TYPE:
                    if (config.intIsSet(name)) {
                        values.put(name, config.getInt(name));
                    }
                    break;
                case TextField.FIELD_TYPE:
                case DropdownField.FIELD_TYPE:
                    if (config.stringIsSet(name)) {
                        values.put(name, config.getString(name));
                    }
                    break;
                default:
                    throw new IllegalStateException("Unknown field type " + type + " for configuration field \"" + name + "\". This is a bug.");
            }
        }
        return new Configuration(values);
    }
681240
public static ArrayList<ConfigSource> getDiscoveredSources(ClassLoader classloader) {
        ArrayList<ConfigSource> sources = new ArrayList<>();

        //load config sources using the service loader
        try {
            ServiceLoader<ConfigSource> sl = ServiceLoader.load(ConfigSource.class, classloader);
            for (ConfigSource source : sl) {
                sources.add(source);
            }
        } catch (ServiceConfigurationError e) {
            throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.sources.CWMCG0010E", e), e);
        }

        try {
            //load config source providers using the service loader
            ServiceLoader<ConfigSourceProvider> providerSL = ServiceLoader.load(ConfigSourceProvider.class, classloader);
            for (ConfigSourceProvider provider : providerSL) {
                for (ConfigSource source : provider.getConfigSources(classloader)) {
                    sources.add(source);
                }
            }
        } catch (ServiceConfigurationError e) {
            throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.source.providers.CWMCG0011E", e), e);
        }

        return sources;
    }
482746
private CodePluginConfig parsePluginConfig(InputStream inputStream) {
        Gson gson = new Gson();
        CodePluginConfig config = gson.fromJson(new InputStreamReader(inputStream), CodePluginConfig.class);
        logger.log(Level.INFO, "Loaded configuration " + config);
        return config;
    }
367137
protected ClassConfigData processClassConfiguration(final InputStream inputStream) throws IOException {
        if (introspectAnnotations == false) {
            return new ClassConfigData(inputStream);
        }

        ClassReader cr = new ClassReader(inputStream);
        ClassWriter cw = new ClassWriter(cr, 0); // Don't compute anything - read only mode
        TraceConfigClassVisitor cv = new TraceConfigClassVisitor(cw);
        cr.accept(cv, 0);
        ClassInfo classInfo = cv.getClassInfo();
        InputStream classInputStream = new ByteArrayInputStream(cw.toByteArray());

        return new ClassConfigData(classInputStream, classInfo);
    }
599417
public java.util.List<String> getConfigure() {
        if (configure == null) {
            configure = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return configure;
    }
325733
public final File getJasperCompilation(final Configuration configuration) {
        File jasperCompilation = new File(getWorking(configuration), "jasper-bin");
        createIfMissing(jasperCompilation, "Jasper Compilation");
        return jasperCompilation;
    }
39692
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) {
		List<String> keyValues = new ArrayList<String>();
		for (String key : configuration.keys()) {
			keyValues.add(key + "=\"" + configuration.getString(key) + "\"");
		}
		Collections.sort(keyValues);
		return keyValues;
	}
846895
public static Annotation getAnnotation(Annotation[] annotations, Class<?> annotationClass) {
        return Arrays.stream(annotations).filter(annotation -> annotation.annotationType().equals(annotationClass)).findFirst().orElse(null);
    }