Skip Headers

Oracle® Application Development Framework Development Guidelines Manual 10g Release 2 (10.1.2) Part No. B14362-02 |
| Library | Product | Contents

Previous | Next |

# 1 Introduction to J2EE Application Development in JDeveloper

The Oracle Application Development Framework (Oracle ADF), available with Oracle JDeveloper 9.0.5.1 and later, offers developers greater flexibility and openness when deciding how to implement the layers of a J2EE enterprise application. Oracle ADF brings "data control" abstraction to back-end business services (data sources) and generalizes Oracle's existing data binding objects to support it. These features of Oracle ADF give developers a consistent and pluggable model layer to the J2EE application architecture.

This chapter provides an overview of the ways in which Oracle ADF supports J2EE application development in JDeveloper.

## 1.1 Summary

- Introduction

- Considering the Application Architecture

- Partitioning Application Development in JDeveloper

- Speeding Development with Frameworks in JDeveloper

- Development Methodology in JDeveloper

  - Iterative Development and Visual Tools

  - Roles and Code Integration

- Proceeding with Application Development in JDeveloper

- Related Information

## 1.2 Introduction

This document addresses the enterprise application developer who wants to use JDeveloper to implement enterprise business solutions for the J2EE platform (Java 2 Platform, Enterprise Edition). Enterprise applications are built from various components that derive from standards-based technologies. As a J2EE-compliant development tool, JDeveloper supports building enterprise applications using these same standard technologies:

- JavaServer Pages technology to handle the presentation of the user interface

- Servlet and JavaBeans technology for the Apache Struts framework to manage the application flow

- Enterprise JavaBeans to manage application state and define the business logic

In addition, JDeveloper extends the J2EE paradigm by giving developers alternatives to the standard technology stack. Developers can elect to work with a wide variety of technologies, as illustrated by the following diagram.

The purpose of this document is to show how developers can combine technologies to suit their particular application needs. Recommendations are made in the interest of ease of development and recognized best practices that exploit the design time of the JDeveloper IDE.

The remainder of this chapter describes the application development choices JDeveloper provides in more detail. These choices comprise best practices that can improve application reliability, increase your productivity, and decrease the overall time to deployment.

Where to find additional information:

- For information about JDeveloper IDE features that support team development, testing, and production deployment to the J2EE platform, see the JDeveloper help system. These topics are beyond the scope of the present document.

- For a list of J2EE-related learning resources, see Related Information links at the end of this chapter.

## 1.3 Considering the Application Architecture

The enterprise application is typically deployed across multiple servers to achieve its distributed component architecture. On the client side, the part of the application that users interact with, the application can be browser-based or it may be a standalone client based on Java Swing components. JDeveloper supports two databound web application user interface technologies and one standalone client:

- Standard JSP pages and HTML elements

- Oracle's own ADF UIX pages with its own set of ADF UIX user interface components

- Standard Java/Swing components with Oracle's own ADF JClient bindings

The JDeveloper IDE for building enterprise applications provides equal support for all styles of application clients. Screen designers, whether creating web pages or Swing forms, work with databound UI components through a single, easy-to-use design time tool, known as the Data Control Palette.

For the middle tier, several technologies are available in JDeveloper to help define the application's business logic. In the J2EE platform, Enterprise JavaBeans components provide the persistence layer for the application and manage transactions between the client and the back-end data store. However, in JDeveloper, business logic developers can choose to implement this functionality using a variety of technologies:

- Standard Enterprise JavaBeans components

- Oracle ADF Business Components technology, which implements many of the design patterns required by transactional applications

- OracleAS TopLink mapping objects based on JavaBeans components

Or when the middle tier need not support transactional operations (that is, when users can commit or roll back changes), the developer can provide data-access and method-execution operations to the view and controller layers using these technologies:

- Web services

- Standard JavaBeans components

All five of the above business services are accessible at design time through the JDeveloper Data Control Palette. Because data controls abstract business services, the Swing UI developer, the page designer, or the controller layer developer can work from a single, consistent design time regardless of the chosen technology stack.

Note: In JDeveloper, business objects that define the business logic are referred to as business services. The Oracle ADF model layer objects abstract the implementation of a business service and provide access to the application in a consistent way for all business services. As already mentioned, JDeveloper provides a range of available business services technologies that work out of the box with Oracle ADF.

The following section describes how you use these technology choices in JDeveloper to implement the application based on the Model-View-Controller architecture.

## 1.4 Partitioning Application Development in JDeveloper

The J2EE architectural design pattern for the interactive enterprise application is known as Model-View-Controller, or MVC. The MVC pattern is ideally suited for the kind of application that combines distributed application logic with a complex user interface. When developing applications based on the MVC pattern, the goal is to enforce separating or "partitioning" the application logic and the user interface.

