Merge config properties

@param rxConfigProperties config properties from ra.xml
@param annoConfigProperties config properties from annotations
@return a list of the merged config properties
496734
@SuppressWarnings("unchecked")
    private List<RaConfigProperty> mergeConfigProperties(List<RaConfigProperty> rxConfigProperties, List<RaConfigProperty> annotatedConfigProperties) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();

        LinkedList<RaConfigProperty> configProperties = new LinkedList<RaConfigProperty>();
        List<RaConfigProperty> annoConfigProperties = null;
        if (annotatedConfigProperties != null)
            annoConfigProperties = (List<RaConfigProperty>) ((LinkedList<RaConfigProperty>) annotatedConfigProperties).clone();
        else
            annoConfigProperties = new LinkedList<RaConfigProperty>();

        if (trace && tc.isDebugEnabled())
            Tr.debug(this, tc,
                     "rxConfigProperties size: " + rxConfigProperties.size());

        for (RaConfigProperty rxConfigProp : rxConfigProperties) {
            RaConfigProperty annoConfigProp = null;

            if (annoConfigProperties.isEmpty()) {
                return (List<RaConfigProperty>) ((LinkedList<RaConfigProperty>) rxConfigProperties).clone();
            } else {
                for (RaConfigProperty configProp : annoConfigProperties)
                    if (isEqual(rxConfigProp.getName(), configProp.getName())) {
                        annoConfigProp = configProp;
                        break;
                    }

                if (annoConfigProp != null) {
                    if (trace && tc.isDebugEnabled())
                        Tr.debug(this, tc, "merging " + rxConfigProp + ", " + annoConfigProp);

                    // remove the config property from the list so we know at the end if there
                    // are any additional annotated-only config properties that we need to copy
                    // into the master
                    annoConfigProperties.remove(annoConfigProp);

                    // merge the two config properties
                    if (rxConfigProp.getConfidential() == null)
                        rxConfigProp.setConfidential(annoConfigProp.getConfidential());

                    if (rxConfigProp.getDescription() == null || rxConfigProp.getDescription().isEmpty())
                        rxConfigProp.setDescription(annoConfigProp.getDescription());

                    if (rxConfigProp.getIgnore() == null)
                        rxConfigProp.setIgnore(annoConfigProp.getIgnore());

                    if (rxConfigProp.getSupportsDynamicUpdates() == null)
                        rxConfigProp.setSupportsDynamicUpdates(annoConfigProp.getSupportsDynamicUpdates());

                    if (rxConfigProp.getType() == null || rxConfigProp.getType().equals(""))
                        rxConfigProp.setType(annoConfigProp.getType());

                    if (rxConfigProp.getDefault() == null || rxConfigProp.getDefault().equals(""))
                        rxConfigProp.setDefault(annoConfigProp.getDefault());

                    configProperties.add(rxConfigProp);
                } else {
                    configProperties.add(rxConfigProp);
                }
            }
        }

        if (!annoConfigProperties.isEmpty()) {
            // there are annotated config properties that do not exist already in the ra.xml,
            // thus add them to the master
            for (RaConfigProperty configProp : annoConfigProperties)
                configProperties.add(configProp);
        }

        return configProperties;
    }
468224
public List<CmsPropertyConfig> getPropertyConfiguration() {

        CmsADEConfigData parentData = parent();
        List<CmsPropertyConfig> parentProperties;
        if ((parentData != null) && !m_data.isDiscardInheritedProperties()) {
            parentProperties = parentData.getPropertyConfiguration();
        } else {
            parentProperties = Collections.emptyList();
        }
        List<CmsPropertyConfig> result = combineConfigurationElements(
            parentProperties,
            m_data.getOwnPropertyConfigurations(),
            false);
        return result;
    }
914911
private static List<ConfigFile> createStandaloneConfigFiles(FeaturePack featurePack, ConfigOverride configOverride) {
        final List<org.wildfly.build.common.model.ConfigFile> configFiles = featurePack.getDescription().getConfig().getStandaloneConfigFiles();
        final Map<String, ConfigFileOverride> configFileOverrides = configOverride != null ? configOverride.getStandaloneConfigFiles() : null;
        return createConfigFiles(featurePack.getFeaturePackFile(), configFiles, configOverride, configFileOverrides);
    }
