|Oracle® Fusion Middleware Java EE Developer's Guide for Oracle Application Development Framework
11g Release 2 (188.8.131.52.0)
Part Number E17272-03
|PDF · Mobi · ePub|
This chapter describes the architecture and key functionality of the Oracle Application Development Framework (Oracle ADF) when used to build a web application with session and entity beans that use EJB 3.0 annotations and the Java Persistence API (JPA), along with ADF Model, ADF Controller, and ADF Faces rich client.
This chapter includes the following sections:
The Oracle Application Development Framework (Oracle ADF) is an end-to-end application framework that builds on Java Platform, Enterprise Edition (Java EE) standards and open-source technologies to simplify and accelerate implementing enterprise applications. If you develop enterprise solutions that search, display, create, modify, and validate data using web, wireless, desktop, or web services interfaces, Oracle ADF can simplify your job. Used in tandem, Oracle JDeveloper and Oracle ADF give you an environment that covers the full development lifecycle from design to deployment, with drag and drop data binding, visual UI design, and team development features built in.
Figure 1-1 illustrates where each Oracle ADF module fits in the web application architecture. The core module in the framework is ADF Model, which is a declarative data binding facility. The ADF Model layer enables a unified approach to bind any user interface to any business service, without the need to write code. The other modules that make up the application technology stack aside from EJBs, are:
ADF Faces rich client, which offers a rich library of AJAX-enabled UI components for web applications built with JavaServer Faces (JSF). For more information about ADF Faces, refer to the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.
ADF Controller, which integrates JSF with ADF Model. The ADF Controller extends the standard JSF controller by providing additional functionality, such as reusable task flows that pass control not only between JSF pages, but also between other activities, for instance method calls or other task flows. For more information about ADF Controller, see the "Getting Started with ADF Task Flows" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
In addition to ADF Faces, Oracle ADF also supports using the Swing, JSP, and standard JSF view technologies. For more information about these technologies, refer to the Oracle Fusion Middleware User Guide for Oracle JDeveloper. Oracle ADF also provides support for using Microsoft Excel as a view layer for your application. For more information, see the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework.
Oracle ADF emphasizes the use of the declarative programming paradigm throughout the development process to allow users to focus on the logic of application creation without having to get into implementation details. Using JDeveloper with Oracle ADF, you benefit from a high-productivity environment that automatically manages your application's declarative metadata for data access, validation, page control and navigation, user interface design, and data binding.
At a high level, the declarative development process for a Java EE web application usually involves the following core steps:
Creating an application workspace: Using a wizard, JDeveloper automatically adds the libraries and configuration needed for the technologies you select, and structures your application into projects with packages and directories. For more information, see the "How to Create an Application" section of the Oracle Fusion Middleware User Guide for Oracle JDeveloper.
Creating the persistence model: From your database tables, you create EJB 3.0 entity beans using wizards or dialogs. From those beans, you create the session bean as the facade that will be used by the pages in your application. For more information about using JDeveloper with EJBs, see the "Developing with EJB and JPA Components" section of the Oracle Fusion Middleware User Guide for Oracle JDeveloper.
Creating data controls for your services: Once you've created your entity and session beans, you create the data controls that use metadata interfaces to abstract the implementation of your EJBs, and describe their operations and data collections, including information about the properties, methods, and types involved. These data controls are displayed in the Data Controls panel and can be dragged to pages to create databound UI components. For more information, see Chapter 2, "Using ADF Model Data Binding in a Java EE Web Application."
Adding declarative metadata to your data controls: You can augment your data controls with UI control hints, validation rules, criteria for use in search forms, and other features. For more information, see Chapter 3, "Adding Business Logic to Data Controls".
Implementing the user interface with JSF: JDeveloper's Data Controls panel contains a representation of the beans for your application. Creating a user interface is as simple as dragging an object onto a page and selecting the UI component you want to display the underlying data. For UI components that are not databound, you use the Component Palette to drag and drop components. JDeveloper creates all the page code for you. For more information, see the "Implementing the User Interface with JSF" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
For information about creating specific types of web pages, see the following in this guide:
Deploying the application: You use wizards and editors to create and edit deployment descriptors, JAR files, and application server connections. For more information, see Chapter 9, "Deploying an ADF Java EE Application."
The process of developing a Java EE application with Oracle ADF modules is very similar to developing a Fusion web application. The main difference is that a Fusion web application uses ADF Business Components for the back-end services. When the development process and procedures are the same for both application types, this guide refers you to the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework for that information.
Please disregard any information in the Fusion Developer's guide regarding ADF Business Components (such as entity objects and view objects). For similar information for EJB/JPA, refer to the "Developing with EJB and JPA Components" section of the Oracle Fusion Middleware User Guide for Oracle JDeveloper.
In addition to the above core steps for developing Java EE applications with Oracle ADF, JDeveloper provides tools for the tasks in the list below. These tasks are not covered in detail in this guide.
Modeling the database objects: You can create an offline replica of any database, and use JDeveloper editors and diagrammers to edit definitions and update schemas. For more information, see the "Modeling with Database Object Definitions" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Creating use cases: Using the UML modeler, you can create use cases for your application. For more information, see the "Creating Use Cases" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Designing application control and navigation: You use diagrammers to visually determine the flow of application control and navigation. JDeveloper creates the underlying XML for you. For more information, see the "Designing Application Control and Navigation using ADF Task Flows" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Identifying shared resources: You use a resource library that allows you to view and use imported libraries by simply dragging and dropping them into your application. For more information, see the "Identifying Shared Resources" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Securing the application: You use editors to create roles and populate these with test users. You then use a flat file editor to define security policies for these roles and assign them to specific resources in your application. For more information, see the "Enabling ADF Security in a Fusion Web Application" chapter in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Developing pages and applications to allow customization: Using the customization features provided by the Oracle Metadata Services (MDS), you can create applications that are customizable by customers yet still easily upgradable, create pages that allow end users to change the application UI at runtime, and create applications that are completely customizable at runtime. For more information, see the "Customizing Applications with MDS" and "Allowing User Customizations at Runtime" chapters of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Testing and debugging: JDeveloper includes an integrated application server that allows you to fully test your application without needing to package it up and deploy it. JDeveloper also includes the ADF Declarative Debugger, a tool that allows you to set breakpoints and examine the data. For more information, see the "Testing and Debugging ADF Components" chapter of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
As a companion to this guide, the Summit demo application was created to demonstrate the use of the Java EE and Oracle ADF web application technology stack to create transaction-based web applications. The demonstration application is used to illustrate points and provide code samples.
The Summit application requires an existing Oracle database. You run the Summit application using Oracle JDeveloper 11g Release 2.
Do the following before installing the Summit application:
Install Oracle JDeveloper. You need the Studio configuration of Oracle JDeveloper11g Release 2 to view the application's projects and run the application using the JDeveloper integrated server. You can download Oracle JDeveloper from:
Download the Summit application ZIP file (
Summit_JPA.zip). You can download the ZIP file from:
Download the Summit database schema (
Summit_Schema.zip). You can download the ZIP file from:
Install an Oracle database. The Summit application requires a database for its data.
The SQL scripts were written for an Oracle database, so you will need some version of an Oracle RDBMS, such as 11g, or XE. The scripts will not install into Oracle Lite. If you wish to use Oracle Lite or some other database, then you will need to modify the database scripts accordingly. You can download an Oracle database from:
Specifically, the small footprint of the Oracle Express Edition (XE) is ideally suited for setting up the database on your local machine. You can download it from:
To install and run the summit demo application, follow the instructions that are posted in the following document:
The Summit application consists of a business services project named
Model and a web user interface project named
ViewController. You run the Summit application by running the
ViewController project. The
ViewController project uses JavaServer Faces (JSF) as the view technology, and relies on the ADF Model layer to interact with the EJBs in the
Figure 1-2 shows the Application Navigator after you open the file for the application workspace.
Once you have opened the demo application's projects in Oracle JDeveloper, you can then begin to review the artifacts within each project. The
Model project contains the Java classes and metadata files that allow the data to be displayed in the web application. The
model package contains Java classes and the
DataControls.dcx file. The
persdef.model package contains data control structure files that contain declarative metadata for some of the beans in the
model package. Figure 1-3 shows the
Model project and its associated directories.
ViewController project contains the files for the web interface, including the backing beans, deployment files, and JSPX files. The Application Sources node contains the code used by the web client, including a managed bean and the metadata used by Oracle ADF to display bound data. The Web Content node contains web files, including the JSP files, images, skin files, deployment descriptors, and libraries. Figure 1-4 shows the
ViewController project and its associated directories.