public PropertyValues postProcessPropertyValues(PropertyValues pvs,
PropertyDescriptor[] pds, Object bean, String beanName)
throws BeansException {
- ExecutionFlow currentFlow = ExecutionContext.getCurrentFlow();
- if (currentFlow == null)
+ if (!ExecutionContext.isExecuting())
return pvs;
+// ExecutionFlow currentFlow = ExecutionContext.getCurrentFlow();
+//
+// Properties props = new Properties();
+// Map<String, Object> attributes = currentFlow.getAttributes();
+// Map<String, ExecutionSpecAttribute> specAttributes = currentFlow
+// .getExecutionSpec().getAttributes();
+//
+// for (String key : specAttributes.keySet()) {
+// ExecutionSpecAttribute obj = specAttributes.get(key);
+// if (!(obj instanceof RefSpecAttribute)) {
+// if (!attributes.containsKey(key))
+// throw new SlcException("Specified attribute " + key
+// + " is not set in " + currentFlow);
+//
+// props.setProperty(key, attributes.get(key).toString());
+// // if (log.isTraceEnabled())
+// // log.trace("Use attribute " + key);
+// }
+// }
+
Properties props = new Properties();
- Map<String, Object> attributes = currentFlow.getAttributes();
- Map<String, ExecutionSpecAttribute> specAttributes = currentFlow
- .getExecutionSpec().getAttributes();
-
- for (String key : specAttributes.keySet()) {
- ExecutionSpecAttribute obj = specAttributes.get(key);
- if (!(obj instanceof RefSpecAttribute)) {
- if (!attributes.containsKey(key))
- throw new SlcException("Specified attribute " + key
- + " is not set in " + currentFlow);
-
- props.setProperty(key, attributes.get(key).toString());
-// if (log.isTraceEnabled())
-// log.trace("Use attribute " + key);
- }
- }
CustomPpc ppc = new CustomPpc(props);
for (PropertyValue pv : pvs.getPropertyValues()) {
tsv.setValue(convertedValue);
if (log.isTraceEnabled()) {
if (!originalValue.equals(convertedValue))
- log.trace("Converted " + beanName + "[" + pv.getName()
- + "]: " + originalValue + " to "
- + convertedValue);
+ log.trace("Converted field '" + pv.getName() + "': '"
+ + originalValue + "' to '" + convertedValue
+ + "' in bean " + beanName);
}
} else {
-// if (log.isTraceEnabled())
-// log.trace(beanName + "[" + pv.getName() + "]: "
-// + pv.getValue().getClass());
+ // if (log.isTraceEnabled())
+ // log.trace(beanName + "[" + pv.getName() + "]: "
+ // + pv.getValue().getClass());
}
}
}
public String process(String strVal) {
- String value = parseStringValue(strVal, this.props, new HashSet<String>());
+ String value = parseStringValue(strVal, this.props,
+ new HashSet<String>());
return (value.equals(nullValue) ? null : value);
}
+
+ @Override
+ protected String resolvePlaceholder(String placeholder, Properties props) {
+ if (ExecutionContext.isExecuting())
+ return ExecutionContext.getVariable(placeholder).toString();
+ else if (SimpleExecutionSpec.isInFlowInitialization())
+ return SimpleExecutionSpec.getInitializingFlowParameter(
+ placeholder).toString();
+ else
+ return super.resolvePlaceholder(placeholder, props);
+ }
+
}
}