In this blog I will describe two simple methods to include version information in your
OSB application. This information is shown in the sbconsole, within the “description” field of the OSB project, or Proxy and BusinessServices.
Version information is very useful in complex, dynamic environments like in a full dev/test/pre-prod/prod environment, and/or when
branches in the sourcecode repository are used.

Subversion information in Proxy or BusinessServices.

This is simply achieved in the Workshop editor by having subversion automatically update the keyword placeholders that are located in the “description” field of the Proxy or BusinessService.
For instance enter the following two placeholders:

$Id$
$HeadURL$

Of course the automatic subversion update needs to be enabled for the source file. Using for instance the subclipse plugin in Workshop: right-click the BusinessService, select “Team”, “Set Property…”.
In the property dialog, select property name: “svn:keywords”, and enter the keywords separated by a space character: Id HeadURL

When the BusinessService is committed, the version information is set and after the deployment of the OSB project the result will look similar to this in the sbconsole:

POM version in OSB project description.

In my current project we use Maven to export the configuration JAR for the deployment. In this framework, ANT scripting is used to perform the actual export. There seems to be no
direct way to set the project descripton using any scripting. Therefore we use ANT scripting to post-process the configuration JAR. These are the steps:

  1. un-jar the configuration JAR
  2. search in the file “_projectdata.LocationData” for the <proj:description/> tag, and insert the POM version (or any other information)
  3. re-jar the configuration JAR

This is the ant script:

<target name=”insertPOMVersion”>
<echo message=”>>> updating ${configurationJAR}” />
<delete dir=”${dir.tmp}” />
<mkdir dir=”${dir.tmp}” />
<unzip src=”${configurationJAR}” dest=”${dir.tmp}” />
<replace file=”${dir.tmp}/${osb.project.name}/_projectdata.LocationData”>
<replacefilter token=”proj:description/”
value=”proj:description>${POM.version}&lt;/proj:description” />
</replace>
<delete file=”${configurationJAR}” />
<zip destfile=”${configurationJAR}”>
<fileset dir=”${dir.tmp}”>
<include name=”**” />
</fileset>
</zip>
</target>

Notice that the ANT replace command does not handle < and > very well. These characters are therefore not in the search string and there is a &lt; in the replace value.

The result will look like this:

This post is by John Chin-a-Woeng, Senior Oracle SOA Suite Consultant for Capgemini