This chapter from BEA WebLogic Workshop 8.1 (Kick Start series, from Sams Publishers, by Albert J. Saganich, Jr., et al., 2004. ISBN: 0-672-32622-1) explores the WebLogic Workshop programming model and introduces enterprise application development.
WebLogic Workshop Application Development Basics (Page 1 of 7 )
WebLogic Workshop (WLW) is a full-featured development environment that allows developers to build enterprise applications, Web applications, individual components, Enterprise JavaBeans (EJBs), or any combination of these elements. This chapter explores the WebLogic Workshop programming model and introduces enterprise application development. Specifically, WebLogic Workshop allows you to:
• Create WebLogic Workshop applications.
• Create WebLogic Workshop projects supporting portals, integration, controls, EJBs, Web Services, and XML Schema.
• Create traditional Web applications using Page Flow for page navigation and Form beans for data gathering and display.
• Create portal applications that can be the basis for a custom look and feel as well as personalization and other portal features.
• Create integration applications that can be the basis for business process modeling, data transformation and integration, and multiparty orchestrated messaging.
• Create and use simple controls and Web services.
The WLW Programming Model and Structured Programming
Before you can develop applications with WebLogic Workshop, you must understand the Workshop programming model, shown in Figure 1. WebLogic Workshop applications are separated into a number of different layers. The topmost level of a Workshop application, the external interface layer, provides methods for accessing an application. Application functionality can be accessed traditionally, typically by using a browser, through portal or Web applications, or directly using Web services or business processes via Web services.
Figure 1 - The WebLogic Workshop programming model.
Business Process - For those unfamiliar with the term, a business process performs a well-defined set of business operations to complete some task. A business process definition is a programmatic construct that models a business process. WebLogic Workshop provides a mechanism for defining business processes in the Integrated Development Environment (IDE) known as a Java Business Process Definition (JPD). WebLogic Workshop business process definitions are discussed in Chapter 11, "Working with Workflows."
The second level of the model shows the controls layer. Web applications, portals, and other applications access resources or business logic using various controls. Controls, a new concept introduced with WebLogic Workshop 1.0 and improved greatly with 8.1, provide an abstraction layer that simplifies the process of working with Java 2 Enterprise Edition (J2EE) or custom resources. Controls are completely integrated into the WebLogic Workshop IDE, and much of the application code, regardless of what the application makes available, is dedicated to working with controls in one fashion or another.
Controls are a revolutionary step forward for application developers and component developers. For the consumer, controls provide both an IDE-based facade and a runtime behavior for accessing functionality. Workshop controls enable developers to access resources and business logic in a consistent, straightforward manner, as though the control is a simple Java object. Controls simplify interaction with resources by providing a common interface to all resources.
For the developer, controls are Java classes annotated with Javadoc tags that integrate seamlessly into WebLogic Workshop. These Javadoc tags, along with specific file extensions, allow WebLogic Workshop to recognize a class as a control. The developer of a control, whether the control is packaged with WebLogic Workshop or custom developed, makes a set of core functionality available via standard Java methods. At runtime, the WebLogic Server engine creates instances of the control during the consuming application's life cycle. The runtime engine sets up and tears down the background instance, as required. As a result, all the drudgery and issues of accessing J2EE resources are hidden behind the control interface.
JSR 175 As a Definition of Class Metadata - The use of Javadoc annotations to provide metadata is currently being standardized and reviewed as part of Java Specification Request (JSR) 175, "A Metadata Facility for the Java Programming Language."
The application developer needs to know only the simpler aspects of the Java language, and most method calls are handled in a sequential, rather than object-oriented, fashion. Figure 2 shows how workshop applications interface with controls. Annotations exist at the file, field, and method levels and apply to a variety of file types. Although WebLogic Workshop handles most annotations, knowing what annotations are and are not is helpful. These are the most common annotations:
@jc:<tagname>—Annotations for Java controls
@jpd:<tagname>—Annotations for Java business processes
@jpf:<tagname>—Annotations for Java Page Flows
@jws:<tagname>—Annotations for Web services
@common:<tagname>—Annotations for common features
Figure 2 - The WebLogic controls model.
WebLogic Workshop provides two specific control types: Java controls, defined with a .jcs extension, that developers write to provide business logic and access other controls for creating logical units of business functionality, and resource or extensible controls, defined with a .jcx extension, which act as wrappers for traditional J2EE resources. In either case, a control can be used in page navigation, Web services, business processes, or from within another control.
The lowest layer in the WebLogic Workshop programming model is the resource access layer. Resource controls are purchased from third-party vendors and used directly to access the functionality of resources based on the WebLogic Workshop wizards or to access J2EE functionality. WebLogic Workshop comes packaged with a large variety of controls, all ready to use directly out-of-the-box. Examples of packaged controls include the following, which are only a small subset of the available controls:
Database and Rowset controls providing support for easy access to existing databases
Message-oriented controls for simplifying interactions with messaging-oriented middleware, such as Java Messaging Service (JMS)
Business process (workflow) controls for defining and interacting with business processes
EJB controls designed to simplify accessing existing EJBs
Web services controls for creating and accessing existing Web services
Application view controls for simplifying access to underlying J2EE Connector Architecture (J2CA) adapters
Third-party controls, including controls provided by partners and other interested parties
Resource controls come in two types: those used directly by dropping instances into your application and manipulating their properties, and those that you custom-configure using wizards. The rowset control is an excellent example of a custom-configured (not "developed") control. Using the RowSet Wizard, you can specify the database schema and table you need to access, and the wizard creates a class that encapsulates all the logic to access the specified database table using java.sql.Rowset objects.
This chapter is from BEA WebLogic Workshop 8.1, by Albert J. Saganich, Jr., et al. (Apress, 2004, ISBN: 0-672-32622-1). Check it out at your favorite bookstore today. Buy this book now.