Disclaimer This document in any form, software or printed matter, contains proprietary information that is the exclusive property of Oracle. Your access to and use of this confidential material is subject to the terms and conditions of your Oracle Software License and Service Agreement, which has been executed and with which you agree to comply. This document and information contained herein may not be disclosed, copied, reproduced or distributed to anyone outside Oracle without prior written consent of Oracle. This document is not part of your license agreement nor can it be incorporated into any contractual agreement with Oracle or its subsidiaries or affiliates. This document is for informational purposes only and is intended solely to assist you in planning for the implementation and upgrade of the product features described. 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 any features or functionality described in this document remains at the sole discretion of Oracle. Due to the nature of the product architecture, it may not be possible to safely include all features described in this document without risking significant destabilization of the code.
Demystifying 11i Framework State Management Barbara J. Waddoups Senior Principal Instructor, ATG, Oracle University [email protected]
What is “State Management”?
Anatomy of a Framework Page
What is a Framework Page?
Framework Page Breakdown Page –Root Region •Items –Buttons –Fields –Images
»Sub-regions
–Region –Region
Terminology • BC4J – Business Components for Java Java packages/class files referenced in Oracle Applications and built for custom applications
• AOL/J – Application Object Library for Java Java packages/class files explicitly built for securing/authenticating connections to Oracle Applications
• OC4J – Oracle Containers for J2EE Core runtime J2EE components for Oracle Applications Framework pages
• UIX – User Interface XML Presentation components for rendering a Framework page
• OA Framework – “The Glue”
How Does A Page Get Displayed?
Read XML
Client
Http Request
Session Session
Read Class Files
Define Web Bean Hierarchy HTML Returned via UIX Web Bean Hierarchy
Web Server
Design Methodology
Model – View - Controller
Admin Server
Controller JAVA & XML Oa.jsp Oa.jsp
db AM AM
Model
View
BC4J
UIX
Model (cont) VL (View Link) •Links VOs
Model VVO (Validation View Object) •Stores Composite Relationships •Used for validation
EO (Entity Expert) •Encapsulates Data •Represents One Row •Setters and Getters •Data Integrity/Validation/Locking, Posting
EE (Entity Expert Class) •Created on Parent EO of composite relationship •References relationships for validation •Cached in memory
VO (View Object) •Represents Query & Data (all returned rows) •Builds (Instantiates) EO •Contains pointers to EO Rows
PVO (Property View Object) •Tracks state of rendered property •Used with Partial Page Rendering •Contains a single row
AM (Application Module) •Container for VO’s •Controls DB Transaction (OADBTransaction) AO (Association Object) •Links EO’s (master/detail) •Setters and Getters
Controller AM
VL
VO AO
VO
CO
EO
PVO
•Holds code for regions •ProcessRequest – Get Action •ProcessFormData – Post Action •ProcessFormRequest – Post Action
EO
DB VVO VAM
View •User Interface (UIX/OA Extensions) •Instantiates files •Reads Java & XML à HTML
Controller Actions GET (ProcessRequest Method) Validate à
Fetch à
User on App
MDS (XML & Java BC4J )
AM à Access to BC4J objects Transaction Context Establishes DB Connect
Instantiate à BC4J (some) & UIX Build WebBean Hierarchy
Post Process à Render Complex Bean Processing
Read JAVA & XML Build HTML Populate Page
POST (ProcessFormData & ProcessFormRequest Methods) Submit à
Validate User à
ProcessFormData à ProcessFormRequest à
Client-Side Validation
Possibly Retain State if needed
Submit Form Validate VO’s & EO’s
Render Page Read JAVA & XML Build HTML Populate Page
Detect Button Action Validate & Commit
STATE MANAGEMENT COMPONENTS • • • • • •
Root Application Module Application Module Pooling and Passivation Servlet Session Application User Session Page Context Request
Conceptual View of State Management Java Virtual Machine (JVM)
db
Servlet Session Application State
WebAppsContext Application State
ICX SESSIONS Table
Uses OA.jsp (servlet) OADBTransaction OAPageBean Application State
OAPageContext Application State
References Caches
Contains
Request Application State
AMImpl
Root Application Modules (Database Session and Transaction State)
Root Application Module • Each OA Framework page is associated with a root application module. • The root application module • Provides transaction context • Provides JDBC Database connection (In OA Framework, a database session is associated with a JDBC connection). • Caches the core application data (BC4J view objects, entity objects, etc, and the web bean hierarchy) on the root application’s oracle.apps.fnd.framework.OADBTransaction object. • Provides accessibility to transaction data for all pages that share the same root application instance (as long as the data is retained between pages). • Provides methods to retrieve, store and remove application data within the root application module • oracle.apps.fnd.framework.webui.OAPageContext (for controller) • OADBTransaction (for model) classes.
Typical User Navigation/ Application Module Instantiation Page A Servlet
Page B
Request Navigates
Session Response
Uses
Uses
Root Application Module
Root Application Module
Page AAM Instance #1
Page BAM Instance #1
User Navigation/ Application Module Retention
Servlet
Page A
Page B
RetainAM=Y
RetainAM=Y
Request Navigates
Session Response
Uses
Root Application Module Task CAM Instance #1
When to Release/Retain Application Modules Multiple Page, Unrelated Tasks, Multiple Transactions Desired
Do Not Retain
Multiple Pages, Related Tasks, Single Transaction Desired
Retain
Multiple Pages, Different Tasks, Same BC4J Object
Retain
Multiple Pages, Related Tasks, Single Transaction with Page Branch to Perform Discrete Task
Retain - for Multiple Pages. Page Branch will have it’s own AM. Use OAPageContext.releaseRootApplic ationModule method to release AM in the branch page
Application Module Pooling and Passivation
Root Application Module Pooling/Passivation User A
JVM Session begin1
Root AM Pool Manager
end1 begin2
PageA Root AM AM - Instance 1
end2
Referenced
begin1
User B
end1
Un-Referenced
AM -Instance 2
Reinstate
Passivate
Servlet Session / Oracle Application User Session
Servlet Session / Application User Session ICX Sessions Table
User Session
WebAppsContext Session Cookie
Session Servlet
Servlet 4
Servlet 2
Servlet 3
Page Context
Page Context - Simple Page Processing Servlet Session Http Page A Request
Page A
Page Context Http A
Response (Display Page)
Request/Page Boundary Page Http Page B Request
Context
Page B
Page Context - Complex Page Processing Servlet Session Http Page A Request
Page
Page A
Context
JSP Forward
Page Boundary Page B
Http Page A Response
Request Boundary
Request
HTTP Request – Page Context Servlet Session Http Page A Request
• URL Parameters
Page Context
• Form Field Data Values ( on POST) •Web Bean/Event Name related for user selection (on POST) •Hidden Fields •JSP Page Forwards •Access Via: •OAPageContext.getParameter*( ) Methods •OAPageContext.putParameter Method •OAPageContext.setForward*( ) Methods
Profile Options
Profile Options - ICX Profile Option Description
Default/ Suggested Setting
ICX: Limit Time
Maximum user session in hours
4 / NA
ICX: Session Timeout
Maximum Idle Time for session in minutes
Profile Options – Application Module
Profile Option Description
Default/ Suggested Setting
FND: Application Module Pool Enabled
Indicates whether AM Pooling is enabled. Disabling can create serious performance degradation.
Yes/Yes
FND: Application Module Pool Monitor Sleep Interval
How long the AM Pool Monitor can sleep prior to waking up and destroying inactive root AM’s. Set time in milliseconds
300000/30 0000 (5 min)
Profile Options – Application Module Profile Option Description
Default/ Suggested Setting
FND: Application Module Pool Recycle Threshold
The number of application module instances the pool will create before passivating and recycling the application modules for reuse.
10/10
FND: Application Module Pool Maximum Inactive Age
The time-out period in milliseconds for 180000 available, inactive application /180000 modules. (3 minutes)
Profile Options – Application Module Profile Option Description
Default/ Suggested Setting
FND: Application Module Pool Minimum Available Size
The minimum number of available application modules allowed per pool (low water mark).
0
FND: Application Module Pool Maximum Available Size
The maximum number of available application modules allowed per pool (high water mark).
10
Profile Options – Application Module Profile Option Description
Default/ Suggested Setting
FND: Passivation Level
Indicates if passivation is enabled. Valid values: None, Resource Threshold, Request
None /
FND: Session Timeout Recovery Enabled
Used only if FND: Passivation Level set to Resource Threshold or Request. Set to No until application fully certified with Passivation
No / No – At Application Level
FND: Application Module Connection Pool Enabled
Indicates whether the connection associated with an Application module should be checked into the connection pool on AM checkin when application modules are pooled.
No/Yes
New Framework Application Module Property Setting AM Property
Property Value Options
Default/ Suggested Setting
Retention Level
RESERVE_FULL – Indicates that the root AM is used exclusively for the current user thread between requests. Does not guarantee state management during failover. MANAGE_STATE – Root AM and connection can be released between threads. AM is guaranteed to be preserved. CONNECTION_AGNOSTIC – Connection may be released between threads. Only use if connection is not dependent on DB State references (PL/SQL, Global Variables, etc)
RESERVE_ FULL / MANAGE_S TATE
Additional Information http://education.oracle.com 11i Extend Oracle Applications: Extending OA Framework Applications (E-Business Suite) 5 Days
11i Extend Oracle Applications: Customizing OA Framework Applications (E-Business Suite) 4 Days
http:// www.oracle.com/technology/products/jdev/viewlets/viewlet.html http://www.oracle.com/technology/index.html
References Oracle Corporation. Oracle Applications Framework Technical Reference Release 11.5.10.2 “OA Framework State Management” , 2000 - 2005 Oracle Corporation. Application Development Framework Developer's Guide For Forms/4GL Developers 10g Release 3 (10.1.3.0) “Understanding Why State Management is Necessary” Reilly, David. “State and session tracking with Java servlets, Part 1: Using cookies”. Reilly, David. “State and session tracking with Java servlets, Part 2: Securing data”. Flanagan, David. Java In A Nutshell, A Desktop Quick Reference. O’Reilly Media, Inc., 2005 Oracle University. 11i Extend Oracle Applications: Building OA Framework Applications. Ed 1.1, October 2005