Upload
oracle-isv-migration-center
View
4.585
Download
5
Embed Size (px)
DESCRIPTION
Reusability in the Oracle ADF Development
Citation preview
<Insert Picture Here>
Reusability in Oracle ADF development
Dmitry Nefedkin
Oracle ISV Migration Center FMW Consultant
2
ISV Migration Center Team
• Who we Are ISV Migration Center Team is a team of senior technical consultants based in
Eastern and Central Europe and represents Oracle's technical investment for partners.
• Mission Statement Enable partners to rapidly and successfully adopt and implement Oracle
latest technology
• What do we Offer Whether you are selling Oracle technology, building business solutions,
including hosted Internet solutions or providing system integration and implementation services
for Oracle technology, IMC Team can help you succeed.
• How can we assist We offer a wide range of free services for partners such as one2one
assistance, webinars, seminars and hands-on workshops.
ISV Migration Center blog: http://blogs.oracle.com/imc
Contacts:
Ruxandra Radulescu, ISV Migration Center Manager, EE&CIS
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Benefits of Reusability
• Designing code to be reused has the following benefits:
• Increased developer productivity
• Fewer bugs – debug once
• Consistency
• In functionality
• In look and feel
• Easier maintainability
• Rapid adaptability
Business Services
Data Services
Model
Controller
JSFJSF View
Desktop Browser-Based
StrutsStruts
OfficeOffice ADFADF SwingSwing
Oracle ADF - The Bigger Picture
JSPJSP
EJBEJB BAMBAM ADFbcADFbc PortletsPortlets BIBI BPELBPEL Web ServicesWeb Services JavaJava
ADF FacesADF Faces
Me
tad
ata
Se
rvic
es (
MD
S)
Me
tad
ata
Se
rvic
es (
MD
S) MobileMobile
Database Web Services Legacy Systems Apps Unlimited
JSFJSF ADF ControllerADF Controller
ADF ADF Model (Model (DataControlsDataControls & Bindings)& Bindings)
ADF Has a lot of Opportunities for
Reusability, But First…
• Don’t forget the obvious thing
• Java is an Object Orientated language with inheritance
• Use it!
• If using ADF
• Refactor common code into Framework superclasses
• Create common utility classes
• Use advanced features like polymorphic entities
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
The Resource Catalog
• Enables application developers to find and incorporate
shared resources created by other members of the team
• Provides a federated view of the resources from one or more
otherwise unrelated repositories in a unified search and
browse UI
• Enables you to store libraries comprising a common
repository that can be used by the developers building any
client application
• Ensures that all application developers use the same
business model without any discrepancies
Working with the Resource Catalog
Creating a catalog
Adding to a Catalog
Reusing Components with Libraries
• ADF Library enables you to reuse components:
• Package them into ADF Library JAR files
• Add them to a reusable component repository
• Add the library to a project to use its
components
• Basically a standard JAR with a bit of
extra metadata
Building ADF Libraries
• ADF supports reusing the following types of components in
ADF Libraries
• Data controls
• Application modules
• Business components
• Task flows
• Task flow templates
• Page templates
• Declarative components
Building ADF Libraries
• Guidelines:
• Use naming conventions
• Avoid naming conflicts
• Facilitate identifying component functionality
• Standardize storage by agreeing on:
• Type of repository needed
• Storage and organization
• Access methods
Creating an ADF Library
1
2
3
4
Adding an ADF Library to a Project
1 2
3
4
Removing an ADF Library from a Project
• Remove by:
• Using Resource
Palette
• Using Project Properties
Restricting BC Visibility in Libraries
• Set Library Private property
for a business component to
true if you don’t want consumers
to see the object in the library JAR.
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Create ADF BC extension classes
Create subclasses for ADF BC framework base classes
Register your extension classes
• Tools->Preferences ->
ADF Business
Components -> Base
Classes
• These settings will be
inherited by the new
Model projects.
• Can be overridden on
the project level
19 Oracle Restricted and Confidential
Basing an ADF Component on an Extension
Class
20 Oracle Restricted and Confidential
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Page Templates
• Provides layout and behavior
• Layout
• Uses default ADF Faces layout managers
• Can have custom facets for content stamping
• Template is referenced, not compiled: easy to change at design time
and run time
• Behavior
• Can have bindings
• Can have attributes
Creating a Page Template
Creating a Page Template
Header (with Title)
A
B
Menu Regions
News Portlet
Named Facets
Editing a Page Template
Header (with Title)
A
B
Header (with Title)
A
B
Footer
Modified Template Original Template
Must continue to use the
same named facets
Applying a Page Template to a Page
UI Shell – page template used by Fusion
Apps
UI Shell goals:
• Accelerate the ADF learning curve for teams new to ADF
• Provide a best practice layout based on a given UI design
• Provide high-level, best practice behavior out-of-the-box
• Make it easier to follow an Oracle UI design
Anatomy of ADF UI Shell Best practice use of stretching & flowing layout
Anatomy of ADF UI Shell Runtime example
UI Shell tutorial and demo application:
http://www.oracle.com/technetwork/developer-tools/adf/uishell-093084.html
Declarative Components
• Characteristics of Declarative Components:
• Are component definitions that are reusable across applications
• When changed, affect all pages that use them
• Are made up of any number of other components
• Do not have data binding in their definition
• Can be made available for reuse in the Component Palette
• Are defined only at design time in:
• One .jspx file for each component
• One declarativecomp-metadata.xml file for all components in a
project
Creating a Declarative Component
• The JSF Declarative
Component dialog box:
• Is invoked with
New > Web Tier > JSF
> JSF Declarative Component
• Creates <af:componentDef>
tag in .jspx file
• Creates metadata
Using a Declarative Component
on a Page
• To use a declarative component on a page:
• Deploy the component’s project as an ADF library JAR file.
• Add the ADF library to your current project.
• Select the ADF library from the Component Palette drop-down list.
• Select the declarative component and drag it to your page, providing
values for any attributes.
Declarative Components – Use Cases
• Create layout fragments
• Use in addition to page templates for consistent look and feel
• Oracle Forms-like toolbar
• Wrap components to add functionality
• For example, provide table shell that applies keyboard functionality
• Create panel that allows you to export table content to Excel in binary
format
• Create complex components that operate on iterator or
bindings that are passed in as arguments
ADF Skinning
• This allows you to customize the look and feel of an application
• Without affecting functionality
• Without editing individual pages
• A skin is a style sheet based on the CSS 3.0 syntax that is specified in one place for an entire application
• ADF delivers default skins for ADF Faces components
• The minimal look and feel is the ―simple‖ skin. It has very little styling
• The ―fusion‖ skin extends simple and provides a very rich styling of our components. This is the default
• Developers can change the styles, icons, properties, and text of ADF Faces components by creating a new skin
Skinning Examples
• Icons
• Change messages, text, tooltips etc. af_messages.TIP_FATAL "What were you thinking"
af_messages.TIP_ERROR "You bozo, that is so wrong"
af_messages.TIP_CONFIRMATION "I got it!"
af_messages.TIP_INFO― "FYI Dude"
• Splash Screen
• Colors, styles
• Tabs
Creating a skin
• When creating a skin, one extends a delivered skin
• You can create multiple skins to serve different purposes
• Skins can be dynamically applied at runtime
• A skin consists of the following artifacts: • An ADF Skin file (.css) that defines the actual look of the components
• A configuration file - ―trinidad-skins.xml‖ - that lists all skins available for the
application
• An entry in the ADF Faces configuration file - ―trinidad-config.xml‖
• Any other resources needed to create the actual look of the components -
additional CSS files, Images
Creating a skin
Skin development in JDeveloper 11g R1
• Code editing support
• ADF Faces Skin Extension • Tool > Preferences >CSS Editor
• Check ADF Faces Extension
• Syntax Help
• Image selection
• Code Completion
• E.g. type "af|inputr" then press ctrl+Enter
• Code Folding
• Collapses CSS style definitions
• Mouse-over code info
Syntax Help
Skin development in JDeveloper 11g R2
Configuring what skin to use in runtime
• Using static name
• Using Expression
<trinidad-config
xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>MYSKIN</skin-family>
</trinidad-config>
<trinidad-config
xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>
#{facesContext.viewRoot.locale.language =='de' ?'MYSKIN_DE' :
'MYSKIN'}
</skin-family>
</trinidad-config>
trinidad-config.xml
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Characteristics of Bounded Task Flows
• Bounded task flows:
• Are modular blocks of task flow functionality for reuse, with the
following characteristics:
• Single point of entry
• Well-defined boundary
• pageFlow Memory scope
• Declarative transaction
management
• Declarative Back button support
Characteristics of Bounded Task Flows
• Bounded task flows consist of :
• Activities (View, Router, Method Call, etc..)
• Control flows between activities
• Ability to accept input parameters and to return values
• On-demand metadata loading
• Fragment reuse through task flow templates
• Addressable
Modular "UI Services"
Use It in Another Flow
Using a Bounded Task Flow
• Using a bounded task flow
in a region on a page
Task Flow Templates • Reusable task flow definition
• Reuse by reference or as a copy
• Can contain common functionality and settings
• Exception handlers
• Task flow activity navigation outline
• Use of initializers and finalizers
• Visibility settings
• URL accessible
• Visible in ADF Library
• Behavior settings
• Train
• Task flow reentry
• Critical
• Data Control sharing
• Pre-defined input and output parameters
Deciding Which to Use
• You can use a page template when you want:
• Similar page layout to be used on multiple pages
• Similar look on multiple pages
• You can use a declarative component when you want to:
• Use a similar grouping of components on multiple pages or
applications
• Select the component from the Component Palette
• You can use a bounded task flow when you want to:
• Reuse a set of activities and control flows
• Use multiple page fragments in a region on a page
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Bringing it all together
Common Code Workspace
• ADF BC extension classes
• Utility classes
Common Model Workspace
• Entity Objects and Associations
•Shared View objects for LOVs
•Default VOs and AM for testing
Common UI Workspace
•Page Templates
•Declarative Components
•Task Flow templates
•Skins
Sybsystem Workspaces
• View objects and view links
•Application Module(s)
•Bounded Task Flows with fragments
Master Workspace
•Page(s) with the regions/dynamic regions,
maybe based on UIShell template • This sample shows how you can structure the artifacts of your ADF application between JDeveloper workspaces
•Arrows show ADF library dependencies
•Master workspace produce EAR file as the build output
<Insert Picture Here>
Agenda
• ADF Opportunities for Reusability
• Resource catalogs and ADF Libraries
• Business logic reusability: ADF BC extension classes
• UI reusability: page templates, declarative components, skins
• Controller reusability: ADF Task Flows and templates
• Bringing it all together
• Getting more information
Getting more information
• Oracle ADF Insider - recorded sessions that will help you get up to speed with Oracle ADF: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html
• Oracle ADF Code corner - hints, tips and coding examples for ADF developer: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html
• Useful links for the ADF Developer: http://blogs.oracle.com/imc/entry/useful_links_for_the_adf
Getting more information
• Quick Start Guide to Oracle Fusion Development
• Oracle JDeveloper 11g Handbook
• Oracle Fusion Developer Guide
Getting more information
Sten E. Vesterli
Oracle ADF Enterprise Application Development — Made Simple
QuestionsQuestions
©2011 Oracle Corporation
Dmitry Nefedkin
Oracle ISV Migration Center FMW Consultant
ISV Migration Center blog: http://blogs.oracle.com/imc