ADF Binding Internals - Oracle

42
ADF Binding Internals Shaun OBrien Shaun O Brien Principal Product Manager – Oracle Development Tools

Transcript of ADF Binding Internals - Oracle

Page 1: ADF Binding Internals - Oracle

ADF Binding Internals Shaun O’BrienShaun O BrienPrincipal Product Manager – Oracle Development Tools

Page 2: ADF Binding Internals - Oracle

Agenda

• ADF Model OverviewUnderstanding data controls• Understanding data controls

• Bindings at Design Time• Bindings at RunTimeBindings at RunTime

Page 3: ADF Binding Internals - Oracle

ADF Model Overview

Page 4: ADF Binding Internals - Oracle

Desktop Browser/ Mobile Devices

Oracle ADF 11g Architecture

JSP ViewJSF ADF FacesOfficeSwing

Struts

Model

Controller

ADFm (JSR 227)

JSF/ADFc

Business

ModelADFm (JSR 227)

Java EJB BAM BPEL ADF BC BI XMLWeb Services Services

Portlet Toplink JMXJCR

Relational Data XML Data Legacy Data

Data Services

Packaged Appsg y g pp

Page 5: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

Web Services

SOAP

Web Services

Java/RMI

POJO

Java/RMI

Page 6: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

ol

Web Services

SOAP

DF

Bin

di

Dat

a C

o

Web Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 7: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

ol

Web Services

SOAP

DF

Bin

di

Dat

a C

o

Web Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 8: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

ol

Web Services

SOAP

DF

Bin

di

Dat

a C

o

Web Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 9: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

ol

Web Services

SOAP

DF

Bin

di

Dat

a C

o

Web Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 10: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

olWeb Services

SOAP

DF

Bin

di

Dat

a C

oWeb Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 11: ADF Binding Internals - Oracle

Overview of ADF Model

JDBC

Database

ngs

ontr

olWeb Services

SOAP

DF

Bin

di

Dat

a C

oWeb Services

Java/RMIA

D

AD

F

POJO

Java/RMI

Page 12: ADF Binding Internals - Oracle

Understanding Data Controls

Page 13: ADF Binding Internals - Oracle

Data Control Concepts

• Uses standard metadata interface to describe the services’ operations and data collectionservices’ operations and data collection

• At design time, simplifies binding components to data control operation or data collection p

• At run time, wires business service data controls to UI bindings from XML files

• Has the following benefits:• You write less code.• You work the same way with any UI and Business ServiceYou work the same way with any UI and Business Service

technology.• You gain useful run-time features because you do not have to

code them yourself.code them yourself.

Page 14: ADF Binding Internals - Oracle

ADF 11g Built-in Data Controls

• ADF Business Components• Java class• EJB• URL (XML or CSV)• URL (XML or CSV)• Web service• PlaceholderPlaceholder• Add your own

Page 15: ADF Binding Internals - Oracle

ADF BC Data Control

Application Module

View Object

Client Method

Operation

Nested ApplicationModule

Page 16: ADF Binding Internals - Oracle

•<Insert Picture Here>DemoADF Data Controls

Page 17: ADF Binding Internals - Oracle

Binding at Design Time

Page 18: ADF Binding Internals - Oracle

What happens ?

Page 19: ADF Binding Internals - Oracle

ADF Data Bindings Concepts

• Bindings abstract the details of accessing data from the data collections and of invoking its operations

• Tree kinds of declarative bindings objects:• Tree kinds of declarative bindings objects:• Iterator bindings

• Tracks current row in a data collection• Value bindings

• Binds UI components to attributes values in a data collection

• Action bindingsUsed to in oke c stomer or b ilt in operations• Used to invoke customer or built-in operations on data collections

Page 20: ADF Binding Internals - Oracle

PageDef.xml FileThe key data binding artifact• The key data binding artifact• Accessable via Bindings tab in visual

editor or context menu on a pagep g• Describes service usage of a particular

page• XML content

• Default location controlled by ADFm SettingsSettings

• Runtime location determined by DataBindings.cpx

Page 21: ADF Binding Internals - Oracle

ADF Binding in the ADF Faces UI

Page 22: ADF Binding Internals - Oracle

Types of Bindings

• Attribute binding• Input text tem to a String valueInput text tem to a String value

• Tree binding• Table or tree to a data collection

• List binding• Exports a list of legal values, enabling the user to

l tselect one• Action binding

• Built in operation or custom method• Built in operation or custom method

Page 23: ADF Binding Internals - Oracle

Executables

• Link bindings to Data Controls• Iterator• Method iterator• Method iterator• Access iterator• Variable iteratorVariable iterator

Page 24: ADF Binding Internals - Oracle

What You Need to Know About Bindingsg• The may or may not be used by the UI• Accessed via the “bindings” object on the g j

HTTP request• Conventially via Expression Language

#{bi di E N }#{bindings.EmpNo}• #{bindings} provides access to

everything defined in the binding y g gcontainer/PageDef

• Attributes other than Value• #{bindings.Emps.rangesize}

Page 25: ADF Binding Internals - Oracle

Binding Objects in the Parameters Section

The parameters element of the page definition file defines the parameters for the page.defines the parameters for the page.

• Parameter binding objects declare the parameters that the page evaluates at the beginning of a request.

• Page parameters are evaluated once during the Prepare• Page parameters are evaluated once during the Prepare Model phase.

• Define the value of a parameter in the page definition file using:using: • Static values• Binding expressions• EL expressions that assigns

a static value

Page 26: ADF Binding Internals - Oracle

•<Insert Picture Here>DemoADF Binding

