Open ESB Tip: Extending the Template based BPEL Document Generator

Following on from my previous blog entry (Template Based BPEL Document Generation) which described the Template Based BPEL Documentation Generator and briefly mention how it could be extended. This entry will take you through the steps of building a Simple JDBC based document writer that will retrieve the process and activity information from a specified JDBC DataSource. Although this is a simple example it should, hopefully, show you how to write your own Documentation Writer by extending the existing functionality. As I gen the chance I hope to add additional Writers to the basic jar to leverage a variety of possible Data Stores (e.g. the Adjoovo Spaces REgiSTry, OpenDS, WebService Calls).

Document Generator Trail
  1. Template Based BPEL Document Generation.
  2. NetBeans Plugin For Template Based BPEL Documentation.
  3. Extending the Template Based BPEL Document Generator.

Building the Jdbc Writer

Although during testing I used MySQL as the database I decided to build the Jdbc Writer in a flexable manner and hence when it is executed you will need to specify the actual JDBC Driver Class along with the username, password and url. You will notice that I build a Properties Object that contains Display names and actual property names but this will not be used as part of this blog. Instead it is in preparation for a future extension to the associated NetBeans Plug-in.

Minimum Requirements

Before we start to build the Jdbc Writer we will need to create the database table we will use to store the information. As mentioned I created a new MySQL Database called bpeldoc and then created the table tox_bpel_doc as follows:

TABLE tox_bpel_doc
id int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
processId varchar(30) NOT NULL,
activityId varchar(45) NOT NULL,
type varchar(20) NOT NULL,
description text NOT NULL,

This is a very simplistic table and I am assuming the contents of the description column is simple text. All information associated with the processes will be stored within the single table and be identified by the processId and type. To facilitate this the following constants are defined in the code.

 public final static String IMPORTS_TYPE = "Imports";
public final static String OVERVIEW_TYPE = "Overview";
public final static String PARTNERLINKS_TYPE = "PartnerLinks";
public final static String TECHNICALINFO_TYPE = "TechnicalInfo";
public final static String VARIABLES_TYPE = "Variables";
public final static String ACTIVITIES_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + ACTIVITIES_TYPE + "'";
public final static String IMPORTS_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + IMPORTS_TYPE + "'";
public final static String OVERVIEW_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + OVERVIEW_TYPE + "'";
public final static String PARTNERLINKS_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + PARTNERLINKS_TYPE + "'";
public final static String TECHNICALINFO_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + TECHNICALINFO_TYPE + "'";
public final static String VARIABLES_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND type = '" + VARIABLES_TYPE + "'";
public final static String ACTIVITYDESC_SQL = "SELECT description FROM tox_bpel_doc WHERE processId = ? AND activityId = ?";

In addition to this I created a new properties file, to specify the connection information.

# JDBC Connection Properties
jdbc.username = root
jdbc.password = adminadmin
jdbc.url = jdbc:mysql://localhost:3306/bpeldoc
jdbc.driver.class = com.mysql.jdbc.Driver

In addition I modified the to add two additional properties.

# External Connection properties file = C:/Development/NetBeansModules/BPELDocumentationSuite/BpelDocumentGenerator/src/
# Used to indicate if the inline documentation should be displayed in addition to that obtained external.
# It is up to the implementation classes to use this value.
include.inline.documentation = true

Finally I, obviously, added the MySQL jar file to my classpath.


As mention briefly in the blog entry "Template Based BPEL Document Generation" to enhance the documentation we need to override the following methods:
  • protected String getBPELModuleOverviewText(TProcess process)
  • protected String getBPELModuleImportsText(TProcess process)
  • protected String getBPELModulePartnerLinksText(TProcess process)
  • protected String getBPELModuleActivitiesText(TProcess process)
  • protected String getBPELModuleVariablesText(TProcess process)
  • protected String getBPELModuleTechnicalInformationText(TProcess process)
  • protected String getActivityDescription(TProcess process, TActivity activity)
  • public Properties getConnectionPropertyNames()
  • public boolean connect()
  • public boolean connect(Properties connectionProps)
  • public boolean isConnected()
  • public boolean disconnect()
  • public boolean reconnect()
  • public boolean reconnect(Properties connectionProps)
As you can see from the code below the connection methods simply manage the connection to the JDBC Resource whilst the getBPELModule.....Text methods perform essentially that same action. If we take the getBPELModuleOverviewText as the example (line 132) you can see that we first check that the process has been passed and then extract its name. Once we have the name we retrieve the appropriate prepared statement getOverviewStmt() then specify the parameter (name) execute the query and retrieve the documentation CLOB as a string.

The resulting string is appended to a StringBuffer before we check if the in-line Documentation is to be displayed as well, i.e. that added to the bpel file, if this is the case then it is extracted and appended to the StringBuffer before it is returned. The resulting string will then be processed by the underlying Abstract class and inserted into the OpenOffice Document at the appropriate bookmark.

Hopefully this short blog shows how simple it is to add you own concrete implementations that access you information about the BPEL Components from alternative locations.


Pdf Example

The pdf generated below is based on the simple addition of a single entry into the database for the module overview.



I'm sure that this is not the place to post this question...but I do anyway :)

Which is the status of the WLM Project, because it seem that will be Milestone 1 forever...? Have you any information about that?


Posted by Juan on August 11, 2009 at 06:48 AM GMT #

Post a Comment:
Comments are closed for this entry.

As a member of the Oracle A-Team we specialise in enabling and supporting the Oracle Fusion Middleware communities.


« June 2016