[jbosstools-issues] [JBoss JIRA] Updated: (JBIDE-5307) Generalize the model creation code

Brian Fitzpatrick (JIRA) jira-events at lists.jboss.org
Thu Jan 7 16:10:31 EST 2010


     [ https://jira.jboss.org/jira/browse/JBIDE-5307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Fitzpatrick updated JBIDE-5307:
-------------------------------------

     Original Estimate: 0 minutes
    Remaining Estimate: 0 minutes
         Fix Version/s: LATER
                            (was: 3.1.0.CR2)


> Generalize the model creation code
> ----------------------------------
>
>                 Key: JBIDE-5307
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-5307
>             Project: Tools (JBoss Tools)
>          Issue Type: Task
>          Components: smooks
>            Reporter: Tom Fennelly
>             Fix For: LATER
>
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> 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();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list