665144
public InterceptorConfigurationBuilder withProperties(Properties properties) {
      attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties));
      return this;
   }
1245060
public static String join(List<? extends PropertyInfo> properties) {
    StringBuilder sb = new StringBuilder();
    for (PropertyInfo info : properties)
      sb.append(info.getName()).append('.');
    return sb.toString();
  }
1254119
public static Config parse(Properties properties) {
        ConfigBuilder config = new SimpleConfig();
        for (Object o : new TreeSet<>(properties.keySet())) {
            String key = o.toString();
            if (isPositional(key)) {
                String entryKey = entryKey(key);
                if (config.containsKey(entryKey)) {
                    config.getCollection(entryKey).add(properties.getProperty(key));
                } else {
                    ArrayList<Object> sequence = new ArrayList<>();
                    sequence.add(properties.getProperty(key));
                    config.putCollection(entryKey, sequence);
                }
            } else {
                config.put(key, properties.getProperty(key));
            }
        }
        return ImmutableConfig.copyOf(config);
    }
644298
public static String getConfigProperty(String configProperty) {
        checkArgument(configProperty != null, "Config property cannot be null");
        return getConfig().getString(configProperty);
    }
945095
public static Map<String, String> mergeDefaults(
        CmsObject cms,
        Map<String, CmsXmlContentProperty> propertyConfig,
        Map<String, String> properties) {

        Map<String, String> result = new HashMap<String, String>();
        if (propertyConfig != null) {
            for (Map.Entry<String, CmsXmlContentProperty> entry : propertyConfig.entrySet()) {
                CmsXmlContentProperty prop = entry.getValue();
                String value = getPropValueIds(cms, prop.getType(), prop.getDefault());
                if (value != null) {
                    result.put(entry.getKey(), value);
                }
            }
        }
        result.putAll(properties);
        return result;
    }
714066
public void configPropertiesUpdated(Dictionary<String, String> properties)
    {
        if (HttpServiceTracker.propertiesEqual(properties, configProperties))
            return;
        configProperties = properties;
        ServiceReference reference = context.getServiceReference(HttpService.class.getName());
        if (reference == null)
            return;
        HttpService httpService = (HttpService) context.getService(reference);

        String oldAlias = this.getAlias();
        this.changeServletProperties(servlet, properties);
        String alias = properties.get(BaseWebappServlet.ALIAS);
        boolean restartRequired = false;
        if (!oldAlias.equals(alias))
            restartRequired = true;
        else if (servlet instanceof WebappServlet)
            restartRequired = ((WebappServlet)servlet).restartRequired();
        if (!restartRequired)
            return;
        try {
            httpService.unregister(oldAlias);
        } catch (Exception e) {
            e.printStackTrace();    // Should not happen
        }
        this.properties.put(BaseWebappServlet.ALIAS, alias);
        
        if (servlet instanceof WebappServlet)
            if (((WebappServlet)servlet).restartRequired())
        {
            ((WebappServlet)servlet).free();
            servlet = null;
        }

        this.addingService(reference); // Start it back up
    }
1014384
private DynamoDBMapperConfig mergeConfig(DynamoDBMapperConfig config) {
        if ( config != this.config )
            config = new DynamoDBMapperConfig(this.config, config);
        return config;
    }
386758
def merge_config(configs):
    
    new_config = {}

    for name, config in configs.items():
        new_config = dictmerge(new_config, config, name)

    return new_config
