Reficio™ - Reestablish your software!

Just another “Hack Weekend”

And they say that Software Engineering is boring… It doesn’t get more wrong than that! At least it’s like this with me… but I know a couple of other freaks (Hackergarten Basel team) that hack on a lot of interesting stuff whenever they can :) Here’s the proof:

After the last weekend of hacking when I worked on my own open source projects, mainly on the p2-maven-plugin, this weekend I decided to contribute to the Grails Framework. I have done a couple of project using Grails, but I haven’t seen the latest releases, so it was a chance to get the gist of what has changed. And I wasn’t disappointed! The framework really rocks!

So, I have worked on 5 tickets assigned to the next release (2.3.5) – along the way I have submitted 3 pull requests. Hopefully. I have solved all of the problems. In some cases the users tried to use the mechanisms in a wrong way -> maybe doc should be supplemented? Anyway, here’s the list to the issues, in case you are interested.

Now, it’s time to get some sleep! Eventually! It’s 3.32 am :)

Eclipse RCP dependency management done right with p2-maven-plugin

I am happy to announce the fourth official release of the p2-maven-plugin -> version 1.1.0! I managed to find some time to work on the Maven 3.1.x compatibility issues that have been finally fixed (…hmmm actually, I’ve managed to find a lot of time, since I’ve been hacking for the last 48 hours ;) ) I also refactored the code, so it should be more clean and readable now! The test coverage is awesome… as always – it averages at around 95%. I am especially proud of the end-to-end integration tests as that’s where most of the test-coverage comes from. It was really easy to refactor the code having such great tests!

It’s been a lot of work to release four versions in the last 10 months, even though that the codebase is relatively small – but the devil is in the details – especially when it comes to OSGi and Tycho :) . It was, however,a lot of fun and satisfaction to see that people appreciate your work and that the plugin is used more and more widely! I will try to post an article about the projects that use p2-maven-plugin soon.

In the meantime grab version 1.1.0 as it is still hot:

What is the p2-maven-plugin?

Are you familiar with the automated dependency management like in Maven, Gradle or any other fancy tool? You just define a project descriptor, add a bunch of dependencies and everything happens “automagically”… Piece of cake huh?! Well, there are, however, these RCP “unfortunates” for whom it is not quite that easy… Why’s that, you might think?

The following blog entry outlines the problem perfectly: The author presents five different approaches how to configure the build and dependency management in a Tycho / Eclipse RCP project and, in the end, she couldn’t really propose a satisfactory solution!

In order to add a third-party dependency to an Eclipse RCP project the dependency has to reside in a P2 update site.
So in order to generate such site you have to do three things by-hand:

  • 1. download all required dependencies to a folder,
  • 2. recognize which dependencies are not OSGi bundles and bundle them using the ‘bnd’ tool,
  • 3. take all your bundles and invoke a P2 tool to generate a P2 update site.

Ufff, that is a mundane, cumbersome, repeatable and stupid activity that may take you a few hours – imagine now that you have to do it multiple times… That’s where p2-maven-plugin authored by me comes into play. It solves problems #1, #2, #3 and does all the hard work for you. Isn’t that just brilliant? I think it is… :)

How to use it in 2 minutes?

Using p2-maven-plugin is really simple. I have prepared a quickstart pom.xml file so that you can give it a try right away. We will generate a P2 site with a couple of OSGi bundles (bundling some of them on the fly) and and then we will expose it using the jetty-maven-plugin.

The full code of the example is located HERE. There’s more examples HERE

In order to use the plugin the following section has to be added to your pom.xml file:

The plugin hasn’t been deployed to Maven Central so far – I would appreciate help on this issue!

Here’s the pom.xml:

There are many more config options, but basically that’s the thing that you need for now. In order to generate the site invoke the following command ‘mvn p2:site’ in the folder where the pom.xml file resides. When the process finishes your P2 site is ready!

You will see the following output:

Your site is located in the target/repository folder and looks like this:

Unfortunately, it’s not the end of the story since Tycho does not support local repositories (being more precise: repositories located in a local folder). The only way to work it around is to expose our newly created update site using an HTTP server. We’re gonna use the jetty-plugin – don’t worry, the example above contains a sample jetty-plugin set-up. Just type ‘mvn jetty:run’ and open the following link http://localhost:8080/site. Your P2 update site will be there!

