Matthias Wessendorf’s Weblog

Entries from November 2007

Apache SVN: Revision 600000

November 30, 2007 · 1 Comment

Tonight, I was committing some things to MyFaces and starting the process of preparing a new Trinidad release.
Bernd Bohmän who is just now sitting next to me (from the Tobago project), was also committing several things.

We both had a battle…

Who is the committer, that actually gets r600000 ??

I won! :-)

Here is the log-message! :-)

Categories: apache · java

Amsterdam: ApacheCon EU – second round!

November 29, 2007 · Leave a Comment

Next year in April the ApacheCon EU is in Amsterdam, again. Not to bad, actually! This year was a blast! Not only because of Queens day! ;-) Last night, I got a notification by the planers, that my session was accepted.

Cool! But I’d would have gone anyway. It is so close, from where I live :-)
Basically it is a ~3 hours train drive. Not to bad.

I am really looking forward for this COMMUNITY event!

See you there and let’s have a Heineken :-)

Categories: apache · apachecon

Running Swing with JRuby

November 22, 2007 · Leave a Comment

Inside $JRUBY_HOME there are some samples. One is running a simple Swing application w/ JRuby.

Wow!

The JRuby SwingRunner looks like:


# Import Java packages
include Java

import javax.swing.JFrame

frame = JFrame.new("Hello Swing")
button = javax.swing.JButton.new("Klick Me!")

class ClickAction
  include java.awt.event.ActionListener
  def actionPerformed(evt)
    javax.swing.JOptionPane.showMessageDialog(nil, <<EOS)
<html>Hello from <b><u>JRuby</u></b>.<br>
Button '#{evt.getActionCommand()}' clicked.
EOS
  end
end
button.add_action_listener(ClickAction.new)

# Add the button to the frame
frame.get_content_pane.add(button)

# Show frame
frame.set_default_close_operation(JFrame::EXIT_ON_CLOSE)
frame.pack
frame.visible = true

Sure, that looks different, when coming (like I) from a kind of Java-only perspective. Some keywords are different or used in a different way, like the new operator or how to access a constant. But, after I read it once more, I start to like it.I “ported” it over to real Java :-) to show the difference:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class SwingRunner {

  public static void main(String[] args)
  {
    JFrame frame = new JFrame("Hello Swing");
    JButton button = new JButton("Klick Me!");

    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        JOptionPane.showMessageDialog(null, "<html>Hello from <b><u>Java</u></b>.<br> Button " + evt.getActionCommand() + " clicked.");
      }
    }
    );

    frame.getContentPane().add(button);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);

  }
}

I think that is a little bit more typing. But perhaps you haven’t noticed, but the JRuby version supports Expressions :-) Like #{evt.getActionCommand()}. Cool!
Sure! This little (stupid) demo doesn’t sell (J)Ruby at all, but to me it was interesting and I think an eyeopener. Since I prefer reading books (perhaps I am traveling too much) I ordered Ola’s Book on JRuby and Rails.I need more of that!

Categories: java · jruby

Google’s Android

November 21, 2007 · 1 Comment

One of the cool things of Android is, that is uses Apache Harmony. For those, that don’t know it, Harmony is Apache’s Java-Impl., which is (for some reasons) not yet tested by the “Java TCK”.

But, what does that mean for J2ME ? I worked with J2ME in the past and kind of liked it, but Android gives you more, much more!

Will Android kinda kill J2ME ?

Categories: apache · java · mobile

JSF – We need more interfaces in the API

November 21, 2007 · 1 Comment

I filed this JSF Spec bug because I think, that we (the JSF folks) need more interfaces in the Components API.

In MyFaces (to connect Trinidad / Tomahawk) we were doing String comparison (the Component Family) to check if a component is a Form. With an interface for “JSF Form components”, that wouldn’t be needed and the solution would be more type-safe, than the String-hack.

The “table” component also could be a good candidate for getting an interface.

Let’s see what happens!

Categories: jsf · myfaces · trinidad

JRuby on Rails

November 20, 2007 · Leave a Comment

