Hola,
Did you want to code it from scratch or use an existing implementation?

Have a look at http://www.noeska.com/doal/ if you just want to use an existing implementation in your own app.