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 OpenDS based document writer that will retrieve the process and activity information from a specified OpenDS Directory. 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, 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 LdapWriter

Minimum Requirements

Before we start to build the Ldap Writer we will need to two additional Objects with our OpenDS Instance and a number of associated Attributes (see below). These are used to store specific information about your BPEL Modules and the Activities within them. The information below should be imported into your OpenDS instance as an LDIF file.

# Defines the BPEL Objects and Activities used within the To BPEL Document Generator
dn: cn=schema
changetype: modify
add: attributeTypes
# Service Attributes
attributeTypes: ( NAME 'bpelModuleImportsDesc' DESC 'Imports Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelModuleOverviewDesc' DESC 'Overview Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelModulePartnerLinksDesc' DESC 'Partner Links Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelModuleSummaryDesc' DESC 'Summary Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelModuleTechnicalInfoDesc' DESC 'Technical Info Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelModuleVariablesDesc' DESC 'Variable Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelActivitiesDesc' DESC 'Activities Section Documentation' SYNTAX SINGLE-VALUE )
attributeTypes: ( NAME 'bpelActivityDesc' DESC 'Activity Documentation' SYNTAX SINGLE-VALUE )
add: objectClasses
objectClasses: ( NAME 'bpelModule' DESC 'A BPEL Module' STRUCTURAL MUST (cn ) MAY ( bpelActivitiesDesc $ bpelModuleImportsDesc $ bpelModuleOverviewDesc $ bpelModulePartnerLinksDesc $ bpelModuleSummaryDesc $ bpelModuleTechnicalInfoDesc $ bpelModuleVariablesDesc ) )
objectClasses: ( NAME 'bpelActivity' DESC 'A BPEL Activity' STRUCTURAL MUST (cn ) MAY ( bpelActivityDesc ) )

This is a very simplistic Object structure and I am assuming the contents of the description attributes is simple text. All information associated with the processes will be stored within the appropriate attribute and accessed using the cn=. An example of the structure can be seen in the image below.

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

# OpenDS Connection Properties
ldap.username=cn=Directory Manager

In addition I modified the to add two additional properties.

# Specify the document writer
#document.writer.class = com.tox.doc.gen.oo.SimpleBpelWriterDocumentGenerat or
#document.writer.class = com.tox.doc.gen.oo.JdbcBpelWriterDocumentGenerator
document.writer.class = com.tox.doc.gen.oo.LdapBpelWriterDocumentGenerator
# External Connection properties file = C:/Development/NetBeansModules/BPELDocumentationSuite/BpelDocumentGenerator/src/ = 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 OpenDS jars 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 OpenDS Directory whilst the getBPELModule.....Text methods perform essentially that same action. If we take the getBPELModuleOverviewText as the example (line 142) you can see that we first check that the process has been passed and then extract its name. Once we have the name we can build a very simple LDAP Query to extract the attributes associated with the Process. Once we have the resulting Enumeration we can scan this for the Appropriate Attribute and then retrieve its value.

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 bpelModule Object and a number of bpelActivity Objects to my OpenDS instance.