Oracle ADF Scope and Session State

6-6 Oracle Fusion Middleware High Availability Guide domain before you deploy the application. For information about registering MDS, see the Oracle Fusion Middleware Administrators Guide. Then, when you deploy the application, JDeveloper prompts you to choose the target metadata repository or shared metadata repository. You will be able to choose from the list of metadata repositories registered with the Oracle WebLogic Administration Server. To ensure that you receive the metadata repository prompt, the application’s adf-config.xml file must define a cust-config element in the mds-config section. This element specifies an ordered and named list of customization classes. A customization class is the interface that MDS uses to define which customization applies to the base definition metadata. In JDeveloper, you can use the overview editor for the adf-config.xml file to define a cust-config element. For information about configuring the adf-config.xml file for MDS, see the chapter on customizing with MDS in the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. For more information about the MDS architecture and metadata repositories database and file-based and archives EAR, MAR, refer to the Oracle Fusion Middleware Administrators Guide.

6.1.1.4 Oracle ADF Log File

The operations performed by the Fusion web application are logged directly to the WebLogic Managed Server where the application is running: DOMAIN_HOME serversserver_namelogsserver_name-diagnostic.log The log files for the different WebLogic Managed Servers are also available from the Oracle WebLogic Server Administration Console. To verify the logs, access the Oracle WebLogic Server Administration Console http:admin_server_ host:portconsole and click on Diagnostics-Log Files. This logs granularity and logging properties can be changed using Oracle Enterprise Manager Fusion Middleware Control Fusion Middleware Control. Fusion Middleware Control is a Web browser-based, graphical user interface that you can use to monitor and administer a farm. To receive high availability warning diagnostic messages for Oracle ADF, the level should be set to FINE, as described in Section 6.1.4.3, Troubleshooting Oracle ADF Replication and Failover Issues. For more information about the level of diagnostics you can specify for Fusion web applications, see the chapter on testing and debugging in the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. For details about using Fusion Middleware Control to change the log settings of WebLogic Managed Servers and Oracle ADF, see the Oracle Fusion Middleware Administrators Guide.

6.1.2 Oracle ADF High Availability Considerations

Fusion web applications built on the Oracle ADF technology stack are Java EE applications and J2EE applications. You should observe the same best practices for Fusion web applications as you would any other Java EE application in a high availability environment.

6.1.2.1 Oracle ADF Scope and Session State

At runtime, ADF objects such as the binding container and managed beans are instantiated. Each of these objects has a defined life span set by its scope attribute. Configuring High Availability for Oracle ADF and WebCenter Applications 6-7 There are six types of scopes in a Fusion web application: ■ Application scope: The object is available for the duration of the application. ■ Session scope: The object is available for the duration of the session. ■ Page flow scope: The object is available for the duration of a bounded task flow. ■ Request scope: The object is available from the time an HTTP request is made until a response is sent back to the client. ■ Backing bean scope: Used for managed beans for page fragments and declarative components only, the object is available from the time an HTTP request is made until a response is sent back to the client. ■ View scope: The object is available until the view ID for the current view activity changes. This scope can be used to hold values for a given page. However, unlike request scope, which can be used to store a value needed from one page to the next, anything stored in view scope will be lost once the view ID changes. When the Fusion web application runs in a clustered environment, a portion of the applications state is serialized and copied to another server or a data store at the end of each request so that the state is available to other servers in the cluster. When you are designing an application to run in a clustered environment, you must: ■ Ensure that all managed beans with a life span longer than one request are serializable that is, they implement the java.io.Serializable interface. Specifically, beans stored in session scope, page flow scope, and view scope need to be serializable. ■ Ensure that Oracle ADF is aware of changes to managed beans stored in ADF scopes view scope and page flow scope and enable the tracking of changes to ADF memory scopes. When a value within a managed bean in either view scope or page flow scope is modified, the application needs to notify Oracle ADF so that it can ensure the beans new value is replicated. In Example 6–1 , an attribute of an object in view scope is modified. Example 6–1 Code that Modifies an Object in viewScope MapString, Object viewScope = AdfFacesContext.getCurrentInstance.getViewScope; MyObject obj = MyObjectviewScope.getmyObjectName; Obj.setFoonewValue; Without additional code, Oracle ADF will be unaware of this change and will not know that a new value needs to be replicated within the cluster. To inform Oracle ADF that an object in an ADF scope has been modified and that replication is needed, use the markScopeDirty method, as shown in Example 6–2 . The markScopeDirty method accepts only viewScope and pageFlowScope as parameters. Example 6–2 Additional Code to Notify Oracle ADF of Changes to an Object controllerContext ctx = ControllerContext.getInstance; ctx.markScopeDirtyviewScope; 6-8 Oracle Fusion Middleware High Availability Guide This code is needed for any request that modifies an existing object in one of the ADF scopes. If the scope itself is modified by the scopes put, remove, or clear methods, it is not necessary to notify Oracle ADF. To enable ADF Controller to track changes to ADF memory scopes and replicate the page flow scope and view scope within the server cluster, you can enable theadf-scope-ha-support parameter in the adf-config.xml file, as described in Section 6.1.3.3, Configuring adf-config.xml. For more information about ADF object scopes, see the chapter on Fusion page lifecycle in the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework.

6.1.2.2 Oracle ADF Failover and Expected Behavior