aspose file tools*
The moose likes Java in General and the fly likes Single Java program process multiple text file format for same business logic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Single Java program process multiple text file format for same business logic" Watch "Single Java program process multiple text file format for same business logic" New topic
Author

Single Java program process multiple text file format for same business logic

G Munappy
Greenhorn

Joined: Nov 13, 2009
Posts: 2
Dears
I don't know this is the right forum to raise this query
Kindly give some idea how to design this solution:
How do a single Java program will process data different text file format for same business function.
Client will send thier own text file with data in the format they wish, we can not dictate about single uniform text file format
We don't want to change the Java program for every clients.
Is XML file are the answer? But still as XML files changes our Java programs has to equally change
Can we maintain different client text file formats in a table and then process?
Can any one suggest a better solution design / pattern / logic to this scenario?

With Thanks & Regards
Gopinathan Munappy
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
How about an "adapter" custom made for each format which converts the text file into a standard form for the rest of the processing.

I actually do this sort of thing with exam question documents. Adding a new input type just involves coding one new class which implements my adapter interface. I create an instance of the adapter using Class.forName() so the main program does not have to be recompiled, it just needs to read the names of classes it can use as an adapter.

XML as a standard form would only be appropriate if the document structure controls processing and you need to store the converted document.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Single Java program process multiple text file format for same business logic