Tuesday 8 March 2016

Application Development Framework (ADF)

Application Development Framework


CONTENTS


  • Introduction
  • MVC Design Pattern
  • Why we need Struts
  • Overview of ADF Data Binding Concepts
  • Support for Existing and Emerging Standards
  • Example Master and Detail Page


Introduction


The new Oracle Application Development Framework (ADF) in Oracle JDeveloper 10g evolves our road-tested BC4J framework to a new level of flexibility and openness. By introducing a new "data control" abstraction for back-end business services and generalizing our existing data binding objects to support it, we've added a consistent and pluggable model layer to our J2EE application architecture. It is fully based on MVC design pattern.

MVC Design Pattern: 

In the late 1970s, when graphical user interfaces (GUIs) were being invented,software architects saw applications as having three major parts: the part that manages data, the part that creates screens and reports, and the part that handles interactions between the user and the other subsystems [Ooram].

In the early 1980s, the ObjectWorks/Smalltalk programming environment introduced this triumvirate as a development framework.

In Smalltalk 80 parlance, the data system is dubbed the Model, the presentation system is called the View, and the interaction system is the Controller. Many modern development environments, including Java’s Swing, use this Model/View/Controller (MVC) architecture


Originally, Model/View/Controller was a framework for building Smalltalk applications. The framework supported a triad of classes representing the application state, the screen presentation, and control flow—which it termed the Model, View, and Controller.


Why we need Struts 

Today’s web applications are critical components of the corporate mission. As always, development teams need to build applications in record time, but they have to build them right and build them to last. Java web developers already have utilities for building presentation pages, such as JavaServer Pages and Velocity templates. We also have mechanisms for handling databases—JDBC and Enterprise JavaBeans (EJBs), for example. But what do we use to put these components together? The answer for this question is struts. Struts is a frame work which follows MVC design pattern.

The centerpiece of Struts is an MVC-style Controller. The Struts Controller bridges the gap between Model and View. The framework also includes other missing pieces developers need to write scalable, leading-edge web applications. Struts is a collection of “invisible underpinnings” that help developers turn raw materials like databases and web pages into a coherent application.

Following Figure illustrates where the ADF Data Control and ADF Bindings fit into the overall ADF Model, View, Controller, and Business Services architecture. 

Figure 1: Oracle ADF Architecture for J2EE Applications

Overview of ADF Data Binding Concepts

The key data binding concepts in Oracle ADF are the following:

Data Controls

A data control abstracts the implementation of a business service, allowing the binding layer to access the data from all services in a consistent way.

Iterator Bindings and Control Bindings

Bindings are lightweight objects that decouple back-end data and front-end UI display. An iterator binding provides a consistent way to work with a collection of data objects supplied by a data control. Control bindings provide a standard interface for UI components to interact with an iterator's data or to invoke "action" methods for preparing model data and handling events. Bindings also expose key metadata to simplify building dynamic, multi-lingual user interfaces.

Binding Containers

A binding container is a named group of of related iterator and control bindings that you use together for a particular page (or panel) of your application. A binding container is also known as a "UI Model" since it provides the appropriate subset of model data for a specific UI.

Binding Context

The binding context provides the data environment for your application. It contains all of the data controls and binding containers that your application can access.

Following Figure illustrates how the concepts hang together at runtime. The application's binding context contains one or more data controls being used, as well as one or more binding containers that use them. Each binding container has one or more iterator bindings identifying the data collections used by a given page. Each iterator binding works with data from one particular data control. Binding containers also have one or more control bindings that support the UI controls in the page. Control bindings are related to an iterator when they are bound to data, or may be related straight to a data control if they are control action bindings, used to invoke custom data control methods.

  
Figure: UML Diagram of ADF Binding Runtime Classes

Support for Existing and Emerging Standards


ADF Bindings have been designed with Java standards in mind, so they are easy to use with any client technology that can interact with JavaBean's and the Java Collections Framework. For example, popular tag libraries like the JSP Standard Tag Library (JSTL) and those from the Jakarta Struts project now work seamlessly with Oracle ADF. You can use the standard Expression Language, common to both JSTL and JSP 2.0, to easily work with data from your business services in your Web pages. For rich client applications with Swing UI's, we've refactored our existing JClient bindings to extend the base ADF Bindings functionality with additional bindings needed by more sophisticated Swing controls like trees, spinners, sliders, and others.

ORACLE ADF EXAMPLE:

In this example we are going to see how we can construct master and detail Page by using ADF with struts. This application is going to use two tables.
1. Departments table
2. Employees Table

Open a new application workspace.
  

Change the application template to Web Application (Default).This allows us to specify the technology used in the application to simplify and personalize the environment according to the technology preferences.



Open a Business Component diagram.


Establish a connection to the Database and then select any two tables. In this case I have selected Departments and Employees tables.

Drag and drop of database tables onto a UML diagram can be used to create different types of objects with the same user experience.
This will generate the business component diagram with the relationships indicated in it. Select all and then right click.
Now select Default Data Model Components which are business components that collect data and present it to the client.








Open page flow editor which allows you to visually and declaratively define the flow of application. This can also be done by right clicking on the ViewController.

Drag and drop a Data Page from the component palette onto the screen.


Double click on the DataPage1 and then select dataPage1.uix to open a new UIX page.


Now open the data controls and double click on AppDataModuleControl and do the following steps. All previously created business services are exposed in the Data Control Palette
Then drag and drop the Employeeview2 onto the uix page which will give you the following page
Then change the names Master and Detail to the respective table names in the Property inspector by selecting the respective tables.

And repeat the same steps for another Datapage2 and select the Input form this time instead of one to many.

Then drag and drop the same onto the UIX page.
Then drag and drop a Page Link connecting datapage1 and datapage2 which shows the flow of the application.
Now right click on the dataPage1 and run the application.

This will generate the following screen.










No comments:

Post a Comment