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).
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.
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.
In addition to this I created a new properties file, mysqlConnection.properties to specify the connection information.
In addition I modified the config.properties to add two additional properties.
Finally I, obviously, added the MySQL jar file to my classpath.
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.

| Document
Generator Trail |
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:CREATE
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,
PRIMARY KEY USING BTREE (id)
)
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, mysqlConnection.properties 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 config.properties to add two additional properties.
# External Connection properties file
connection.properties.filename = C:/Development/NetBeansModules/BPELDocumentationSuite/BpelDocumentGenerator/src/mysqlConnection.properties
# 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.
Methods
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)
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.
Code
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?
Thanks,
juan.-
Posted by Juan on August 11, 2009 at 01:48 PM GMT #