Every system needs some kind of object mapping. One of the classic example would be when the Business object model and the data model does not match. Consider a example where system is communicating with CICS based host. System has a busineed object with attributes firstName , lastName, streetNo,streetName,City,State and zipCode. To store this data in CICS this syetm can communicate with the CICS based host by sending message such as
- Posted by: Sunil Pandit
- Posted on: October 22 2004 15:25 EDT
There is a mismatch between the attributes on business object and keywords in message. And to resolve this mismatch it needs something describing this mapping . Are there any patterns to handle such scenario or are there any tools.
XSLT could be a solution but to use XSLT the preson object needs to be convertated in DOM object and then write XSL.
I think this is genuine problem every system implements in one form or another . Any suggestions ? thoghts ?
This is not a pattern at all. You are looking for a tool or spec. If all you are looking for is a way to turn one keyword into another then a simple property file can suffice, i.e.
Also, do NOT uses xslt. Why would you use this ? You have no xml. You want to create xml just for search and replace ? No way. Just use String.repalce() (or whatever). C'mon.
You might want to use something like this to map your Java objects with your Cobol programs.
I would'nt use XSL in your case since your inputs aren't XML. It would be overkill to transform your inputs into XML just to use an XSL transformation.
The only XML you will have in your case will be used to map your COBOL parameter to your Java attributes. It's pretty straightforward to implement.
You could create a JDBC style interface to set your values, it would map directly with your inputs. Ie:
Also, do not use a property file because it will get messy as you will probably want to handle array of objects, you will have to come up with something unatural. XML easily handle collections and hierarchy.
CobolTransaction trx = new CobolTransaction();
// Handle array with something like this
CobolArray raisesHistory = trx.initArray("raisesHistory");
Iterator raisesIt = employee.getRaisesHistory().iterator();