Now, simply reference your site in your target definition and play with your Eclipse RCP project like you were in the Plain Old Java Environment. Remember to enable the “Group items by category” option, otherwise you will not see any bundles.

Would you like to read more?:
Thanks for reading!

Getting version of the Maven project in a freestyle Jenkins build

Today, I have had to extract the version of a Maven project that is built as a part of a freestyle Jenkins build. There are some stackoverflow posts describing how to do it, but the implicit prerequisite is that the build is a native Maven build – not a freestyle build. That is not what I wanted.

Below, I enclose a script that I have come up with for a Jenkins freestyle build that contains a Maven project step. You may have to adjust the path to the pom.xml file. It is important that the script is executed as a system Groovy script, otherwise the Jenkins’ jars are not on the classpath.

The script sets an environment variable (MAVEN_VERSION) that may be used later on in the build. Enjoy!

“ESB Monitoring Framework for SOA Systems” published in IEEE TSC

I am really happy to announce that an article that I have co-authored titled “Enterprise Service Bus Monitoring Framework for SOA Systems” was published in the IEEE Transactions on Service Computing Magazine. Have a look at the abstract:

The paper presents a Monitoring Framework for the integration layer of SOA systems realized by an Enterprise Service Bus (ESB). It introduces a generic ESB Metamodel (EMM) and defines mechanisms which gather monitoring data related to the model entities. Applicability of the model is verified on the Java Business Integration (JBI) specification – available standardization of an ESB. An analysis of the JBI specification from the Metamodel perspective is presented, resulting in identification of JBI monitoring deficiencies. Then, the paper illustrates a realization of mechanisms ameliorating JBI deficiencies. The paper also defines the notion of a Monitoring Goal Metamodel which lays a foundation for a fully-featured and technologyagnostic monitoring framework established on the EMM. The Monitoring Goal Metamodel allows a declarative definition of how the framework should react to anomalies by performing drill-down monitoring to diagnose the root cause of the problems. Evaluation of the prototype implementation of the ESB Monitoring Framework that verifies its correctness and fulfillment of the non-functional requirements is presented. Related work and some important relevant projects and technologies are also briefly described. Finally, the paper is summarized with conclusions and a vision of the proposed framework usage and extensions.

Here’s the link: IEEE Magazine. Let me know if you would like to get a copy.

UberConf – be ready to have your mind blown!

I hate blogging about conferences. I find it dull, unentertaining and worthless. Yet another blog entry about a few sessions that the person attended and some comments whether it was good or bad. I did it once following the “common” pattern and I still feel bad about it. I don not particularly like these posts since they rarely judge the conference as a whole and concentrate on that year’s events that, guess what, will not be there the following year. IMHO, the only noble purpose that they serve is to broadcast the message that this particular person attended that specific conference. Fair enough.

This post is supposed to be different (I hope at least) because what I would like to do is to basically focus on the fact why UberConf rocks. That being said I will give you 5 reasons to prove my point.

  • First of all, there are no sponsors (literally NULL). That is really fair since you have to pay for the ticket and there is nothing worse in the schedule than the sessions presented by sponsors. They are pretty often boring, unobjective and tiresome.
  • Next, sessions are 90 minutes long. It is the biggest advantages in comparison to other conferences (JavaZone 60 min., Devoxx 60 min., Geecon 60 min., JAX 50 min., Jazoon 50 min). 90 minutes is enough to give a proper introduction, develop the topic, present decent code samples, and wrap up in a thorough Q&A section. From now on, anything shorter than that seems just too short.
  • In addition to that, a full-day workshop preceding the conference is a brilliant idea. I am aware of the fact that many conferences offer university days, but the sessions are maximally 3 hours long which, in my opinion, is not enough to fully cover the topic on a reasonable level of abstraction.
  • Do not be suprised if it is 21.30 in the evening and you are still at a lecture, a session or a workshop. The wide variety and amount of sessions is just mind-blowing.
  • Over many years UberConf and NFJS have proven to invite the most influential java rock star speakers, like Ted Neward, Venkat Subramaniam, Mark Richards, Ken Sipe, Tim Berglund, Matthew McCullough, Neal Ford, etc.. .You cannot discuss with that.
  • Finally, the atmosphere rocks at UberConf. People are so friendly and open that you immediately have the impression that you know each other for a long time. That enthusiasm and dynamism is also so tangible that you almost feel it in the air.