383681
public static List<RepositoryConfigValidationResult> validateRepositoryPropertiesFile(Properties repoProperties) throws InstallException {

        List<RepositoryConfigValidationResult> validationResults = new ArrayList<RepositoryConfigValidationResult>();
        // Retrieves the Repository Properties file
        File repoPropertiesFile = new File(getRepoPropertiesFileLocation());
        Map<String, String> configMap = new HashMap<String, String>();
        Map<String, Integer> lineMap = new HashMap<String, Integer>();

        if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {
            logger.log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_VALIDATING", getRepoPropertiesFileLocation()));
            //Load repository properties
            FileInputStream repoPropertiesInput = null;
            BufferedReader repoPropertiesReader = null;
            try {
                repoPropertiesInput = new FileInputStream(repoPropertiesFile);
                repoPropertiesReader = new BufferedReader(new InputStreamReader(repoPropertiesInput));
                String line;
                int lineNum = 0;
                //Validate configurations in the repositories.properties file
                while ((line = repoPropertiesReader.readLine()) != null) {
                    lineNum++;
                    validateRepositoryPropertiesLine(repoProperties, line, lineNum, configMap, lineMap, validationResults);
                }
                //Missing Host
                if (configMap.containsKey(PROXY_HOST)) {
                    int ln = lineMap.get(PROXY_HOST);
                    if (!configMap.containsKey(PROXY_PORT)) {
                        validationResults.add(new RepositoryConfigValidationResult(ln, ValidationFailedReason.MISSING_PORT, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_VALIDATION_MISSING_PORT_VALUE",
                                                                                                                                                                           configMap.get(PROXY_HOST))));
                    } else {
                        /**
                         * verify proxy host url along with the port number
                         */
                        String proxyHost = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_HOST);
                        String proxyPort = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_PORT);
                        try {
                            //Trim any trailing whitespaces
                            proxyHost = proxyHost.trim();
                            proxyPort = proxyPort.trim();
                            URL proxyUrl = null;
                            if (proxyHost.toLowerCase().contains("://")) {
                                proxyUrl = new URL(proxyHost + ":" + proxyPort);
                                if (!proxyUrl.getProtocol().toLowerCase().equals("http"))
                                    validationResults.add(new RepositoryConfigValidationResult(ln, ValidationFailedReason.INVALID_HOST, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_VALIDATION_INVALID_HOST",
                                                                                                                                                                                       configMap.get(PROXY_HOST))));
                            } else {
                                new URL("http://" + proxyHost + ":" + proxyPort);
                            }

                        } catch (MalformedURLException e) {
                            validationResults.add(new RepositoryConfigValidationResult(ln, ValidationFailedReason.INVALID_HOST, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_VALIDATION_INVALID_HOST",
                                                                                                                                                                               configMap.get(PROXY_HOST))));
                        }
                    }
                } else {
                    if (configMap.containsKey(PROXY_PORT) || configMap.containsKey(PROXY_USER) || configMap.containsKey(PROXY_PASSWORD)) {
                        int ln = 0;
                        if (lineMap.containsKey(PROXY_PORT))
                            ln = lineMap.get(PROXY_PORT);
                        else if (lineMap.containsKey(PROXY_USER))
                            ln = lineMap.get(PROXY_USER);
                        else
                            ln = lineMap.get(PROXY_PASSWORD);
                        validationResults.add(new RepositoryConfigValidationResult(ln, ValidationFailedReason.MISSING_HOST, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_VALIDATION_MISSING_HOST")));
                    }
                }
            } catch (IOException e) {
                throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED",
                                                                                          getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
            } finally {
                InstallUtils.close(repoPropertiesInput);
                InstallUtils.close(repoPropertiesReader);
            }
            logger.log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_VALIDATION_DONE"));
        }

        return validationResults;

    }
156232
protected function mergeConfigs(array $configs)
    {
        $merged = array();
        foreach ($configs as $config) {
            $merged = array_merge($merged, $config);
        }

        return $merged;
    }
1150291
@Override
	public ApiDoc mergeApiDoc(Class<?> controller, ApiDoc apiDoc) {
		ApiDoc jsondocApiDoc = JSONDocApiDocBuilder.build(controller);
		BeanUtils.copyProperties(jsondocApiDoc, apiDoc, new String[] { "methods", "supportedversions", "auth" });
		return apiDoc;
	}
994538
protected function mergeConfigs()
    {
        $repo   = $this->getConfigRepository();
        $config = $repo->get(static::CONFIG_FILE_NAME_WO_EXT, []);
        $base   = $this->getBaseConfig();
        $result = $config + $base;
        $repo->set(static::CONFIG_FILE_NAME_WO_EXT, $result);
    }
279249
public Properties appendProperties(Properties properties, File configFile) {    

    if(!configFile.exists()) {

      return properties;
    }

    return reader.appendProperties(properties, configFile, log);
  }
1203491
public static void merge(CSProperties base, CSProperties overlay) {
        for (String key : overlay.keySet()) {
            if (base.getInfo(key).containsKey("public")) {
                base.put(key, overlay.get(key));
            } else {
                throw new IllegalArgumentException("Not public: " + key);
            }
        }
    }