Set properties in configuration bean based on the parsed configuration. Called by unit test.
356726
void apply(final ConfigurationContext ctx, final ParsedConfiguration _parsedCfg, final Object cfg) {
    ParsedConfiguration _templates = ctx.getTemplates();
    ConfigurationTokenizer.Property _include = _parsedCfg.getPropertyMap().get("include");
    if (_include != null) {
      for (String _template : _include.getValue().split(",")) {
        ParsedConfiguration c2 = null;
        if (_templates != null) { c2 = _templates.getSection(_template); }
        if (c2 == null) {
          throw new ConfigurationException("Template not found \'" + _template + "\'", _include);
        }
        apply(ctx, c2, cfg);
      }
    }
    applyPropertyValues(_parsedCfg, cfg);
    if (!(cfg instanceof ConfigurationWithSections)) {
      return;
    }
    ConfigurationWithSections _configurationWithSections = (ConfigurationWithSections) cfg;
    for(ParsedConfiguration _parsedSection : _parsedCfg.getSections()) {
      String _sectionType = ctx.getPredefinedSectionTypes().get(_parsedSection.getName());
      if (_sectionType == null) {
        _sectionType = _parsedSection.getType();
      }
      if (_sectionType == null) {
        throw new ConfigurationException("type missing or unknown", _parsedSection);
      }
      Class<?> _type;
      try {
        _type = Class.forName(_sectionType);
      } catch (ClassNotFoundException ex) {
        throw new ConfigurationException(
          "class not found '" + _sectionType + "'", _parsedSection);
      }
      if (!handleSection(ctx, _type, _configurationWithSections, _parsedSection)
        && !handleCollection(ctx, _type, cfg, _parsedSection)
        && !handleBean(ctx, _type, cfg, _parsedSection)) {
        throw new ConfigurationException("Unknown property  '" +  _parsedSection.getContainer() + "'", _parsedSection);
      }
    }
  }
933313
private static void setProperty( Object bean, String key, Object value, JsonConfig jsonConfig )
         throws Exception {
      PropertySetStrategy propertySetStrategy = jsonConfig.getPropertySetStrategy() != null ? jsonConfig.getPropertySetStrategy()
            : PropertySetStrategy.DEFAULT;
      propertySetStrategy.setProperty( bean, key, value, jsonConfig );
   }
641832
private void setProperties(Dictionary<String, ?> d) {
        if (d == null) {
            this.properties = null;
            return;
        }

        ConfigurationDictionary newDictionary = new ConfigurationDictionary();
        Enumeration<String> keys = d.keys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            if (newDictionary.get(key) == null) {
                Object value = d.get(key);
                if (value.getClass().isArray()) {
                    int arrayLength = Array.getLength(value);
                    Object copyOfArray = Array.newInstance(value.getClass().getComponentType(), arrayLength);
                    System.arraycopy(value, 0, copyOfArray, 0, arrayLength);
                    newDictionary.put(key, copyOfArray);
                } else if (value instanceof Collection) {
                    newDictionary.put(key, new Vector<Object>((Collection<?>) value));
                } else {
                    newDictionary.put(key, value);
                }
            } else
                throw new IllegalArgumentException(key + " is already present or is a case variant."); //$NON-NLS-1$
        }

        // fill in necessary properties
        if (this.factoryPid != null) {
            newDictionary.put(ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPid);
        }
        newDictionary.put(Constants.SERVICE_PID, this.pid);
        if (this.inOverridesFile) {
            newDictionary.put("config.overrides", "true");
        }

        this.properties = newDictionary;

        //we got new props so we should redo the mappings in case they changed
        addPidMapping();
    }
1177306
protected void initialize() {
        this.mappedFields = new HashMap<String, PropertyDescriptor>();
        PropertyDescriptor[] pds = BeanUtils.getPropertyDescriptors(mappedClass);
        if (checkProperties) {
            mappedProperties = new HashSet<String>();
        }
        for (int i = 0; i < pds.length; i++) {
            PropertyDescriptor pd = pds[i];
            if (pd.getWriteMethod() != null) {
                if (checkProperties) {
                    this.mappedProperties.add(pd.getName());
                }
                this.mappedFields.put(pd.getName().toLowerCase(), pd);
                for (String underscoredName : underscoreName(pd.getName())) {
                    if (underscoredName != null
                            && !pd.getName().toLowerCase().equals(underscoredName)) {
                        this.mappedFields.put(underscoredName, pd);
                    }
                }
            }
        }
    }
327033
public void addToConfiguration(String name, String value) {
        if (this.sessionConfigProperties == null) {
            this.sessionConfigProperties = new Properties();
        }
        this.sessionConfigProperties.setProperty(name, value);
    }
