JavaFXComposerDSTutorial

(Difference between revisions)
m (Common Data Sources)
m (JavaFX Composer Data Sources Tutorial)
Line 1: Line 1:
-
== JavaFX Composer Data Sources Tutorial ==
+
= JavaFX Composer Data Sources Tutorial =
-
=== Goal ===
+
== Goal ==
This tutorial gives an overview about Data Sources (DS) in JavaFX Composer, their design and usage.
This tutorial gives an overview about Data Sources (DS) in JavaFX Composer, their design and usage.
-
=== Common Data Sources ===
+
== 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.  
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.  
Line 22: Line 22:
* Record - set of (name->value) pairs holding actual data
* Record - set of (name->value) pairs holding actual data
-
==== Data Source ====
+
=== 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.
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.
Line 33: Line 33:
* Filesystem
* Filesystem
-
==== RecordSet ====
+
=== RecordSet ===
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 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.
-
==== Record ====
+
=== Record ===
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.
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 ===
+
== 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 https://kenai.com/api/projects URL:
Here is an example how a JSON object maps to the Data Source structure used by the JavaFX Composer. This is a result of https://kenai.com/api/projects URL:
[[File:javafxcomposer-tutorial-REST3-s1.png]]
[[File:javafxcomposer-tutorial-REST3-s1.png]]

Revision as of 10:03, 18 March 2010

Contents

JavaFX Composer Data Sources Tutorial

Goal

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

RecordSet

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.

Record

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 https://kenai.com/api/projects URL:

File:javafxcomposer-tutorial-REST3-s1.png

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