Java Platform, Enterprise Edition

Java EE Journal

Subscribe to Java EE Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Java EE Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


J2EE Journal Authors: Jeremy Geelan, Zakia Bouachraoui, Douglas Lyon, Stackify Blog, APM Blog

Related Topics: Java EE Journal

J2EE Journal: Article

Maple Leafs Score on WebSphere's Midmarket "Power" Play

Maple Leafs Score on WebSphere's Midmarket "Power" Play

Can you build a custom dynamic Web content management solution and a high-performance dynamic professional sports Web site from scratch on J2EE in a short period of time? Oh yes, it must have Fortune 500 sophistication and be delivered within a midmarket budget. Impossible? Well, that's exactly what Braegen Group, Inc. (www.braegen.com), a Toronto-based e-business solution provider, recently accomplished for Maple Leaf Sports & Entertainment Ltd. (MLSE), owners of the Toronto Maple Leafs hockey team. Braegen's breakthrough Web content management software, called Oriel, is among the first software products in the market to take advantage of "Power Servlets," the servlet middleware technology from Espressiv, Inc (www.espressiv.com).

Formed in 1927, the Toronto Maple Leafs is one of the NHL's oldest and most decorated hockey teams. Leaf fans are fiercely loyal, hoping for a chance to celebrate the return of Lord Stanley's Cup to Toronto this year. And with their anticipation comes the need to know all the latest stats, standings, and lineup details. For Leaf fans, www.mapleleafs.com is the source for all of the up-to-the-minute action and post-game analysis.

MLSE faced a dilemma. Administering the site was challenging because content revisions happened constantly - and only the site administrator could make changes. As a result, with numerous departments within the organization creating contributions to the site, the site administrator was often backlogged with requests. MLSE wanted a Web content management solution that would be easy for staff members to use and that would allow them to dynamically and directly publish content in real time.

MLSE turned to Braegen to create an integrated Web content management solution and redesign the entire Web site. They wanted a Web site that would be easy to maintain, and would allow internal departments with little technical knowledge the ability to update content. MLSE also wanted a simple and productive system to manage the massive amounts of constantly changing content on the site. Added to the requirements was the fact that the NHL season was under way; Leaf fans could not be left without access to real-time Leafs stats and stories.

To meet these requirements, Braegen designed Oriel, a dynamic Web content management system. It featured an in-line interface that presents users with the actual Web-page template with content management functions (i.e., replace an image, update a cover story, or add a new page). This graphical interface allows contributors with little training or technical skills to become productive. In addition, Oriel needed to be flexible enough to be extended with minimal effort as new features are required.

Power Servlet Technology Achieves
New Levels of Price-Performance

The challenge was to deliver a sophisticated Web content management system and improve the performance and stability of the Web site. Braegen first selected a low-cost but scalable platform suitable for MLSE that included WebSphere Application Server Express, DB2, and Linux. Then, after exploring conventional architectural approaches, Braegen's architects chose to use Power Servlet middleware technology to simplify and streamline application development and provide a higher level of software agility. "The simplicity, productivity, and flexibility of Power Servlets allowed us to build Oriel rapidly but without sacrificing any of the sophistication that MLSE requested," said Morgan Smyth, president and CEO of the Braegen Group Inc. "The reaction to Oriel from MLSE and other prospects has been so tremendous that we are now offering it as a commercial product. And by choosing Power Servlets to develop with, we are able to customize Oriel for new customers at a fraction of the cost."

"The Power Servlet is an innovation whose time has come," said Matt Puccini, president of Espressiv. "The complexity of the middle tier has slowed J2EE adoption by millions of skilled programmers and inflated project schedules and costs. Power Servlets introduce a stateful, structured middleware solution that sets new levels of simplicity, productivity, quality, security, agility, and maintainability for J2EE control programming. We forecast tremendous growth in Power Servlet deployments in 2003, driven by the need for next-generation software products like Oriel."

IBM has been working closely with Espressiv to integrate Power Servlets into WebSphere Studio tooling as a "Perspective" and is introducing the technology to partners and customers at numerous WebSphere Road Shows. "We are pleased that Espressiv has embraced IBM WebSphere software as a strategic platform for Power Servlets," said IBM's Scott Hebner, director of WebSphere marketing. "Power Servlets work with WebSphere to offer our customers an easy-to-use programming environment that streamlines Web application development."

Where Did Power Servlets Come From?
Bruce Cichowlas, the inventor of the Power Servlet, is no stranger to technology innovation. After graduating from MIT at 19, Bruce joined the original Lotus Notes development team and from there went on to invent the sophisticated technologies behind the Kurzweil piano keyboard. "Power Servlets came to me two years ago when I tried to design a Java-based music Web site for my teenagers to build," said Cichowlas, Espressiv cofounder and vice president of R&D. "The complexity I encountered drove me to come up with a simpler approach so that my kids could build it themselves." The result was the Power Servlet, an entirely new middleware for Web applications.