806164
public static void setProperty(Object bean, String propertyName, Object value,boolean throwExceptionForMissingProperty)
   {
      try
      {
         //find key ignoreClase
         //PropertyUtils.setProperty(aBean, aPropName, aValue);
    	  PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,propertyName);
    	  if(propertyDescriptor == null)
    	  {
    		  throw new IllegalArgumentException("propertyName:"+propertyName+" not found for bean:"+bean);
    	  }
    	  Method writeMethod = propertyDescriptor.getWriteMethod();
    	  
    	  if(writeMethod == null)
    	  {
    		  if(throwExceptionForMissingProperty)
    			  throw new IllegalArgumentException("Write method not found for propertyName:"+propertyName+" for bean:"+bean);
    		  else
    			  return; //ignore missing set method for property
    	  }
    	  writeMethod.invoke(bean, value);
    	  
      }
      catch(IllegalArgumentException e)
      {
    	  if(!(value instanceof String))
    		  throw e;
    		  
    	try
  		{
    	  //convert value
    	  PropertyDescriptor desc = getPropertyDescriptor(bean, propertyName);
    	  
    	  String text = (String)value;
    	  
    
			value = Text.toObject(text, desc.getPropertyType().getName());
			  
			  //try again
			  PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,propertyName);
	    	  propertyDescriptor.getWriteMethod().invoke(bean, value);
		}
		catch(Exception innerError)
		{
			//failed conversion
			//throw original exception
			throw e;
		}
    	  
      }
      catch(NoSuchMethodException e)
      {
         try
         {
            //find key ignores         
            Object key = Organizer.findByTextIgnoreCase(keySet(bean),propertyName );
           
            PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean,String.valueOf(key));
      	  propertyDescriptor.getWriteMethod().invoke(bean, value);
         }
         catch (Exception e1)
         {
            String typeName = "null";
            
            if(value != null)
               typeName = value.getClass().getName();
            
            throw new SystemException("type="+typeName+" "+Debugger.toString(e));
         }
      }
      catch(Exception e)
      {
         String typeName = "null";
         
         if(value != null)
            typeName = value.getClass().getName();
         
         throw new SystemException("type="+typeName+" propery:"+propertyName+" ERROR:"+e.getMessage(),e);
      }
   }
149900
def set_properties(self, properties):
        """"""
        if isinstance(properties, dict):
            self.properties = properties
            self.sync_properties()
        else:
            self.text = properties
988590
private void parseConfig(Element property, BeanDefinitionBuilder propertyBuilder) {
        Element config = (Element) getTagChildren("config", property).item(0);

        if (config != null) {
            Properties properties = new Properties();
            NodeList entries = getTagChildren("entry", config);

            for (int i = 0; i < entries.getLength(); i++) {
                Element entry = (Element) entries.item(i);
                String key = entry.getAttribute("key");
                String value = entry.getTextContent().trim();
                properties.put(key, value);
            }

            propertyBuilder.addPropertyValue("config", properties);
        }
    }
446582
public void setProperties(Properties props) throws Exception {
		// Use reflection to read in all possible properties of int, String or boolean.
		for (Method method: BoneCPConfig.class.getDeclaredMethods()){
			String tmp = null;
			if (method.getName().startsWith("is")){
				tmp = lowerFirst(method.getName().substring(2));
			} else if (method.getName().startsWith("set")){
				tmp = lowerFirst(method.getName().substring(3));
			} else {
				continue;
			}

			if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(int.class)){
				String val = props.getProperty(tmp);
				if (val == null){
					val = props.getProperty("bonecp."+tmp); // hibernate provider style
				}
				if (val != null) {
					try{
						method.invoke(this, Integer.parseInt(val));
					} catch (NumberFormatException e){
						// do nothing, use the default value
					}
				}
			} else if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(long.class)){
				String val = props.getProperty(tmp);
				if (val == null){
					val = props.getProperty("bonecp."+tmp); // hibernate provider style
				}
				if (val != null) {
					try{
						method.invoke(this, Long.parseLong(val));
					} catch (NumberFormatException e){
						// do nothing, use the default value
					}
				}
			} else if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(String.class)){
				String val = props.getProperty(tmp);
				if (val == null){
					val = props.getProperty("bonecp."+tmp); // hibernate provider style
				}
				if (val != null) {
					method.invoke(this, val);
				}
			} if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(boolean.class)){
				String val = props.getProperty(tmp);
				if (val == null){
					val = props.getProperty("bonecp."+tmp); // hibernate provider style
				}
				if (val != null) {
					method.invoke(this, Boolean.parseBoolean(val));
				}
			}
		}
	}