In the most general terms, the model is the underlying logical representation, the view is the visual representation, and the controller specifies how to handle user input. When the data model changes, it notifies all views that depend on it. This separation of state and presentation results in these important characteristics of the enterprise application:

- Multiple views can be based on the same model. For instance, the same data can be presented in both table form and chart form. As the data model becomes updated, the model notifies both views and gives each an opportunity to update itself.

- Because models specify nothing about presentation, you can modify or create views without affecting the underlying model.

A view uses a controller to specify its response mechanism. For instance, the controller determines what action to take when receiving keyboard input. To accomplish this requires additional objects to pass information between the two layers, but the benefits are worth the effort. Having a clean separation between application layers at each tier makes it easier for the development team to divide roles and responsibilities.

In JDeveloper, the integration effort is minimized, since the design time helps establish the wiring between the model, the view, and the controller, as described in the following table:

Layer | Browser-Based Web Application | Java Client Application
--- | --- | ---
Model layer | A thin data binding layer, identical for web applications and Java clients, known as the Oracle ADF model layer, provides access to the business objects. In the web application, instances of the model layer are created by standard Struts action classes. | A thin data binding layer, identical for Java clients and web applications, known as the Oracle ADF model layer, provides access to the business objects. In a Java client application, instances of the model layer are created in Java code during a panel initialization.
View layer | HTML, Struts tags, and JSTL tags comprise the view layer in the JSP web application. JDeveloper also provides an alternative view technology, known as Oracle ADF UIX components. Both JSP and Oracle ADF UIX have full design time support that integrates them with the model layer. | Standard Swing UI components comprise the view layer in the Java client graphical user interface. JDeveloper provides design time integration with the model layer for Swing components and specialized composite widgets (like chart controls), known as JClient controls.
Controller layer | The Struts action servlet that dispatches incoming requests from the view layer to the appropriate action classes in the model layer. The Oracle ADF UIX technology is also fully integrated with the Struts controller. | Standard Swing UI components serve the role of the controller layer in the Java client. Again, JDeveloper provides design time integration with Swing components.

The following section provides more detail about the technology stack available with Oracle ADF.

## 1.5 Speeding Development with Frameworks in JDeveloper

Frameworks make sense for developers because developers can write code based on well-defined interfaces. This is largely a time-saving benefit, but it also makes sense in a J2EE environment because J2EE frameworks provide the necessary infrastructure for the enterprise application. In other words, J2EE frameworks make the concepts expressed in the J2EE design patterns more concrete.

One example of a J2EE framework already familiar to many web application developers is the framework available from Apache Software Foundation, known as Struts. Web application developers currently work with the Struts framework to manage the flow of their application. Simply, JavaBeans technology and declarative definition files define the Struts framework. The framework provides the web application view layer with a single, centralized point of access for request handling.

Another such framework, also provided with JDeveloper, is the Oracle Application Development Framework (Oracle ADF). In its entirety, Oracle ADF provides you with the means to easily create the business services, the model, the controller, and the view layers. The full stack of Oracle ADF looks like this:

The salient point when using Oracle ADF is that you may use the framework components in their entirety, or you can elect to use just the Oracle ADF model layer, just the Oracle ADF UIX view, or just the Oracle ADF BC business services. In fact, JDeveloper places no restrictions on the Oracle ADF framework technology usage. For example, JDeveloper makes it especially easy to integrate a non-Oracle ADF business service with the Oracle ADF UIX view technology. For the complete set of applicable J2EE technologies, see the illustration at the beginning of this document.

The glue that makes customization of the technology stack possible is the Oracle ADF model layer, represented in the diagram as the Oracle ADF data controls and data bindings. ADF Business Components in Depth describes the objects of that layer in detail. For now it is sufficient to understand that the Oracle ADF model layer places no restrictions on which view technology or which back-end business service to use. Further, because the Oracle ADF model layer is designed by Oracle as a thin integration layer, the Oracle ADF model objects provide data binding and other services without degradation of performance to the application.

The following section describes how the JDeveloper design time helps you to build seamless enterprise applications easily and transparently.

## 1.6 Development Methodology in JDeveloper

Oracle ADF and the JDeveloper design time support two high-level concepts of development: iterative development and division of labor. These concepts lay the foundation for the Oracle ADF best practices described in subsequent chapters.

Consider the demands of iterative development before examining roles-based development in more detail.

### 1.6.1 Iterative Development and Visual Tools

Developers approach a business problem by analyzing and dividing the task into its constituent parts. The team then proceeds to create the application's components, including model data abstractions, screens that the user will interact with, and code to manage the application flow. The development phase frequently progresses iteratively. That is to say, as the application grows, and the constituent parts become better identified, developers expect to be able to add new components to the application, for example, to address new functionality.

The finished result, created from diverse components, must function as a coherent whole. To allow you to work in this fashion, the tools of the IDE must be both highly visual and interactive. The benefit of getting immediate feedback that an addition was successfully integrated across layers is vital to creating robust applications. JDeveloper serves this need with a rich assortment of visual tools.

Tools such as Oracle ADF Business Components wizards, the Struts Page Flow Modeler, the JSP Visual Editor, and the Data Control Palette assist in iterative development because you can create an object in one layer and allow others to work with it in their own layers. For instance, the JSP or Oracle ADF UIX page created by the page designer will be accessible to the developer managing the application's flow control in the Struts Page Flow Modeler. Similarly, the objects of the business services are exposed to the Oracle ADF model layer through the Data Control Palette, which is refreshed to display items used to create data bindings for the UI components.

### 1.6.2 Roles and Code Integration

An additional demand for building enterprise applications is the need to support the development roles suggested by the model-view-controller paradigm. The model layer designer, for example, should decide what to expose from the model data, but the UI developer need not be concerned with how this is performed. Likewise, page flow control should be tightly integrated with the actual pages of the application, but the page designer should not have to write Java code for this purpose.

In the realm of web application development, where the model-view-controller paradigm is known as Model 2 to distinguish it from the early notion that pages might contain the flow control logic, the need for experts to work by roles has real merit. At this time, the Struts framework provides the integration mechanism that allows page designers to refer to page handler classes (Struts actions) in a declarative fashion. Similarly, in JDeveloper, the visual editor together with the Data Control Palette (the design time for working with the Oracle ADF model layer) simplifies binding UI components or Struts actions to data and methods. In the case of web pages, the result is easy-to-read binding expressions that appear as part of the markup language of the page itself (HTML elements, Struts form tags, or Oracle ADF UIX elements).

Overall, the JDeveloper design time permits developers to work across the model-view-controller areas, without requiring detailed knowledge of how the integration is accomplished.

## 1.7 Proceeding with Application Development in JDeveloper

To quickly become familiar with the full technology stack provided in Oracle ADF, continue reading this document. Here are some specific suggestions that may begin to address your application development questions:

1. Read Business Services and the Oracle Application Development Framework and determine which business services the business logic developers will be most comfortable creating when exposing the model data to the application. Each business service, including Oracle's own transactional technology, Oracle ADF Business Components, provides its own unique set of features and benefits.

2. Determine the style of application you want to create: one that uses JSP pages, Oracle ADF UIX pages, or Oracle ADF JClient for Swing forms. More information about each of these technologies can be found in Overview of Oracle ADF Data Binding in View Technologies dealing with the view layer.

3. If your application will be browser-based, and you are uncertain about whether or not to work with the Struts framework, read Overview of Oracle ADF Integration with Struts on the integration of Oracle ADF and the controller layer. JDeveloper supports Model 1–style application development when the Struts controller is not required. However, this document only addresses Struts integration.

4. In your browser, run the Quick Tour of the JDeveloper IDE for an overview of the available enterprise application development tools. The Quick Tour is accessible from the JDeveloper help system Getting Started topics.

5. In JDeveloper, create an application workspace based on a template that meets your application needs. The JDeveloper help system describes this technology-scoping feature in the Working with Application Design Tools topics.

6. Investigate typical use cases for your application in the end-to-end procedural documentation. The JDeveloper help system provides this information in the Working with Oracle ADF topics.

Once you have decided how to implement your application, selecting an application template or creating a custom template in JDeveloper will streamline the IDE and set up project folders with the appropriate standard libraries. The technology scope feature is particularly useful when the development effort is underway and limiting choices to the application requirements is desirable.

It is important to note that application templates and technology scopes, once selected, do not permanently remove tools and technologies from JDeveloper, nor do they prevent you from accessing the full list of technologies should you need to alter the chosen technology stack.

## 1.8 Related Information

Additionally, the following resources may be helpful when you wish to read more about J2EE and JDeveloper:

- For getting started information on the Oracle Technology Network, specifically for new users, see `http://www.oracle.com/technology/new/index.html`.

- For Oracle JDeveloper production information on the Oracle Technology Network, see `http://www.oracle.com/technology/products/jdev/index.html`.

- For the Oracle JDeveloper documentation page on the Oracle Technology Network, see `http://www.oracle.com/technology/documentation/9i_jdev.html`.

- For the Sun Microsystems home page for J2EE, see `http://java.sun.com/j2ee/`.

- For the Apache Software Foundation home page for Struts, see `http://struts.apache.org/`.