Revision as of 10:03, 18 March 2010 by Msandor (Talk | contribs)


JavaFX Composer Data Sources Tutorial


This tutorial gives an overview about Data Sources (DS) in JavaFX Composer, their design and usage.

Common Data Sources

To simplify access to data coming from various sources in various formats we have unified the data format on client side so that it is easier for people to start using a remote data source. There are two basic aspects of each data source:

  • actual source of data (HTTP server, database, file, etc.)
  • format of data (XML, JSON, etc.).

JavaFX Composer data source framework defines a specialized DataSource class for each source of data (HttpDataSource, FileDataSource, etc.) and defines set of parsers for each supported data format (Parsers.XML_PARSER, etc.)

When a DataSource object retries the data, it typically passes the raw stream to a Parser which understand the format and shich produces a RecordSet, a common data format na JavaFX Composer. You will learn more about this structure later in this chapter.

To summarize, common data source framework consists of three three fundamental entities (classes):

  • DataSource - responsible for fetching raw data from the source
  • Parser - responsible for parsing raw data and producing RecordSets and Records
  • RecordSet - groups Records into an array, maintaining a cursor over it
  • Record - set of (name->value) pairs holding actual data

Data Source

A Data Source object holds basic properties needed to fetch data from a source. For example, for HTTP Data Source this is URL, Authentication method, etc. For JDBC Data Source this is a connection string, credentials and SQL query. For File Data Source this is a file path.

JavaFX Composer currently supports four data sources:

  • HTTP and HTTPS
  • JDBC
  • File
  • Filesystem


A RecordSet serves two purposes: it holds an ordered set of Records and maintains a cursor over them with the possibility to move it in both directions.


A Record holds a set of (name, value) pairs, you can imagine a Record as a row in a database table with column names as keys.

Example Data Structure

Here is an example how a JSON object maps to the Data Source structure used by the JavaFX Composer. This is a result of URL:


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo