YOUR FEEDBACK
Robert Z. Cashman wrote: I'll be the first one to cry foul once someone does something wrong with the pat...
Cloud Computing Conference
March 22-24, 2009, New York
Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TODAY'S TOP SOA & WEBSERVICES LINKS


Exploring XML Schema Styles Using JAXB in Enterprise Applications
Choose the right XML Schema for your enterprise applications

Code-generation tools are capable of significantly impacting productivity and are now an essential part of a developer's tool set. There are two categories of transformation tools: those whose output is used by software components, and those whose output is used by developers. With tools that generate output for developers, it becomes important to properly design the input to these tools so that the output is comprehensible and usable, and the input is maintainable by developers. Java Architecture for XML Binding (JAXB) is one such tool that takes an XML Schema file as input, and transforms this input into a Java class model that is usable directly by a developer. Since an essential part of any application is its information model, it becomes important to properly design the XML Schema so that the generated class model is comprehensible and usable, and the schema itself is maintainable and reusable.

This article explores various styles for designing XML Schemas and assesses each style in terms of certain quality attributes. Figure 1 shows how an information model is transformed to a class model using JAXB, and shows which qualities of the artifacts should be assessed based on a set of quality attributes.

There are four XML Schema styles based on various combinations of the global and local scope of elements and complex types. The styles are assessed by evaluating how the JAXB output satisfies comprehensibility and usability concerns, and how well the XML Schema satisfies modifiability and reusability concerns. The JAXB component's quality is not assessed since its implementation is based on a standard and there is little variability in its behavior; once a developer learns to use it, its model behavior is predictable.

The Design Context
When designing an XML-centric application, two concerns need to be addressed:

  1. Functional Concerns - How to represent an information model, i.e., a data model or a UML class model, in XML using XML Schema so that any subset of the information model can be produced and consumed in a flexible and extensible manner, and the information model can be correctly represented in XML.
  2. Quality Concerns - How to design an XML Schema that is maintainable and reusable, and allows processing by a tool (JAXB) so that the generated output from the tool is comprehensible and usable by a developer.
The Quality concerns are the primary focus of this article, since the design of the XML Schema will be a significant contributing factor to how well quality concerns are satisfied. Figure 2 shows a design concern tree with the two main design concern paths and further subconcerns for each path. The functional concerns are primarily satisfied by the XML Schema specification, while the Quality concerns will be satisfied to varying degrees based on the XML-to-Java binding framework, and the design of the XML Schema used as input to the framework.

XML Schema Styles
XML Schema styles are based on various combinations of global and local scopes for XML Schema Element and Complex Type declarations. Table 1 shows the four styles.

Why is one style chosen over another? Normally, a developer may choose to use Style 1 <L, L> over Style 3 <L, G> simply due to level of knowledge and experience, lack of time, or simply a preference. However, each style will have different degrees of influence on the qualities of the XML Schema, and the resulting generated Java code. For example, maintainability of an XML Schema file will be significantly impacted based on what style is used, and comprehensibility of the resulting Java code will be sensitive to each style as well.

Quality Attributes for Evaluating XML Schema Styles
Figure 3 shows a tree view of quality attributes that will be used to assess the quality of the XML Schema and the generated class model for each XML schema style. This list is not comprehensive, but is only meant to be a starting point for introducing quality assessment of XML Schema styles in the context of code generation tools. Each quality attribute will be assessed simply as High or Low, so as not to get overly complex. Table 2 shows what High or Low means for each quality attribute.

When creating an XML Schema, element specifications and type specifications are normally defined separately since type specifications represent pure business domain entities, and element specifications represent roles of their underlying type.

Example
First, a business object model (BOM) is described that shows the key business entities and relationships. Then the BOM is specified in XML Schema using each of the four styles discussed earlier. Each XML Schema is then input into JAXB to generate a class model, whose UML representation is presented as well. Each style's XML Schema and generated class model are assessed using the quality attributes.

Business Object Model
Figure 4 shows an example business object model. This model shows simple aggregate associations, e.g., Customer to Order, and multiple associations between two entities with different roles, e.g., Customer to Address. In order to understand the dynamics among the XML Schema, JAXB transformation, and generated class model, the model was kept simple, hence it leaves out self-relationships and inheritance.

Listings 1 to 4 and Figures 5 to 8 show a representation of the object model in XML Schema using the four styles, and their corresponding generated JAXB class models, respectively.

Assessing the Styles
Based on the example analyzed above, quality assessment of each style is summarized in Tables 3 and 4. For the XML Schema quality, styles 2 and 4, the ones with global complex types, offer the highest modifiability and reusability, and style 3 and 4, the ones with global complex types, have the highest flexibility. For the generated class model, style 2 has the highest simplicity, while any style with at least a global element or complex types has a high structural affinity.

About Pushkar Varma
Pushkar Varma is an IT architect with IBM Global Services whose interests include application architectures, architecture assessment methods, Web application development using Web services and J2EE, and rich clients using Eclipse.

YOUR FEEDBACK
XML Journal News Desk wrote: Exploring XML Schema Styles Using JAXB in Enterprise Applications. Code-generation tools are capable of significantly impacting productivity and are now an essential part of a developer's tool set. There are two categories of transformation tools: those whose output is used by software components, and those whose output is used by developers. With tools that generate output for developers, it becomes important to properly design the input to these tools so that the output is comprehensible and usable, and the input is maintainable by developers. Java Architecture for XML Binding (JAXB) is one such tool that takes an XML Schema file as input, and transforms this input into a Java class model that is usable directly by a developer.
XML JOURNAL LATEST STORIES . . .
A round-up of the many themes and topics of interest to infrastructure architects, developers and IT managers featuring at SYS-CON's Cloud Computing Expo being held November 19-21, 2008 at The Fairmont Hotel in San Jose, California. The conference is expecting a record turnout of senio...
SYS-CON Events announced today that the leading global SOA, Virtualization, Cloud Computing and Open Source technology provider FreedomOSS named "Gold Sponsor" of SYS-CON's SOA World Conference & Expo which will take place November 19-21, 2008, at the Fairmont Hotel in the heart of Sil...
Cloud Computing offers significant benefits over traditional solutions for deploying production systems as well as for conducting development and testing activities. This session will distill the unique characteristics of clouds and describe how to best think about deployments in the c...
Intel has just released Intel XML Software Suite 1.2. This latest release helps maximize XML performance, while minimizing the effort for any Enterprise, SOA, SaaS, and Web 2.0 based applications. Intel XML Software Suite 1.2 optimizes XML application performance, takes full advantage ...
SYS-CON Events announced today that the leading global SOA, Virtualization, Cloud Computing and Open Source technology provider Intel named "Gold Sponsor" of SYS-CON's SOA World Conference & Expo which will take place November 19-21, 2008, at the Fairmont Hotel in the heart of Silicon ...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS


ADS BY GOOGLE