SmooksResourceConfiguration decoderConfig = new SmooksResourceConfiguration();
extensionContext.addResource(decoderConfig);
try {
String type = populatorConfig.getStringParameter("type");
DataDecoder decoder = DataDecoder.Factory.create(type);
String reType = UUID.randomUUID().toString();
// Need to retype the populator configuration so as to get the
// value binding BeanInstancePopulator to lookup the new decoder
// config that we're creating here...
populatorConfig.removeParameter("type"); // Need to remove because we only want 1
populatorConfig.setParameter("type", reType);
// Configure the new decoder config...
decoderConfig.setSelector("decoder:" + reType);
decoderConfig.setTargetProfile(extensionContext.getDefaultProfile());
if(type != null) {
decoderConfig.setResource(decoder.getClass().getName());
}
for(int i = 0; i < decodeParams.getLength(); i++) {
Element decoderParam = (Element) decodeParams.item(i);
String name = decoderParam.getAttribute("name");
if(name.equals(PreprocessDecoder.VALUE_PRE_PROCESSING)) {
// Wrap the decoder in the PreprocessDecoder...
decoderConfig.setResource(PreprocessDecoder.class.getName());
if(type != null) {
decoderConfig.setParameter(PreprocessDecoder.BASE_DECODER, decoder.getClass().getName());
}
}
decoderConfig.setParameter(name, DomUtils.getAllText(decoderParam, true));
}
} finally {