Oracle® Enterprise Pack for Eclipse User's Guide
Release 12.1.3
E53428-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

3 Oracle ADF Tools Support

OEPE provides a set of plugins for the Eclipse IDE designed to create, configure, and run Oracle Application Development Framework (ADF) applications.

This section contains the following sections:

3.1 Getting Started with Oracle ADF

The Oracle Application Development Framework (Oracle ADF) is an end-to-end application framework that builds on Java Platform, Enterprise Edition (Java EE) standards and open-source technologies. You can use Oracle ADF to implement enterprise solutions that search, display, create, modify, and validate data using web, wireless, desktop, or web services interfaces. Because of its declarative nature, Oracle ADF simplifies and accelerates development by allowing users to focus on the logic of application creation rather than coding details.


Note:

This document contains links to more detailed conceptual information in other Oracle ADF documentation. Keep in mind that while the information is sometimes presented in the context of another Oracle IDE (JDeveloper), the concepts are applicable to OEPE as well. For your ease of understanding, equivalent JDeveloper and OEPE IDE components are listed in the table below.


Oracle JDeveloper IDE Component Corresponding OEPE IDE Component

Applications Window

Project Explorer

Structures Window

Outline

Components Window

Palette

Data Controls Panel

Data Palette

Properties Window

Properties

Databases Window

Data Source Explorer

Log Window

Console

Application Servers Window

Servers


3.1.1 Understanding the Oracle ADF Architecture

In line with community best practices, applications you build using the ADF web technology stack achieve a clean separation of business logic, page navigation, and user interface by adhering to a model-view-controller architecture.

For more information about the Oracle ADF Architecture, see the Oracle ADF Architecture section in the "Introduction to Building Fusion Web Applications with Oracle ADF" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.1.2 Configuring Oracle WebLogic Server

Before starting to create your pages, you need to create a server configuration for Oracle WebLogic Server (WLS). It will be the link to the WLS instance that will be used to run the project.


Note:

To use GlassFish ADF enabled runtime with you JAVA or ADF application see Section 3.10, "Configuring and Using ADF with GlassFish Server".


The WebLogic server should be running. You can use an existing domain or create a new domain.

To configure WLS using an existing domain:

  1. From the main menu, select Window > Show View > Other.

  2. In the Show View dialog, select Server > Servers to open the Servers pane.

  3. In the Servers pane, right-click and select New > Server.

    Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server. link.

  4. On the Define a New Server page of the New Server wizard, expand Oracle and select the type of Oracle WebLogic server you are running, for example, Oracle WebLogic Server 12c (12.1.3). Enter the server's hostname, for example localhost and click Next.

  5. On the server details page of the Define a New Server wizard, click Browse Browse button next to WebLogic Home. In the Browse for Folder dialog navigate to the WebLogic home directory and click OK.

    Alternatively, if you have already defined domains for the IDE they are listed when you choose Browse Browse button > Known Domains.

    Click Next.

  6. On the Add and Remove page, in Available select your application and click Add to shuttle the selection to the Configured. This associates your application with the newly created domain.

    Click Finish.

    The new server connection appears in the Servers pane. Note that the server is a in stopped state.

To configure WLS and create a new domain:

  1. From the main menu, select Window > Show View > Other.

  2. In the Show View dialog, select Server > Servers to open the Servers pane.

  3. In the Servers pane, right-click and select New > Server.

    Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server. link.

  4. In the New Server wizard on the Define a New Server page, select the server type. Select Oracle and then select the type of Oracle WebLogic server you are running, for example, Oracle WebLogic Server 12c (12.1.3). Click Next.

  5. To create a new domain, in the server details page of the Define a New Server wizard, click Create Create button then Create Domain. In the New WebLogic Domain dialog:

    • Enter a name for the domain.

    • Optionally specify a password that will override the default password welcome1.

    • Check that the extensions you want are selected.

    The IDE validates the domain path you choose and automatically enters the Java home path in Java home. It also lists the relevant extensions on the server.

    Click Next.

  6. In the New WebLogic Domain dialog, specify a name and a location for the domain. Optionally, you can specify a new password (the default is welcome1). Under Extensions, select Oracle JRF - 12.1.3.0.

    Click Finish.

  7. On the New Server wizard, Domain directory is now populated. Click Next.

  8. On the Add and Remove page, in the Available list, select your application. Then click Add to shuttle the selection to the Configured pane. This associates your application with the newly created domain.

    Click Finish.

    The new server connection appears in the Servers pane. Note that the server is a in stopped state.

To configure WLS using the WebLogic Server configuration wizard:

  1. From the main menu, select Window > Show View > Other.

  2. In the Show View dialog, select Server > Servers to open the Servers pane.

  3. In the Servers pane, right-click and select New > Server.

    Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server. link.

  4. In the New Server wizard on the Define a New Server page, select the server type. Select Oracle and then select the type of Oracle WebLogic server you are running, for example, Oracle WebLogic Server 12c (12.1.3). Click Next.

  5. To create a new domain or update an existing domain using the WebLogic Server configuration wizard, click Create Create button then Launch Domain Configuration Wizard.

    The Oracle Fusion Middleware Configuration Wizard opens where you can create a new domain or update an existing domain.

    Once you have specified the domain in the configuration wizard, click Browse Browse button next to WebLogic Home. In the Browse for Folder dialog navigate to the WebLogic home directory and click OK.

  6. On the New Server wizard, Domain directory is now populated. Click Next.

  7. On the Add and Remove page, in the Available list, select your application. Then click Add to shuttle the selection to the Configured pane. This associates your application with the newly created domain.

    Click Finish.

    The new server connection appears in the Servers pane. Note that the server is a in stopped state.

3.1.3 Creating an Oracle ADF Application

OEPE supports the creation of the following ADF application artifacts:

  • JPA Entity

  • EJB Session Bean as service

  • JSF Managed Bean for binding

  • ADF Data Controls for binding data to the View and Controller

  • ADF Task Flow as Controller

  • ADF Components as View

To create an ADF application:

  1. From the main menu, select File > New > ADF Application.

  2. In the New Oracle ADF Application dialog, enter the following:

    • Application name

    • Application project location The default is user_home/workspace.

    • Dynamic web project name. The default is Web. This name is appended to the application name.

  3. Click New Runtime to set the WebLogic Runtime environment. The New Server Runtime Environment wizard opens.

  4. In the New Server Runtime Environment wizard, Select Oracle and then select the type of Oracle WebLogic server you are running, for example, Oracle WebLogic Server 12c (12.1.3) and click Next.

  5. On the server details page, click Browse Browse button next to WebLogic home and browse to the location of your WebLogic server installation. Click OK.

  6. In the New Oracle ADF Application dialog, select a JPA project in the JPA Project field. To optionally create a new JPA project, click New JPA Project.

  7. In the New JPA Project wizard, enter the following details then click Next:

    • Project name

    • Project location (user_home/workspace by default)

    • Target runtime

    • JPA version (If you have installed JPA 2.0, the version defaults to 2.0)

    • Configuration


      Note:

      You can modify the default configuration to add the Oracle WebLogic EJB Extensions facet or the Oracle WebLogic Utility Module Extensions facet. These facets cannot be added together. The benefit of using the WLS Extensions facet during project creation is that you can take advantage of the EclipseLink/TopLink shared libraries that ship with Oracle WebLogic Server. If you do not select a WLS Extensions facet, you will need to manually configure your JPA runtime.


    • EAR Membership. Select an EAR file to add the project to. Note that the JPA project will be added to the application's EAR file by default.

    • Working sets. For more information, see the help topic "Working Sets" in the Workbench User Guide > Concepts > Workbench.

  8. On the Java page, specify the source folders on build path and the default output folder, and click Next.

  9. On the JPA Facet page, specify the Platform, JPA Implementation, and database connection settings, and click Finish.

  10. In the New Oracle ADF Application dialog, you will see that your JPA project is listed in the JPA Project field. Click Add project to working sets if you would like to include the current project in a working set. Select an existing working set from the Working sets menu or create a new one.

  11. Click Finish.

    Two projects are created in the Project Explorer - an EAR project and a dynamic web project. If you created a JPA project, that is also added to the Project Explorer.


    Note:

    Using the ADF application wizard is not the only way you can create ADF applications. You can also add the ADF facets to your existing project to use ADF design time features.


3.2 Working with the Oracle ADF Model Layer

The model layer represents the data values related to the current page.

3.2.1 Creating the JPA Model Project

If you did not create the JPA project when you created your ADF Application, you can create one using the New Gallery.

To create the JPA project:

  1. From the main menu, select File > New > Other. From the New Gallery, open the JPA node and select JPA Project.

  2. In the New JPA Project wizard, enter the following details:

    • Project name.

    • Project location. By default, this is user_home/workspace.

    • Target runtime. Choose from the list of those defined, or click New Runtime to define a new one.

    • JPA version. The default is 2.1 and the other available JPA versions are 1.0 and 2.0.

    • Configuration. The default is Basic JPA Configuration. You can modify it by clicking Modify and choosing to enable additional facets. The best option here depends on how you separate your EAR modules. If you store JPA entities as EJBs, then the EJB model is a better choice because it configures the project to use JPA (creating the persistence.xml, adding the design time tools for JPA like entity creation and annotation content assist) as well as EJB (wizards to create a new session bean). If you are separating the entities and EJBs into different modules, then it makes sense to use the JPA configuration preset and use the current preset only for Entity configuration, then create an additional EJB utility module later.


      Note:

      You can modify the default configuration to add the Oracle WebLogic EJB Extensions facet or the Oracle WebLogic Utility Module Extensions facet. These facets cannot be both added to the same configuration. The benefit of using the WLS Extensions facet during project creation is that you can take advantage of the EclipseLink/TopLink shared libraries that ship with Oracle WebLogic Server. If you do not select a WLS Extensions facet, you will need to manually configure your JPA runtime.


    • EAR Membership. Select an EAR file to add the project to. If you do not select an EAR, the project is added to the current ADF EAR project.

    • Working sets

  3. Once you have added details in the JPA Project page of the New JPA Project Wizard, click Next.

  4. On the Java page, specify the source folders on build path and the default output folder, and click Next.

  5. On the JPA Facet page, specify the Platform, JPA Implementation, and database connection settings, and click Finish.

3.2.2 Creating JPA Entities from Tables

You create JPA Entities from tables.

