Most data access builders in IBM® WebSphere® Portlet Factory generate data in XML format (the IXml class internally). This XML format is required when creating a service provider model using the Service Definition and Service Operation builders. This sample shows how you can create a service provider from data that comes from Java Beans instead of XML. Once you have this provider, you get all the benefits of the provider/consumer architecture, such as automatic testing support, separation of data and presentation layers, and automatic support in the consumer model for high-level builders such as View & Form or Rich Data Definition.
There are two different implementations of the service provider in this sample, using different techniques for converting between Java and IXml. The BeanServiceProvider model uses the Java/XML Converter builder, BeanServiceProvider2 uses the IXml API directly.
Here are some of the techniques illustrated in this sample:
- Using the Java/XML Converter builder to handle the conversion between Java and IXml, and to generate a schema for the Bean structure (in BeanServiceProvider).
- Using the IXml API to convert between IXml and Java, with a schema defined in XSD file (in BeanServiceProvider2).
- In the consumer model, you can see the use of Data Field Settings to control field behavior for validation, formatting, and UI control.
- Also in the consumer model, the View & Form builder and Input Page builder are used to generate all the pages, including list, details, update, and create support.
Here are two screenshots of the running sample model, showing the list and update pages.
Notes on running the sample and prerequisites
Import the attached zip file into your project using the Import WebSphere Portlet Factory Archive command. The provider and consumer models are all in the samples/bean_service folder.
To download the sample, open the "Attachments" section below and download the bean_service_sample_2.zip.