Download - 1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework
1Copyright © 2004, Oracle. All rights reserved.
Oracle Application Development Framework
Copyright © 2004, Oracle. All rights reserved.1-2
Objectives
After completing this lesson, you should be able to do the following:
• Describe the Java 2, Enterprise Edition (J2EE) platform
• Describe the benefits of framework-based application development
• Describe the purpose and benefits of Oracle ADF
• Describe the Model-View-Controller (MVC) architecture
• Describe the technologies used in each of the MVC layers
Copyright © 2004, Oracle. All rights reserved.1-3
J2EE Platform
• Is a multitiered, distributed application model
• Supports component-based J2EE applications
Business tier
JSP/ Servlet
Browser/ Application
BusinessServices
Web tierClient tier EIS tier
Database ServerJ2EE ServerClient Machine
Database
Copyright © 2004, Oracle. All rights reserved.1-5
Benefits of the J2EE Platform
• “Write once, run anywhere” provides simplified component development.
• J2EE separates client requirements from business logic.
• J2EE provides multiple development and design scenarios:– Multitier– Web– Stand-alone client
• J2EE separates development tasks into specific skill areas.
Copyright © 2004, Oracle. All rights reserved.1-6
J2EE Platform: Architecture Details
JSP/ Servlet
Browser
BusinessServices
Web container
Client container
EIS tierJ2EE Server
DatabaseApplication
Client
APIs
Business container
Client Machine
JMS
JNDI RMI
JDBC
JTA
JavaMail
JAF
Copyright © 2004, Oracle. All rights reserved.1-7
Building J2EE Applications
• Building J2EE applications can be complex.
• Development time can be extensive.
• Choosing and implementing appropriate design patterns can be overwhelming.
• “Do it yourself” applications often repeat existing application code.
• A large portion of “Do it yourself” code is dedicated to common tasks.
• The more code you write, the greater is the chance of errors.
• Using an existing application framework enables you to concentrate on your business needs.
Copyright © 2004, Oracle. All rights reserved.1-8
What Is Framework-BasedApplication Development?
A framework:
• Is a productivity layer for building applications
• Is a set of intelligent cooperating software components
• Is designed to be specialized for your business
• Handles the majority of common tasks with sensible behavior
• Enables easy customization of default behaviors
• Uses standard, proven techniques and design patterns
Copyright © 2004, Oracle. All rights reserved.1-9
Understanding Framework-Based Application Development
A framework provides base functionality:• Standard behaviors
• Data access methods
• Transaction management
You can augment or circumvent base functionality.
Provides “hook points” to standard functions
Your objects have only your code.
Framework
No messy code generation
Copyright © 2004, Oracle. All rights reserved.1-10
Oracle Application Development Framework
• Reduces the complexity of J2EE development by providing visual and declarative development
• Increases development productivity– Less coding, more reuse– Focus on the application, not the “plumbing”
• Encourages J2EE best practices by implementing standard J2EE design patterns (MVC)
• Provides a flexible and extensible environment by allowing multiple technology choices and development styles
Copyright © 2004, Oracle. All rights reserved.1-11
Visual and Declarative Development
• Visual– WYSIWYG editors– UML modelers – Structure pane
• Declarative– Structure pane – Property Inspector
• Code view/design view synchronization– No separate generation step—always synchronized– Underlying code always accessible
Copyright © 2004, Oracle. All rights reserved.1-12
Design Patterns
• Design patterns:– Are proven solutions to specific problems– Are a means to an end, not the end itself– Address programming tasks, not business
problems– Are reusable– Provide a framework for re-creatable results
• The MVC architecture is an example of a design pattern.
Copyright © 2004, Oracle. All rights reserved.1-13
Model-View-Controller Architecture
MVC provides logical separation of an application.
Browser/ Application
Web tier
Client tier
EIS tier
Database
View
ControllerModel
Business tier
Bu
siness S
ervices
Copyright © 2004, Oracle. All rights reserved.1-14
MVC Structure
View• Renders the UI• Requests data from the
Model• Sends “Events” to the Model• Allows the Controller to
select the next View
Model• Stores the application
state• Responds to data requests• Encapsulates business
logic
Display Submit page
Request data
• Handles routing to the correct page
• Maps UI data changes to the Model
Data and transactions
Controller
Copyright © 2004, Oracle. All rights reserved.1-15
What Is the Model?
• It is a wrapper and abstraction for business services:– Handles data events from the Controller– Feeds data to the View
• It manages and presents data from different Business Service types in a common way.
View Controller
Model
Copyright © 2004, Oracle. All rights reserved.1-16
The Model Layer
Business Services
Model
TopLink Mapping
ADF Bindings
ADF Data Control
WebServices
ADFApplication
Module
JavaClasses
EJBSessionBeans
TopLinkQueries
ADFView Object
JavaClasses
EJBFinders
ADF Entity Object
EJB EntityBeans
JDBC
Copyright © 2004, Oracle. All rights reserved.1-17
Components of the Model Layer
• Bindings:– Metadata that describes how the UI components on
a page use the values and actions provided by the Business Service
• Data controls:– Metadata that describes the data model returned by
the Business Service
• The metadata has the same format for all business services.
ADF Bindings
ADF Data Control
Copyright © 2004, Oracle. All rights reserved.1-18
What Is the Controller?
On a Web page, everything significant happens on submit or a link.
• A Controller intercepts a request and dispatches it to the correct page.
• The source page does not have to know how to handle an event or where to go next.
• The handling code does not need to know what page to display in response.
• The Controller separates the Model and the View.
• The Controller manages the flow of a Web application.
Copyright © 2004, Oracle. All rights reserved.1-19
Struts in JDeveloper
JDeveloper uses Apache Struts as a Controller.
• It is popular among J2EE developers.
• It has been around since 2000.
• It is designed to handle views based on HTTP technology.
Copyright © 2004, Oracle. All rights reserved.1-20
Controller: Summary
• Controllers are key to MVC separation and to promote code and layer reuse.
• Apache Struts is the de facto standard for Web application controllers.
• Oracle JDeveloper 10g supports Struts as a controller.
Copyright © 2004, Oracle. All rights reserved.1-21
What Is the View?
• The MVC View is the UI of the application.
• It is what the end user sees and interacts with.
View Controller
Model
Copyright © 2004, Oracle. All rights reserved.1-22
View Concept
• A View does not contain application code; it contains code to represent the UI and pass events to the Controller.
• Views are interchangeable without rewriting controller or model logic.
• A single application can have different Views that are compatible with different types of devices (HTML browser, handheld devices, and so on).
Copyright © 2004, Oracle. All rights reserved.1-23
View Technologies in Oracle JDeveloper 10g
• JavaServer Pages (JSP)
• UIX
• ADF JClient
Creating databound clients is the same in JDeveloper for any of these supported client technologies.
Copyright © 2004, Oracle. All rights reserved.1-24
View: Summary
• Views contain only display code.
• Views do not contain application logic.
• Views do not contain navigation logic.
• Views are independent of the Controller and the Model.
Copyright © 2004, Oracle. All rights reserved.1-25
ADF Technology Stack
WebServices
EJBSessionBeans
JavaBeans/Other
JSP JSF
Struts
Swing/ADF JClientADF UIX
ADF Business
Components
ADF Model
View
Controller
Model
BusinessServices
Copyright © 2004, Oracle. All rights reserved.1-26
ADF: Summary
• Productive end-to-end development– Model-View-Controller– Visual– Declarative
• Standard J2EE framework– Implements J2EE best practices– Uses the latest standards – Provides architecture choices– Is built on the MVC design pattern
Copyright © 2004, Oracle. All rights reserved.1-27
Summary
In this lesson, you should have learned how to:
• Identify the benefits of framework-based application development
• Describe the Java 2, Enterprise Edition (J2EE) platform
• Define the components of the Model-View-Controller architecture
• Describe the benefits of Oracle Application Development Framework (ADF)
• Describe the technologies used in each of the MVC layers