Oracle® Application Development Framework Developer's Guide
10g Release 3 (10.1.3) B25386-01 |
|
![]() Previous |
![]() Next |
This chapter shows a simple CSV data control adapter as an example of a custom data control adapter. This adapter is a simplified version of the CSV data control adapter that ships with JDeveloper.
The chapter describes what the simple CSV data control adapter does and the classes that make up the adapter.
The simple CSV data control adapter retrieves comma-separated values from a file and displays them on a page. To use the adapter in JDeveloper, you can do one of the following:
right-click a node that represents a CSV file and choose "Create Data Control" from the context menu
drag and drop a node on the Data Control Palette
In either case, the node must map to a CSV text file, and the name of the file must have a .csv
extension. You do not have to enter any metadata because the simple CSV data control adapter extracts the metadata from the node.
After you create a data control using the simple CSV adapter, the data control appears in the Data Control Palette. You can then drag and drop it onto a view page.
To simplify some details, the simple CSV adapter hardcodes the following items:
The fields in the CSV file are comma-separated.
The delimiter character is the double-quote character.
The CSV file uses UTF-8 encoding.
The first line in the file specifies column names.
The name of the CSV file must have a .csv
extension.
(The CSV adapter that ships with JDeveloper enables you to set these values.)
When you create a data control adapter, you create it so that it represents a source type, not a source instance. In the case of the CSV adapter, the source type is CSV files. To specify a specific data instance, for example, a particular CSV file, the user creates a data control with the help of the data control adapter and associates the instance with metadata. The metadata specifies the data for the instance. In the case of the simple CSV adapter, the metadata includes the path to a specific CSV file.
The responsibilities of a data control adapter include:
Providing metadata for the data control instance
Creating a data control instance using the stored metadata during runtime
Data control adapters run within the adapter framework. The adapter framework takes care of storing the metadata, integrating the data control adapter with the ADF lifecycle, and integrating with JDeveloper during design time.