Thursday, October 21, 2010

XA Transactions

Reading MySQL documentation I have found a good description of how XA distributed transactions and two-phases commit work. I like to share it because it's short, clear and applies in general situations. It also teaches us why distributed transaction, being much more complex, should be managed very carefully to avoid severe performance penalties.
Applications that use global transactions involve one or more Resource Managers and a Transaction Manager:

A Resource Manager (RM) provides access to transactional resources. A database server is one kind of resource manager. It must be possible to either commit or roll back transactions managed by the RM.

A Transaction Manager (TM) coordinates the transactions that are part of a global transaction. It communicates with the RMs that handle each of these transactions. The individual transactions within a global transaction are “branches” of the global transaction. Global transactions and their branches are identified by a naming scheme described later.

The MySQL implementation of XA MySQL enables a MySQL server to act as a Resource Manager that handles XA transactions within a global transaction. A client program that connects to the MySQL server acts as the Transaction Manager.

To carry out a global transaction, it is necessary to know which components are involved, and bring each component to a point when it can be committed or rolled back. Depending on what each component reports about its ability to succeed, they must all commit or roll back as an atomic group. That is, either all components must commit, or all components musts roll back. To manage a global transaction, it is necessary to take into account that any component or the connecting network might fail.

The process for executing a global transaction uses two-phase commit (2PC). This takes place after the actions performed by the branches of the global transaction have been executed.

In the first phase, all branches are prepared. That is, they are told by the TM to get ready to commit. Typically, this means each RM that manages a branch records the actions for the branch in stable storage. The branches indicate whether they are able to do this, and these results are used for the second phase.

In the second phase, the TM tells the RMs whether to commit or roll back. If all branches indicated when they were prepared that they will be able to commit, all branches are told to commit. If any branch indicated when it was prepared that it will not be able to commit, all branches are told to roll back.

In some cases, a global transaction might use one-phase commit (1PC). For example, when a Transaction Manager finds that a global transaction consists of only one transactional resource (that is, a single branch), that resource can be told to prepare and commit at the same time.

Sunday, October 3, 2010

Mounting Alfresco as a WebDAV Network Folder

I like Alfresco Share's beautiful UI and I like Alfresco's CIFS capability of being mounted as a remote SMB/CIFS network drive. Anyway, one of the few shortcomings of Share is that you cannot download multiple files from the Web UI (you can upload multiple files), something you can easily do by mounting Alfresco as a SMB/CIFS drive, dragging & dropping files in and out.

Note: I think one of the coolest features we should add to Share's UI would be the ability to download a selection of folders as a ZIP file in one shot.

CIFS is not enabled by default, so there are Alfresco deployments where you cannot mount it locally on your workstation, for security reasons or because of a lazy sys admin. However, to interact with Alfresco easily you always have an option: mount it as a WebDAV network folder, which is easy to do from any operating system and it's enabled by default in Alfresco (unless your sys admin disabled it on purpose).

On the Alfresco Wiki you can find instructions for mounting WebDAV on Windows. Here I want to quickly show you the same thing on  Mac OSX and Finder, which is even easier (of course, it's a Mac....).

First of all, Alfresco's WebDAV is available from address: http(s)://hostname:port/alfresco/webdav/
in my case I'm using a local Alfresco server, within my home network, so it is:
Beware that in most cases Alfresco is configured to be accessible to the external world via HTTPS and not plain HTTP, so write your URL accordingly.

Now open the Finder and press ⌘K to open the server connection dialog, adding you Alfresco's WebDAV URL like this:

After pressing "connect" (sorry, my screenshots are in Italian....) and entering your own Alfresco's username and password, you'll get this:

Now you could go to your Alfresco's User Home, in my case it's mturatti, and start dragging and dropping file into Alfresco, or from Alfresco into your desktop.

Thursday, September 23, 2010

BPMN 2.0 process modeling on the iPad

Have a look at this blog post and video, Signavio BPMN modeler can be used from iPad as well. The modeler works with Activiti, as Signavio donated it to the open source project.

Wednesday, September 22, 2010

JavaOne 2010, Glassfish and Netbeans

Despite the rumors and my own pessimism, it looks like there are plenty of Netbeans and Glassfish sessions at JavaOne 2010. From my point of view the combination of Netbeans + Glassfish and Java EE 6 is the easiest and quickest way to develop and deploy Enterprise-class Java (and Groovy) applications, without all those boring xml configuration files.

As reported by many observers, if we look at the apparently outstanding number of people trying to attend Gf and Nb sessions at Javaone, I think nobody can deny the fact that, contrarily to previsions, interest around both Glassfish and Netbeans is growing at great speed in the Java community.

Wednesday, August 11, 2010

A short video demonstrating Alfresco IMAP integration

A short video from Alfresco's partner Zia Consulting demonstrating how IMAP integration works in Alfresco. You can access and iteract the whole document repository from a regular email client, like Outlook, Thunderbird or Apple Mail. This opens a set of possible interesting use cases within a company, and doesn't force some employees to learn a new tool to effectively use the document management system.

Some more links about email management with Alfresco:

Wednesday, July 28, 2010

OpenESB Summit 2010 in Brussels

The OpenESB community now has a new web site:

Authors write:
"This site is dedicated to the OpenESB community. The aim of this site is not to to create a substitute to the previous sites dedicated to OpenESB. We simply try to fuel up the community with news, papers, blogs users feedback about OpenESB."

The OpenESB community is trying hard to survive the impact of Oracle's acquisition, which has stopped most of OpenESB development and practically killed Project Fuji.

To revamp OpenESB is now mandatory creating a bigger and stronger open community around the product. Some companies seems the most active at present, the ones I know are: Logicoy, ForgeRock and Pymma.

This effort will be illustrated in the forthcoming OpenESB Summit 2010, Brussels (Belgium) Monday 4th and Tuesday 5th of October 2010.

On the other hand, I think the OpenESB (and JBI, as Oracle has never been committed to JBI) communities needs to connect to the wider Netbeans community, to join forces, as OpenESB to survive without Sun needs to keep the pace with newer Netbeans releases much better than what has been achieved so far.

Personally, as from the beginning of this year I'm fully employed with Alfresco Software, I will keep following the OpenESB evolution and experiment with Alfresco integration.

Good luck to all former colleagues involved with this project.

Tuesday, July 27, 2010

XML Schema and WSDL modules for Netbeans 6.9

*** UPDATE ***
The instructions below are still valid for Netbeans 6.9, but there is a new repository link for Netbeans 7.x, have a look here for more.

In the latest Netbeans releases, for some reason I can't understand, they removed the XML and WSDL plugin from the list of default available. This plugin is one of the best tools you have in Netbeans, as it allows to create and modify XML files, XML Schemas and WSDL files easily and graphically. It is a reduced version of what you get with Altova's XML Spy.

Browsing the Internet I have found a Netbeans repository from which I can install this plugin for Netbeans 6.9 also, what I did is to add a new Plugin download URL:

Then I added the new plugin center:

From where I can install some development plugins:

To know what it's possible with this plugin, have a look at:

I'd like to now if the URL above is the right one or there are different places from where it is possible to download updated releases of this.

Monday, May 17, 2010

Alfresco launches Activiti BPMN 2.0 business process engine

Alfresco today announced the Activiti Business Process Management (BPM) open source project and the addition of leading BPM expert Tom Baeyens as Chief Architect, BPM. The Activiti project is a new Apache-licensed open source BPM platform designed from a blank slate to implement the new BPMN 2.0 standard from the Object Management Group (OMG) and to support new technology challenges such as interoperability and the Cloud. Tom Baeyens, founder and architect of the JBoss jBPM project, and fellow architect Joram Barrez, join Alfresco to create the first Apache-licensed BPMN 2.0 engine.

Sunday, May 9, 2010

Friday, May 7, 2010

Pymma about BPEL Compensation

Another great technical paper from Pymma Consulting:

"Every Thing You Always Wanted to Know About BPEL Compensation But Were Afraid to Ask ;-).
BPEL compensation is one of the main feature used to provide consistency in a business process. Unfortunately, BPEL tutorials often skip this part of Oasis specifications. Even if on Internet you can find papers on that topic, few propose a complete and progressive explanation with simple exercises. It is the reason why we decided to write a complete tutorial which covers all the features defined in BPEL Specifications. We hope that this paper will be useful for you. Please send us your feedback and your comment.

Download from here.

Tuesday, March 30, 2010

From database table to Excel with Groovy

I have a MySQL table with customers data and I want to select records and create an Excel CSV file from them. This can be easily done in Groovy with few lines of code:

package it.alfresco.groovy

import groovy.sql.Sql

def sql = Sql.newInstance("jdbc:mysql://localhost:3306/test",
"root", "******", "com.mysql.jdbc.Driver")

def query = "select * from webinar order by company"

outFile = new File("/Users/mturatti/Desktop/Roadshow.csv")
appendFlag = false
outStream = new FileOutputStream(outFile, appendFlag)
writer = new FileWriter(outFile, appendFlag)
outChannel =

outFile << "Firstname; Lastname; Email; Company; Job Title; Process\r\n"
sql.eachRow(query, { outFile << "${it.firstname}; ${it.lastname}; ${}; ${}; ${it.title}; 1\r" });

println outFile.text.size()
The table contains the following columns: firstname, lastname, email, company, title.
The resulting CSV file can be opened by Excel and Openoffice.