Thursday, January 31, 2008

Compare two OpenOffice Documents

I received some feedback on a document I wrote and I wanted to know what the changes were. In Word you can track the changes, but where is this functionality in OpenOffice? I looked around a bit and found this really nice feature I had been missing - it is the 'compare document' feature, and it allows you to accept changes on a per diff level. Simply open the original document and then under Edit, select the 'Compare Document...'



and browse to the edited version document. After that it will bring up a nice dialog box with all the diffs which you can accept or deny. I think it makes a lot of sense not to do this in the document itself like Word does.

Wednesday, January 30, 2008

Post XML code fragments

It turns out that it is not that straightforward to display XML fragments in a blog. Usually I use GeSHi to do the formatting for me. I then look at the source for the HTML page and grab the piece that I need, which I then host on my own site, and I reference it in an iframe like

Switch jUDDI on JBossESB over to Postgres

By default JBossESB uses HSQL to handle persistence for jUDDI. For production it is recommended to switch it to for example Postgres.

1. First you will need to download the Postgres JDBC driver. I selected the '8.2-507 JDBC 2EE' driver. You can copy it to either the jboss_home/server/default/lib directory, or to the jbossesb.sar/lib directory.

2. Create the juddi database. Run the pgAdmin a shown in Figure 1.



Figure 1. The Postgres Admin

and create a juddi user, which has create rights to create tables, see Figure 2.



Figure 2. Add a user called 'juddi'


3. Next you should update the datasource for jUDDI, which is defined in the jbossesb.sar/juddi-ds.xml. Comment out the Hypersonic configuration and add the postgres datasource configuration like



4. Finally we have to tell jUDDI where it can find the DDL to create the juddi schema. For this we edit the jbossesb.sar/esb.juddi.xml. Modify the 'juddi.sqlFiles' setting by replacing the 'hsqldb' occurances to 'postgresql'.



Now on startup JBossESB will create the jUDDI tables in the Postgres juddi database.

For an overview of jUDDI in JBossESB in pdf format see the Registry Guide.

Friday, January 25, 2008

jBPM ant task to deploy a process definition to a running server

I've been working on jBPM integration into JBossESB to do Service Orchestration, and I created a new ant task to deploy a process definition to a running instance of jBPM. When I say a running instance I mean an instance that deploys the jBPM-console. The jBPM-console ships with a DeployerServlet which is used by the jBPM eclipse plugin to deploy process definitions. The ant task is called "DeployProcessToServerTask" and it uses the very same servlet. The java code for the task has been attached to jira JBPM-1117 so it should hopefully make it into SVN soon.

To use the DeployProcessToServer Task you need to define a new task using the taskdef command

<taskdef name="deployToServer" classname="org.jbpm.ant.DeployProcessToServerTask">
<classpath refid="exec-classpath"/>
</taskdef>

So here I defined a task called 'deployToServer', but you can call it whatever you want. The classpath should obviously point to the jar containing this class. The 'deployToServer' can either deploy a Process Archive (PAR), which is a zip file containing the files you want to deploy, or you can specify a set of files which it will zip up and deploy for you. You can use the following attributes and subelements:







Attribute DescriptionDefault value
processThe location of process archive-
servernameThe name of the server which is used to build the deployment urllocalhost
serverportThe port to which the http protocol is bound8080
serverdeployerThe address of the deployer servlet/jbpm-console/upload
debugDebug flag which, if set, writes out a debug.par zip file. This is especially useful if fileSet subelements are used, so you can check what gets loaded to the server-
SubElement DescriptionDefault value
fileSetA fileSet element-


The following xml fragment deploys all the files in the processDefinition directory to the server

<target name="deployProcess" description="deploys the process definition">
<echo>Deploy the process definition</echo>
<taskdef name="deployToServer" classname="org.jbpm.ant.DeployProcessToServerTask">
<classpath refid="exec-classpath"/>
</taskdef>
<deployToServer>
<fileset dir="${basedir}/processDefinition" includes="*"/>
</deployToServer>
</target>

Or if you already have a par archive ready to go you could reference that

<target name="deployProcess" description="deploys the process definition">
<echo>Deploy the process definition</echo>
<taskdef name="deployToServer" classname="org.jbpm.ant.DeployProcessToServerTask">
<classpath refid="exec-classpath"/>
</taskdef>
<deployToServer process="${build}/process.par"/>
</target>