At the moment, we are using the Smooks programmatic APIs to configure the input parser etc for creating the input model. This requires translation of the EMF config model into java code instructions for configuring the Smooks Reader - see JsonInputDataParser, CSVDataParser, EDIDataParser.
I think this can be simplified significantly by simply asking Smooks to process the Smooks config and then extracting the reader configuration from the Smooks instance and reuse that to configure an empty Smooks config... and then parse the input to extract the model.
The code would be something like this...
// Get the Reader config from the Smooks config file....
Smooks smooks1 = new Smooks(smooksConfigStream);
ExecutionContext execCtx = smooks1.createExecutionContext();
SmooksResourceConfiguration readerConfig = AbstractParser.getSAXParserConfiguration(execCtx.getDeliveryConfig());
// Create a second "empty" Smooks instance and add the reader config to it....
Smooks smooks2 = new Smooks();
smooks.addConfiguration(readerConfig);
// Filter the input message through this second Smooks instance and capture the model in the DOMResult...
DOMResult result = new DOMResult();
smooks2.filterSource(new StreamSource(inputMessageStream), result);
// And get the model DOM instance (org.w3c.dom.Document)...
Document inputModelDOM = (Document) result.getNode();
- is blocked by
-
JBIDE-5304 Remove use of Dom4J and replace with standard "org.w3c.dom" API from the JDK
- Resolved