To create JPA Entities from Tables:

  1. Right-click your JPA project, and in the context menu, select JPA Tools > Generate Entities from Tables.

  2. On the Generate Custom Entities wizard - Select Tables page, select a database connection from the Connection dropdown list, or click the New Connections button to add a connection.

  3. On the Generate Custom Entities wizard - Select Tables page, select a database schema from the Schema dropdown list, and select the tables you want to generate entities from in the Tables area. Then click Next.

  4. On the Table Associations page, review and optionally edit the table associations. Then click Next.

  5. On the Customize Default Entity Generation page, optionally customize aspects of entities that will be generated by default from database tables. You must specify a Java package.

  6. On the Customize Individual Entities page, optionally customize individual entities. Then click Finish.

  7. In the Project Explorer, expand the src folder in your JPA project to see the JPA entities that have been created.

3.2.3 Working with Session Beans

Session beans implement business logic. A session bean instance serves one client at a time.

3.2.3.1 Generating a Session Bean on Selected JPA Entities

You can generate session beans on JPA entities.

To generate a session bean on selected JPA entities:

  1. Right-click your JPA project to open the context menu.

  2. In the context menu, select New > Session Bean (EJB 3.x) from JPA Entities.

  3. On the Session Bean (EJB 3.x) page of the Create EJB 3.x Session Bean from JPA Entities wizard, specify a Java package and a class name. Then click Next.

  4. On the Select Entities page, indicate which entities to access via the generated session bean. Then click Finish.

  5. You can view the generated session bean in the Project Explorer.

3.2.3.2 Generating a JSF Managed Bean

You can generate a JSF Managed Bean which is a wrapper on a session bean.

To generate a JSF Managed Bean:

  1. Right-click the session bean in the Project Explorer to open the context menu.

  2. In the context menu, select New > Data Model Components > Generate JSF Managed Bean.

  3. On the Managed Bean page of the Create Managed Bean wizard, specify the Java package and the Session bean to wrap. Then click Finish.

  4. View the generated JSF Managed Bean in the Project Explorer.


Notes:

  • While regeneration is available for EJBs, it is currently not supported for a Managed Bean. The Create Managed Bean wizard will fail if the class already exists.

  • OEPE uses the @generated annotation to determine what can be overwritten when regenerating the EJB. If you customize one of the generated methods, persist for example, you will need to remove the @generated label from the method before regenerating an EJB.


3.2.3.3 Generating a Session Bean and a JSF Managed Bean using the Data Components Model Wizard

You can generate a Session Bean facade on selected entities and generate a JSF Managed Bean to wrap the services in the session facade using the Data Components Model Wizard.

To generate a Session Bean and a JSF Managed Bean using the Data Components Model Wizard:

  1. Open the New Gallery by selecting File > New > Other.

  2. Expand Application Development Framework, and double-click Data Model Components.

  3. On the Session Bean (EJB 3.x) page of the Create Data Model Components wizard, specify the Java package and class name for the session bean. Then click Next.

  4. On the Select Entities page, indicate which entities to access via the generated session bean, then click Next.

  5. On the Data Object page, select JSF Managed Bean or ADF Data Control as the Data object type. Then specify name and location details for the Managed Bean and click Finish. For more information on ADF Model Data Binding see "Working with ADF Model Data Binding".

  6. In the Project Explorer, view the generated session bean facade in the JPA project and the JSF Managed Bean in the web project.

3.2.3.4 Editing a Session Bean

You can edit sessions beans.

To edit the session bean facade:

  1. Right-click the session bean to open the context menu.

  2. In the context menu, select Data Model Components > Edit Session Bean Facade.

  3. On the Select Entities page, indicate which entities you want to add to or remove from the session bean facade.

3.2.4 Working with ADF Model Data Binding

ADF Model implements two concepts that enable the decoupling of the user interface technology from the business service implementation: data controls and bindings. Data controls abstract the implementation technology by using standard metadata interfaces to describe the bean's operations and data collections, including information about the properties, methods, and types involved. In OEPE, you can view this information in the Data Palette, and create databound HTML elements for JSP pages by dragging and dropping data control artifacts from the Data Palette onto the editor for a page. OEPE automatically creates the metadata that describes the bindings from the page to the services. At runtime, the ADF Model layer reads the metadata information from the appropriate XML files for both the data controls and the bindings, and then implements the two-way connection between your user interface and your services.

Declarative bindings abstract the details of accessing data from data collections in a data control and of invoking its operations. There are three basic kinds of declarative binding objects:

  • Executable bindings: Include iterator bindings, which simplify the building of user interfaces that allow scrolling and paging through collections of data and drilling-down from summary to detail information. Executable bindings also include bindings that allow searching and nesting a series of pages within another page.

  • Value bindings: Used by UI components that display data. Value bindings range from the most basic variety that work with a simple text field to more sophisticated list and tree bindings that support the additional needs of list, table, and tree UI controls.

  • Action bindings: Used by UI command components like hyperlinks or buttons to invoke built-in or custom operations on data collections or a data control without writing code.

Figure 3-1, "ADF Bindings" shows how bindings connect UI components to data control collections and methods.

Figure 3-1 ADF Bindings

ADF bindings

The group of bindings supporting the UI components on a page are described in a page-specific XML file called the page definition file. The ADF Model layer uses this file at runtime to instantiate the page's bindings. These bindings are held in a request-scoped map called the binding container.

3.2.4.1 Creating ADF Data Controls

Once you have your application's services in place, you can use OEPE to create data controls that provide the information needed to declaratively bind UI components to those services. In an ADF application, you can create a data control for the session bean or POJO, and that data control will contain representation of all data on the bean. The data control consists of a number of XML metadata files that define the capabilities of the service that the bindings can work with at runtime.

To create a data control from the Project Explorer:

  1. In the Project Explorer, right-click the session bean or POJO for which you want to create a data control.

  2. From the context menu, select Model Components > Create ADF Data Control.

Alternatively, you can also create a data control from the New Gallery.

To create a data control from the New Gallery:

  1. Right-click your model project and select New > Other from the context menu.

  2. In the New gallery, choose Oracle > Application Development Framework > ADF Data Control.

  3. On the Bean Class page, select project [Project] and the bean [Bean Class] from which to create the data control. Note: The Project dropdown list contains all eligible projects in the workspace.

  4. Preview and confirm the project changes on the Summary page and click Finish.

The metadata file datacontrols.dcx is created in the adfmsrc > model node of your Model project, as shown in Figure 3-2, "Data Control File in Project Explorer". When you create a data control based on an EJB session bean, the data control contains a representation of all the methods exposed on the bean, as well as underlying entity beans, and the methods and properties exposed on those.

Figure 3-2 Data Control File in Project Explorer

Data control file in project explorer

For a description of Oracle ADF Data Bindings metadata files and links to more information, see Section 3.11, "Appendix A Oracle ADF XML Files."

With a web page in focus, you can open the Data section of the Palette to view and drag-and-drop data controls, JSF Managed Beans, and page variables on to the page, shown in Figure 3-3, "Data Palette".

Figure 3-3 Data Palette

Data palette

For more information about ADF data controls, see "Using ADF Data Controls" in Developing Applications with Oracle ADF Data Control.

3.2.4.2 Using the ADF Data Control Manager

The Data Control Manager shows all the data controls available to your ADF project. Use the Data Control Manager to view details about your data control objects, including the data type associated with your Java elements, and related artifacts.

The Data Controls tab of the Data Control Manager shows the data control tree. The Structure Definitions tab shows the structure definition control objects. Every data control object exposes the structure definition of your data objects and is shown in the Structure Definitions view. When you are customizing your data structure in the 12c runtime, you customize the structure definition object. Customizing a structure definition object impacts every data control object that exposes that structure definition object.

Note that in 12c applications you can customize your data structure definition object, but in 11g applications, the Data Control Manager shows your available data controls, java elements, and object types, but doesn't allow customizing of the structure definition object.

There are a three ways to access the Data Control Manager:

1. Opening a data control .dcx file.

2. When creating a data control, the last page of the wizard has a check box that you can select to open the data control manager.

3. If you are editing a ADF page, you can open the manager through the Data Palette view: Palette > Data tab > right-click the control > Data Control Manager.

Figure 3-4 shows the Data Control Manager with the Show structure definition link available. When you select a data control object, with an editable structure definition, this link changes to Edit structure definition as shown in Figure 3-5.

Clicking on the Edit structure definition link selects the appropriate structure definition on the second tab of the Data Control Manager, as shown in Figure 3-6. In this dialog, you can enter custom label and tool tip text used by a widget that is rendering the selected data control object on a ADF web page. You can also create, edit, or delete a list of values for the structure definition, as shown in. Use the list of values to determine which values are available for the selected attribute defined by either a collection accessor or an attribute of a collection accessor.

In the web page editor, when you select from a list of available widgets for an attribute of a data control, OEPE determines whether the list of values can be used at runtime. If yes, it displays the name of the list of values in the Edit List Binding dialog, as shown in Figure 3-7.

Figure 3-4 Data Control Manager - Show Structure Definition

As described in surrounding text

Figure 3-5 Data Control Manager - Edit Structure Definition

as described in the surrounding text

Figure 3-6 Data Control Manager - Edit List of Values

as described in the surrounding text

Figure 3-7 Data Control Manager - Edit List Binding

as described in the surrounding text

3.2.4.3 Using the Data Palette to Create UI Components

OEPE provides you with a predefined set of UI components from which to choose for each data control item you drop.

To use the Data Palette to create UI components:

  1. Select an item in the Data Controls panel and drag it onto the editor for your page. You can also drag it and drop it from the data palette to the Outline view.

  2. From the ensuing context menu, select a UI component. When you drag an item from the Data palette and drop it on a page or task flow, OEPE displays a context menu of all the default UI components available. The UI components currently supported are: Form, Graph, Navigation, Single Selection, and Table.

    Depending on the component you select from the context menu, OEPE displays a dialog that enables you to define how you want the component to look.

    For example, if you select Form > ADF Form, the Create Form dialog is opened, as shown in Figure 3-8, "Create Form Dialog". You can specify if you want it to be a Read-Only Form. Additionally, you can edit the Fields table to change the Display Label, Value Binding, and Component to Use elements. Additionally, you can add or delete value bindings, and specify if you want to include navigation controls and a submit button.

    Figure 3-8 Create Form Dialog

    Create form dialog

    The resulting code appears in the source editor for your page.

  3. You can click the Edit Component Definition toolbar button on the Properties window to edit the properties of your UI component.


    Note:

    This feature is currently supported only for ADF Table and ADF DVT Graph components.


For more information using the data palette, see "Using ADF Data Controls" in Developing Applications with Oracle ADF Data Control.

To run the ADF page containing your newly added component, right-click the page in the Project Explorer and select Run As > Run on Server. For more information, see Section 3.5, "Deploying an Oracle ADF Application."


Note:

When running an ADF page from within OEPE, graph components may render inconsistently in the Eclipse browser. Using an external browser is recommended for best results.


3.2.4.4 Using the Bindings Tab in the Properties Window