After I installed JRuby 1.1-beta, I tested the integration with Rails. Worked very well and wasn’t hard. Since JRuby is a Java-interpreter for the Ruby scripting language, you can use all you know (or not ;-) ) form Ruby.

I used GEM to install the Rails framework on my box and the rails command to create my simple app.
Like in plain Rails (well this is Rails, just with JRuby), I created a controller and edited it. I also updated the generated rhtml file.

After starting the server (the included WEBrick 1.3.1) I could access my first Rails app ever.

That was a very very simple demo (not an application at all), but I’ve to say, that I will continue my playings with JRuby on Rails!

It’s really worth to try!

Categories: jruby · rails · web²

Apache Wicket

November 20, 2007 · 18 Comments

Wicket is a Java Web Framework that uses POJOs and HTML to create applications. I read a lot’s of blogs that Wicket is so great, but never really bothered with taking it serious. When flying back from ApacheCon US, I read an article about Apache Wicket and I have to say, that I don’t buy the Wicket story, yet.

The key features of Wicket, as far as I got it, are:

  • POJOs
  • HTML pages
  • no XML

A typical Wicket-HTML file looks like

<html>
...
 <span wicket:id="value">Some value</span>
 <a href="" wicket:id="link">Go there</a>
...
</html>

The Java file behind the page looks like this:

public class MyPage extends WebPage {

  public MyPage() {
    Label valueLabel=new Label("value" ...);
    add(valueLabel);
    Link link=new Link("link") {
      @Override
      public void onClick() {
        setResponsePage(hardCodedLinkToAnotherPage);
      }
    };
    add(link);
   }
}

Noticed it ? Yes, it uses Java…., but that wasn’t the point. The structure of the HTML and the Java is same. You kind of rebuild the thing in Java, what your designer did before. Also the navigation is hardcoded :-) I am not sure if this all is really sufficient, when creating large applications, because it looks to me, that you are coding redundantly (HTML and Java).

In JSF you describe your view in a view-technology (Facelets, JSP, Clay,…) and behind you have a POJO object (managed bean) as well. It only captures the actual values. Sure you can code against the JSF-API, by using bindings. That allows you the creation of dynamic formulars, for instance.

What happens to Wicket, when I want to replace the Link class by an extension (FancyAjaxSomewhatLink for instance) ? Do I have to change all my classes ? In JSF the managed bean behind the page is somewhat independent from the “view-technology” as HTML, AJAX or even XUL, since it usually just captures the values. If you want to replace the default commandLink from the JSF standard API, by an extension, just change the declarative view, but you don’t have to touch the Java-code behind that page, like:

...
<ajax:myCoolCommandLink action="#{bean.theRegularActionMethod}" />
...

I like the fact, that there are different frameworks out there, but I belive in JavaServer Faces.

Perhaps it is worth to take a deeper look at Wicket, not sure on that, to be honest.

Categories: apache · jsf · jsp · myfaces

JRuby installed

November 19, 2007 · Leave a Comment

This morning, I installed JRuby on my computer. Why ?

Planing and checking things. Sounds like an interesting opportunity.

Oracle is also using it in Oracle Mix.

Categories: oracle · web²

ApacheCon US

November 17, 2007 · Leave a Comment

ApacheCon was fun. As always! Also my girlfriend Anja was enjoying the event, at least the social part, when meeting other speakers / attendees in the evening. My talk was the last talk on Friday and I posted my slides here. It is about “Advanced JSF” and gives you an idea of an optimal technology stack. For ApacheCon EU I submitted some talks as well and I hope they make it :-)

As of now, the conferences for 2007 are done. At least for me, since I am not going to JavaPolis.

CU in Amsterdam :-)

Categories: Blogroll · apache · jsf · myfaces · orchestra

ApacheCon US

November 8, 2007 · Leave a Comment

ApacheCon is fun. Haven’t been there? Go!

This year I’ll give a talk on “Advanced JSF”, just right after Dennis’ JSF Pitfalls (or was it Anti-Patterns). Dennis and JBoss’ Stan Silvert will do a BOF on JSF-Testing.

Veeeeeeeeery early on Saturday, I am off to Atlanta.

CU

Categories: apache · apachecon · jsf · myfaces · orchestra · trinidad · web²