"J2EE is an incredibly open, robust, and scalable platform. But it is also incredibly complex from an application developer's perspective," said Bill Hughes, another Espressiv cofounder and vice president of product development. "The reason is simple: the Web was never designed for building and maintaining enterprise applications. What J2EE needs is a new kind of middleware that removes the burden of state management complexity from developers and architects."

What's the Difference Between a Servlet and a Power Servlet?
Servlets were designed as a page-centric processing model for Web applications. For example, when a user fills out a form and submits that information, a servlet is responsible for processing the information on that page, storing any information from that page that is required by another page (this information defines the application "state"), and displaying the next page to the browser. Servlets give developers a very fragmented, rigid, and fragile model for pulling together application components. Developers must piece these hundreds of small programs together themselves, or use a framework, which is often equally rigid (though maybe faster). Certain methodologies, such as M-V-C, provide a model to guide developers to best practices that make it easier for one developer on a team to build applications using similar structures, yet many developers feel that a richer solution is required to simplify the servlet/controller tier, particularly as users are demanding more sophisticated application functionality.

Power Servlets are stateful, modular application "controllers" that can handle multiple page flows (such as a wizard or master-detail) from a single program. They automatically manage state, providing a simple, intuitive way to integrate the components of a Web application: Web pages, beans, EJBs, Web services, databases, and legacy assets.

The result is that control coding is reduced by up to 90%, making it easier to design, build, modify, and maintain applications. This means that any developer with traditional structured programming skills can write well-architected applications on the J2EE platform.

Power Servlet programs are written using a Java IDE or code editor with a development tool called Presto for Power Servlets, and then converted at runtime (similar to JSPs) into a set of instructions that tell the Power Servlets which J2EE resources to invoke. Because programmers write these instructions in Java, they can employ ordinary programming constructs to dramatically simplify the complexity of J2EE.

To better understand the power of Power Servlets, let's look at a familiar example: the Java Pet Store.

Power Servlets In Action:
The Java Pet Store

Using Power Servlets, the now-famous Pet Store application can be decomposed into two kinds of Power Servlet classes: an event controller and several event-handler controllers. In this example, we will look at the shopping cart controller.

EVENT CONTROLLER
The Java Pet Store application is typically implemented with an event controller responsible for translating end user actions (clicking a link or a button) into a program event. This event controller can be implemented as a single Power Servlet method, called "main()" in Listing 1. This main method reflects the top-level logic for the entire application.