You can view the bindings associated with a page in the Bindings tab of the Properties window. The tab provides contextual bindings information based on the tag currently in focus in the editor, as shown in Figure 3-9, "Bindings tab in Properties Window". The Bindings tab provides the following features:

  • If you place the cursor in the jsp:root tag of the page, the Bindings tab provides an overview of all the bindings used in the page.

  • Each binding is listed along with its iterator and associated data control, in addition to the tags it is used in.

  • Click on the binding id or iterator to open the item in the page definition editor.

  • Click on a tag to highlight that portion of the source code in the web page editor.

Figure 3-9 Bindings tab in Properties Window

Bindings tab in properties window

3.2.4.5 Working with Page Definition Files

Page definition files define the binding objects that populate the data in UI components at runtime. For every page that has ADF bindings, there must be a corresponding page definition file that defines the binding objects used by that page. Page definition files provide design time access to all the ADF bindings. At runtime, the binding objects defined by a page definition file are instantiated in a binding container, which is the runtime instance of the page definition file.

When you drag and drop an item from the Data Palette to the page, OEPE automatically creates a page definition file for that page and adds definitions for each binding object referenced by the component. For each subsequent databound component you add to the page, OEPE automatically adds the necessary binding object definitions to the page definition file. By default, the page definition files are located in the view.PageDefs package in the adfmsrc directory of the web project.

OEPE names the page definition files using the following convention:

pageNamePageDef.xml

where pageName is the name of the JSP page. For example, if the JSF page is named home.jsp, the default page definition file name is homePageDef.xml.

3.2.4.6 Opening a Page Definition File in the Page Definition Editor

You can open a page definition file in the page definition editor using any of the following ways:

  • Right-click the page in the Project Explorer and select Open Page Definition. If the page does not have an associated page definition file, OEPE asks if you want to create it.

  • With a page active in the editor, from the main menu, select Navigate > Go To > Page Definition.

  • In the Bindings tab of the Properties view, click on a binding id to open it in the page definition editor.

  • If the page definition file already exists, you can double-click it in the Project Explorer.

3.2.4.7 Understanding the Page Definition Editor

The page definition editor allows you to view and configure bindings, as shown in Figure 3-10, "Page Definition Editor". It consists of the following sections:

  • Outline: Shows three different types of objects: bindings, executables, and the data controls in use. You can also add a new binding or executable using the New button (green plus icon). When you click an item in the Outline section, its corresponding details are shown in the right pane in the Binding (for bindings) and Iterator Binding (for executables) section.

  • Binding: Displays information about the binding currently selected in the Outline section.

    Figure 3-10 Page Definition Editor

    Page definition editor
  • Executable: Displays information about the executable currently selected in the Outline section.

  • Iterator Binding: Displays information about the currently selected iterator in the Outline section.

  • Usage: Displays usage information. For a binding, it displays the tags that use it. For an executable, it displays the bindings that use it. For a data control, the bindings and executables that use it are displayed.

  • Bindings Summary or Executable Summary, Validation Details, Usage Details: These sections display summary information when the parent Bindings or Executables folder is selected in the Outline section.

  • Data Control: Displays the Id and Type of the currently selected data control.

  • Data Control Child: Displays the Id and Type of the currently selected Data Control child element.

The toolbar icons on the top right corner of the page definition editor are:

  • Open web page Open file_name: Click to open the associated JSP page, where file_name is the name of the file.

  • Open databindings.cpx Open 'adfmsrc/view/DataBindings.cpx': Click to open the DataBindings.cpx file.

  • Open in xml editor Open this page definition using the XML editor

  • Hide outline Hide Outline: Click to hide the Outline section.

The page definition editor is tolerant of artifacts that are not supported. For example, in Figure 3-11, "Unsupported Artifact", the editor recognizes the tasteful executable even though the artifact is not supported.

Figure 3-11 Unsupported Artifact

Unsupported artifact

If a page definition file is modified outside of the page definition editor, the editor will inform you via the External Changes Detected dialog. The contents of the file are then reloaded. Additionally, the editor also supports Forward and Back navigation from the Eclipse IDE. You can navigate previous selections using either the left and right arrows on the Eclipse toolbar or the main menu items Navigate > Back and Navigate > Forward.

3.2.4.8 Understanding Bindings and Executables

Declarative bindings abstract the details of accessing data from data collections in a data control and of invoking its operations.

Bindings

There are three types of Bindings binding objects used to bind UI components to objects on the data control:

  • Value: Displays data in UI components by referencing an iterator binding. Each discrete UI component on a page that will display data from the data control is bound to a value binding object. Value binding objects include:

    • Attribute Values: Binds text fields to a specific attribute in an object (also referred to as an attribute binding object.)

    • List: Binds the list items to all values of an attribute in a data collection.

    • Tree: Binds an entire table to a data collection and can also bind the root node of a tree to a data collection.

    • Button (boolean): Binds a checkbox to a boolean value for an attribute.

  • Method Action: Binds command components, such as buttons or links, to custom methods on the data control. A method action binding object encapsulates the details about how to invoke a method and what parameters (if any) the method is expecting.

  • Action: Binds command components, such as buttons or links, to built-in data control operations (such as, Commit or Rollback) or to built-in collection-level operations (such as, Create, Delete, Next, or Previous).

  • Task Flow: A binding used to encapsulate a reusable portion or region of an application. You can isolate a small, specific piece of application functionality as a region that can be reused throughout the application. Task flow binding enables you to extract, parameterize, and package

There are five types of supported executable binding objects:

  • Iterator: Binds to an iterator that iterates over view object collections. There is one iterator binding for each collection used on the page. All of the value bindings on the page must refer to an iterator binding in order for the component values to be populated with data at runtime.

    When you drop a collection or an attribute of a collection on the page, an iterator binding is automatically added as an executable. Iterator binding objects bind to an underlying ADF RowSetIterator object, which manages the current object and current range information. The iterator binding exposes the current object and range state to the other binding objects used by the page. The iterator range represents the current set of objects to be displayed on the page. The maximum number of objects in the current range is defined in the rangeSize attribute of the iterator. For example, if a collection in the data control contains products and the iterator range size is 25, the first 25 products in the collection are displayed on the page. If the user scrolls down, the next set of 25 is displayed, and so on. If the user scrolls up, the previous set of 25 is displayed. If your view object uses range paging, then you can configure the iterator binding to return a set of ranges at one time.


    Note:

    If you have two pages each with an iterator binding bound to the iterator on the same view object (which you will if you drop the same collection, for example, on two different pages), then you should ensure that the rangeSize attribute is the same for both pages' iterator bindings. If not, the page with a smaller range size may cause the iterator to re-execute, causing unexpected results on the other page.


  • Method Iterator: Binds to an iterator that iterates over the collections returned by custom methods in the data control.

    A method iterator binding is always related to a method action binding object. The method action binding encapsulates the details about how to invoke the method and what parameters (if any) the method is expecting. The method action binding is itself bound to the method iterator, which provides the data.

    You will see method iterator executable binding objects only if you drop a method return collection or an attribute of a method return collection from a custom method on the data control.

  • Variable Iterator: Binds to an iterator that exposes all the variables in the binding container to the other bindings. While there is an iterator binding for each collection, there is only one variable iterator binding for all variables used on the page. (The variable iterator is like an iterator pointing to a collection that contains only one data object whose attributes are the binding container variables.)

    Page variables are local to the binding container and exist only while the binding container object exists. When you use a data control method (or an operation) that requires a parameter that is to be collected from the page, OEPE automatically defines a variable for the parameter in the page definition file. Attribute bindings can reference the page variables.

  • Accessor Iterator: Iterates over detail collections returned by accessor methods. Accessor iterators are always related to a master iterator, which is a method iterator. The accessor iterator returns the detail objects related to the current object in the master (or method) iterator.

  • Invoke Action: Binds to a method that invokes the operations or methods defined in action or method action bindings during any phase of the page lifecycle.

3.2.4.9 Adding Bindings and Executables

Bindings are added on the Page Definition page, which can be accessed by right-clicking your page in the Project Explorer, and choosing Open Page Definition. For information on tree bindings see "Working with Tree Bindings".

To add a new binding:

  1. In the Outline section, click the New icon and then select Binding.

  2. In the New Binding dialog, select the type of the new binding, for example, list, and enter the Id. Then click OK. The binding is added to the Outline section in the page definition editor.

  3. In the editor, specify binding attributes for the new binding that you just created. For example, if you created a list binding, select the Target Attribute from the Edit List Binding dialog, as well as a List Source Attribute. You can also add or delete Field Mappings.

To add a new executable:

  1. In the Outline section of the Page Definition editor, click the New icon and then select Executable.

  2. In the New Executable dialog, select the type of the new executable, for example, methodIterator, and enter the Id. Then click OK. The executable is added to the Outline section in the page definition editor.

  3. In the editor, specify attributes for the executable that you just created. For example, if you created a methodIterator, select a method action in the Binds field and specify a Range Size.

3.2.4.10 Working with Tree Bindings

Tree bindings are used to display a collection of data in forms requiring a nested data structure. For example, if you are displaying an organization chart, for the organization entities such as Department, Location, and Employee, a tree binding is used to display the parent and each child node using a unique type. So, if Department is the root entity type, you can bind and show attributes of Department, such as Department Name and ID, as well as show attributes for child entity types Location and Employee.

The system adds the ADF Tree component for a tree or hierarchical format, or the ADF Table component for a tabular display. For display such as organization charts or for any nested structure, the Hierarchy Viewer component is used.

To add a new tree binding:

  1. In the Outline section of the Page Definition editor, click the New icon and then select Binding.

  2. In the New Binding dialog, select Tree and enter the ID. Click OK. The binding is added.

To add or change binding attributes for the new binding that you just created:

  1. Add and edit attributes for new bindings on the right side of the Page Definition editor. Click on the page icon for Target Attribute. In the Edit Tree Binding dialog, select the data collection to bind. Click OK. Edit Tree Binding dialog

  2. The editor displays the entity type of the data collection in the Hierarchy section on the left.

    New binding
  3. Click Add (plus icon) in the Attribute Name section on the right to select the attributes of the entity data type you added to the Hierarchy section.

    new binding
  4. Double-click on the newAttribute entry and click on the drop-down icon to select the attribute.

    new binding
  5. To add a new entity type as a child of the selected node, Click Add in the Hierarchy section and select from the available type. Repeat steps 3-4 to select attributes of the type.

    new binding

    Note:

    There are two categories of nodes in the Hierarchy section. There are concrete categories which allow selection of attributes, and virtual categories which have been defined previously in the tree binding structure.


new bindings