Personally, I extremely enjoyed the conference and all the fun that was around it. Ken Sipe offered once 20 USD to the person that implements a cross-tab scripting example on his web-security workshop. I am neither a javascript expert nor a web-development geek, but this task was pretty enjoyable to me. You can see the full script below (works on Firefox only). The “showAllURLs” function displays all URLs opened in all browser’s windows/tabs. I enjoyed this 20 bucks as well – Long Island ice tea with Szczepan Faber and some other guys was great!

I was also happy to discuss the issues around JmsTemplate with Mark Richards, who claimed that JmsTemplate was 10 times slower than the native JMS code on sending 1000 consecutive messages. He even presented some examples and performance charts to prove this fact. That was pretty confusing to me since my internal tests performed a few years ago have proven something completely different. After a while I noticed that he simply had not compared apples with apples. In the code using the native JMS API Mark reused one JMS connection and one JMS session whereas in the code using JmsTemplate he did not use caching at all (be default JmsTemplate opens a new conncetion and a new session on every operation – it is well documented though). I sent him the following XML snippet with CachingConnectionFactory setup and he rerun the test. The result was very different – JmsTemplate was only about 2 times slower – and this could be fine-tuned as well. It was a reasonable result, though, since JmsTemplate offers you a lot of convenience stuff and eliminates boilerplate code from your app.

That is pretty much it. I hope I convinced you that UberConf is really a great show that is a bit different from the ones that we have in Europe. I have never regretted going there twice – even when I suffered from a jet lag at 4am in the morning. I hope you will not regret either. See you at UberConf!

Generic ESB Monitoring Architecture Compliant with JBI

I finally managed to publish my master thesis titled “Generic ESB Monitoring Architecture Compliant with JBI”. It is quite old now, but since I have just resurrected my blog it is a perfect topic to start with. Maybe somebody will still find it interesting – it was quite successful in a few IT contests. You can download it here: LINK. Here is the abstract:

Currently, the significance of the Enterprise Application Integration (EAI) in the field of Service Oriented Architecture (SOA) is gradually increasing. The quality of the integration patterns is constantly ameliorating. Progressive integration solutions are designed, published and offered to the community by most of the prominent IT vendors. Today, Enterprise Service Bus (ESB) is one of the most meaningful solutions and top-selling products on the market of the integration services. There is, however, no agreed-upon definition of what an ESB actually is. Java Business Integration (JBI) presents an approach to standardizing the ESB pattern by specifying a concrete, well-defined and Java-centric model of ESB. The first version of the specification does not mention any kind of monitoring solution for JBI, which is the vital drawback of the concept. Increasing complexity of the SOA-oriented IT systems implies higher importance of the selective monitoring, which allows to mitigate the problem of the management of software infrastructure. The main goal of the thesis is to design and implement a system which adds a monitoring and management logic to a Java Business Integration container in such a way that the logic is fully transparent and compliant with the JBI specification and allows to gather, process and expose sophisticated information regarding the qualitative parameters and operational reliability of the JBI container. The design of the system was performed in accordance with the Experimental Driven Development (EDD) methodology. At the beginning a statement of functional and non-functional requirements was created. Afterwards, an analysis and prototype construction were performed. At the end, the prototype was meticulously examined during a set of experiments which were conducted, in order to provide best-fitting architectural solutions which are compliant with the aforementioned requirements. Finally, it was possible to design and implement functional and innovative realization of the JBI monitoring solution called GlassBus. Performance test have proofed that the average JBI performance deterioration, while being monitored, is not higher than 20 percent. Not only did the results of the work described in this thesis fully satisfy the authors, but they also amazed the academic supervisor. Progressive architectural solutions introduced in GlassBus ensure its forthcoming success.

Here’s the link to the Scribd online reader: Scribd

Hardcore Java: Quine and Backward quine

Browsing through old university folders I found interesting pieces of code that I wrote some time ago for a contest at IBM. Have you ever heard of a quine? If not, here’s the definition by Wikipedia:

In computing, a quine is a computer program which produces a copy of its own source code as its only output. (…). For amusement, programmers sometimes attempt to develop the shortest possible quine in any given programming language.

Now, when everything is clear – let’s amuse ourselves and write a shortest possibile quine in Java :)
After some experimenting, I ended up with a Java code which consisted of 135 characters (the code is wrapped for better readability):

That’s all you think? – no class, no main method? Yes, but let’s make some test in order to prove the correctness of the presented approach (note: you won’t run it in eclipse – you have to use command line) :

