Skip Headers
Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework
11g Release 1 (11.1.1)
B31974-03
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

41 Using the Active Data Service

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:

41.1 Introduction to the Active Data Service

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.

41.2 Using the Active Data Service in an Application

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 the ActiveDataModel 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.

41.2.1 How to Configure the Active Data Service

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:

  1. 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.

  2. 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>

    Latency threshold in milliseconds. Active data messages with network delays greater than this threshold will be treated as late.

    10000

    1000

    <keep-alive-interval>

    Frequency in milliseconds for sending keep-alive messages when no events are generated.

    10000

    5000

    <max-reconnect-attempt-time>

    Maximum period of time in milliseconds a client will attempt to reconnect the push channel upon getting disconnected.

    1800000 (30 minutes)

    0

    <reconnect-wait-time>

    Time interval in milliseconds to wait between reconnect attempts.

    10000

    1000



    Performance Tip:

    Keep the following in mind when configuring the ADS.
    • Set the latency threshold to more than 1000 to avoid frequent component refreshing.

    • Set the keep-alive interval and reconnect wait time to be less than browser's keep-alive timeout.

    • Set the max reconnect time to be less than your web server's session timeout.


    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>
    
  3. Create a properties file with an entry for the ADS configuration.

    1. From the Main menu, choose File > New.

    2. In the New Gallery select General Category and then File, and click OK.

    3. Name the file adf-config.properties and save it to the META-INF\services directory.

    4. Add the following line:

      http\://xmlns.oracle.com/adf/activedata/config=oracle.adfinternal.view.
      faces.activedata.ActiveDataConfiguration$ActiveDataConfigCallback
      
    5. Save and close the file.

41.2.2 How to Configure Components to Display Active Data

You need to set a value on the binding element in the corresponding page definition file.

To configure a component to display active data:

  1. Drop a component onto a JSF page.

  2. In the Property Inspector, optionally change the value for the component's Id attribute.

  3. 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.

  4. Open the page's associated page definition file.

  5. 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 the statusIndicator 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.

41.2.3 What Happens When You Use the Active Data Service

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.