For more information about bindings and executables, see sections "Bindings Binding Objects" and "Executable Binding Objects" in the "Using ADF Model in a Fusion Web Application" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.2.5 Adding Data Binding to Existing UI Components

While the Data Palette enables you to design and create bound components in a single drag-and-drop action, in some cases, it may be preferable to create the basic UI components first and add the bindings later. For example, you can first create an ADF Faces component, and then bind it to the correct ADF control. Additionally, you can also rebind a UI component to a different data control.

When designing web pages, keep in mind that ADF bindings can be added only to certain ADF Faces tags. The following lists the ADF Faces tags to which you can add ADF bindings.

  • Text Fields

    • af:inputText

    • af:outputText

    • af:outputLabel

    • af:inputDate

  • Tables

    • af:table

  • Actions

    • af:commandButton

    • af:commandLink

    • af:commandMenuItem

    • af:commandToolbarButton

  • Selection Lists

    • af:inputListOfValues

    • af:selectOneChoice

    • af:selectOneListbox

    • af:selectOneRadio

    • af:selectBooleanCheckbox

To apply ADF Model data binding to existing UI components:

  1. In source editor for your page, select the UI component to which you want to add ADF bindings. When you select a component in the editor, OEPE simultaneously selects that component tag in the Outline window.

  2. On the Properties pane, click the Bind to ADF Control toolbar button on the top right.

    Properties View

    Note:

    Your project must already contain data controls for the Bind to ADF Control button to appear.


  3. On the Select Data Control dialog, select an ADF Data Control or one of its properties. You must select a compatible control or property to continue. Click OK.

To rebind an existing UI component:

  1. In source editor for your page, select the UI component you want to rebind to a different data control. When you select a component in the editor, OEPE simultaneously selects that component tag in the Outline window.

  2. On the Properties pane, click the Bind to ADF Control toolbar button on the top right.

  3. On the Select Data Control dialog, select the new data control or data control property you want to bind the UI component to. You must select a compatible control or property to continue. Click OK.

    Depending on the UI component being rebound, OEPE displays a dialog where you can re-enter properties for the component. For example, if you are rebinding an ADF Table, the Edit Table dialog is displayed.

  4. Specify properties for your component and click Finish to complete rebinding.

3.2.6 Debugging ADF Bindings

You can debug ADF bindings by setting breakpoints in the page definition editor. For more information, see Section 3.6.4, "Setting and Using ADF Page Definition Breakpoints.".

3.2.6.1 ADF Page Definition Artifact Validation

OEPE provides real-time and on-demand validation of your page definition files even while the page definition editor is closed. Page definition validation warnings and errors are reported in the Markers view under the section ADF Page Definition Problems. You can set workspace preferences for ADF page definition validation from the Preferences dialog.

To specify preferences for ADF page definition validation:

  1. From the main menu, select Window > Preferences to open the Preferences dialog.

  2. In the Preferences dialog, select ADF > Artifact Validation to open the Artifact Validation page.

  3. Specify validation options as per your preference:

    • Disable validation: Click to stop ADF page definition validation.

    • Reduce all validation errors to warnings: Selected by default. Deselect if you want validation issues to be reported as errors, thereby preventing deployment to WebLogic Server. This option is disabled if Disable validation is selected.

    • Run Validation: Click to run a workspace-wide validation based on current saved preferences. This option is disabled if Disable validation is selected.

    • On clicking OK or Apply:

      • If Disable validation is unselected or the Reduce all validation errors to warnings option was changed, a workspace-wide validation occurs.

      • If Disable validation is selected, all ADF Validation Markers are deleted.

      • Open page definition editors immediately reflect the changes.

3.2.7 Refactoring ADF Bindings

You can perform several refactoring options on ADF data binding artifacts using the AppXRay dependency engine. For more information, see Section 3.8.4, "Refactoring ADF Data Binding Artifacts."

3.3 Working with Oracle ADF Controller

In the controller layer, where handling page flow of your web applications is a key concern, ADF Controller provides an enhanced navigation and state management model on top of JSF. OEPE allows you to declaratively create task flows where you can pass application control between different types of activities, such as pages, methods on managed beans, case statements, or calls to other task flows.

These task flows can be reused, and can also be nested, both within themselves and within pages. Task flows nested in pages become regions that contain their own set of navigable pages, allowing users to view a number of different pages and functionality without leaving the main page.

3.3.1 Understanding ADF Task Flows

ADF task flows provide a modular approach for defining control flow in an ADF application. Instead of representing an application as a single large JSF page flow, you can break it up into a collection of reusable task flows. Each task flow contains a portion of the application's navigational graph. The nodes in the task flows are activities. An activity node represents a simple logical operation such as displaying a page, executing application logic, or calling another task flow. The transitions between the activities are called control flow cases.

For more information about ADF Task Flows, see the Introduction to ADF Task Flows section in the "Getting Started with ADF Task Flows" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.3.2 Creating a New Task Flow

You can create a task flow.

To create a new task flow:

  1. In the Project Explorer, right-click your web project and select ADF Task Flow in the context menu. If the ADF Task Flow menu item is not visible, select Other, and in the New Gallery, expand Application Development Framework and double-click ADF Task Flow.

  2. In the Create ADF Task Flow wizard, specify a file name (default: task-flow.xml) and location (default: WebContent/WEB-INF folder of your web project) for the ADF Task Flow. Then click Next.

  3. On the Task Flow Options page, select options to specify the type of task flow you want to create. The Create as Bounded Task Flow checkbox is selected by default. Deselect it to create a source file that will be incorporated into the application's unbounded task flow. Select Task flow will use page fragments if you want the view activities that you add to the task flow to reference page fragments files (.jsff). Leave it unselected if you want the view activities that you add to the task flow to reference JSF pages. Then click Finish. The task flow that you created opens by default in the Diagram view of the ADF Task Flow Editor.

  4. After you create the task flow, you can update it using the Diagram, Overview, or Source views. When you use the Design view, the Properties pane is context-aware, making additional configuration for various activities easily accessible without switching to the Overview pane.

A new XML source file is created every time you create a new ADF unbounded or bounded task flow. By default, the XML source file for an ADF unbounded task flow is called adfc-config.xml.


Note:

Do not use the same name for more than one task flow in the same workspace, even if the task flows belong to different projects. Identical task flow names can cause unpredictable behavior while debugging.


3.3.3 Adding Activities to a Task Flow

You can add activities to a task flow.

To add activities to a task flow:

Drag an activity from the Palette onto the ADF Task Flow. Normally, you would start with a view activity.

  • If you drag a view activity onto the diagram, you can double-click it to display the wizard for the page or page fragment that the task flow is configured to invoke. Use the wizard to define characteristics for the page or page fragment.

  • If you drag a router activity onto the diagram, you can use the Properties pane to create an expression whose evaluation will determine which control flow rule will be followed.

  • If you drag a method call activity onto the diagram, you can use the Properties pane to configure the method to be called.

  • If you drag a task flow call activity onto the diagram, you can double-click it to display the Create Bounded Task Flow dialog where you can define settings for a new bounded task flow.

  • If you are creating a bounded task flow, and you drag a task flow return activity onto the diagram, you can use the Properties pane to configure the activity.


Note:

The default activity is the first activity to execute in an ADF bounded task flow. For example, the default activity always executes first when a task flow call activity passes control to the ADF bounded task flow. The first activity that you add to a new ADF bounded task flow diagram is automatically identified as the default activity. A green blob over a node indicates that it is the default activity.


For more information on activity types, see the Introduction to Activity Types section in the "Working with Task Flow Activities" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.3.4 Adding ADF Bindings to a Task Flow

Once you have created your task flow, you can add ADF bindings to the Router, Method Call, and TaskFlow Call activities by creating Page Definitions. For more information, see Section 3.3.2, "Creating a New Task Flow."

To create a Page Definition for binding task flow activities:

  1. Drop the activity onto the task flow page. ADF bindings can only be added to the Method Call, Router, and TaskFlow Call activities on a task flow.

  2. Mouse over the activity to view the Create Page Definition icon. Click on that icon to create a new Page Definition, or to open an existing Page Definition.

  3. Once you have a Page Definition for that activity, create a binding. For more information, see Section 3.2.4.9, "Adding Bindings and Executables."

Figure 3-12 shows an example of a Method Call on a task flow page showing the Create Page Definition option.

Figure 3-12 Method Call on a Task Flow Page

Method call on a task flow page

Figure 3-13 shows an example of a Router on a task flow page showing the Create Page Definition option.

Figure 3-13 Router on a Task Flow Page

Router on a task flow page

Figure 3-14 shows an example of a methodAction binding on the Page Definition that can be bound to a method call activity.

Figure 3-14 methodAction binding on the Page Definition

methodAction binding on the Page Definition

To configure ADF bindings for Method Calls in a task flow:

  1. Create a Page Definition for the Method Call, if you don't already have one, and create a binding. For more information, see Section 3.3.4, "Adding ADF Bindings to a Task Flow."

    In the Task Flow editor, choose the Overview tab.

  2. In the Outline panel on the left, select the activity for which your are going to associate the method call to a binding.

  3. In the Method Call Activity panel on the right, select the edit page icon next to the Method field. The Choose Method dialog appears. The bindings available for that method are shown.

  4. Choose the appropriate binding and click OK.

Figure 3-15 shows an example of the Choose Method dialog for a Method Call taskflow page definition.

Figure 3-15 Choose Method Dialog

Choose Method dialog

To configure ADF bindings for Router activities in a task flow:

  1. Create a Page Definition for the Router, if you don't already have one, and create a binding. For more information, see Section 3.3.4, "Adding ADF Bindings to a Task Flow."

    In the Task Flow editor, choose the Overview tab.

  2. In the Outline panel on the left, select the activity for which you are going to associate the Router to a binding.

  3. In the Router Activity panel on the right, select the edit page icon next to the Router field. The bindings available for that router are shown.

  4. Choose the appropriate binding and click OK.

Figure 3-16 shows an example of an attribute binding to be used to bind a Router in a taskflow.

Figure 3-16 Attribute Binding Used to Bind a Router in as Taskflow

Attribute binding to be used to bind a Router in a taskflow

Figure 3-17 shows an example showing the Choose Binding dialog for the Router activity.

Figure 3-17 Choose Binding Dialog

Choose binding dialog

3.3.5 Adding Control Flows to a Task Flow

A control flow case identifies how control passes from one activity to the next in the application.

To add a control flow case:

  1. In the Palette, select Control Flow Case.

  2. On the diagram, click a source activity, for example a view, and then click the destination activity.

  3. Set the outcome value in the Properties pane, using either the From Action attribute (if the outcome is to be determine by a method) or the From Outcome attribute (if the outcome can be set as a String).

3.3.6 Using Task Flows as Regions