OK, but grouches may say that it is an old trick – and that’s actually true. You can google much stuff concerning that problem. So, let’s raise the bar and write a shortest backward quine – a program which will output its content backwardly. I haven’t found a word about it on the Internet. My version contains 191 characters:

Is your version shorter :) ? Groovy version is gonna be much briefer – I will code it and post soon…

E-point prize for the best thesis is mine :)

I am really excited to inform that the master thesis written by Marek and me was awarded for the second time! Today, our dissertation titled “Generic ESB Monitoring Architecture Compliant with JBI” has received the e-point prize for the best thesis on JEE Internet solutions. The official results are published on the e-point site (in Polish). See the screenshot attached below:

Few months earlier it had been also awarded by the Polish Information Processing Society – I blogged about it HERE. On that occasion, I would like to thank Marek for great and successful cooperation! As far as I know it was the last contest to which we submitted our dissertation so in the nearest future I will publish its content in the Internet. Stay tunned :)

Mission Impossible with Kirk Pepperdine

Last Tuesday Kirk Pepperdine gave a talk at Warszawa Java User Group. Kirk is a Real Guru in the Java world so I was truly excited to meet him. He has been working in high performance and distributed computing for nearly 20 years. What is more, in 2006 Kirk was recognized by Sun Microsystems as a Java Champion recipient for his contributions to the Java community.

“Performance Tuning with Cheap Drink and Poor Tools” was the topic of the session. At the beginning participants got a cheap food (pizza) and a cheap drink (coke) – so everybody was in high spirits :) You can expect everything when you attend a JUG meeting. Sometimes people present something you actually got acquainted with very well, sometimes you don’t know the subject, but Wikipedia, Google and Eclipse would give you the same answers without leaving your home. Some sessions are, however, sensational – and Kirk’s talk was really that case!

At first, Kirk put emphasis on the fact that there is no taxonomy regarding performance tuning. The main problem is that very often developers do not realize that the process of giving a performance boost to an application is much different than the development itself. Kirk made a joke that many companies tune their application in accordance with the following rule:

“We don’t know where we are going, but we are having a great time” .

According to the speaker, issues concerning performance should be take into consideration at every stage of the project life-cycle. Could we disagree with that? I don’t think so, but why it is neglected most of the time…?

Later, Kirk presented a sample application which encompassed the most common performance bottlenecks. The audience was supposed to tune it on the spot. It was really funny as this simple exercise showed the main problem right away! Developers are used to work with the code – we can even say that we love the code :) So, what do we actually do to solve potential performance problems? – we look into the code! According to Kirk it is the last thing that should be done. However, to cut the long story short, here are some general rules presented by Kirk:

  • When is the performance bad? – When users do complain!
  • Everything matters – tune application in exactly the same hardware/software environment as the production environment.
  • DON’T LOOK INTO THE CODE unless you really know where you wanna look.
  • Find the DC (dominating consumer): application, jvm, os, hardware.
  • If CPU kernel time is higher than 10% – application is the DC.
  • Use poor tools – such as: jps, jstack, jvisualvm – to locate the piece of code that is responsible for the degradation of performance. THEN look into the code to modify it.
  • Using a profiler is the last step
  • Don’t shoot wild – don’t do anything blindfold – making your code look beautiful won’t help!

Do you agree with that? YES, YES, YES ;)

Spring integration in jBPM 4

When I was supposed to use the fourth version of jBPM for the first time I couldn’t find a sufficient documentation concerning the integration with Spring. I have also seen that there are many questions regarding that issue on forums or discussion lists. Despite the fact that there are some entries on Andries Inzé Blog or in jBPM official documentation which actually outline that problem I felt a lack of a sample project archetype. Something that I could download, build and take the first shot right away!

After few months I found some time to make this dream come true :) as I have created a sample Spring+jBPM+Maven2 project. All details of the integration are described in my developers notebook under the entry: Spring integration in jBPM 4. The article briefly shows how to set up:

  • Maven Project Configuration [pom.xml]
  • Logging configuration [log4j.xml]
  • jBPM Configuration [jbpm.cfg.xml]
  • and Spring Configuration [applicationContext.xml]

It also outlines how to write and execute a sample test case.

That is all what you need to start playing with jPBM in your favorite IDE(A)! More on this is comming soon! Stay tunned!