Library Packages and Key Classes

For an introduction to the most commonly used classes, see key classes.

For an introduction to the data source Java library packages follow the links below:

Key Classes

The key classes are DataSourceServlet, DataTable, Query and DataSourceHelper.

The simplest implementation of the library involves inheriting from DataSourceServlet, writing your own implementation of generateDataTable() and then running the implementation within a servlet. This type of implementation is described in the Getting Started section.

The DataTable class defines the columns, column types, labels, ids, and custom properties for a data table.

The Query class is the base class for data queries, it handles a visualization-generated query.

For more complex use cases, the helper class DataSourceHelper provides a set of helper functions. This type of implementation is described in Defining Capabilities and the Flow of Events.

datasource

This is the top level package and contains the API classes with which most data source developers interact.

Also at this top level is Capabilities, which is used to define the data source's query capabilities.

base

This package contains all classes that are used by more than one package to prevent circular dependencies between the packages. The most notable items are error messages in the default locale of US English. To internationalize your implementation, you will need to translate these messages.

datatable

This package contains classes that handle data table structure (columns, rows, cells) and functionality (insert, add).

This package also contains the value package that handles values and value types supported by the library. Available value types are defined in the ValueType enumeration and include: boolean, date, time of day, date and time, null, number, and text. 

query

This package contains classes that handle queries, the base class is Query. This package also contains the following packages:

  • parser - classes that handle query parsing.
  • engine - classes that handle query execution.
  • scalarfunction - classes that handle scalar functions used in a query.

render

This package contains the classes that format a response. For example:

  • CsvRenderer renders a data table as CSV.
  • HtmlRenderer renders a data table as HTML.
  • JsonRenderer renders a data table as JSON.
  • EscapeUtil provides a utility to escape strings.

util

This package provides two sets of helper functions:

  • CsvDataSourceHelper and CsvDataSourceException provide helper functions for using a CSV file as a data store, they do not provide a complete implementation of a data source. For an example implementation, see Using an External Data Store.
  • SqlDataSourceHelper and SqlDatabaseDescription provide helper functions for using a mySQL database as a data store, they do not provide a complete implementation of a data source. For an example implementation, see SqlDataSourceServlet in the examples package.