Page 27: ADF Binding Internals - Oracle

Bindings MetaData SummaryBinding Context

Structure D fi iti ( )

Binding Container Data ControlDefinition(s)*.xmlPage Definition(s)

*PageDef.xml

Data Control Description*.dcx

Binding Context DefinitionDataBindings.cpx

Page 28: ADF Binding Internals - Oracle

DataBindings.cpx File

• Provides the metadata from which the Oracle ADF binding objects are created at run time

• Uses XML syntax• <pageMap>• <dataControlUsages>• <dataControlUsages>• <pageDefinitionUsages>

Page 29: ADF Binding Internals - Oracle

DataBindings.cpx<?xml version="1.0" encoding="UTF-8" ?><Application xmlns="http://xmlns.oracle.com/adfm/application"

version="…" id="DataBindings" SeparateXMLFiles="false"Package=“oracle.demo.view" ClientType="Generic">

<pageMap><page path="/home jspx" usageId="homePageDef"/><page path /home.jspx usageId homePageDef /><page path="..." />

</pageMap><pageDefinitionUsages><page id="homePageDef" path="oracle.demo.view.pageDefs.homePageDef"/>

id /<page id="..."/></pageDefinitionUsages><dataControlUsages><BC4JDataControl id="AppModuleDataControl" Package="oracle.demo.model"

FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"SupportsTransactions="true" SupportsFindMode="true"SupportsRangesize="true" SupportsResetState="true"SupportsSortCollection="true"Configuration="AppModuleLocal" syncMode="Immediate"Configuration="AppModuleLocal" syncMode="Immediate"xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>

</dataControlUsages></Application>

Page 30: ADF Binding Internals - Oracle

Product DemonstrationExploring ADF Data Controls and p g

Binding

Page 31: ADF Binding Internals - Oracle

Bindings at Runtime

Page 32: ADF Binding Internals - Oracle

ADF binding responsibility

• Prepare model for page requestg• Query data• Insert – Update – Delete • Execute operations and methods• Manage row currencies

Si lif b i i th h i t t• Simplify business service access through consistent programming APIs

Page 33: ADF Binding Internals - Oracle

ADF Request Lifecycle

ADFBindingFilter

ADFPageLifecycle

ApplicationModule

ViewModel

JSFLifecycle

DataControl

Controller

BindingContext

BindingContainerJSF Module

Pool

Get Service instance or create newbeginRequest

Find or create Binding Context Find DataControl

Find Binding Container

ReadData

ReadData

Iterate modeldata

WriteData

WriteData

Render Response ReleaseserviceinstanceendRequest

Page 34: ADF Binding Internals - Oracle

ADF Faces ADF Model IntegrationServer SideServer SideJava EE Model

Business Service Data Binding Expression Language

Component to Model Binding

Web Service

POJOADF

Data Data UI Renderer

ComponentFaces Ctrl Bindings

g g

PageDef.xml

ADF BC

EJB

BPELCustom POJO Binding

Control Binding

Client SideClient Side

UI Renderer

Component Model

BPEL

JMX

TopLink

g

Rich Client Component

BAMComponent Peer

Page 35: ADF Binding Internals - Oracle

Binding Classes – The Java in ADF

• Bindings are defined in XML at designtimeg g• Binding objects are created at Runtime• Generic Binding classes start with "JUCtrl"• Specific ADF Faces binding classes start with

"FacesCtrl"• Adapt the generic binding layer to component modelAdapt the generic binding layer to component model

requirements• Expose extra methods to be used in action listeners

• makeCurrent• makeCurrent• Labels

• Developers usually work with a subset of classes

Page 36: ADF Binding Internals - Oracle

Commonly used binding classes

• ADFContext• DCBindingContainer• BindingContext• DCIteratorBinding• JUCtrlAttrsBinding

JUCt lLi tBi di• JUCtrlListBinding• JUCtrlHierBinding• JUCtrlHierNodeBinding• JUCtrlHierNodeBinding• OperationBinding

Page 37: ADF Binding Internals - Oracle

BindingContainer

• Contains objects for the bindings used in a given viewj g g• Page• Page fragment• Defined in <view>Pagedef xml• Defined in <view>Pagedef.xml

• EL accessible #{bindings}

Page 38: ADF Binding Internals - Oracle

Accessing the Binding Container from JavaJava

import oracle.adf.model.BindingContext;import oracle.binding.BindingContainer;p g g…BindingContext bctx = BindingContext.getCurrent();BindingContainer bindings = null;bindings = bctx.getCurrentBindingsEntry();g g g y

Page 39: ADF Binding Internals - Oracle

For more information

• http://www.oracle.com/technetwork/jdev• Downloads on Oracle Technology Network (OTN)• Product Documentation• Data Sheets and Whitepapers• Blogs• OTN Discussion Forums• Books

Page 40: ADF Binding Internals - Oracle

Learn More at ODTUG K-Scope 2011

• http://kscope11.com/• Special Fusion Middleware Track• 50 dedicated sessions and hands on labs• Presented by Oracle ACEs, developers and product

managers• ADF WebCenter SOA Suite and more• ADF, WebCenter, SOA Suite and more

Page 41: ADF Binding Internals - Oracle

The preceding is intended to outline our general product direction. It is intended for information

purposes only, and may not be incorporated into any contract. It is not a commitment to deliver anycontract. It is not a commitment to deliver any

material, code, or functionality, and should not be relied upon in making purchasing decisions.The development release and timing of anyThe development, release, and timing of any

features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 42: ADF Binding Internals - Oracle