9.1 Legacy Software Reengineering and Reuse Exercise
Provide a command-line (or graphical) interactive Java front-end to the legacy
COBOL application SMPLCALC.cbl by implementing the program architecture
illustrated in Fig. 9.4. Before starting the exercise, download and extract the following
a r c h i v e f i l e l o c a t e d h e r e h t t p : / / r e v e r s i n g p r o j e c t . i n f o / r e p o s i t o r y . p h p ? f i l e I D = 9 _ 1 _ 1 .
Follow these steps to complete the exercise:
Locate the interface data structure for SMPLCALC.cbl in the copybook (source include file) SMPLCALC.cpy. There is only one data structure in the copybook.
Create an XML Schema which represents all of the data in the SMPLCALC- INTERFACE COBOL data structure. Instead of writing this by hand, you can use the Micro Focus Net Express CBL2XML wizard .
Write a Java interface ISimpleCalculator.java for three computation types supported by SMPLCALC.cbl using appropriate method signatures:
long doAdd(int, int) throws java.lang.ArithmeticException.
long doSubtract(int, int) throws Java.lang.ArithmeticException
long doMultipy(int, int) throws Java.lang.ArithmeticException
Write a Java class JSimpleCalculator.java that implements the interface defined in ISimpleCalculator.java and provides a user interface for:
Specifying which computation (add, sub, mul) is desired.
Specifying the operands to the computation.
Displaying the result of the computation (can be an error).
Use the Java command-line utility xjc, in combination with the XML Schema created in Step 2, to generate Java to XML marshalling code (JAXB). Update JSimpleCalculator.java to call this marshalling code.