Insurance Profile System using Java Architecture for XML Binding (JAXB) - Readme

Insurance Profile System using Java Architecture for XML Binding (JAXB)

Table of Contents

Overview of the Application

Java Architecture for XML Binding (JAXB) provides API and tools that automate the mapping between XML documents and Java objects. JAXB makes XML easy to use by compiling an XML schema into one or more Java technology classes. The combination of the schema derived classes and the binding framework enable one to perform the following operations on an XML document:

  • Unmarshal XML content into a Java object representation
  • Access, update and validate the Java representation against schema constraints
  • Marshal the Java representation of the XML content into XML content

JAXB gives Java developers an efficient and standard way of mapping between XML and Java code. Java developers using JAXB are more productive because they can write less code themselves and do not have to be experts in XML. Oracle provides comprehensive support for the latest XML standards including JAXB through its Oracle10g XDK. The JAXB class generator part of the Oracle10g XDK allows creation of Java classes based on the XML Schema.

Insurance Profile System

    Application Overview

    Insurance profile system is an application that allows storage and retrieval of customer profile information. Insurance profile information consists of customer information like customer id, name, gender, age, address, contact information etc. Insurance claim history is also part of the customer profile document. All this information is structured as an XML document. An XML schema defines the document structure. It makes use of complex types to merge the related information in a single complex type. Users can add and modify customer profile records. They can also add and delete claim information to and from the customer profile records.

    Technical Overview

    The User interface is based on the Java Swing API. The insurance profile information is taken from either of the two datasources, one is from the file system and the other is from the database. Note that only one datasource is active at any point of time. The data retrieved from the files is converted into Java Object using JAXB and File Input/Output stream APIs. Streamsource APIs are used for Marshaling and UnMarshalling the data from the database. The database information is specified in the application itself. An XMLType table in the database is used to store insurance profile records. Whereas in the case of the datasource being the file system, the records are stored as flat files. The figure below (Figure 1) describes the technical overview from a high level perspective:


    Flow image
    Figure 1.

    Listed below are the features provided by Oracle JAXB implementation as demonstrated in the application under consideration:

    • Usage of JAXB class generator
    • Usage of Marshaller and Unmarshaller classes
    • Marshalling and Unmarshalling from File and StreamSource
    • Using JAXB in conjunction with XMLType
    • Binding of XML Schema and Complex types
    • Using collection types in schema definition (Multiple claim information)
    • Unmarshal-time validation


User Notes with Screen Shots 

Back To Top

Install the application using the instructions in the "Installation and Configuration" section below. Once you have successfully configured the application, start up to see a screen as shown in Figure 1.1 below. This screen will prompt the user to choose either one of the datasources:

Screenshot1      

Figure 1.1: First Screen


When the user clicks the "Next" button with the default option of "File System" or after changing it to "Database", the user is asked to enter the location of the directory where the sample XML files are stored. This directory contains some sample records that are loaded in the application / database depending on the Data Source that user selects. Refer to Figure 1.2:

    Screenshot2

Figure 1.2
( Shown irrespective of the Data Source selection to load some sample records)


Here, enter/select the directory <SAMPLE_HOME>/xml where sample files are provided. If the option selected in Figure 1.1 was "File System" and user clicks on the "Next" button, then the user will be taken to the screen in Figure 1.4 with all the insurance records loaded from the sample files in the provided directory.

If the user selected the "Database" option from the screen shown in Figure 1.1 above and clicks the "Next" button, the user will be asked to enter the database connection information as shown in Figure 1.3 below: Note that files "profError1.xml"  and "profileError2.xml" are not valid and that is the reason you should see the error messages.

  Screenshot3    

Figure 1.3
( Shown only if the Data Source is database )

When the user clicks on "Next" button from the screen in Figure 1.3, the sample files from the directory provided in Figure 1.2 are loaded into the database table using the connection information provided in Figure 1.3. Then, the same insurance records in the database table are displayed as shown in the Figure 1.4 below:

  Screenshot4    

Figure 1.4

From the screen in Figure 1.4 above, users can update any of the insurance records and also create new records using the "New" button. To update any record, the user can modify the desired details and use the "Save" button to commit the changes to the selected datasource (either the file system or database). While updating a record, users can also edit the associated insurance claim record using the "Insert Claim" and "Delete Claim" buttons.