Very simply, this Power Servlet implements the following logic:

  • Initialize the database connection and query file (used by the Data Set class later).
  • Set the first application action as the login() method in the Power Servlet called "Security".
  • Start an event control loop that involves the Power Servlet method representing the next user-requested action (e.g., "doCart"). Note that this action, because it is a Power Servlet class, can implement user work flows that span multiple page displays, such as login() or doCart().
  • If the requested action is "logoff", then exit the application.

    One breakthrough feature of Power Servlets is that user interactions are represented as method calls that return control to the calling program. This is revolutionary for developers, so let's look at a simple example.

    In Listing 1, if the esp.invoke() call fails (for example, if the program attempts to execute a Power Servlet method that doesn't exist), the main() method will execute the statement

    esp.showMessage("Error! invalid action: " + next);

    This statement does two important things: first, it forwards the page ShowMessage.jsp (a template message page) to the JSP engine, substituting the string argument as the message on that page. Then it waits until the user has submitted another request for the PetStore Power Servlet. When that request is received, the program executes the next logical statement (in this case it checks to see whether the next action is "logoff").

    To developers who know J2EE and the Web, this is magic. To developers just learning Web development, it's very natural. Why is it magic to the experienced Web developer? Because the Web in general - and J2EE in particular - does not let a program display a user page and then continue execution of that same program. That is a fundamental limitation of the current servlet tier from the standpoint of application architectures and developer productivity. It breaks the structured programming model.

    However, Power Servlets fix that problem by implementing the magic of "freeze-drying," a patented method for halting and resuming the execution of programs that preserves the J2EE scalability model. This means that your application no longer needs to be designed around the limitations of the servlet tier. Rather, it can be written the way you were taught in Programming 101: modular, top-down, coherent, and object-oriented.

    SHOPPING CART CONTROLLER
    Unlike the event controller main(), the Power Servlet method doCart() is an event handler controller. It handles user requests to "Add to Cart" or "View Cart". The logic is straightforward:

  • First, doCart() creates a FormPage object, which allows the Power Servlet to treat the JSP page for the cart like a JavaBean. This means that there is much less logic in the JSP page - it can focus on simply formatting the user controls and data, and taking user input.
  • The "while" loop keeps users processing the cart, unless they indicate that they are finished and want to do something else.
  • The page is loaded with data from the Cart object.
  • The page is displayed to the user.
  • The user actions are captured via the getButtonUsed() and getButtonUsedIndex() methods of FormPage. The Power Servlet decides what action to take based on the button selected - remove a cart item, update cart information, show detail on a cart item.
  • Unless the user requests to perform another action, the Cart.jsp page is redisplayed with its particular view updated based on changes to the Cart object.
  • doCart() is called from main(), so when it completes, it returns control to main().

    Listing 3 shows the fragments of Cart.jsp that define the FormPage controls (text fields, arrays, and buttons using the FormPage tag library provided with Presto).

    Developing Applications from the User's Perspective
    Another important characteristic of Power Servlets is that they allow developers to program from the user's perspective. For example, the doCart() or doCheckout() routines correspond precisely to the entire use case that the user describes for those functions. In ordinary servlet programming, the doCheckout() use case would have to be broken into several fragments: loadAndShowCartForReview(), handleCartReviewAction(), loadAndShowShippingPage(), handleShippingPageAction(), loadAndShowBillingPage(), handleBillingPageAction(), loadAndShowConfirmationPage(), handleOrderSubmission(), showOrderSubmissionApprovalPage(), showOrderSubmissionConfirmation(). These fragments cannot be abstracted into a higher-level user function such as doCheckout().

    The other user actions - whether they call a single page, require that page to loop (in order to implement validation, previous, and next buttons), or call multiple pages in sequence (such as "checkout" or "register") - can be implemented as modular Power Servlet methods as well. These methods can be implemented and tested by separate developers with no knowledge of one another, and then be immediately integrated and run.

    Presto for Power Servlets and WebSphere Studio
    Presto for Power Servlets is the development tool that is used in conjunction with WebSphere Studio and other popular Java IDEs/editors to create Power Servlets. Presto for Power Servlets includes a runtime dashboard, a powerful debugger, and foundation classes. The foundation classes are optional libraries that further simplify Web application development. They include:

  • FormPages: These expose a bean interface to your JSP page from your Power Servlet program. This enables a VB-like coding model for Web pages, cleanly separating Web page design, application logic, and data binding.
  • DataSets: These provide a generic data access object to manage SQL interactions. This eliminates the necessity of writing Java classes to interact with your database, accelerating the application development process.

    Presto for Power Servlets has an auto-compiler that generates XML-based instructions that tell the Power Servlet what J2EE resources to call - beans, EJBs, JSPs, Web services, or any other Java classes. It does not, however, need to generate Java source to be compiled and run on the application server. Instead, the Power Servlet uses these instructions to run Java classes and libraries that run on the application server.

    "Power Struts"
    Struts is a popular MVC framework, yet most developers need to add three important capabilities: workflow, security, and debugging - all features that are inherent to Power Servlets. For example, to add workflow to Struts, a developer can simply call a Power Servlet as a Struts action. The Power Servlet implements an entire workflow process (e.g., master-detail, wizard, or checkout), requiring no changes to the Struts architecture.

    Power Servlets also simplify the Struts configuration file, which was never designed to implement workflow. Power Servlets are workflows that are self-contained, coherent, and more secure. These flows can be tested, debugged, and analyzed centrally. JSPs implemented using Struts tag libraries don't need to be changed, although by using Power Servlets they can be simplified. Power Servlets can be incorporated immediately into new or exiting Struts implementations to get these benefits.

    Integrating Power Servlets into a Project
    While Power Servlets are revolutionary, they are not disruptive to your existing developer resources, business systems, or applications. Power Servlets provide for an incremental migration process.

    There are two ways to migrate to Power Servlets:
    1.   Extend existing functionality. Presto for Power Servlets (the development tool for creating Power Servlets) programs can be written to extend an existing J2EE Web application. For example, if a company wants to add a personalization interface to their e-commerce site, this interface could be written in Power Servlets instead of writing it using raw servlets and JSPs.

    2.   Replace application logic. Presto for Power Servlets programs can leave the components of a Web application - Web pages, beans, EJBs, database access - intact and simply replace the content-centric servlet programming that is hard to write, maintain, and debug.

    Espressiv offers a free evaluation license for Presto for Power Servlets that can be downloaded from www.espressiv.com.

    Leafs Success, Oriel Future Opportunity
    Coinciding with the pre-playoffs push, within the first three weeks of the new mapleleafs.com site going live, fan traffic increased by more than 60%. Through the new design, Braegen has been able to improve the site's download performance and stability significantly. "We think these statistics verify our design and approach with Oriel," says Smyth. "In addition to the rapid development, MLSE also realized the added benefits of increased performance, stability, and scalability." No doubt; and Oriel has made the management of mapleleafs.com. one of Oriel's greatest fans.

  • More Stories By Matt Puccini

    Matt Puccini is the president of
    Espressiv, a company dedicated to the creation of products that drive down unnecessary complexity and cost to substantially improve how distributed enterprise applications are developed and deployed.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.