Project Home page

JEDI is a J2EE application that provides a centralized service aiming at significantly simplify the generation of data driven documents in a enterprise environment.

The documents (hereafter called JEDI documents) can have different format types: pdf, excel, rtf, plain text data streams and xml streams.

JEDI documents are instances of the so called managed documents (see below), configured by a developer into the JEDI configuration database (JEDI_DB). The provision of a JEDI document is based on a synchronous processing performed by the JEDI core engine triggered by an end-user request (through HTTP request or RMI invocation).

The content of a JEDI document must be an XML stream regardless of the source. Such data is subsequently processed through one or more XSL transformations in order to provide the user with the document in the required format.

The definition of XML stream source and XSL transformation are main parts of the managed documents.

This approach guarantees an high decoupling level between the JEDI service itself and the documents to be generated, since each managed document can be added (or modified) at runtime without restarting the JEDI service.

Some types of documents (pdf, rtf and excel) are generated by using open source libraries such as Apache FOP and POI.

Managed documents

A managed document is a package composed of configuration data and a set of rules containing the logic to generate a JEDI document.

Each managed document regards a specific type of document and is identified by a unique identifier (a numeric ID).

All the configuration data, defined by the document developer, are stored into the JEDI configuration database (JEDI_DB).

The attributes of a managed document are listed in the following.

  • Description: it is an internal description to documentation purpose;
  • Description: it is an internal description to documentation purpose;
  • Reference application: it is the description of the application to which belongs the document. Being JEDI a centralized provisioning service, it can manage documents of every application running in the enterprise environment.
  • Output format: it specifies the format type of JEDI document that will be generated;
  • Transformer: it is a XSL document that will be used to transform business data XML into the requested JEDI document. Alternatively can be specified a reference to a generic reusable XSL (see below);
  • XML data source: it is a group of attributes that specifies the source of the XML business data (see below);
  • Parameters: they are required parameters to be provided to the XML data source in order to retrieve desired business data; for each parameter should be specified description and type (Integer, String, Date, Double, Boolean or Long);

The managed documents can be defined or modified directly on the database or through JEDI admin interface. This is a software module based on JSF and EJB created to easily configure new managed documents (it is also available a testing function in order to easily generate a JEDI document).

The main features of a managed document are discussed in the following paragraphs.

Output formats

An output format specifies the type of the JEDI document that will be generated.

Currently JEDI handles the following output formats:

  • PDF (using XSL/FO transformations)
  • RTF (using XSL/FO transformations)
  • Excel (using XSL to produce a transient XML document that will be processed with POI library to produce an Excel document)
  • Text (using XSL to produce a transient XML document that will be processed to produce an positional text document)
  • XML
  • HTML

The XSL transformer must be specified accordingly to the chosen output format.

As a further consideration JEDI allows the overriding of the default output format (e.g. PDF in RTF and vice versa).

Each format type is defined into the JEDI configuration database (JEDI_DB) and is identified by a unique ID. It has the following attributes:

  • Mime type: is used to show the JEDI document into a browser
  • Transformer class name: Java fully qualified class (implementing XMLTransformer interface) used by the JEDI core engine to produce the JEDI document

From the foregoing we note the possibility of adding at runtime other output formats.

Reusable transformers

A reusable transformer is a XSL document stored into JEDI_DB as independent transformer available to be used in various documents.

A managed document indeed can reference to a reusable transformer without specifying an own XSL document.

This can be useful for simple data presentation independently from the XML data structure, for example to provide a generic record set data via plain excel file.

JEDI application comes with some reusable transformers already defined but you can add other ones at your leisure.

XML data sources

A XML data source specifies where and how the XML business data have to be read.

An XML data source may have different attributes depending on its type (configured into JEDI_DB).

A data source type can be one of the following:

  • Stored procedure: it is a stored procedure that provides XML business data. In this case the XML data source of each managed document must define the procedure name to be invoked;
  • JEDI XML Document: it is a reference to another managed document having XML as output format. This feature allows to easily create a chain of managed documents; in that case all the documents belonging to the same chain must have the same set of input parameters;
  • URL: it is an URL pointing to a Web resource that return XML stream (i.e. a web service or a servlet). In this case the XML data source must define the string representing the URL;
  • SQL query: it is a string representing a query to be executed on the enterprise database; the resulting record set is converted into an XML stream. In that case the XML data source of each managed document must define the SQL query where parameters are substituted by the character "?";

