Java 2EE and XML Development

Скачать в pdf «Java 2EE and XML Development»

6.7 Structuring application data

After reviewing the code for our application, the next step is to examine the data. We have intentionally left the structure of the XML simple so that you can follow the flow of data through the application. Listing 6.6 is the menu.xml file containing menu data for the application.

Listing 6.6 The menu.xml data file

<?xml version=»1.0″ encoding=»UTF-8″?>


List of initial menu oPtions


<machine id=»ominco4000″>Omnico 4000</machine> <machine id=»amaya»>Amaya Workstation</machine> <machine id=»computech»>Computech ATX</machine> <machine id=»xpad»>ACME xPad</machine> </machines>


Listing 6.7 is amaya.xml, which contains a detailed list of problems with the Amaya machine. Given the scope of our application, it is not necessary to validate these files against DTDs or XML Schemas. This would certainly be necessary in a production application. Additionally, a backup of the amaya.xml file should be made each time the list is updated using Amaya’s we
b service. In the event that the update fails, you can revert to the previous version.

Listing 6.7 The amaya.xml data file

<?xml version=»1.0″ encoding=»UTF-8″?>





<issue id=»0001″>Machine Is Not Receiving Power</issue> <issue id=»0002″>LCD Stopped Working</issue>

<issue id=»0003″>Abnormally Low Battery Life</issue> </issues>


6.8 The Amaya web service

Though we have completed our analysis and implementation of the RepairCo side of the case study, we are fortunate enough to have access to Amaya’s web service implementation as well. This web service provides Amaya resellers with access to the latest support information about its machines. This particular web service contains one stateless session bean (CommonIssuesBean) running in a J2EE container that returns the latest data from an XML document (amaya.xml) on the file system. This scenario is depicted in figure 6.9.

Скачать в pdf «Java 2EE and XML Development»