418606
@SuppressWarnings({ "unchecked", "rawtypes" })
	public void set(String fieldName, Object value) throws BeanException{
		if(Map.class.isAssignableFrom(beanClass)){
			((Map)bean).put(fieldName, value);
			return;
		}else{
			try {
				final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
				if(null == setter){
					throw new BeanException("No set method for {}", fieldName);
				}
				setter.invoke(this.bean, value);
			} catch (Exception e) {
				throw new BeanException(e);
			}
		}
	}
1071802
public Configuration withProperties(java.util.Map<String, String> properties) {
        setProperties(properties);
        return this;
    }
234669
public void setConfigurations(java.util.Collection<java.util.Map<String, String>> configurations) {
        if (configurations == null) {
            this.configurations = null;
            return;
        }

        this.configurations = new java.util.ArrayList<java.util.Map<String, String>>(configurations);
    }
329229
protected void setBeanPropertyValue(final String property, final Object bean,
			final Serializable value) {
		if (bean == null) {
			return;
		}

		if (".".equals(property)) {
			LOG.error("Set of entire bean is not supported by this model");
			return;
		}
		try {
			PropertyUtils.setProperty(bean, property, value);
		} catch (Exception e) {
			LOG.error("Failed to set bean property " + property + " on " + bean, e);
		}
	}
264092
public void setProperties(Properties properties) throws ConfigurationException {
		String dbDriver = properties.getProperty("dbdriver").toString();
		if (dbDriver == null) {
			throw new ConfigurationException("please specify dbDriver for connectionpool");
		}

		dbUrl = properties.getProperty("dburl").toString();
		dbUsername = properties.getProperty("dbusername").toString();
		dbUserpassword = properties.getProperty("dbuserpassword").toString();

		if (properties.getProperty("nrof_connections") != null) {
			initialNrofConnections = Integer.valueOf(properties.getProperty("nrof_connections"));
			maxNrofConnections = Integer.valueOf(properties.getProperty("nrof_connections"));
		} else {
			initialNrofConnections = Integer.valueOf(properties.getProperty("initial_nrof_connections", "" + initialNrofConnections));
			maxNrofConnections = Integer.valueOf(properties.getProperty("max_nrof_connections", "" + maxNrofConnections));
			//set default option
			//properties.getProperty("nrof_connections", new GenericValue(initialNrofConnections)).toInteger().intValue();
		}
		connectionRequestTimeout = Integer.valueOf(properties.getProperty("connection_request_timeout", "" + connectionRequestTimeout));
		connectionTimeout = Integer.valueOf(properties.getProperty("connection_timeout", "" + connectionTimeout));
		connectionTimeoutCheck = Integer.valueOf(properties.getProperty("connection_timeout_check_interval", "" + connectionTimeoutCheck));

		connectionTestStatement = properties.getProperty("connection_test_statement", connectionTestStatement).toString();

		createReadOnlyConnections = Boolean.valueOf(properties.getProperty("create_readonly_connections", "" + createReadOnlyConnections));
		defaultIsolationLevel = isolationLevelStrings.indexOf(properties.getProperty("default_isolaton_level", "" + defaultIsolationLevel));

		try {
			Class.forName(dbDriver);
			Enumeration drivers = DriverManager.getDrivers();

			driverInfo = "";
			int count = 0;
			while (drivers.hasMoreElements()) {
				count++;
				Driver driver = (Driver) drivers.nextElement();
				driverInfo += "driver " + count + ": " + driver.getMajorVersion() + '.' + driver.getMinorVersion() + "\n";
			}
		} catch (ClassNotFoundException cnfe) {
			throw new ConfigurationException("ERROR: Driver \"" + dbDriver + "\" not found...");
		}
		resetStatistics();
	}
954903
@Override
    public void setProperty(String name, Object value) {
        if (currentBeanConfig != null) {
            setPropertyOnBeanConfig(name, value);
        }
    }
147294
public void setConfigurationProperties(java.util.Collection<SdkConfigurationProperty> configurationProperties) {
        if (configurationProperties == null) {
            this.configurationProperties = null;
            return;
        }

        this.configurationProperties = new java.util.ArrayList<SdkConfigurationProperty>(configurationProperties);
    }
647468
def set(self, name, default=0, editable=True, description=""):
        ''''''

        var, created = ConfigurationVariable.objects.get_or_create(name=name)

        if created:
            var.value = default

        if not editable:
            var.value = default

        var.editable = editable
        var.description = description
        var.save(reload=False)

        # ATTRIBUTES is accesible by any instance of VariablesManager
        self.ATTRIBUTES[var.name] = var.value