Home Fabio Cortesi Stefan Jäger

Welcome to the Joint-Venture Blog from Fabio Cortesi and Stefan Jäger.

 

 
 

 

With two co-workers from Zühlke, I wrote an article about an scalable Java EE scheduler. This article got published in the JavaSpektrum magazin 04/2009.
 
It’s written in German and can be downloaded here.

 

 

 
 

 

On the Eclipse homepage you will find a very nice description about all new features in Galileo.

In a view of a Java developer, there are not a lot of new features. German readers will find at jaxenter a nice article with all new Java features.

The only one, which seems noteworthy, is the new toString() wizard:

eclipse_galileo_tostring_generator

 

 

 
 

 

Lucene offers great full text search capabilities. It is based on an index, which is maintained by Lucene. With Luke, the Lucene Index Toolbox (http://www.getopt.org/luke/) you can analyze your index and let explain queries.

After startup, you have to select your index. For this example, I created a test index with one file. It’s content is “this is a lucene test”. I used the StandardAnalyzer, which uses the WhitespaceTokenizer and filters out all tokens less than 3 characters and stop words. This will result in an index of the terms “lucene” and “test”.

image 

Continue Reading

 

 

 
 

 

Ant offers some XML features like the xslt task, which transforms XML files into other files. But unfortunately, with Ant you can’t make simple XPath Queries on a specific XML file.

 

Luckily, there is a nice open source solution called XmlTask, which offers many possibilities to work with XML files.

 

  1. Download the latest version of XmlTask from http://xmltask.sf.net
  2. Create a task definition in Ant
    1
    2
    3
    4
    
    <taskdef 
      name="xmltask" 
      classname="com.oopsconsultancy.xmltask.ant.XmlTask"
      classpath="./xmltask-v1.15.1.jar" />
  3. Use it with the <xmltask> definition

    For example, read out the number of a specific node in the XML file:

    1
    2
    3
    
    <xmltask source="someFile.xml">
      <copy path="count(//aNode)" property="numberOfNodes" />
    </xmltask>

    Or change an attribute:

    1
    2
    3
    
    <xmltask source="someFile.xml" dest="toAnotherFile.xml">
      <attr path="//aNode[1]" attr="enabled" value="true"/>
    </xmltask>

 

There are many other possibilites to work with XML files inside Ant. Check out the documentation at http://xmltask.sf.net.

 

 

 
 

 

Wrong use of the memory options can cause serious performance problems. To optimize the right memory size of the JVM or to find some critical memory issues, the GC log of the JVM can be very useful. Simply start the Java application with the option -Xloggc:<file>. Every GC action gets logged into this file.

 

To analyse this log file, there is a nice tool called GCViewer, which can be downloaded from http://www.tagtraum.com/gcviewer-download.html. GCViewer is able to display the memory usage of the application based on time and old/young generation heap space.

clip_image002

Continue Reading

 

 

 
 

 

There are some kind of tasks, which Ant won’t do. One of them is the loop. There is no simple way to implement a dynamic for or while loop in Ant. What do i mean with dynamic? Let me make an example. Ant reads out a number of iterations from a property file (we call it the number x) and should perform a loop x-times to call another Ant task. And this can only hardly be done with Ant.

 

 

image But fortunately, there is Groovy. Groovy is a scripting language, which runs in a Java Virtual Machine. And because of that, it can be easily integrated with Ant.

 

 

 

 

 

 

 

Continue Reading

 

 

 
 

 

Yesterday, I visited an interesting presentation from Tudor Girba. He showed us several ways for visualize code. One of the most interesting visualization was Code City.

 

image

(ArgoUML from http://moose.unibe.ch/tools/codecity)

 

Continue Reading

 

 

 
 

 

Today, I encountered a very helpful feature in Eclipse. When I am debugging code, I sometimes want to know, what’s the result of a method is. If the result it’s not assigned to a variable, it gets complicated. Take a look to this example: what is the result of add(17,19)?

public class DemoApplication {
 
    public static void main(String[] args) throws Exception {
        DemoApplication calc = new DemoApplication();
        System.out.println(calc.divide(calc.add(17, 19), 2));
    }
 
    public int add(int i, int j) {
        return i + j;
    }
 
    public int divide(int i, int j) {
        return i / j;
    }
}

In earlier times, I stepped one step further to get into the method divide. Then I got the result of add(17,19) in my parameter.

 

Continue Reading

 

 

 
 

 

There was a time, OSGi was for me just an “not understandable” abbreviation. Wiki told me, that OSGi is a framework for a dynamic component model. Huh? Is it just a specification or is it an implementation? Didn’t understand it all.

I started about two months with working a little bit with OSGi. I want to write here these parts, which were unclear for me at the beginning. It should be an introduction for everyone, who has never heard about OSGi.

Okay, let’s start.

The setup of OSGi is something like EJB.

  1. EJB has a specification from Sun.
  2. OSGi has specification from the OSGi Alliance.
  3. EJB need’s an application server as a platform (Weblogic, Glassfish, Websphere, JBoss, and so on) to run an “EJB” application.
  4. OSGi need’s also a platform to run “OSGi” application. Like an application server, which is implementing the EJB contract, an OSGi platform implements the OSGi framework specification. Currently, there some OSGi implementation out there. The most known are Equinox, Apache Felix or Knopflerfish.

Okay, now, we know, how OSGi is built. But what does it? In one sentence, it is something like a JVM with some extra features. OSGi extends the JVM and a Java program is running on that OSGi Platform instead of running directly on the JVM. OSGi offers some advantages, which I will mention shortly.

image 
(Source: http://de.wikipedia.org/wiki/OSGi)

 

Continue Reading

 

 

 
 

 

Today, I passed the SCBCD exam! Here some information’s, which helped me to pass the exam:

I also wrote some “Factsheets”, which I used to sum up all topics. Besides Factsheet 0, they can also be used as an assistance on the daily EJB 3.0 work.

If you find any mistakes in the Factsheet, just let me know.

 

 

 

Older Posts »