Inject the config properties into the object
@param o The object
@param configProperties The config properties
@param overrides The overrides
@param classLoader The class loader
@return The deployment data
@exception Throwable Thrown if an error occurs
324146
private Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty>
      injectConfigProperties(Object o,
                             Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties,
                             Map<String, String> overrides,
                             ClassLoader classLoader)
      throws Throwable
   {
      Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = null;
      if (configProperties != null && !configProperties.isEmpty())
      {
         Injection injector = new Injection();

         dcps = new ArrayList<org.ironjacamar.core.api.deploymentrepository.ConfigProperty>(configProperties.size());
         for (org.ironjacamar.common.api.metadata.spec.ConfigProperty cp : configProperties)
         {
            String name = cp.getConfigPropertyName().getValue();
            Class<?> type = Class.forName(cp.getConfigPropertyType().getValue(), true, classLoader);
            boolean readOnly = cp.getConfigPropertySupportsDynamicUpdates() != null ?
               cp.getConfigPropertySupportsDynamicUpdates().booleanValue() : true;
            boolean confidential = cp.getConfigPropertyConfidential() != null ?
               cp.getConfigPropertyConfidential().booleanValue() : false;
            boolean declared = true;

            Object value = cp.isValueSet() ? cp.getConfigPropertyValue().getValue() : null;
            if (overrides != null)
            {
               if (overrides.containsKey(cp.getConfigPropertyName().getValue()))
               {
                  value = overrides.get(cp.getConfigPropertyName().getValue());
               }
               else
               {
                  String alternative = cp.getConfigPropertyName().getValue().substring(0, 1).toUpperCase();
                  if (cp.getConfigPropertyName().getValue().length() > 1)
                     alternative += cp.getConfigPropertyName().getValue().substring(1);

                  if (overrides.containsKey(alternative))
                  {
                     value = overrides.get(alternative);
                  }
                  else
                  {
                     log.tracef("%s: Override for %s not found", o.getClass().getName(),
                                cp.getConfigPropertyName().getValue());
                  }
               }
            }

            if (value != null)
            {
               try
               {
                  injector.inject(o,
                                  cp.getConfigPropertyName().getValue(),
                                  value,
                                  cp.getConfigPropertyType().getValue());
               }
               catch (Throwable t)
               {
                  type = convertType(type);
                     
                  if (type != null)
                  {
                     injector.inject(o,
                                     cp.getConfigPropertyName().getValue(),
                                     value,
                                     type.getName());
                  }
                  else
                  {
                     throw new DeployException(bundle.unableToInject(o.getClass().getName(),
                           cp.getConfigPropertyName().getValue(),
                           value.toString()), t);
                  }
               }
            }

            dcps.add(new ConfigPropertyImpl(o, name, type,
                                            value, readOnly, confidential,
                                            declared));
         }
      }
      return dcps;
   }
580697
public static PropertiesLoader getPropertiesLoader() {
		synchronized (PropertiesLoader.class) {
			final ClassLoader classLoader = ConfigurableClassLoader.INSTANCE.getClassLoader();
			PropertiesLoader loader = clMap.get(classLoader);
			if (loader == null) {
				try {
					loader = new PropertiesLoader(MASTER_PLUGIN_FILE, EXTRA_PLUGIN_FILE);
					clMap.put(classLoader, loader);
				} catch (final IOException ex) {
					throw new RuntimeException(ex);
				}
			}
			return loader;
		}
	}
1274666
@Override
    public String getChangedProperties(WebAppSecurityConfig original) {
        // Bail out if it is the same object, or if this isn't of the right type.
        if (this == original) {
            return "";
        }
        if (!(original instanceof WebAppSecurityConfigImpl)) {
            return "";
        }

        StringBuffer buf = new StringBuffer();
        WebAppSecurityConfigImpl orig = (WebAppSecurityConfigImpl) original;

        for (Entry<String, String> entry : configAttributes.entrySet()) {
            try {
                Field field = (WebAppSecurityConfigImpl.class).getDeclaredField(entry.getValue());
                field.setAccessible(true);
                appendToBufferIfDifferent(buf, entry.getKey(), field.get(this), field.get(orig));
            } catch (Exception e) {
                // this won't happen. just ignore.
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Exception is caught " + e);
                }

            }
        }
        return buf.toString();
    }
531643
public ConfigParseOptions setClassLoader(ClassLoader loader) {
        if (this.classLoader == loader)
            return this;
        else
            return new ConfigParseOptions(this.syntax, this.originDescription, this.allowMissing,
                    this.includer, loader);
    }
