Saturday, January 16, 2010

NetBeans JSF Converter Template

Object conversion is a common requirement in JSF. Surprisingly there is no template for a JSF Converter in the NetBeans Template list. I have created a template to create JSF Converters in NetBeans.


To use the template is very simple:

  1. Download the template.
  2. Start NetBeans.
  3. Go to Tools --> Templates.
  4. Select the JavaServer Faces folder.
  5. Select Add from the menu.
  6. Locate the file you downloaded and select it, and you are done.

Here is the file: Converter.zip


<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">

<#if package?? && package !="">
package ${package};
</#if>

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
/**
 *
 * @author ${user}
 */

public class ${name} implements Converter{

    public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}

Monday, January 11, 2010

Book Review: Maven By Example

I received a copy of 0.2.1 of the Maven By Example book from Tim O'Brien from Sonatype. I was in the process of learning Maven and moving some of my projects to Maven when Tim contacted me and offered the book to me. He also included a number of copies to give away at my local JUG.

This turned out to be a really good book on learning Maven. It is a Creative Commons licensed book so that it offers the community a chance to update the book and add content. Like any great open source project, giving the community to have a direct chance to update the project produces a better final product.

The most important chapter in the book is chapter 7 which brings together the components of the book into a multi-module enterprise project. The code for the chapter really shows how the components fit together. However, this chapter is lacking a lot of material and does not match the code in the example code in the download.

The chapter needs additional work to explain how to do the project. It really should hand-hold the reader through the chapter, and allow them to use the code in the book to create a project from scratch. I had to download the code to see why examples would not work in the book.

I don't want the previous remarks to seem to critical. They are not meant to be. The book is really well done, and I am glad that I went through it thoroughly. It will serve as a good reference going forward.

You can get a PDF version of the book from here: Maven By Example

Sunday, December 20, 2009

Nexus - "The Nexus Book" by Sonatype

I completed the Nexus book (version 1.8.2) from Sonatype last night.  A special thanks to Tim O'Brien for sending me a copy. The book is remarkably well written for the sections I reviewed. I installed the open source version of the software, and not the professional edition. As a result, a number of chapters were not applicable to my installation. I examined chapters: 1-6, 17, and Appendix C.

Note: Chapters 7-16 were excluded because it applies to professional edition. Chapter 18 is about developing plugins, and Appendices A-B apply to migrations to Nexus.

I did a cursory installation of Nexus using the binary installation and the books seems to match the installation process. My review is focused on installing the 1.4.0 war file on GlassFish 2.1.1 and 3.0. After I began my review, a new update 1.4.1 was was released and I got a chance to test the upgrade process. I can state it was a seemless upgrade.

Note: I found that I could not install the application on GlassFish version 3.0.

The book is definitely worth reading if you are serious about using Apache Maven and would like to host a repository for your development environment (team).

Chapter 6 Nexus Plugins

My only real complaint is Chapter 6. The details in the book are not correct for version 1.8.2 of the book. Section 6.2 Installing Plugins should point the user to installing the plugins in the following directory:
${NEXUS_WORK}/nexus/plugin-repository
I installed the Nexus Archetype Plugin (not detailed in book) and it was painful until I discovered the correct directory. Once it was in the correct directory it worked seamlessly. I have submitted a bug NXBOOK-394.

I would have liked more explanation of the available plugins including the open source LDAP plugin as an alternative to the version which is available in the commercial licensed professional edition.

Chapter 17 Nexus Best Practices

It was only 1.5 pages long. It needs more content to be useful.

Appendix C Configuring Nexus for SSL

This chapter is very important and covers Jetty extensively. The chapter should have included a little more assistance on setting up Apache HTTPD to handle SSL. There is also no coverage for Apache Tomcat, or GlassFish. These are all popular arrangements.

Final Thoughts...

I liked the book and thought any serious Nexus user, or potential user should read the book. It includes a lot of details, and a plethora of screen shots to get you on your way. 

Popular Posts