Sunday, 19 April 2015

How ADF Bindings Work


Before Learning about How ADF Data Bindings work, let us have a brief info on the following things:

Binding Context:
The ADF binding context is a container object that defines a hierarchy of data controls and data binding objects derived from the Oracle ADF model layer.


         
Binding Container:
Oracle defines Binding Container as “The BindingContainer contains the Control Bindings for a reusable unit of View technology”. But in simpler words it is a runtime representation of a view technology like pageDefintion file. The bindings are held in a request-scoped map called the binding container, accessible during each page request using the EL expression #{bindings}.
Some of the important methods provided by BindingContainer are:
getAttributeBindings:
java.util.List getAttributeBindings()
Return a list of all AttributeBinding and AttributesBinding in this RegionBinding

getOperationBindings
java.util.List getOperationBindings()
Return a list of all Action bindings in this RegionBinding.

Page Definition File:
Page definition files define the binding objects that populate the data in UI components at runtime. For every page that has ADF bindings, there must be a corresponding page definition file that defines the binding object used by that page. Page definition files provide design time access to all the ADF bindings. At runtime, the binding objects defined by a page definition file are instantiated in a binding container, which is the runtime instance of the page definition file.

ADF Data Control
The application module data control is a thin adapter over an application module pool that automatically acquires an available application module instance at the beginning of the request. During the current request, the application module data control holds a reference to the application module instance on behalf of the current user session. At the end of the request, the data control releases the instance back to the pool.
This optimized interaction allows the bindings to work directly with the application module instances in its data model in the following ways:
·         Iterator Bindings directly bind to the default row set iterator of the default row set of any view object instance. The row set iterator manages the current object and current range information.
·         Action bindings directly bind to either Custom methods on the data control client interface or built-in operations of the application module and view objects.

Different Types of Declarative Bindings
There are three basic types of Declarative Bindings:
·         Iterator Bindings:Simplify the building of user interfaces that allow scrolling and paging through collections of data
·         Value Bindings:Used by UI components that display data. Value bindings range from the most basic variety that work with a simple text field to more sophisticated list and tree bindings that support the additional needs of list, table, and tree UI controls.
·         Action Bindings:Used by UI components like hyperlinks or buttons to invoke built-in or custom operations on data collections or a data control without writing code.




Things to know about using Data Controls Panel
When we use the Data Controls panel, the listed points below are some of the things which get configured:
·         Create a DataBindings.cpx file in the default package for the project(If one does not already exist), and adds an entry for the page.
DataBindings.cpx file defines the binding context for the application. Each DataBindings.cpx file maps individual pages to the binding definitions in the page definition file and registers the data controls used by the pages.
·         Creates the adfm.xml file creates a registry for the DataBindings.cpx file, which allows the application.
·         Registering the ADF Binding Filter in web.xml file. The ADF Binding Filter pre-processes any HTTP requests that may require access to the binding context.
·         Creates the orion-application.xml file and adds a reference to the oracle ADF shared libraries needed by the application.

What is DataBindings.cpx and DataControls.dcx?
DataBindings.cpx file defines the binding context for the application. Each DataBindings.cpx file maps individual pages to the binding definitions in the page definition file and registers the data controls used by the pages.

The DataControls.dcx file is created when you register data controls on the business services. Note that this file is not generated for the Oracle ADF Business Components and Oracle ADF TopLink Mappings data controls. In those cases, the data control obtains the metadata directly from the generated services.

The DataControls.dcx file specifies the factory classes for a bean registered as an Oracle ADF data control. In the case of EJB, web services, and bean-based data controls, you can edit this file in the Property Inspector to add or remove parameters and to alter data control settings.

How Binding Context Works?
When a page contains ADF Bindings, at runtime the interaction with the business services initiated from the client or controller is managed by the application through a single object known as binding context.
The ADF Lifecycle creates the Oracle ADF Binding Context from the application module, DataBindings.cpx and page definition files.
We already know about databindings.cpx file and page definition files which have been explained above.




The Binding Context does not contain real live instances of these objects. Instead, the map contains references that become the data control or binding container objects on demand. When the object (such as page definition) is released from the application, for example when a task flow ends or when the binding container or data control is released at the end of the request, the data controls and binding containers turn back into reference objects.

1 comment:

  1. Its a good work Pankaj. Can u explain how the bindings will get updated in the concurrent users case.

    ReplyDelete