248129
public static void modifySelfConfig(String configAbsoluteClassPath, Map<IConfigKey, String> modifyConfig)
            throws IOException {
        OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
        if (configs == null) {
            return;
        }
        configs.modifyConfig(modifyConfig);
    }
84892
private static ClusterConfig config(String[] resources, ClassLoader classLoader) {
    return new ConfigMapper(classLoader).loadResources(ClusterConfig.class, resources);
  }
1079216
public static List<RepositoryConfig> getRepositoryConfigs(Properties repoProperties) throws InstallException {
        List<String> orderList = getOrderList(repoProperties);
        List<RepositoryConfig> connections = new ArrayList<RepositoryConfig>(orderList.size());
        if (repoProperties == null || repoProperties.isEmpty()) {
            connections.add(new RepositoryConfig(WLP_REPO, null, null, null, null));
            return connections;
        }

        for (String r : orderList) {
            if (r.equalsIgnoreCase(WLP_REPO)) {
                connections.add(new RepositoryConfig(WLP_REPO, null, null, null, null));
                continue;
            }
            String url = repoProperties.getProperty(r + URL_SUFFIX);
            String user = null;
            String userPwd = null;
            if (url != null && !url.isEmpty()) {
                user = repoProperties.getProperty(r + USER_SUFFIX);
                if (user != null) {
                    if (user.isEmpty())
                        user = null;
                    else {
                        userPwd = repoProperties.getProperty(r + PWD_SUFFIX);
                        if (userPwd == null || userPwd.isEmpty()) {
                            userPwd = repoProperties.getProperty(r + USERPWD_SUFFIX);
                        }
                        if (userPwd != null && userPwd.isEmpty())
                            userPwd = null;
                    }
                }
                String apiKey = repoProperties.getProperty(r + APIKEY_SUFFIX);
                url = url.trim();
                if (!InstallUtils.isURL(url)) {
                    File f = new File(url);
                    try {
                        url = f.toURI().toURL().toString();
                    } catch (MalformedURLException e1) {
                        logger.log(Level.FINEST, "Failed to convert " + f.getAbsolutePath() + " to url format", e1);
                    }
                }
                connections.add(new RepositoryConfig(r, url, apiKey, user, userPwd));
            }
        }
        if (connections.isEmpty()) {
            throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_NO_REPO_WAS_ENABLED"));
        }
        return connections;
    }
495967
private void setupData(ValidationConfig config, ClassLoader classLoader) {
        // A config object is always used to use a common code path, so the parsed
        // ValidationConfig may be null if a validation.xml wasn't found.
        if (config != null) {
            versionID = config.getVersionID();

            defaultProvider = config.getDefaultProvider();
            defaultProvider = defaultProvider != null ? defaultProvider.trim() : defaultProvider;

            messageInterpolator = config.getMessageInterpolator();
            messageInterpolator = messageInterpolator != null ? messageInterpolator.trim() : messageInterpolator;

            traversableResolver = config.getTraversableResolver();
            traversableResolver = traversableResolver != null ? traversableResolver.trim() : traversableResolver;

            constraintMapping = config.getConstraintMappings();

            constraintValidatorFactory = config.getConstraintValidatorFactory();
            constraintValidatorFactory = constraintValidatorFactory != null ? constraintValidatorFactory.trim() : constraintValidatorFactory;

            properties = config.getProperties();
        }
        appClassloader = classLoader;
    }
293172
private Properties loadConfig() throws IOException {
		String configUrl = String.format("%s/%s/%s", defaultRepositoryUrl, DIST_DIR, RESOLVE_CONFIG_FILE);
		log.info("Looking for repository-config at {}", configUrl);

		CloseableHttpClient client = HttpClients.createDefault();

		HttpGet httpget = new HttpGet(configUrl);
		CloseableHttpResponse contentResponse;
		try {
			contentResponse = client.execute(httpget);
		} catch (ConnectTimeoutException e) {
			throw new ConnectException(e.getMessage());
		}

		int statusCode = contentResponse.getStatusLine().getStatusCode();
		log.debug("HttpGet at {}, Status is {}", configUrl, statusCode);
		if (statusCode == HttpStatus.SC_NOT_FOUND) {
			log.info("No repository-config found at {}", configUrl);

			return null;
		} else if (statusCode != HttpStatus.SC_OK) {
			String msg = "Error loading " + configUrl + ":\n";
			msg += contentResponse.getStatusLine().toString();

			throw new RuntimeException(msg);
		}

		HttpEntity entity = contentResponse.getEntity();
		BufferedInputStream inputStream = new BufferedInputStream(entity.getContent());

		Properties properties = new Properties();
		properties.load(inputStream);

		contentResponse.close();
		client.close();

		return properties;
	}