You can render a bounded task flow in a JSF page or page fragment (.jsff) by using an ADF region. When first rendered, the ADF region's content is that of the first view activity in the bounded task flow. The view activities used in the bounded task flow must be associated with page fragments, not pages.

You can pass values to the ADF Region using task flow binding input parameters or contextual events.

For more information on ADF Regions, see the Introduction to Using Task Flows in ADF Regions section in the "Using Task Flows as Regions" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

Before you create an ADF region, you need to do the following:

  • Create a bounded task flow with one or more view activities associated with page fragments or one task flow call activity to a task flow with view activities.

  • Create a page to host the ADF region.

To create an ADF Region:

  1. In the Project Explorer, drag the bounded task flow onto the JSF page and drop it where you want to place the ADF region.

  2. In the context menu, select Region.

  3. Review or modify (as appropriate) the following properties which OEPE automatically populates with default values in the Properties pane for the ADF region:

    • Id: An ID that the JSF page uses to reference the ADF region.

    • Rendered: If selected (the default state), the ADF region renders when the JSF page renders.

    • Value: An EL reference to the ADF region model, for example, #{bindings.task_flow1.regionModel}. This is the region model that describes the behavior of the region.

3.3.7 Running an ADF Task Flow

The procedure for running and debugging task flows differs depending on whether the task flow is bounded or unbounded, whether it contains pages or page fragments.

To run or debug a bounded task flow that uses pages:

  • Right-click the bounded task flow in the Project Explorer and choose either Run As or Debug As.

To run or debug a bounded task flow that uses page fragments:

  1. Create a JSF page containing a region that is bound to the bounded task flow. When you drop a bounded task flow containing page fragments onto a JSF page, OEPE automatically prompts you to create a region.

  2. Create a view activity in the project's unbounded task flow that refers to the page.

  3. Right-click the view activity in the Project Explorer and choose Run.

For more information on running and debugging task flows, see the Testing ADF Task Flows section in the "Getting Started with ADF Task Flows" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.4 Working with Oracle ADF Faces

ADF Faces rich client (known also as ADF Faces) is a set of JavaServer Faces (JSF) components that include built-in Asynchronous JavaScript and XML (AJAX) functionality. While AJAX brings rich client-like functionality to browser-based applications, using JSF provides server-side control, which reduces the amount of JavaScript code that application developers need to write in order to implement AJAX-based applications. In addition to providing a rich set of JSF components, the ADF Faces rich client framework (RCF) provides a client-side programming model familiar to developers accustomed to the JSF development model.

For more information on Oracle ADF Faces, see the "Introduction to ADF Faces Rich Client" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.4.1 About ADF Faces Configuration Files

A JSF web application requires a specific set of configuration files, namely, web.xml and faces-config.xml. ADF applications also store configuration information in the adf-config.xml and adf-settings.xml files. Because ADF Faces shares the same code base with MyFaces Trinidad, a JSF application that uses ADF Faces components for the UI also must include a trinidad-config.xml file, and optionally a trinidad-skins.xml file.

For more information on ADF Faces configuration files, see the "ADF Faces Configuration" appendix in Developing Fusion Web Applications with Oracle Application Development Framework.

For more information on all Oracle ADF XML files generated by OEPE, see Section 3.11, "Appendix A Oracle ADF XML Files."

3.4.2 About ADF Data Visualization Components

The ADF Data Visualization components provide significant graphical and tabular capabilities for displaying and analyzing data, and support the use of ADF data controls.

For more information regarding ADF Data Visualization Components, see the "Introduction to ADF Data Visualization Components" chapter of Developing Fusion Web Applications with Oracle Application Development Framework.

3.4.3 Working with ADF tags in JSP Pages

You can create JSP pages.

To create a JSP page:

  1. In the Project Explorer, In your dynamic web project, right-click the WebContent node, and select New > JSP File. Alternatively, from the main menu, click New > Other, and choose JSP File under the Web node.

  2. In the New JSP File dialog, enter or select the parent folder, and enter a file name, for example, login.jspx, in the File name field. Then click Next.

  3. On the Select JSP Template page, select a template and view the statements generated for it in the Preview pane. A variety of JSP templates are available for JSP, JSF, and ADF development. For ADF applications, you will need to select a JSP template that supports XML style syntax, for example, New ADF Rich Faces Page - Basic (xhtml, xml syntax).

  4. Optionally, you can click the JSP Templates link at the bottom to customize existing templates or create new ones.

  5. Click Next. The page opens in the Web Page Editor.

3.4.4 Support for ADF Components in the Palette

The Palette pane displays all the available library components. You can click on an item in the palette to expand it.

The ADF Data Visualizations node shows all the GUI components available to represent data, for example, Bars, Pies, or Gauges. You can drag an item from the Palette and drop it on the JSP page. The following figure shows the ADF Data Visualizations node in the Palette.

The last item in the Palette is the Data Palette. Expand it to see content related to the available variables. Variables displayed in the Data Palette range from local Page Variables declared within the current JSP page to JSF Managed Beans available to the whole application. The Data Palette enables easy navigation to variable and class declarations as well as Drag and Drop onto the page.

3.4.5 Using the Tag Drop Editor for ADF Faces Components

You can set properties for ADF components.

To set properties for ADF components using the tag drop editor:

  1. Select an ADF Faces component in the Palette, for example, Form.

  2. Drag the selected component and drop it on to your JSP file.

  3. In the dialog that opens, set properties for the ADF component. For example, if you dropped the Form tag, you can specify the type of form to create, as well as select properties that will be used as form fields.


    Note:

    Some tags may not render correctly; rendering support for these will be added in a future release.


3.4.6 Using the Smart Editor for ADF Components

The Properties pane provides a smart editor for ADF components where you can review and update the properties of ADF tags and attributes.

To use the smart editor for an ADF component:

  1. Click an ADF component, for example, af:form, either in the source view or design view of the JSPX file.

  2. Click the Properties pane.

  3. In the Properties pane, you click any of the property categories, and review or update the attributes. For example, if you are viewing the properties for the af:form tag, you can click Common and edit the Id attribute. If you want to view all attributes together, click All.

  4. You can click on a hyperlinked field to open its value in the editor.

  5. For documentation on a particular tag, press F1 from within the Properties pane.

3.5 Deploying an Oracle ADF Application

You can quickly deploy applications.

To run an ADF application on WLS:

  1. Right-click the page you want to run, for example, login.jspx, and select Run As > Run on Server.

  2. In the Run on Server dialog, select Choose an existing server if you already have a valid server connection to WLS 10.3.5. If you do not have an existing valid server configuration, select Manually define a new server and follow the instructions.

3.6 Debugging an Oracle ADF Application

Like any debugging task, debugging the web application's interaction with Oracle Application Development Framework (Oracle ADF) is a process of isolating specific contributing factors.

To identify and fix application problems, the ADF Debugger provides declarative breakpoints that you can set at the ADF object level (such as task flows and ADF lifecycle phases), as well as standard Java breakpoints. ADF declarative breakpoints provide a high-level object view for debugging ADF applications. For example, you can break before a task flow activity to see what parameters would be passed to the task flow. To perform the same function using only Java breakpoints would require you to know which class or method to place the breakpoint in. ADF declarative breakpoints should be the first choice for ADF applications.

For more information about debugging an ADF application, see "Using the ADF Declarative Debugger" in Developing Fusion Web Applications with Oracle Application Development Framework.

3.6.1 Using ADF Source Code with the Debugger

If you have valid Oracle ADF support, you can obtain complete source code for Oracle ADF by opening a service request with Oracle Worldwide Support. You can request a specific version of the Oracle ADF source code. You may be given download and password information to decrypt the source code ZIP file. Contact Oracle Worldwide Support for more information.

Adding Oracle ADF source code access to your application debugging session will:

  • Enhance the use of Java code breakpoints by displaying the Oracle source code that's being executed when the breakpoint is encountered. You can also set breakpoints easier by clicking on the margin in the source code line you want to break on. Without the source code, you will have to know the class, method, or line number in order to set a breakpoint within Oracle code.

  • For Java code breakpoints set within the source code, you will be able to see the values of all local variables and member fields in the debugger.

After you have received or downloaded the "outer" ZIP, unzip it with the provided password to access the actual source code ZIP file. The ADF source code ZIP name should be a variant of the ADF version number and build number. For example, the ADF source ZIP may have a format similar to adf_vvvv_nnnn_source.zip, where vvvv is the version number and nnnn is the build number. Extract the zip into a folder that has the same name as the zip. For example, if the ADF zip is named adf_111150_6013_source, extract it into a folder called adf_111150_6013_source.

To add an ADF source library to a project:

  1. From the main menu, select Window > Preferences.

  2. In the Preferences dialog, select ADF > ADF Source Code Location.

  3. In the ADF Source Code Locations page, click Add.

  4. In the Add ADF Source Bundle Location dialog, navigate to the ADF source location by clicking Browse in the Location field. The Bundle information field is populated. Then click OK.

  5. Click OK in the Preferences dialog.


Note:

When multiple versions of WLS (for example, 10.3.5 and 10.3.6) and ADF runtime are configured in OEPE, and the shared libraries from these distributions have the same sub-version, only the latest WAR/JAR from the latest WLS runtime will be registered in the OEPE shared library registry. If the version of ADF source code (for example, 11.1.1.6.0) provided to OEPE is targeted to an older WLS/ADF runtime, it will not be mapped to the later version of the runtime JAR.


3.6.2 Setting ADF Declarative Breakpoints

You use the ADF Declarative Debugger features in OEPE to declaratively set breakpoints on ADF task flow activities, ADF bindings, and ADF lifecycle phases. ADF declarative breakpoints provide a high-level object view for debugging ADF applications. For example, you can break before a task flow activity to see what parameters would be passed to the task flow. To perform the same function using only Java breakpoints would require you to know which class or method to place the breakpoint in. ADF declarative breakpoints should be the first choice for ADF applications.

The ADF Declarative Debugger also supports standard Java code breakpoints. You can set Java code breakpoints in any ADF application. You may be able to use Java code breakpoints when an ADF declarative breakpoint does not break in the place you want.

The ADF Declarative Debugger is built on top of the Java debugger, so it has the features and behaviors of the Java debugger. But instead of needing to know the Java class or method, you can set ADF declarative breakpoints in visual editors.

3.6.3 Setting and Using ADF Task Flow Breakpoints

You can add breakpoints to task flow activities in the task flow editor by selecting a task flow activity and using the context menu to toggle or disable breakpoints on that activity. After the application pauses at the breakpoint, you can view the runtime structure of the objects as well as a list of data for a selected object in the ADF Structure and Data window.

When an ADF declarative breakpoint is set, it appears as a red dot icon in the task flow activity.

