BASICS OF ADF

Monday, October 25, 2010

| | | 0 comments
                                ADF

Architecture:
                                         
                                          

                                      MVC Architecture Cleanly Separates UI, Business Logic and Page Navigation

Ø       Model layer represents the data values related to current page.
Ø       View layer contains UI pages used to view or modify the data.
Ø       Controller layer process the user inputs and determines the page navigation.
Ø       Business service layer handles data access and encapsulates business logic.

The core module in the framework is Oracle ADF Model layer. The Oracle 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 a Fusion web application technology stack are:

Ø       Oracle ADF Business Components, which simplifies building business services.
Ø       Oracle ADF Faces rich client, which offers a rich library of AJAX-enabled UI components for web applications built with Java Server Faces (JSF).
Ø       Oracle ADF Controller, which integrates JSF with Oracle ADF Model. The ADF Controller extends the standard JSF Controller by providing additional functionality, such as reusable task flows, that passes control not only between JSF pages, But also between other activities, for instance method calls or other task flows.

In Addition to JSF oracle also supports using the Swing, JSF, standard JSF view and MS Excel.



                                                      Simple Oracle ADF Architecture

ADF Business Components
                                        
                                                  When building service oriented java EE applications, you implement your core business logic as one or more business services. These backend services provide clients with a query, insert, update and delete business data as required while enforcing business rules.ADF business components are a prebuilt application objects that accelerate the job of delivering and maintain high performance, rich functional, and database centric services.
They provide you with a ready to use implementation of java EE design patterns and best practices.

  • ENTITY OBJECT
                                    EO represents row in a data base table. Simplifies DML for you.
Encapsulates business logic. you can associate EO with other EO to reflect the relationship in the underlying schema.

  • VIEW OBJECT
                                 VO object represents a SQL query and simplifies working with its result .you use SQL language to sort, aggregate, filter data into the shape required by end user.
When end user modifies data in the user interface, VO collaborates with EO to consistently validate and save the changes.

  • APPLICATION MODULE
                                               AM is transactional component that UI clients use to work with application data. It defines an updatable data model along with top level procedures and functions (called service methods) related to logical unit of work related to an end user task.



                            ADF Business Components Simplify Data Access and Validation

ADF Model Layer
                     In the model layer, Oracle ADF Model implements the JSR-227 service abstraction called the data control. Data controls abstract the implementation technology of a
Business service by using standard metadata interfaces to describe the service’s operations and data collections, including information about the properties, methods, and types involved. Using JDeveloper, you can view that information as icons that you can then drag and drop onto a page. At that point, JDeveloper automatically creates the bindings from the page to the services. At runtime, the ADF Model layer reads the information describing your data controls and data bindings from appropriate XML files and implements the two-way connection between your user interface and your business service.
Oracle ADF provides out-of-the-box data control implementations for the most common business service technologies. Using JDeveloper and Oracle ADF together provides you with a drag-and-drop data binding experience as you build your user interfaces. Along with support for ADF application modules, ADF Model also provides support for the following service technologies:
  ■ Enterprise JavaBeans (EJB) session beans and JPA entities
  ■ JavaBeans
  ■ Web services
  ■ XML
  ■ CSV files

ADF Controller
                                   In the controller layer, where handling page flow of your web application is a key concern, ADF Controller provides an enhanced navigation and state management model on top of JSF.jdeveloper allows you to declaratively create task flows where you can pass control between different types of activities such as pages and methods on managed beans, case statements, or calls to another task flows.

ADF Faces Rich Client
                                 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.
At a high level, the declarative development process for a Fusion web application
Usually involves the following:
■ 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.
■ 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.
■ Creating use cases: Using the UML modeler, you can create use cases for your application.
■ 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.
■ 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.
■ Creating business components to access data: From your database tables, you
create entity objects using wizards or dialogs. From those entity objects, you create the view objects used by the pages in your application. You can implement validation rules and other types of business logic using editors.
■ Implementing the user interface with JSF: JDeveloper’s Data Controls panel contains a representation of the view objects 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 data bound, you use the Component Palette to drag and drop components.
JDeveloper creates all the page code for you.
■ Binding UI components to data using the ADF Model layer: When you drag an object from the Data Controls panel, JDeveloper automatically creates the bindings between the page and the data model.
■ Incorporating validation and error handling: Once your application is created you use editors to add additional validation and to define error handling.
■ 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.
■ 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.
■ Deploying the application: You use wizards and editors to create and edit deployment descriptors, JAR files, and application server connections.

Building a Single VO CRUD Model layer

Saturday, October 23, 2010

| | | 0 comments
ADF is a fairly new framework for many developers. The best way to learn any new framework is to see a basic example running. In this post i have come up with a single VO (Emp) CRUD operation model layer project. I think it would be easy for newbies to get started after following this viewlet.
A simple ADF application contains 2 projects: Model and ViewController (MVC).
A model project contains BC4J objects: Entity Objects,View Objects and ApplicationModules.
An Entity Object is a row from a DB table. It is synonymous to an EJB entity bean. A ViewObject represents a collection of Entity Rows in memory. It can be compared with a EJB Session bean. An application Module is a special Session bean which provides important functionality to the BC4J objects like transaction, session management, activation, passivation etc. It is the interface through which all the business logic is exposed for the UI layer to consume. Its much like a sessionFacade in a typical EJB model layer.

Jdeveloper provides an integrated Swing client to test an AM. Its called the Business Component Browser or simply, AM tester. This gives a very important feature for developers to test the integrity of model layer separately.
Refer the ADF developer guide for more details : http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/toc.htm

Click on the image to see the viewlet..



(Note: If you have resolution problems, right click and zoom in. View in Full Screen and navigate through the tutorial using the Green buttons)

I hope this will help anybody to bring up a simple ApplicationModule and compare it with any other Framework such as EJB beans or Hibernate POJOs.

The next topic will be ADF Single VO CRUD UI layer. Stay tuned...