My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Wiki pages

What is jSmaTeP?

Often there is the task to process import data stored in a data file. Or even “worse” - you have to process imported data and afterwards you have to export processed data in a different format into a new export file and send it to a different recipient.

What do you do? You write some “handy” code to process the import and the export and you think: that's it! But what happens if the import and/or the export format changes? What do you do if you get a second import and/or export format for a further 3rd party system? Often you go into the code, copy & paste it, do some “very special changes” (probably include some if-else-cascades), deploy it and hope everything is OK. What about testability, maintainability etc.???

jSmaTeP (Java SMArt TExt Processor) wants to meet all these stumbling blocks and provides a handy & smart way processing import and export data by configuring data structure – NOT by programming it!. (See examples

Data structure configuration example:

        <ns0:variable-length max-record-length="14"></ns0:variable-length>
        <ns0:field name="a" position="0" length="2" type="String"></ns0:field>
        <ns0:field name="b" position="2" length="8" type="Date" format="yyyyMMdd" null-value="00000000" default-value="99991231"></ns0:field>
        <ns0:field name="c" position="10" length="4" type="Integer" default-value="9999"></ns0:field>

For this data:

EF        12

Bringing it all together - example using jSmaTeP in your code:

BufferedImportProcessor<DefaultValueTestValueObject> ip = new BufferedImportProcessor<DefaultValueTestValueObject>(xmlConfigFile);
ImportResult importResult = ip.importContent(importStrings);
// get all parsed data objects
List<DefaultValueTestValueObject> parsedData = ip.getMappedValueObjects();

In this example the integrated BufferedImportProcessor is used to get all mapped records (value objects) at once. If you like, you can use your own listener class which implements

jSmaTeP supports importing flat file data with fixed length data format, comma separated data file format or variable length data file format (as shown above).

As it is time consuming (and boring) implementing simple value objects, jSmaTeP gives you the possibility to generate a value object.

What do you win?

If you have to change your import and/or export data format structure you have to modify your configuration only (and if required generate a new value object). That's it! (And hopefully write some unit tests ;-))

Interested? Take a look at the example how to use jSmaTeP to parse incoming text data

Powered by Google Project Hosting