domingo, 8 de fevereiro de 2015

Mozilla Build: My first accepted contribution to an open source project

It began in 2011, i started to review some Mozilla Build code and noticed that some scripts could be improved.

A couple of years later, they asked me if i could re-do the changes, and so i did. Although this change does not have a clearly visible impact on the Mozilla products, it improves the start up of the build environment for developers.

Here is a link to the Mozilla repository with the changes:
http://hg.mozilla.org/mozilla-build/rev/587f5ce581e5

This change as already been superseeded due to some recent developments, but some changes remained. Hurray!

quinta-feira, 5 de fevereiro de 2015

Simple Maven archetype for Axis2 web services with Tomcat embedded

Technology credits:
Apache Maven & Failsafe
Apache Tomcat
Apache Axis2

Disclosure

Before you start reading further: Keep in mind that this is a work in progress, and although i'm a "Systems&Informatics Engineer" i consider myself a novice programmer. If you have any question you don't see answered here, please leave your comment on the section below to help me improve this article.
Also, you should be aware that this post was a result of a lot of work. If you like it, please feel free to show your appreciation by offering me a cup of coffee through paypal and/or add value to this article by sharing your knowledge.

Apache Axis2 architecture

If you check out some of my older posts, such as this you should by now be wondering whats the deal with Axis2. You can already deploy to Tomcat your own WebServices, so why bother have Axis2 on your WebServices?

Well... Axis2 deploys itself to your 'Application Server' (Tomcat or others) and only then will you be able to deploy your WebService in a special *.AAR format. This allows your 'Application Server Administrator' to deploy your WebApplication only once, give you the required privileges, and let you be responsible for upgrading/updating your own webservices.

This means (as you probably are guessing) that on the Maven building environment, there must be directives to:
  • Build an AAR instead of a WAR
  • Deploy the Axis2.WAR on Tomcat
  • Deploy your AAR on the Axis2.WAR WebApplication


The Maven Project

I've finally sum up the time to compile a simple but fully functional Maven Project for this post and is available here for your convenience.

Project Structure


The main differences from previous tutorials are on the Java implementation class (notice i've used my_method instead of myMethod for the method name, this was not an arbitrary choice, but a consequence of a drawback of Axis2).
Second, the web.xml reflects the fact that we'll be using the Axis2 container instead of a standalone container.
And third: the deep nesting of folders to define the services.xml configuration file under WEB-INF folder.
Everything else is pretty much the same as in this tutorial.

Since you have access to the project's source code, I'll leave it up to you to discover its internals.
For any questions, just drop me an email.

Happy coding! :)