Friday Sep 05, 2008


Via Mark Stephens' conference trip report, I found out about the above Penguin webcam at the New England Aquarium. Pretty cool!

In other news. Mark's colleague Mariusz has a great article about combining Flex with Java, where one of the tools used is NetBeans IDE 6.1. Click here for all the details.

Thursday Sep 04, 2008

META-INF/services vs. layer.xml registration

There's been some discussion on the NetBeans Platform mailing list (dev AT openide DOT netbeans DOT org) about the two approaches to registering service providers. Because, there are two approaches that are quite distinct that achieve the same end result. So the question is: which one to use and why? And why are there two approaches to begin with?

To recap, the two approaches are as follows:

  • Create a file in META-INF/services named after the fully qualified name of the interface that you'd like to implement, containing (nothing more than) the fully qualified name of the implementing class. This is the standard JDK 6 ServiceLoader approach. An example, covering both ServiceLoader and Lookup, can be found in John O'Conner's excellent Creating Extensible Applications With the Java Platform.

  • Register the service providers in the layer.xml file and then use Lookups.forPath("path/to/layer/folder") to locate the service provider. Toni Epple's recent concise and thorough How Do NetBeans Extension Points Work? on NetBeans Zone takes this approach.

Note that both John and Toni include compilable sample code with their article. In both cases, they explain the approach very well. Heiko Böck, in "NetBeans Platform 6: Rich-Client-Entwicklung mit Java" discusses service provider registrations too, in section 6.4 of his book, although there the service provider, if registered in the layer.xml must be found in a folder named "Services".

However, during the mailing list discussion, Casper Bang pointed to this helpful exchange in comments on Tim Boudreau's blog:

So, Lookups.forPath() is new. That, together with the other info in Tim's comment, clarifies a lot for me. Also see the related mail thread for some discussion.

Tuesday Sep 02, 2008

Announcement: NetBeans Platform Teaching Materials

The always enthusiastic (and NetBeans Docs Coordinator and NetBeans Dream Team member) Varun Nischal wrote me a few days ago asking about NetBeans Platform slides he might be able to learn from in preparing for a presentation he'll be doing at Amity University, Noida, in India. I realized that we don't have a centralized location where anyone can go to download teaching materials for the NetBeans Platform! Sure, we have the NetBeans Platform Learning Trail and the NetBeans Platform Certified Training page, but wouldn't it be cool if we had one single page listing ALL the materials that a teacher might find useful when preparing lesson materials for students learning about the NetBeans Platform?

The problem with the learning trail is that it is aimed at students of the NetBeans Platform. The problem with the certified training page is that it focuses very specifically on the training itself (although it does provide all the related slides). However, there are many other slides available—several NetBeans Dream Team members have given presentations on the NetBeans Platform, for example, and many conferences have been attended where the NetBeans Platform has been introduced in one form or another. How could those slides be shared with others? There are really many one-off presentations that have been held on the same topic, at user groups, at JavaOne, at other conferences. Wouldn't it be cool if EVERYTHING related to teaching the NetBeans Platform were to be found on ONE single page? So that people like Varun would be able to go to ONE single spot where EVERYTHING is centralized?

In that light, hurray for! That site is aimed at educators/teachers/instructors/professors/gurus/etc. These are people who are using NetBeans in one way or another to teach Java/Ruby/whatever in the classroom. It is the one-stop shop for all materials that relate to teaching via the tools made available by the NetBeans team. Wouldn't that be a perfect place for these people to also find exhaustive materials relating to the NetBeans Platform? Therefore, since yesterday, there's this brand new page (click it to jump to it):

It already contains a lot of material. Varun (and all other Varuns out there) is going to have a hard time choosing, rather than having a hard time finding. All the slides that I'm aware of that relate to the NetBeans Platform have been put there—everything from intros to more technical slides to Eclipse/NetBeans comparisons. Tom Wheeler and Alex Kotchnev's introductory NetBeans Platform slides are also there, I'd especially look at those because they're by people from outside Sun, so they have unique perspectives. The start of a non-English section (currently only containing Russian) is also found there. More contributions are needed—German, French, Chinese, Spanish, Portuguese, and so on too. In addition, how about the slides from Tom's Boeing presentation and Fabrizio's blueMarine presentation, both from JavaOne 2008? How about presentations about the NetBeans Platform done by others within Sun? Maybe some Chinese ones from Liang Ye? German slides by Toni Epple or Sven Reimers or any of the other German NetBeans Platform users? A NetBeans Platform course is being planned in Australia, so the resources above could be used there too. There's no limit to what could be added there, so long as there's some interconnection with the NetBeans Platform. I imagine teachers would simply download the slides they need and adapt them to their purposes. If the slides change significantly, it would be very cool to hear about it so that they could be made available via the same page so that others could benefit from your insights.

And... if there are gaps, i.e., if there are topics that you'd like to have slides about that are currently not covered, you are free to request them and they can be made on demand, following the instructions on the page above.

So, thanks Varun for the question. And hopefully the above will be of help to you and others too. Feedback is very welcome.

Chinese Cover of the "Rich Client Programming" Book

The above is the cover of the book "Rich Client Programming: Plugging into the NetBeans Platform" translated into Chinese by Liang Ye. He reports that the book is currently at the printer, so it sounds like things are going to be moving very fast now with this translation! Click here to read an interview with Liang, where he explains the background of this translation project (and go here if you're a Chinese teacher of Java and are looking for some slides for your courses because Liang has made available some of his slide decks for general use).

Monday Sep 01, 2008

Generate UML Diagrams into Javadoc for NetBeans Module Projects

Here's Javadoc with UML diagrams for the Google Toolbar module from the NetBeans Plugin Quick Start:

To let the IDE automatically generate UML diagrams into your NetBeans module's Javadoc, do this:

  1. Read this for background and to set up the required software.

  2. Add this to the module project's build.xml file:
    <target name="netbeans-extra" description="Generates UML-Javadoc">
        <property file="nbproject/"/>
        <mkdir dir="${dist.javadoc.dir}"/>
        <javadoc source="${javac.source}" packagenames="org.\*" 
                <path path="${javac.classpath}"/>
                <path path="${module.classpath}"/>
            <fileset dir="${src.dir}" excludes="${excludes}" 
                <filename name="\*\*/\*.java"/>
            <doclet name="org.umlgraph.doclet.UmlGraphDoc" 
                <param name="-attributes" />
                <param name="-operations" />
                <param name="-qualify" />
                <param name="-types" />
                <param name="-visibility" />

  3. Put UmlGraph.jar in release/modules/ext (or anywhere else, as long as the reference in for ${file.reference.UmlGraph.jar} is correct).

  4. Copy the content of a standard NetBeans Java project's file into your module project's file.

Now build the module and then look in the Files window, within dist/javadoc and you should find your HTML files have UML diagrams.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« September 2008 »