753528
private Map<Metadatas, ArrayList<ConfigProperty>> processConfigProperty(AnnotationRepository annotationRepository,
                                                                             ClassLoader classLoader)
      throws Exception
   {
      Map<Metadatas, ArrayList<ConfigProperty>> valueMap = null;
      Collection<Annotation> values = annotationRepository.getAnnotation(javax.resource.spi.ConfigProperty.class);
      if (values != null)
      {
         valueMap = new HashMap<Annotations.Metadatas, ArrayList<ConfigProperty>>();
         for (Annotation annotation : values)
         {
            javax.resource.spi.ConfigProperty configPropertyAnnotation = (javax.resource.spi.ConfigProperty) annotation
                  .getAnnotation();

            if (trace)
               log.trace("Processing: " + configPropertyAnnotation);

            XsdString configPropertyValue = XsdString.NULL_XSDSTRING;
            if (configPropertyAnnotation.defaultValue() != null && !configPropertyAnnotation.defaultValue().equals(""))
               configPropertyValue = new XsdString(configPropertyAnnotation.defaultValue(), null);

            XsdString configPropertyName = new XsdString(getConfigPropertyName(annotation), null);

            XsdString configPropertyType =
               new XsdString(getConfigPropertyType(annotation, configPropertyAnnotation.type(), classLoader), null);

            Boolean configPropertySupportsDynamicUpdates = configPropertyAnnotation.supportsDynamicUpdates();
            Boolean configPropertyConfidential = configPropertyAnnotation.confidential();
            // Description
            ArrayList<LocalizedXsdString> descriptions = null;
            if (configPropertyAnnotation.description() != null && configPropertyAnnotation.description().length != 0)
            {
               descriptions = new ArrayList<LocalizedXsdString>(configPropertyAnnotation.description().length);
               for (String descriptionAnnoptation : configPropertyAnnotation.description())
               {
                  descriptions.add(new LocalizedXsdString(descriptionAnnoptation, null));
               }
            }

            Boolean configPropertyIgnore = configPropertyAnnotation.ignore();

            String attachedClassName = annotation.getClassName();
            Class attachedClass = Class.forName(attachedClassName, true, classLoader);

            if (hasInterface(attachedClass, "javax.resource.spi.ResourceAdapter"))
            {
               ConfigProperty cfgMeta = new ConfigPropertyImpl(descriptions, configPropertyName,
                                                               configPropertyType,
                                                               configPropertyValue, configPropertyIgnore,
                                                               configPropertySupportsDynamicUpdates,
                                                               configPropertyConfidential, null, false,
                                                               attachedClassName, null, null, null);
               if (valueMap.get(Metadatas.RA) == null)
               {
                  valueMap.put(Metadatas.RA, new ArrayList<ConfigProperty>());
               }
               valueMap.get(Metadatas.RA).add(cfgMeta);
            }
            else
            {
               ConfigProperty cfgMeta = new ConfigPropertyImpl(descriptions, configPropertyName,
                                                               configPropertyType,
                                                               configPropertyValue, configPropertyIgnore,
                                                               configPropertySupportsDynamicUpdates,
                                                               configPropertyConfidential, null, false,
                                                               attachedClassName, null, null, null);
               if (hasInterface(attachedClass, "javax.resource.spi.ManagedConnectionFactory"))
               {
                  if (valueMap.get(Metadatas.MANAGED_CONN_FACTORY) == null)
                  {
                     valueMap.put(Metadatas.MANAGED_CONN_FACTORY, new ArrayList<ConfigProperty>());
                  }
                  valueMap.get(Metadatas.MANAGED_CONN_FACTORY).add(cfgMeta);
               }
               else if (hasInterface(attachedClass, "javax.resource.spi.ActivationSpec"))
               {
                  if (hasNotNull(annotationRepository, annotation))
                  {
                     ((ConfigPropertyImpl)cfgMeta).setMandatory(true);
                  }

                  if (valueMap.get(Metadatas.ACTIVATION_SPEC) == null)
                  {
                     valueMap.put(Metadatas.ACTIVATION_SPEC, new ArrayList<ConfigProperty>());
                  }
                  valueMap.get(Metadatas.ACTIVATION_SPEC).add(cfgMeta);
               }
               else if (hasAnnotation(attachedClass, AdministeredObject.class, annotationRepository))
               {
                  if (valueMap.get(Metadatas.ADMIN_OBJECT) == null)
                  {
                     valueMap.put(Metadatas.ADMIN_OBJECT, new ArrayList<ConfigProperty>());
                  }
                  valueMap.get(Metadatas.ADMIN_OBJECT).add(cfgMeta);
               }
               else
               {
                  if (hasNotNull(annotationRepository, annotation))
                  {
                     ((ConfigPropertyImpl)cfgMeta).setMandatory(true);
                  }

                  if (valueMap.get(Metadatas.PLAIN) == null)
                  {
                     valueMap.put(Metadatas.PLAIN, new ArrayList<ConfigProperty>());
                  }
                  valueMap.get(Metadatas.PLAIN).add(cfgMeta);
               }
            }
         }
         if (valueMap.get(Metadatas.RA) != null)
            valueMap.get(Metadatas.RA).trimToSize();
         if (valueMap.get(Metadatas.MANAGED_CONN_FACTORY) != null)
            valueMap.get(Metadatas.MANAGED_CONN_FACTORY).trimToSize();
         if (valueMap.get(Metadatas.ACTIVATION_SPEC) != null)
            valueMap.get(Metadatas.ACTIVATION_SPEC).trimToSize();
         if (valueMap.get(Metadatas.ADMIN_OBJECT) != null)
            valueMap.get(Metadatas.ADMIN_OBJECT).trimToSize();
         if (valueMap.get(Metadatas.PLAIN) != null)
            valueMap.get(Metadatas.PLAIN).trimToSize();
         return valueMap;
      }

      return valueMap;
   }