To set and use a breakpoint on a task flow activity:

  1. Double-click the task flow in the Project Explorer to open in the task flow editor.

  2. Right-click a task flow activity and choose Toggle Breakpoint from the context menu.

    A blue dot appears on the task flow activity, signifying that the breakpoint has been set.

  3. Start the debugging process. You can:

    • From the main menu, choose Run > Debug As, and then select the server.

    • From the Project Explorer, right-click the project, adfc-config.xml, faces-config.xml, task flow, or page and choose Debug As, and then select the server.

  4. When the application is paused at a breakpoint, a red triangle appears next to the breakpoint icon on the task flow activity. You can now examine the application using the ADF Structure and Data window or the Debug window.

  5. The ADF Structure and Data window appears by default. You can use this window to examine runtime structure and corresponding data values.

  6. Select a node in the ADF structure in the left pane and view pertinent data in the right pane. Task flow activity declarative breakpoints pause the application just before the task flow activity is executed. You can use the Step Into (F5) function to pause the application just prior to executing the called task flow default activity.

  7. Continue debugging the application as required.

3.6.4 Setting and Using ADF Page Definition Breakpoints

You can add breakpoints to page definition executables and bindings in the page definition editor by selecting a binding or executable item and using the context menu to toggle or disable 'before' or 'after' breakpoints on that item. After the application pauses at the breakpoint, you can view the runtime structure of the objects as well as a list of data for a selected object in the ADF Structure and Data window.

To set and use ADF page definition breakpoints:

  1. In the page definition editor, in the Outline section, right-click the binding or executable you want to set the breakpoint on. From the context menu, select Toggle Breakpoint Before or Toggle Breakpoint After or both depending on where you want to place the breakpoint. A blue triangle appears on the item indicating that the breakpoint has been set.

    Breakpoint set
  2. From the main menu, select Window > Open Perspective > Debug. The Breakpoints window lists the breakpoints you have set selected by default. You can deselect breakpoints in the Breakpoints window if you do not want them to be considered by the debugger. Double-clicking a breakpoint in the Breakpoints window opens the page definition editor with the particular binding or executable in focus.

  3. Start the debugging process. You can:

    • From the main menu, choose Run > Debug As, and then select the server.

    • From the Project Explorer, right-click the project or page and choose Debug As, and then select the server.

  4. When the application is paused at an ADF page definition breakpoint, a red triangle appears on the impacted binding element in the page definition editor, as shown in the following figure. You can now examine the application using the debugging resources available.

    Breakpoint active
  5. The ADF Structure and Data window appears by default when you work in the Debug perspective. You can use this window to examine runtime structure and corresponding data values.

  6. Select a node in the ADF structure and view pertinent data in the right pane.

  7. Continue debugging the application as required.

3.6.5 Setting and Using ADF Lifecycle Phase Breakpoints

You can set Before and After breakpoints on all the ADF lifecycle phases in the ADF Lifecycle diagram. For each phase, you can set Before only, After only, or both. You can set breakpoints on as many phases as you want. The ADF Lifecycle diagram is available from the Breakpoints window. You can set ADF lifecycle breakpoints on any of the ADF lifecycle phases:

  • JSF Restore View

  • Initialize Content

  • Prepare Model

  • JSF Apply Request Values

  • Apply Input Values

  • JSF Process Validations

  • Validate Input Values

  • Process Update Model

  • JSF Update Model Values

  • Validate Model Updates

  • JSF Invoke Application

  • Process Component Events

  • Metadata Commit

  • Prepare Render

  • JSF Render Response

To set and use ADF lifecycle phase breakpoints:

  1. Select Window > Show View > Breakpoints to open the Breakpoints window.

  2. In the Breakpoints window, click the Add ADF Lifecycle Breakpoints button in the toolbar.

    The ADF Lifecycle Diagram is displayed.

  3. In the ADF Lifecycle Diagram, select the left checkbox to set a breakpoint before the phase, or select the right checkbox to set a breakpoint after the phase, or select both.

  4. Start the debugging process. You can:

    • From the main menu, choose Run > Debug As, and then select the server.

    • From the Project Explorer, right-click the project, adfc-config.xml, faces-config.xml, task flow, or page and choose Debug As, and then select the server.

  5. When the application is paused at an ADF lifecycle phase breakpoint, you can examine the application using the debugging resources available.

  6. The ADF Structure and Data window appears by default when you work in the Debug perspective. You can use this window to examine runtime structure and corresponding data values.

  7. Select a node in the ADF structure and view pertinent data in the right pane.

  8. Continue debugging the application as required.

3.6.6 Using the EL Expression Evaluator

When the application is paused at a breakpoint, you can use the EL expression evaluator to enter an EL expression for evaluation. You can enter arbitrary EL expressions for evaluation within the current context. If the EL expression no longer applies within the current context, the value will be evaluated to null. The EL Evaluator is available for debugging any JSF application.

To use the EL Evaluator:

  1. Set a break point in the JSF application.

  2. Start the debugging process.

  3. When the breakpoint is reached, click the ADF EL Evaluator tab to bring it forward.

  4. Enter an EL expression in the Expression field.

    When you click in the field after entering #{ or after a period, a discovery function provides a selectable list of expression items. Auto-completion will be provided for easy entry. You can evaluate several EL expressions at the same time by separating them with semicolons.

  5. When you finish entering the EL expression, click Evaluate and the expression is evaluated.

3.6.7 Using the ADF Structure and Data Window

The ADF Structure and Data window displays the ADF structure on the left pane, and relevant data for a given object in the right pane.

When you use the Debug perspective of OEPE, the ADF Structure and Data window opens by default. To manually launch the ADF Structure and Data window, choose Window from the main menu, and then select Show View > ADF Structure and Data.

3.6.7.1 Using the ADF Structure Pane

When the application is paused at a breakpoint, the ADF Structure pane displays a tree structure of the ADF runtime objects and their relationships within the application. In particular, it shows the hierarchy of view ports, which represent either the main browser window or contained regions. When you select different items in the ADF Structure pane, the data display in the accompanying ADF Data pane changes.

The roots of the hierarchy are the sibling nodes Scopes and ADF Context:

  • Scopes: Displayed at the top of the ADF Structure hierarchy above its sibling ADF Context node. There is only one Scopes node in the ADF Structure hierarchy. You can expand the Scopes node to show a list of child scope nodes (such as viewScope and pageFlowScope). If you select a child scope node, the ADF Data pane displays the variables and values for that scope.

  • ADF Context: Displayed as the root node of the ADF Structure hierarchy below its sibling Scopes node. There will only be one ADF Context within the ADF Structure hierarchy.

3.6.7.2 Using the ADF Data Pane

When an application is paused at an ADF declarative breakpoint, the ADF Data pane (in the ADF Structure and Data window)s displays relevant data based on the selection in the ADF Structure pane.

The ADF Data pane displays the following types of data:

  • You can inspect the values of requestScope, viewScope, pageFlowScope, applicationScope, and sessionScope by expanding each corresponding node in the ADF Structure pane.

  • When the ADF context is selected in the ADF Structure pane, the current value of the ADF context variables will be displayed in the ADF Data pane.

  • Selecting a view port within the ADF Structure hierarchy will display the view port's current view port details in the ADF Data pane.

  • In the ADF Structure pane, each individual ADF task flow within a page flow stack hierarchy is selectable. An ADF task flow selected in the ADF Structure pane will display the current task flow information in the ADF Data pane.

  • When you select a page or page fragment node in the ADF Structure hierarchy, the corresponding UI component tree is displayed within the ADF Data pane.

3.7 Using AppXray for Oracle ADF Artifacts

AppXRay is a central feature of Oracle Enterprise Pack for Eclipse designed for dependency tracking, validation, visualization, and refactoring support. In this release of OEPE, AppXray is enabled for ADF components as well.

Some of the features in the source view of the Web Page editor that are driven by AppXray are:

To use AppXaminer to view dependency relationships:

  1. In the Project Explorer, right-click any file in your application, for example, login.jspx, and select Show AppXray Dependencies from the context menu.

  2. AppXaminer opens in the Editor displaying the relationship the selected page has with other components. Numeric values indicate the number of references a component has with another.

  3. Expand a node to the relationship it has with other components.

  4. Right-click a node and select Show Reference Detail from context, which invokes a popup window displaying the detailed components involved. Alternatively, select Open from the context menu to view the file in the editor.

3.8 Refactoring Oracle ADF Components

OEPE provides refactoring options to rename, move, and delete the ADF components that your application uses. These refactoring options synchronize your changes with other parts of the application that are dependent on the changes.

3.8.1 Refactoring ADF Pages

This section describes the refactoring options available for ADF pages. Table 3-1 lists each refactoring operation and what components are consequently modified.

Table 3-1 Refactoring Options Available for ADF Pages

Refactoring Operation Components Modified

Renaming a page file

  • faces-config.xml

  • ADF task flow

  • databindings.cpx

Moving a page to a different folder

  • faces-config.xml

  • ADF task flow

  • databindings.cpx

Deleting a page file

The corresponding page definition file and the entry for the page definition in the CPX file are deleted

Note: If there are invalid references, an error message is displayed

Deleting a folder containing a page

The corresponding page definition files and the entries for the page definitions in the CPX file are deleted

Renaming a folder containing a page

  • faces-config.xml

  • ADF task flow

  • corresponding page definition file

  • databindings.cpx


3.8.2 Refactoring ADF Task Flow configuration files

Table 3-2 describes the refactoring options available for ADF task flow configuration files. The following content lists each refactoring operation and what components are consequently modified.

Table 3-2 Refactoring Options for ADF Task Flow Configuration Files

Refactoring Operation Components Modified

Renaming the task-flow-id tag of a bounded task flow

  • task-flow-call tag in the task flow configuration file

  • Page definition XML file of the page in which the task flow is embedded

Renaming the task flow configuration file

  • document tag in the task flow configuration file

  • Page definition XML file of the page in which the task flow is embedded

Renaming the task-flow-activity id attribute for view and taskflow call activities

References to task-flow-activity within the configuration file

Renaming task flow id

ID reference in page definition

Renaming a folder containing a task flow

  • document tag in task flow configuration file

  • Page definition XML file of the page in which the task flow is embedded

Moving a task flow

  • document tag in the task flow configuration file

  • Page definition XML file of the page in which the task flow is embedded

Deleting a task flow

Entry in page definition file deleted


3.8.3 Refactoring JSF/ADF Managed Beans

OEPE support for refactoring a Java class includes all changes except those noted in Table 3-3, which lists each refactoring operation on managed beans and components consequently modified.

Table 3-3 Refactoring Operations on Managed Beans

Refactoring operation on Managed Bean Components Modified

