X hits on this document





92 / 120

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:

  • 1)

    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.

  • 2)

    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 [37].

  • 3)

    Write a Java interface ISimpleCalculator.java for three computation types supported by SMPLCALC.cbl using appropriate method signatures:

    • a)

      long doAdd(int, int) throws java.lang.ArithmeticException.

    • b)

      long doSubtract(int, int) throws Java.lang.ArithmeticException

    • c)

      long doMultipy(int, int) throws Java.lang.ArithmeticException

  • 4)

    Write a Java class JSimpleCalculator.java that implements the interface defined in ISimpleCalculator.java and provides a user interface for:

    • a)

      Specifying which computation (add, sub, mul) is desired.

    • b)

      Specifying the operands to the computation.

    • c)

      Displaying the result of the computation (can be an error).

  • 5)

    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.


Document info
Document views168
Page views169
Page last viewedSat Oct 22 19:44:18 UTC 2016