The FormattedDataSet API is an free, open-source, thread safe, high performance, Java API that allows developers to easily generate dynamic text such as HTML, XML, WML, and more.

See:
          Description

Packages
com.fdsapi This package contains the classes and interfaces used to in the FormattedDataSet API.
com.fdsapi.arrays This package contains the classes and interfaces used in the ArraySQL, ArrayFilter, ArrayComparator, and ArrayConverter classes.

 

The FormattedDataSet API is an free, open-source, thread safe, high performance, Java API that allows developers to easily generate dynamic text such as HTML, XML, WML, and more.

FormattedDataSet API Summary

The FormattedDataSet Java API is the easiest way to generate dynamic text (HTML, XML, WML, and more). The dynamic text is generated by using tabular data as input (SQL, ResultSets, 2 dimensional arrays and more).

The primary benefit of using the FormattedDataSet is that both data and formatting can be reused independently. Formatting is stored in FormattedDataSet templates which are simply Java Strings, typically stored as files. Developers and GUI designers can create their own templates and so have total control over presentation formatting.

The FormattedDataSet is easy to use. No installation is required; a developer only has to place a few small jars in the class path and within a few minutes can start displaying dynamic text. Also, the learning curve for creating FormattedDataSet templates is not steep, unlike competing products that involve knowing any number of the following technologies: JDBC, tag libraries, proprietary GUI tools, and complex proprietary runtime Object creation code.

The FormattedDataSet was developed primarily for generating dynamic HTML in JSPs and Servlets, however it can be used in any JDK 1.2 or higher environment to generate any dynamic text.

The FormattedDataSet class is the most important class in the API. Out of the box the FormattedDataSet will generate HTML (tables, list boxes, drop down listboxes, multi-select listboxes, and radio buttons), XML and delimited output. One way to use the FormattedDataSet to generate an HTML table follows. Note the data (a query in this case) and formatting (the template used in the second argument) can be reused independently:

FormattedDataSet fds=FormattedDataSet.createInstance();
String html=fds.getFormattedDataSet("select * from table", "htmlTable");

Representative output from the above query follows. Note that ANY query results would be formatted in a similar manner.

Learning to use the FormattedDataSet API

The best way to learn how to use the FormattedDataSet is to look at the FormattedDataSet API Users Manual, read the Java Docs, and review the code in the Demo WARs JSPs. Many examples of using the API are spread throughout the Java Docs. Also, many of the API's classes have sample usage within the code of their main methods.

FormattedDataSet Implementation details

The implementation of the API uses several design patterns from the book "Design Patterns Elements of Reusable Object-Oriented Software" by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (A highly recommended book). Design Patterns used include Builder, Factory Method, Prototype, Singleton, Adapter, Facade, Flyweight, Command, Iterator, and Template Method. The FormattedDataSet has about 1100 lines of code in 71 classes. The JavaDocs for all classes have a view code button that allows a developer to easily view the classes source code. An example using the FormattedDataSet class follows: View Code

The FormattedDataSet uses the Jakarta ORO regular expression package to parse FormattedDataSet templates. It also uses the JAMon performance tuning API to monitor performance. This means that fdsapi.jar, JAMon.jar and jakarta-oro-2.0.6.jar are all required to run the FormattedDataSet API. These jars are less than 100K each.

I suggest reading more about JAMon as it can be used to good effect in the rest of your application (In the interest of full disclosure I also wrote JAMon). For further information on JAMon look at the JAMon user's manual at www.jamonapi.com or review the source code which is also available via this site.

Steve Souza - admin@fdsapi.com - Certified Programmer for the Java 2 Platform, Sun Certified Web Component Developer for the J2EE, Sybase Certified DBA, Sybase Certified PowerBuilder Developer