912092
def _load_with_overrides(base) -> Dict[str, str]:
    
    should_write = False
    overrides = _get_environ_overrides()
    try:
        index = json.load((base/_CONFIG_FILENAME).open())
    except (OSError, json.JSONDecodeError) as e:
        sys.stderr.write("Error loading config from {}: {}\nRewriting...\n"
                         .format(str(base), e))
        should_write = True
        index = generate_config_index(overrides)

    for key in CONFIG_ELEMENTS:
        if key.name not in index:
            sys.stderr.write(
                f"New config index key {key.name}={key.default}"
                "\nRewriting...\n")
            if key.kind in (ConfigElementType.DIR, ConfigElementType.FILE):
                index[key.name] = base/key.default
            else:
                index[key.name] = key.default
            should_write = True

    if should_write:
        try:
            write_config(index, path=base)
        except Exception as e:
            sys.stderr.write(
                "Error writing config to {}: {}\nProceeding memory-only\n"
                .format(str(base), e))
    index.update(overrides)
    return index
293267
private ClassLoader expandClasspath(ExtendedEmailPublisherContext context, ClassLoader loader) throws IOException {
        List<ClasspathEntry> classpathList = new ArrayList<>();
        if (classpath != null && !classpath.isEmpty()) {
            transformToClasspathEntries(classpath, context, classpathList);
        }

        List<GroovyScriptPath> globalClasspath = getDescriptor().getDefaultClasspath();
        if (globalClasspath != null && !globalClasspath.isEmpty()) {
            transformToClasspathEntries(globalClasspath, context, classpathList);
        }

        boolean useSecurity = Jenkins.getActiveInstance().isUseSecurity();
        if (!classpathList.isEmpty()) {
            GroovyClassLoader gloader = new GroovyClassLoader(loader);
            gloader.setShouldRecompile(true);
            for (ClasspathEntry entry : classpathList) {
                if (useSecurity) {
                    ScriptApproval.get().using(entry);
                }
                gloader.addURL(entry.getURL());
            }
            loader = gloader;
        }
        if (useSecurity) {
            return GroovySandbox.createSecureClassLoader(loader);
        } else {
            return loader;
        }
    }
41805
public void loadFromPropertyFile() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "loadFromPropertyFile()");

        String key        = null;
        Properties config = new Properties();
        InputStream is    = this.getClass().getResourceAsStream(PROPERTY_FILE);

        if (is == null) {
            throw new IOException("Resource " + PROPERTY_FILE + " not found in current classloader");
        }

        config.load(is);

        Enumeration vEnum = config.propertyNames();

        while (vEnum.hasMoreElements())
        {
            key = (String) vEnum.nextElement();

            if (key.equals("datasourceClassname"))
                datasourceClassname = config.getProperty(key);
            else if (key.equals("username"))
                datasourceUsername  = config.getProperty(key);
            else if (key.equals("password"))
                datasourcePassword  = config.getProperty(key);
            else if (key.equals("schemaname"))
                schemaName = config.getProperty(key);
            else if (key.equals("poolSize"))
                numberOfPooledConnections = Integer.parseInt(config.getProperty(key));
            else if (key.equals("verbose"))
                verbose = Boolean.valueOf(config.getProperty(key)).booleanValue();
            else
                datasourceProperties.setProperty(key, config.getProperty(key));
        }

        if (datasourceClassname == null)
            throw new IllegalStateException("The properties file must specify datasourceClassname");

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "loadFromPropertyFile()");
    }
783315
def _add_overlays(self, config):
        
        if self._comment:
            config['comment'] = self._comment

        jco = {}
        config["jobConfigOverlays"] = [jco]

        if self._raw_overlay:
            jco.update(self._raw_overlay)

        jc = jco.get('jobConfig', {})

        if self.job_name is not None:
            jc["jobName"] = self.job_name
        if self.job_group is not None:
            jc["jobGroup"] = self.job_group
        if self.data_directory is not None:
            jc["dataDirectory"] = self.data_directory
        if self.preload:
            jc['preloadApplicationBundles'] = True
        if self.tracing is not None:
            jc['tracing'] = self.tracing

        if self.submission_parameters:
             sp = jc.get('submissionParameters', [])
             for name in self.submission_parameters:
                  sp.append({'name': str(name), 'value': self.submission_parameters[name]})
             jc['submissionParameters'] = sp

        if jc:
            jco["jobConfig"] = jc

        if self.target_pe_count is not None and self.target_pe_count >= 1:
            deployment = jco.get('deploymentConfig', {})
            deployment.update({'fusionScheme' : 'manual', 'fusionTargetPeCount' : self.target_pe_count})
            jco["deploymentConfig"] = deployment
        return config
45447
private Dictionary<String, Object> buildServicePropsAndFilterTargets(String pid, Dictionary<String, Object> config) throws IOException, InvalidSyntaxException {
        Dictionary<String, Object> result = new Hashtable<String, Object>();

        // we will use this later to discover the properties configured in this classloader element in config
        result.put("classloader.config.pid", pid);

        // Add the application so other DS components can key from this new classloader sevice
        String appFilter = "(classloader=" + pid + ")";
        Configuration[] appConfigs = configAdmin.listConfigurations(appFilter);

        if (appConfigs.length == 1) {
            Configuration appConfig = appConfigs[0];
            Dictionary<String, Object> properties = appConfig.getProperties();
            String appName = (String) properties.get("name");
            if (appName != null) {
                result.put("application.name", appName);
            }
            String appConfigPid = (String) properties.get("service.pid");
            try {
                result.put("application.pid", appConfigPid);
            } catch (NullPointerException swallowed) {
                /* this will be FFDC'd */
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "service.pid is null", swallowed);
            }
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Creating ApplicationClassloadingService for application" + appName);
        }

        List<String> allLibraries = new ArrayList<String>();

        String[] privateLibraryRefs = (String[]) config.get(LIBRARY_REF_ATT);
        if (privateLibraryRefs != null) {
            allLibraries.addAll(Arrays.asList(privateLibraryRefs));
        }

        String[] commonLibraryRefs = (String[]) config.get(COMMON_LIBRARY_REF_ATT);
        if (commonLibraryRefs != null) {
            allLibraries.addAll(Arrays.asList(commonLibraryRefs));
        }

        if (allLibraries.size() > 0) {
            String filter = buildTargetString(allLibraries);
            result.put("libraryStatus.target", filter);
            if (tc.isDebugEnabled())
                Tr.debug(tc, "This application will wait for the following libraries ", filter);
        } else {
            // we need to clear the blocking target and make sure we 
            // do get activated by setting a target we know will happen
            result.put("libraryStatus.target", "(id=global)");
        }

        return result;
    }
44842
final DynamoDBMapperConfig merge(final DynamoDBMapperConfig overrides) {
        return overrides == null || this == overrides ? this : builder().merge(this).merge(overrides).build();
    }
313085
public void credentialsMigration(T overrider, Class overriderClass) {
        try {
            deployerMigration(overrider, overriderClass);
            resolverMigration(overrider, overriderClass);
        } catch (NoSuchFieldException | IllegalAccessException | IOException e) {
            converterErrors.add(getConversionErrorMessage(overrider, e));
        }
    }