Note that the "Save" button saves only the current record that the user is working on. To update and save other records, apart from the one that is currently displayed on the screen, users can use the "Previous" and "Next" buttons to first move to the desired record and further update it.

The screen below in Figure 1.5 is displayed when the user selects the "New" button from the screen in Figure 1.4 above. Note that only "Save" and "Previous" buttons are enabled in this screen. The "Previous" button here can be used to move to the updateable records existing in the datasource whereas the "Save" button can be used to save the new record entered.

  Screenshot5    

Figure 1.5

At any point, users can view the XML for the current record using the menu option "View XML/XSD files". Also, users can go back to the main screen using the "Application" => "Home Panel" to go back to the first screen and change the datasource. To exit the application, the "Application" => "Exit" menu option can be used.


Dependencies

Back To Top
  • XML Developer's Kit (XDK) 10g
  • Oracle9i Database version 9.2.0.2 or later
  • JDK 1.4.2 or later is required to run this application

Installation and Configuration

Back To Top

Refer to Install.html present in the sample jar for step-by-step instructions on extracting files, installing and configuring the system to successfully run this application.

Description of Sample Files

Back To Top

The directory structure of the JAXBApp.jar is as shown below. JAXBApp is the top-level directory under which all the application files are stored.

Directory Files Description
JAXBApp\doc Readme.html This file.
Install.html This file has the instructions required to deploy and run the application.
otn.css Stylesheet used by the Readme file.
/images This directory contains images used in the Readme and Install files.
JAXBApp\src\oracle\otnsamples\orajaxb DBRecordHolder.java This class handles database storage and retrieval logic.
IProfileManager.java This is the interface that must be implemented by any class that wants to act as a datastore for this application.
MainFrame.java Main frame of the application.
Panel1.java This panel allows users to select the datastore.
Panel2.java This panel allows users to enter database connection details.
Panel3.java This panel allows users to select sample records directory.
Panel4.java This panel displays profile records in graphical format.
Panel5.java This panel displays Profile Record Schema definition.
Panel6.java This panel displays profile record XML documents.
RecordHolder.java This class handles file system storage and retrieval logic. 
JAXBApp\src\oracle\otnsamples\orajaxb\profile
Please note that these files are not shipped with the sample. The Oracle JAXB class generator generates these files.
Address.java Generated by the Oracle JAXB Class Generator.
This interface contains getter and setter methods for Address class that is contained in the Record object.
AddressImpl.java Generated by the Oracle JAXB Class Generator and contains the implementation of the Address interface.
Claims.java Generated by Oracle JAXB Class Generator. This interface contains getter and setter methods for Claims class  that is contained in the Record object.
ClaimsImpl.java Generated by the Oracle JAXB Class Generator and contains the implementation of the Claims interface.
Customer.java Generated by the Oracle JAXB Class Generator. This interface contains getter and setter methods for Customer class that is contained in Record object.
CustomerImpl.java Generated by the Oracle JAXB Class Generator
Contains the implementation of the Customer interface.

JaxbSchemaInfo.java Generated by the Oracle JAXB Class Generator. This class contains information about elements in the profile schema.
ObjectFactory.java Generated by the Oracle JAXB Class Generator. Factory class to generate instances of the classes generated by JAXB class generator.
Profile.java Generated by the Oracle JAXB Class Generator. This interface contains getter and setter methods for Profile  class that is contained in Record object.
ProfileImpl.java Generated by Oracle JAXB Class Generator. Contains implementation of the Profile interface.
Record.java Generated by the Oracle JAXB Class Generator. It has an empty interface definition.
RecordImpl.java Generated by the Oracle JAXB Class Generator. Implements the Record Interface.
RecordType.java Generated by the Oracle JAXB Class Generator. It has the setter and getter methods to access the complex types.
RecordTypeImpl.java Generated by the Oracle JAXB Class Generator. This class implements the RecordType interface.
jaxb.properties Generated by the Oracle JAXB Class Generator. This file specifies the context factory.
JAXBApp\images *.jpg Images used by the application.
JAXBApp\xml profile.xsd Insurance Profile XML Schema definition file.
*.xml
Sample XML files that represent profile records.




E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy