19.11.09

Document for XJC

http://www.j2ee.me/webservices/docs/2.0/jaxb/xjc.html

The one from JDK documentations

Java/jdk-6u10-docs/docs/technotes/tools/share/xjc.html

Plugins for JAXB

https://jaxb2-commons.dev.java.net/

XFire Binding

http://xfire.codehaus.org/Bindings

A Simple Configuration Manager Architecture



This is a simple configuration architecture I use for my small applications these days. I'm happy with it now.

I have
  • A Singleton Application Manager, which represent the business layer of my application information.
  • Configuration Manager is also a Singleton class, but not necessary to be Singleton. Application Manager is the only class which would have relationship with Configuration Manager. The later one is a reusable class, providing DAO implementations to XML based Properties accessing to configuration files.
  • Configuration items are represented by POJO/JavaBeans, provided annotation on each field.
  • Application Manager parses the configuration POJO and retrieve configuration items via Configuration Manager, and saves the POJO as configuration items via Configuration Manager.
Something more:
  • A DAO layer.
  • Spring
  • Apache Configuration

NetBeans JAXB Problem: typedef class com.sun.tools.xjc.XJCTask cannot be found

Phenomenon:
I developed a JAXB application using JAXB Wizard on Netbeans 6.7.1. I submitted the program to SVN and then checkout into another computer. When I tried to compile the program, I met an error as:

D:\......\xml_binding_build.xml:8: typedef class com.sun.tools.xjc.XJCTask cannot be found

Reason:
Netbeans projects uses nbproject/private directory to contain some system dependent attributes. I usual ignore this directory when I submit my application to a version control system. However, Netbeans puts the JAXB path information in this directory, which cause my the compilation problem.

jaxws.endorsed.dir=D:\\Program Files\\NetBeans 6.7.1\\java2\\modules\\ext\\jaxws21\\api:D:\\Program Files\\NetBeans 6.7.1\\ide11\\modules\\ext\\jaxb\\api

Due to my understanding, I think this must be a bug of JAXB Wizard in Netbeans.

Solution:
Create another project in the current Netbeans environment and run JAXB Wizard once. Look at the nbproject/private/private.properties file, copy the corresponding line into your target JAXB application, clean and build the application.

9.11.09

Select a directory with a JFileChooser

reference: http://www.rgagnon.com/javadetails/java-0370.html

chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle(choosertitle);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

8.10.09

Resource for Creating Java Based Server

Apache MINA: http://mina.apache.org
JBoss Netty: http://jboss.org/netty/
STOMP: http://stomp.codehaus.org/