Moving to a different package

Class name in the managed bean definition in the corresponding configuration file

Deleting the Java class

  • No change to the definition of the bean in the configuration file

  • An error message warns you about invalid references

Renaming the name of the managed bean in the configuration file

References to the managed bean in all pages

Deleting the name of the managed bean or the managed bean itself

Reference to the managed bean in all pages

Renaming a property of the managed bean

  • Method or field in the managed bean class that corresponds to the property

  • Name of property in faces-config.xml

  • EL expression in JSP files

Renaming a Java class that is the type for a managed property in a JSF/ADF managed bean

  • Accessors on the property

  • Reference to the managed bean in all pages


3.8.4 Refactoring ADF Data Binding Artifacts

This section describes the refactoring options available for ADF data binding artifacts. Table 3-4 lists each refactoring operation and what components are consequently modified.


Notes:

  • All ADF Model files (.dcx, .cpx, page definitions) must reside in the adfmsrc folder. The user can move the files to any package under adfmsrc. To create a package, right-click the folder and select New > Package.

  • Refactoring of Java files, for example, JPA entities and session beans, does not change the corresponding entries in ADF Model files.


Table 3-4 Refactoring Operations and Modified Components

Refactoring Operation Components Modified

Moving datacontrols.dcx to another package under the adfmsrc folder

  • datacontrolusages attribute in the DataBindings.cpx file

  • Reference to the .dcx file in META-INF/adfm.xml of the Model project

  • package attribute in the file

Renaming or moving a folder containing a data control file

  • datacontrolusages attribute in the DataBindings.cpx file

  • Reference to the .dcx file in META-INF/adfm.xml of the Model project

  • package attribute in the file

Changing the Id within a data control

  • path attribute in the data control usages section of the .cpx file

Moving DataBindings.cpx

  • Reference to the .dcx file in META-INF/adfm.xml of the Model project

  • package attribute in the file

Renaming or moving a folder containing an ADFm file (*.cpx)

  • Reference to the .dcx file in META-INF/adfm.xml of the Model project

  • package attribute in the file

Changing the data control ID in the data control usages section of an ADFm file (*.cpx)

  • DataControl attribute in associated page definition files

Renaming or moving a page definition file

  • Id attribute in the root element

  • Reference to the page definition file in the .cpx file

  • package attribute in the file

  • Page definition Id

Renaming or moving a folder containing a page definition file

  • Reference to the page definition file in the .cpx file

  • package attribute in the file

  • Page definition Id


3.8.5 Externalizing Strings

The string externalization feature in OEPE enables you to extract strings from JSF pages and externalize them in resource bundles. The strings are then substituted by the corresponding EL expression. By externalizing strings, the text can be translated in different languages.

To externalize strings:

  1. In the Project Explorer, right-click the page you want to extract strings from. In the context menu, choose Source > Externalize Strings.

  2. In the Externalize Strings dialog, select the strings you want to externalize. The Externalize Strings dialog contains the following options:

    • Enter common prefix for generated keys: Specifies an optional prefix for all newly generated key. A good practice is to use the name of the JSF page to ensure that entries in the property files can be easily grouped.

    • Strings to externalize: Displays the list of all strings in the file.

    • Externalize: Marks the selected strings to be externalized. Externalized strings will be placed in a property file. In the code, the string is substituted by its corresponding EL expression.

    • Ignore: Marks the selected strings to be ignored from externalization.

    • Edit: Opens a dialog to enter a new value and key.

    • Context: Displays the occurrence of the string in the context of the page.

    • Bundle Property File: Select a property bundle file. If a properties file has not been created previously, OEPE creates called messages.properties.

  3. Click Next.

  4. In the next page of the wizard, confirm the changes to be performed after reviewing the original source and the refactored source.

  5. Click Finish.

3.8.6 Adding and Refactoring ADF Tag IDs

If you have tags on your page with missing IDs, you can add and refactor your ADF tags using the Fix ADF Component IDs feature from your page editor.

To add and refactor ADF tag IDs:

  1. With the focus on your page, right-click and choose Source > Fix ADF Component IDs.

  2. A refactoring diff window comes up and shows you the code before and after the refactor operation. Inspect the changes to ensure correctness, then click Finish.

3.9 Reusing Oracle ADF Application Components

OEPE and ADF enable you to package certain ADF components into the ADF Library for reuse in applications. Reusable ADF components can be task flows and page templates.

3.9.1 About ADF Library Support

ADF Library provides a convenient and practical way to create, deploy, and reuse high-level components. When you first design your application, you design it with component reusability in mind. If you created components that can be reused, you can package them into JAR files and add them to a reusable component repository. If you need a component, you may look into the repository for those components and then add them into your project or application.

An ADF Library JAR contains ADF components and does not and cannot contain other JARs. It should not be confused with OEPE library, Java EE library or Oracle WebLogic shared library.

An ADF Library created in OEPE can be consumed by Oracle JDeveloper.


Note:

OEPE does not support generating an ADF library from a project that contains a reference to an external JAR file. In Oracle JDeveloper, the file adflibREADME.txt contains references to external JAR files. The ADF Library feature in OEPE does not create the adflibREADME.txt file.


3.9.1.1 Naming Conventions

When you create reusable components, you should try to create unique and relevant names for the application, project, task flow, connection, or any other file or component. Do not accept the OEPE wizard default names such as task-flow-definition.xml. You want to try to have unique names to avoid naming conflicts with other projects, components, or connections in the application. Naming conflicts could arise from components created in the consuming application and those loaded from other JAR files.

For more information on best practices for naming reusable ADF components, see "Naming Conventions" in Developing Fusion Web Applications with Oracle Application Development Framework.

3.9.2 Creating an ADF Library

You can create ADF libraries.

To export ADF components to an ADF Library:

  1. In the Project Explorer, right-click the Dynamic Web project and choose Export > Export from the context menu.

  2. On the Select page, choose Oracle > ADF Library.

  3. On the Export ADF Library page, specify the Project (if different from the current one), and the ADF Library you want to export to.

  4. In the Dependent Projects field, select any dependent projects you want to add to the ADF Library.

  5. Click Finish.

3.10 Configuring and Using ADF with GlassFish Server

You can configure GlassFish Server to run your Oracle ADF applications, and configure an ADF-enabled GlassFish Server run-time in your Java applications.

For a list of the supported Oracle ADF features for GlassFish, go to the OTN site at http://www.oracle.com/technetwork/developer-tools/adf/overview/adfessentials-1719844.html.

The following sections describe how to configure GlassFish Server for use with Oracle ADF:

For more information, see "Configuring GlassFish Server" in Administering Oracle ADF Applications.

3.10.1 How to Download ADF Essentials

In order for a GlassFish Server to run Oracle ADF applications, you must download the Oracle ADF Essentials files from the Oracle Technology Network at http://www.oracle.com/technetwork/developer-tools/adf/downloads/adf-download-1649592.html, as shown in Figure 3-18.

Figure 3-18 Oracle ADF Essentials Download Page

Described in surrounding text

Download the Oracle ADF Essentials file adf-essentials.zip to a temporary location. You will install the ADF Runtime library files into the GlassFish installation directory, as described in Section 3.10.3, "How to Configure GlassFish for OEPE."

Download the Oracle ADF Essentials Client files adf-essentials-client-ear.zip and adf-essentials-client-war.zip to a temporary location and then extract the files to flat-structured temporary directories, a separate directory for each download.

For instance, if you are using unzip, you can add the -j option to create a flat directory structure that has no hierarchical folders.

unzip -j <file> -d <destination>

From adf-essentials-client-war.zip, you will create a user library which you will use when you create an ADF Application, described in Section 3.10.6, "How to Create an ADF Application that Uses GlassFish Runtime.".

Once you have created the ADF Application, you will import the files from adf-essentials-client-ear.zip to the EarContent/lib folder of your application, described in Section 3.10.6, "How to Create an ADF Application that Uses GlassFish Runtime."

3.10.2 How to Download and Install GlassFish Server

For instructions on obtaining and installing GlassFish, see http://glassfish.java.net/downloads/3.1.2-final.html.

If you install from Zip, after you have unzipped the files you can start the server using <glassfish_install>/bin/asadmin start-domain. Alternatively, you can start and stop the server from the Servers pane in OEPE once the server has been defined in OEPE.

If you use the native installer, you can choose from Typical Installation or Custom Installation. Custom Installation allows you to specify a domain name other than domain1, and to choose to use different port numbers for the administration and HTTP listener ports. At the end of installation, the server is started.

You can create a GlassFish domain by using the GlassFish Administration utility asadmin. For more information see:

3.10.3 How to Configure GlassFish for OEPE

You need to create a server configuration for GlassFish Server. It will be the link to the GlassFish Server that you use to run your project.

To configure GlassFish:

  1. From the main menu, select Window > Show View > Servers to open the Servers pane.

  2. In the Servers pane, right-click and select New > Server.

    Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server. link.

  3. On the Define a New Server page of the New Server wizard, expand GlassFish and select the type of GlassFish server you are running, for example, GlassFish 3.1.2. Enter the server's hostname, for example localhost and click Next.

  4. On the server details page of the Define a New Server wizard the default domain directory is displayed.

    If necessary, click Browse next to Domain Directory to open the Browse for Folder dialog. Navigate to the domain location which is typically at <glassfish_install>/glassfish/domains and choose the domain. Click OK.

    If necessary, enter the GlassFish Server Administrator Password, and click Finish.

  5. The new server connection appears in the Servers pane. You can start and stop the server from the right-mouse menu of the server node.

3.10.4 How to Configure GlassFish for ADF Essentials

Once you have create a server configuration for GlassFish server you can configure the GlassFish domain for ADF Essentials. See:

3.10.4.1 Installing ADF Essentials on a Domain

If you are configuring a domain that does not use a password, you can use the server adapter from within OEPE.

To configure a domain that does not use a password:

  1. In OEPE, in the Servers pane, right-click the GlassFish server node and choose GlassFish > Install ADF Essentials, as shown in Figure 3-19.

    Figure 3-19 GlassFish Menu in Servers Pane

    Described in surrounding text
  2. Navigate to the adf-essentials.zip file that you downloaded from OTN and click Open.

    You can follow the installation in the console, Window > Show View > Console, as shown in Figure 3-20.

    Figure 3-20 Importing ADF Essentials Console

    Described in surrounding text

    Check that the GlassFish server is not stopped in the server pane. This confirms that ADF Essentials is configured correctly and running in the server instance. You now have a connection to a GlassFish Server, which is configured for ADF Essentials.

3.10.4.2 Installing ADF Essentials on a Domain With a Password

If you are installing ADF Essentials on a domain that has been configured to require a password, you must manually configure the domain from the GlassFish console.

