Combine XML, Java, and SOA to address real business problems
Learn how and why Service-Oriented Architectures (SOAs), XML, and XMLBeans can play an important role in addressing real business problems, using the entertainment industry as a case study. This article isn't about code; rather, you'll learn how and why to use XMLBeans in any situation requiring XML.
Enterprise architects, faced with ever-increasing levels of software complexity, have zeroed in on Service-Oriented Architecture (SOA) as a means of overcoming system integration problems. Fundamentally, SOA is about improving business results by enhancing the working relationship between the business and information technology (IT).
SOA uses the request/reply design paradigm for both synchronous and asynchronous applications. In this approach, the logic and functionality of business applications is presented as a service. Application developers or system integrators can build applications by composing one or more services without knowing the services' underlying implementations. This approach lets you integrate virtually all of your IT resources, including isolated data and previously incompatible legacy systems.
In the SOA paradigm, providers and consumers communicate through messages. The messaging interface must be platform- and language-independent. Therefore, messages are often constructed using XML documents that conform to XML schema. Of course, application data is frequently stored in XML format as well.
XML provides a basic syntax that you can use to share information between different kinds of computers, different applications, and different organizations without needing to pass through many layers of conversion. XML is important because it supports the enterprise application integration effort by providing a common, standardized platform upon which to build an integration infrastructure.
XMLBeans allows you to use Java™ programming language with XML. Java programming language is an object-oriented language based on open, public standards. It's portable, robust and reliable. Because of these characteristics, it has been widely accepted and implemented in many industries, including entertainment. However, XML is not compatible with the Java programming language. XMLBeans is the best option for overcoming this impediment.
XMLBeans is used for XML data binding. XMLBeans lets Java applications take complete advantage of XML. XMLBeans uses XML Schema to compile Java interfaces and classes that you can use to access and modify XML instance data. Using this technology, you can compile an XML Schema into a set of Java classes that can:
- Use XMLBeans for all of the schemas encountered
- Access the XML data at whatever level is required
XMLBeans provides the following application program interfaces (APIs) for data binding:
- XmlObject: When Java classes are generated from an XML Schema, the Java classes are derived from the XmlObject API.
- XmlCursor: The XmlCursor API provides low-level access to the XML Infoset. It represents a cursor position in the XML instance.
- SchemaType: The XML Schema object model for the underlying meta information.
The XMLBeans compiler generates an object representation of an XML schema. This object representation is a set of generic Java classes and interfaces that represent the structure and constraints of the schema. When the Java classes and interfaces are generated, an XML instance document that conforms to the schema is bound to them. The binding process involves using the XMLBeans API to access the data in the actual XML instance document in an object-oriented fashion.
With the power of XMLBeans, you don't have to write all the code to work with XML. Instead, you can simply use the XML in your applications. Without XMLBeans, you would have to write code to consume and leverage every part of the schema. Think about it: XMLBeans generates the classes for the schema. Imagine the number of one-to-one, one-to-many, and many-to-many relationships you would need to manage. And using XMLBeans is as easy as 1-2-3:
- Install XMLBeans.
- Compile your schema to generate the Java Archive (JAR) file.
- Write code to bind an XML instance to the Java types representing your schema. Listing 1 provides a simple example:
Listing 1. XMLBeans is easy and simple to use
File xmlEntertainFile = new File("c:\entertain.xml");
// Bind the instance to the XMLBeans types that were generated.
EntertainDocument entDoc =
EntertainDocument.Factory.parse(xmlEntertainFile);
// Get and then print pieces of the XML instance.
Entertain ent = entDoc.getEntertain();
Entertain[] entArray = ent.getEntertainArray();
for (int i = 0; i <>
So, how does all of this work in the real world? Well, computing power has taken an interesting shift. With the spread of SOAs, more computing power has moved from the traditional hub-and-spoke model, in which high-powered servers form the hub, to a more peer-to-peer model, where the edges of the network combined have more total computing power than the servers at the center. The servers at the center really become just nodes in a network. With the growth of the Internet and high-speed Internet connections, the entertainment industry is going digital. Most, if not all, the new products are and will be sold and distributed digitally.
Believe it or not, the entertainment industry was one of the first to harness this shift in the computing paradigm with the infamous Napster. The entertainment industry continues to be in the vanguard, as demonstrated by the recent conference held by South by Southwest (SXSW, Inc.). SXSW is a private company based in Austin, Texas. They build and deliver conference and festival events for entertainment and related media industry professionals. Their recent conference (March 11-14, 2006) discussed the tools available for development and productivity employed by digital creatives and filmmakers. One of the panel discussions was dedicated to the developing use of XML in the industry: Looking for XML in All the Wrong Places. As they stated in their conference material, "Everyone wants to do everything with XML."
The movie industry, in particular, is enthusiastically embracing XML. The movie industry, having taken major steps towards standardizing their approach to the packaging and distribution of digital products to theaters and other entities, has included the use of XML as part of the process. In July of 2005, in an effort to standardize the digitalization of cinema, the Digital Cinema Initiatives (DCI) group, working in conjunction with members of the Society of Motion Picture and Television Engineers (SMPTE) standards committee, published a system specification for digital cinema that was agreed upon by the major studios. The standard includes the use of XML in areas such as packaging, file format, frame rate and timing, composition playlists, and packing lists.
Today, many new movie-industry-oriented applications are coming online, such as Apple's award-winning software, Final Cut Pro, which supports an open, standards-based XML Interchange Format. In Final Cut Pro, the XML Interchange Format describes every aspect of a project. Starting with clips, bins, and sequences, and moving on to edits, transitions, and effects, as well as color correction settings and keyframes, Final Cut Pro provides an avenue for developers and programmers to access the fine points of a film's design. The use of XML in Final Cut Pro provides an open, transparent, plain-text format that you can read and manipulate with a wide array of tools. Using the XML Interchange Format means the Final Cut Pro users can share comprehensive information about their projects with any application or system that supports XML, including database systems, network servers, HTML-based Web authoring tools, and graphics applications. It also means that Java-based applications can readily access this data using XMLBeans. It is now possible for developers to create Java-based applications that can be fully integrated with Final Cut Pro or build customized post-production conduits that can save significant time and money, all thanks to XMLBeans.
XMLBeans and industry distribution
Of course, after post-production, the most important consideration is distribution, without which there is no profit. The Internet, through agents such as Amazon.com, has become a critical component in the distribution of various forms of media products, such as DVDs, music of all types, and, of course, books. Amazon.com, although usually considered a book vendor, is in fact part of the entertainment industry's distribution network. Amazon Web Services (AWS), consisting of XML-based protocols, provides functions for directly accessing Amazon's technology platform and product data, ranging from retrieving information about a set of products to adding an item to a shopping cart, enhancing the performance of your application, or adding better search capability. Using AWS, you can directly access Amazon's powerful platform to enable and enhance your applications.
Amazon.com is not the only Internet distribution source for the entertainment industry. Entities such as Netflix.com are also part of the distribution network. Netflix uses Really Simple Syndication (RSS) feeds to provide access to their content. Developers can use the RSS feeds to create new and interesting ways of displaying the information that Netflix provides. And, of course, RSS feeds are not limited to Netflix. You find these XML-enabled documents on many sites, from news agencies to content providers.
As you can probably imagine, in addition to the huge benefits this new approach provides, this shift also brings to light significant issues surrounding Digital Rights Management (DRM) and piracy. As new distribution channels open, movie makers (studios, independent production houses, and the like) must be able to interact with all the parties that will buy their product, including theaters, television stations, rental providers, and pay-per-view providers. Several members of the industry are currently in discussions with e-commerce entities searching for profitable and secure ways to distribute their products using the newest and perhaps one of the most cost-effective distribution methods: the Internet. This interaction compounds DRM-related problems.
The key to using XMLBeans on a wide scale is establishing open XML standards that are adopted across the entertainment industry. (See Resources for more information about XML standards that are in the works for the industry.) However, if you do some development work in this space and have an XML standard that you code to (even if it's your own XML schema), you can leverage XMLBeans. As long as you use XML (standard or not), you can use XMLBeans to speed up your development, reduce the code that you must test and maintain, and generally achieve looser coupling and greater service orientation. As XML standards emerge in the DRM space, you can also leverage XMLBeans to enforce and work with the standard. Among the several technical benefits of XMLBeans listed in this and other articles, you'll see a consistent approach to the application of the DRM standard, thus helping streamline your deployments and the exchange of rights data with your partners, distributors, and customers. One upcoming standard in the DRM space is the Open Digital Rights Language (ODRL). You can download the XML schema from the ODRL site (see Resources).
To download the XML schema from the ODRL site, perform these steps:
- Download and install XMLBeans and a container into which you can deploy the code. (See Resources for articles that show you how to do this.)
- Retrieve the Expression Language Schema and the Data Dictionary Schema from the ODRL site, and then save the files into the container you created.
- Go to the XMLBeans Web site and generate the XMLBeans from the XML schema file. Select the option to keep the Java source files. The xmlTypes.jar file that's generated contains the classes that you'll need as you work with ODRL and XMLBeans.
Using XMLBeans has several other benefits. XMLBeans is probably the most mature XML-object-binding technology on the market today, and it's free. Overall, XMLBeans is definitely a tool you should consider when working with XML. With the rapid development of XML usage in the entertainment industry, one can readily see the advantages of XMLBeans in making XML content available to Java-based applications.
The entertainment industry uses XML at many levels and for many applications. Because Java programming language is the world standard object-oriented programming language, and XML has become the data format of choice, XMLBeans will quickly become the preferred Java-binding tool. Its ability to create the classes for Java development avoids duplication and saves time and money. Together, they provide an effective means to develop customer and vendor applications.
No comments:
Post a Comment