Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) B31974-03 |
|
![]() Previous |
![]() Next |
This chapter provides information for using the Oracle ADF Model layer and Oracle ADF Faces components with an active data service.
This chapter contains the following sections:
The Fusion technology stack includes the Active Data Service (ADS), which allows you to bind ADF Faces components to an active data source using the ADF Model layer. To use this functionality, you must configure the components and the bindings so that the components can display the data as it updates in the source.
In order to use the Active Data Service, you need to have a data store that publishes events when data is changed, and you need to create business services that react to those events and the associated data controls to represent those services.
Tip: Oracle offers Oracle Business Activity Monitoring (BAM), which is a complete solution that provides the ability to create an active data store. For more information, see the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite. |
Once your active data store is in place, along with services and the corresponding data control, you can use the Data Controls panel to create the components that will respond to the active data.
You need to configure ADS so that your application receives pushed content from the data source. You also need to set other configurations, such as a latency threshold and reconnect information.
Note: If you enable ADS but do not configure it, the ADS framework will use the default values shown in Table 41-1. |
Once your application is configured to use ADS, you need to create and configure components in your view layer to display active data. First, you must create a data control for your active data service. Once that is done, you can drop a component from the Data Controls panel and configure it to display active data. When you create components from the Component Palette, you need to manually bind the component to a data control providing the data to the component.
Tip: Instead of using data controls, you can create your own model layer. Managed beans used to provide data to components must implement theActiveDataModel interface, and the getActiveDataPolicy() method must return ACTIVE when called. For more information, see the ADF Faces Javadoc. The bean must also implement the model that the component requires, such as collectionModel or treeModel . See the "Using Tables and Trees" chapter of the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework. |
Configuration for ADS is done in the adf-config.xml
file. For more information about the adf-config.xml
file, including how to create one if you need to, see the "Configuration in adf-config.xml" section of the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.
To configure the Active Data Service:
Open the adf-config.xml
file. By default, you can access this file in the Application Resources pane. Expand the Descriptors node. The file is in the ADF META-INF
directory.
Click on the Source tab to open the file in the source editor, and create an entry for each of the elements shown in Table 41-1.
Table 41-1 ADS Configuration Elements in adf-config.xml
Element | Description | Default Value (in milliseconds) | Minimum Value (in milliseconds) |
---|---|---|---|
|
Latency threshold in milliseconds. Active data messages with network delays greater than this threshold will be treated as late. |
10000 |
1000 |
|
Frequency in milliseconds for sending keep-alive messages when no events are generated. |
10000 |
5000 |
|
Maximum period of time in milliseconds a client will attempt to reconnect the push channel upon getting disconnected. |
1800000 (30 minutes) |
0 |
|
Time interval in milliseconds to wait between reconnect attempts. |
10000 |
1000 |
Example 41-1 shows a sample configuration that has content pushed to the client.
Example 41-1 Sample Configuration for ADS in adf-config.xml
<?xml version="1.0" encoding="utf-8" ?> <adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:ads="http://xmlns.oracle.com/adf/activedata/config"> <ads:adf-activedata-config xmlns= "http://xmlns.oracle.com/adf/activedata/config"> <latency-threshold>5000</latency-threshold> <keep-alive-interval>10000</keep-alive-interval> <max-reconnect-attempt-time>90000</max-reconnect-attempt-time> <reconnect-wait-time>8000</reconnect-wait-time> </ads:adf-activedata-config> </adf-config>
Create a properties file with an entry for the ADS configuration.
From the Main menu, choose File > New.
In the New Gallery select General Category and then File, and click OK.
Name the file adf-config.properties
and save it to the META-INF\services
directory.
Add the following line:
http\://xmlns.oracle.com/adf/activedata/config=oracle.adfinternal.view. faces.activedata.ActiveDataConfiguration$ActiveDataConfigCallback
Save and close the file.
You need to set a value on the binding element in the corresponding page definition file.
To configure a component to display active data:
Drop a component onto a JSF page.
In the Property Inspector, optionally change the value for the component's Id attribute.
If you are using an ADF bound tree or tree table, you need to ensure the following:
The binding represents homogeneous data (that is, there is only one rule), although an accessor can still access a like accessor.
The binding rule contains a single attribute.
Open the page's associated page definition file.
In the Structure window for the page definition file, select the node that represents the attribute binding for the component. In the Property Inspector, expand the Advanced section and set the ChangeEventPolicy attribute to Push
.
Tip: You can use thestatusIndicator component to indicate the server state. For more information, see the "Displaying Application Status Using Icons" section of the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework. |
When you configure ADS to use the Push mode, data is pushed to the client whenever a change event is raised by the data. On the client side after the push channel is established, if there is no activity within the time of the value for the latency-threshold
element plus the keep-alive-interval
, an establish-channel-request
will be sent out repeatedly based on value of the reconnect-wait-time
element, until the amount of time passed reaches the value of the max-reconnect-attempt-time
element. After that, the connection will be considered as disconnected. For example, given the values in Example 41-1, if there is no activity in 15,000 milliseconds, an establish channel request will be sent out every 8,000 milliseconds for up to 90,000 milliseconds. After that, the connection will be considered disconnected.
For the server side, the server disconnects the push channel and starts a timer to clean up with a cleanup-delay-time
when there is an empty active data message or it fails to send out active data message. The cleanup-delay-time
is calculated as max-reconnect-attempt-time
+ 30 * 1000 ms. Its default value is 30 minutes.