To configure a domain that does use a password:

  1. Login to the GlassFish admin console, which is at http://<machine_name>:4848/. For example, http://localhost:4848/ when the server runs on the local machine.

  2. Navigate to Configurations > server-config > JVM Settings.

  3. Select JVM Options and add the following JVM options:

    • -Doracle.mds.cache=simple

    • XX:MaxPermSize=512m

  4. Once you have set the JVM parameters, restart the server.

Alternatively, you can set these as <jvm-options> entries in the domain.xml file for the domain, <glassfish_install>\glassfish\domains\<domain>\config\domain.xml.

3.10.5 How to Register the ADF Essentials Client WAR Library in Your Workspace

In this procedure, you will add the ADF Essentials Client WAR files to a user library in OEPE so that when you create an ADF Application you can add the user library.

To register your ADF essentials client libraries

  1. In OEPE, go to Windows > Preferences. Search for "User", and select Java > Build Path > User Libraries to display the User Libraries page of the Preferences dialog, as shown in Figure 3-21.

    Figure 3-21 User Libraries - Java

    As Described in the surrounding text
  2. Click New to open the New User Library dialog. Enter a name for the new ADF Essentials Client WAR library and click OK.

  3. In the User Libraries page of the Preferences dialog, select the new library and click Add External JARS.

    Navigate to the location where you flat unzipped the adf-essentials-client-war.zip. Select all the files and click Open.

    The User Libraries page now shows the as shown in Figure 3-22.

    Figure 3-22 User Libraries - Java - Add External JARS

    This image is described in the surrounding text
  4. Click OK.

3.10.6 How to Create an ADF Application that Uses GlassFish Runtime

Now that you have installed GlassFish Server, configured a domain for ADF Essentials, and added the ADF Essentials Client WAR library to your workspace, you can create an ADF application.

To create a new ADF Application that uses GlassFish

  1. In OEPE, go to File > New > ADF Application. The New Oracle ADF Application wizard appears.

  2. If you performed the previous procedures correctly, you will see that your GlassFish server is listed in Target runtime with ADF extension. If your GlassFish server is not listed, cancel the wizard, and go back and perform the procedures in Section 3.10.3, "How to Configure GlassFish for OEPE" and Section 3.10.4, "How to Configure GlassFish for ADF Essentials.".

    Enter a name for your application.

  3. Click New JPA Project to open the New JPA Project dialog. You use the JPA project for access to the data for your application.

  4. Click Next twice to display the JPA Facet page of the New JPA Project dialog, as shown in Figure 3-23.

    Figure 3-23 Defining the JPA Facet

    Described in the surrounding text

    If necessary, change the Platform. EclipseLink is the reference implementation of JPA, and if you choose it you can take advantage of the EclipseLink shared libraries. For more information, see the "EclipseLink User's Guide - Developing JPA Projects" which is available on the Eclipse site at http://wiki.eclipse.org/EclipseLink/UserGuide/Developing_JPA_Projects_%28ELUG%29.

  5. Choose from the list to use an existing database connection, or click Add connection to create a new database connection.

    Click Finish to return to the New Oracle ADF Application wizard.

  6. In the New Oracle ADF Application dialog, click Next to open the ADF Library page. You should be able to see the library that you defined in Section 3.10.5, "How to Register the ADF Essentials Client WAR Library in Your Workspace".

    If you have not yet downloaded the ADF Essentials Client files from OTN, you can download them by clicking Download from OTN. Flat unzip the client Zip files to a local location.

    If you have downloaded the ADF Essentials Client files from OTN, but not already created the user library for the War client files, click Described in surrounding text (Manage libraries) to open the User Libraries dialog, where you can create a user library (under Java > Build Path > User Libraries), to contain the flat unzipped content of adf-essentials-client-war.zip.

    If the library is not already selected, select it as shown in Figure 3-24, and click Finish.

    Figure 3-24 ADF Library Page

    Described in surrounding text
  7. In the New Oracle ADF Application, click Finish. The application is created, and the generated projects are displayed in the Project Explorer.

  8. The final step is to add the files contained in adf-essentials-client-ear.zip to your new project.

    In the Project Explorer, expand the <project_name> and EarContent nodes, as shown in Figure 3-25.

    Figure 3-25 ADF Project EAR Library Directory

    object described in surrounding text

    Right-click lib and choose Import.

  9. In the Import wizard, choose General > File System and click Next.

    In the File System page of the Import wizard, browse to the location where you flat unzipped adf-essentials-client-ear.zip.

    Select all files and click Finish. If you see a dialog asking whether to overwrite a file, select Yes to All.

3.10.7 How to Create a Global JDBC Data Source

To run an ADF application that uses JPA entities you first need to create a global JDBC data source. You can do this in by running the GlassFish admin console in the Eclipse browser.

Once you have created the JDBC connection pool, you can define a JDBC resource that uses your new connection pool.

To create a Global JDBC Data Source

  1. In OEPE from the Server view select GlassFish and right-click and choose GlassFish > View > Admin Console.

    The GlassFish admin server opens in the Eclipse browser.

  2. Expand the Resources node and choose JDBC > JDBC Connection Pools. Click New to open the new JDBC Connection Pool page.

  3. Name your connection, choose Resource Type of javax.sql.XADataSource, and choose the Database Driver Vendor Oracle. Make sure that Introspect is unselected (introspection not enabled). Click Next.

  4. In New JDBC Connection Pool (step 2 of 2), scroll to Additional Properties and add your database information, as shown in Figure 3-26.

    Figure 3-26 GlassFIsh Server Console - Additional Properties

    Image as described in the surrounding text

    For example, the values for Oracle XE running on the local machine are:

    • user = hr

    • Password = hr

    • databaseName = XE

    • ServerName = localhost

    • DriverType = thin

    • PortNumber =1521

  5. Click Finish. Check your connection by selecting the new JDBC connection pool you have just created in the Tree, and clicking Ping on the General tab. If your ping is successful, you next need to define a JDBC resource that uses your new JDBC connection pool.

To define a JDBC resource that uses your new connection pool

  1. In the admin console, go to Resources > JDBC > JDBC Resources>. Click New to display the New JDBC Resource page, as show in Figure 3-27.

    Figure 3-27 GlassFIsh Server Console - New JDBC Resource

    Image as described in the surrounding text
  2. Enter the JNDI name, for example jdbc/hr.

  3. Select your new connection pool.

  4. Click OK.

3.10.8 Known Problems and Solutions

The following are issues that you might encounter with your GlassFish installation and runtime, and some solutions to address these issues.

  1. ADF DVT components are not rendered.

    If your ADF DVT components such as Graph are not rendered at runtime, the issue is that the application is missing the dvt-as.jar and dvt-shared-js.jar. Do the following steps to correct this issue:

    1. Download the latest distribution of ADF Essentials and extract the JARs as detailed in Section 3.10.1, "How to Download ADF Essentials".

    2. Update the libraries in the Workspace User Library, as detailed in Section 3.10.5, "How to Register the ADF Essentials Client WAR Library in Your Workspace".

    3. Remove the deployed application from the server and re-deploy the application.

  2. Content on a page failing to load.

    If you get the error message "The content of this page failed to load as expected because data transmission was interrupted. Please try again or contact your system admin", follow the steps above for ADF DVT components are not rendered.

  3. Running the application gives the HTTP Status 500 -ADF_Faces-30200 error:

    If you get the error message "HTTP Status 500 - ADF_FACES-30200:For more information, see the server's error log for an entry beginning with: The UIViewRoot is null. Fatal exception during PhaseId: RESTORE_VIEW 1."

    Do the following steps:

    1. Un-deploy the application.

    2. Clean the server instance. With the server stopped, right-click and choose Clean.

    3. Re-deploy the application.

  4. Unable to deploy an application that includes JPA Entities.

    If you have trouble deploying your application that includes JPA entities, do the following steps:

    1. Define a JDBC DataSource in GlassFish, as described in Section 3.10.7, "How to Create a Global JDBC Data Source".

    2. Add the data source you just defined to your JPA persistence.xml.

3.11 Appendix A Oracle ADF XML Files

For more information about configuring GlassFish Server for Oracle ADF Essentials, see "Configuring GlassFish Server" in Administering Oracle ADF Applications.

Metadata files in an Oracle ADF application are structured XML files used by the application to:

The ADF metadata files created by OEPE are listed below.

3.11.1 Oracle ADF Data Binding Files

OEPE creates the following ADF data binding files:

  • adfm.xml: This file lists the DataBindings.cpx file that is available in the current project. For more information about adfm.xml, see Section A.4, "adfm.xml" in Developing Fusion Web Applications with Oracle Application Development Framework.

  • DataBindings.cpx: This file contains the page map, page definitions references, and data control references. The file is created the first time you create a data binding for a UI component. The DataBindings.cpx file defines the Oracle ADF binding context for the entire application. The binding context provides access to the bindings and data controls across the entire application. See Section A.7, "DataBindings.cpx" in Developing Fusion Web Applications with Oracle Application Development Framework.

  • pagenamePageDef.xml:This is the page definition XML file. It associates web page UI components with data, or data controls. OEPE creates this file each time you design a new web page. These XML files contain the metadata used to create the bindings that populate the data in the web page's UI components. For every web page that refers to an ADF binding, there must be a corresponding page definition file with binding definitions. See Section A.8, "pagenamePageDef.xml" in Developing Fusion Web Applications with Oracle Application Development Framework.

3.11.2 Web Configuration Files

OEPE creates the following Oracle ADF web configuration files:

  • web.xml: Part of the application's configuration is determined by the contents of its Java EE application deployment descriptor, web.xml. The web.xml file defines everything about your application that a server needs to know. The file plays a role in configuring the Oracle ADF data binding by setting up the ADFBindingFilter. Additional runtime settings include servlet runtime and initialization parameters, custom tag library location, and security settings.

    An ADF Faces application typically uses its own set of configuration files in addition to web.xml. For more information, see the "Configuration in trinidad-config.xml" section in Developing Web User Interfaces with Oracle ADF Faces.

  • adfc-config.xml: The configuration file for an ADF unbounded task flow. The configuration file contains metadata about the activities and control flows contained in the unbounded task flow. The default name for this file is adfc-config.xml, but an end-user can change the name.

  • task-flow-definition.xml: The configuration file for an ADF bounded task flow. The configuration file contains metadata about the activities and control flows contained in the bounded task flow. The default name for this file can be task-flow-defintion.xml or whatever an end user specifies when creating the task flow. The same application can contain multiple task flow definition files.

For more information on Oracle ADF configuration files, see the Oracle ADF XML Files appendix in Developing Fusion Web Applications with Oracle Application Development Framework.