log.debug("Handling update request");
try {
// only set values for properties that are already defined
String propName = null;
RuntimeConfigProperty updProp = null;
String incomingProp = null;
Iterator propsIT = this.properties.keySet().iterator();
while(propsIT.hasNext()) {
propName = (String) propsIT.next();
log.debug("Checking property ["+propName+"]");
updProp = (RuntimeConfigProperty) this.properties.get(propName);
String[] propValues = (String[]) this.parameters.get(updProp.getName());
if(propValues != null && propValues.length > 0) {
// we don't deal with multi-valued props
incomingProp = propValues[0];
}
// some special treatment for booleans
// this is a bit hacky since we are assuming that any prop
// with a value of "true" or "false" is meant to be a boolean
// it may not always be the case, but we should be okay for now
if( updProp.getValue() != null // null check needed w/Oracle
&& (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
if(incomingProp == null || !incomingProp.equals("on"))
incomingProp = "false";
else
incomingProp = "true";
}
// only work on props that were submitted with the request
if(incomingProp != null) {
log.debug("Setting new value for ["+propName+"]");
updProp.setValue(incomingProp.trim());
}
}
// save it
PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();