Each XML data source type defines a Java fully qualified class (implementing XMLSourceReader interface) used by the JEDI core engine to read the XML business data.

JEDI application comes with two different implementations (for Stored procedure type) based on Oracle database: one to be used for stored procedure returning XMLTYPE data and another one for a stored procedure returning a result set.

Anyway you can add other XMLSourceReader implementations at your leisure.

JEDI documents generation

The document generation is processed by JEDI core engine. It is a module based on a servlet and an EJB and it is able to produce JEDI documents triggered by end-user requests.

The core engine is based on MVC pattern (Model view controller): the presentation layer is represented by the XSL transformations chain, the model layer is carried out by the XML source, whereas the controller layer is implemented by the servlet (or the EJB) exposed to the final user.

The central component of the engine is DocProducerEJB, an EJB that manages the following tasks:

  • Reading the managed document ID from end-user request and loading of the configuration from JEDI_DB
  • Instantiating the proper XMLSourceReader object depending on the specified XML data source in the managed document
  • Mapping the input parameters of the end-user request into the XML data source invocation and reading the XML business data
  • Instantiating the proper XMLTransformer object depending on the format type and transformer specified in the manage document.
  • Applying the transformer task based on a XSL transformation and an optional Java processing (depending on XMLTransformer implementations)
  • Returning the JEDI document

A JEDI document can be obtained by two different ways to be used depending on the final user needs:

  • An HTTP request
  • A RMI call to EJB

During the entire process the resulting documents exist just in memory and are returned to the caller as a stream (showed in the browser in case of HTTP request or passed as a byte array in case of a RMI invocation).

HTTP request

The JEDI core engine provides a servlet (DocProducerServlet) that generates the JEDI document by usingDocProducerEJB and shows the document as a byte array with the proper HTTP headers (mime-type, length...).

The HTTP request must specify in the URL querystring the managed document ID and the list of input parameter values formatted as strings.

Here is an example of an URL requesting the JEDI document identified by 26:

http://<servername>:<port>/jedi/document.jedi?id=26&valString=251&valString=Rossi

The parameter named id contains the identifier of the managed document. It is followed by a valString for each input parameter of the managed document (if a parameter has null value you should indicate valString=&).

In the following there are the possible parameter types and their string representations:

  • Integer: the relative string without thousands separator;
  • String: ;
  • Date: the string as dd/MM/yyyy;
  • Double: the relative string should be formatted using the current Locale settings;
  • Boolean: the string "true" or "false";
  • Long: the relative string without thousands separator;

You can override the default output format of the managed document, specifying in the URL a format parameter whose value is the identifier of the desired type.

RMI invocation

The final user can invoke the methods of DocProducerEJB. They allow to pass the values of the input parameters and to get the JEDI document as a byte array.

Moreover to get rid of server performance issues, it's possible to execute part of the engine work on the client side by using some additional methods of DocProducerEJB and the proper XMLTransformer class.

Technology issues

JEDI application is designed for Java 7 and JBOSS Application server 7.1.1. but it can be installed on other J2EE AS.

The database used is Oracle 11g. Anyway, changing some configuration file, you can use a database of another vendor.

The JEDI admin interface is developed using JSF 2.1.7 and JBoss Rich Faces 4.3.0 (http://www.jboss.org/richfaces).

Excel documents are generated using Apache POI 3.5 (http://poi.apache.org).

PDF and RTF documents are generated using Apache FOP 1.0 (http://xmlgraphics.apache.org/fop ).

JEDI has entirely been developed by the ICT Department of the Italian Senate and is released under the GPL3 open source license. Therefore, it is freely usable, modifiable, embeddable and distributable as long as the Italian Senate is mentioned as author. JEDI is on Source Forge .

JEDI makes use of several open source projects: