logo

Java Code

Projects

JNDI Explorer
A JNDI Explorer plug-in for Eclipse 2.0. JNDI is an abstraction layer for naming and directory services such as Corba, LDAP, DNS etc. As an enterprise programmer I usually use JNDI to lookup Enterprise JavaBeans, but this plug-in works with any naming service supported by JNDI.

Miscellaneous

Useful Java tools that I've developed and used in different project. Free of rights (public domain) unless otherwise specified, their distribution is encouraged.

ActionForm Serializer and its test case
I use this class to serialize a Struts form bean into a hidden field on a Web form. This is the way I've found to support multiple browsers sharing the same session.
Type-safe Enumeration
The correct way to write a type-safe enumeration in Java. This example implements the valid states of a tri-state checkbox widget.
Chaining Exception and its test case
This happens to every Java developer at least once a day: how can one propagate errors occurring in a sub-system, upward into the calling module, when your signature won't allow you to do so? By chaining exceptions, errors are wrapped inside an exception of a different type, and can be propagated safely.
Note: this class has finally been integrated in JDK version 1.4!
Assertion
Another indispensable tool, this simple class lets you enforce runtime conditions. Stuff that typically should never happen, and if it does, you *really* want to know about it right away.
Note: assertions are now available in JDK version 1.4!
Log4J Facade: Logger and its test case
I'm a big fan of using open-source software in my projects, but at the same time I don't mind keeping a layer of abstraction over the "foreign" code for better isolation.
This Facade hides the Log4J logging facility, and lets you switch logging packages if need be.
JavaMail Facade
Same idea as above, this Facade unifies and simplifies the JavaMail classes. Using this class one can send an e-mail in a lot less code than it takes using the JavaMail classes directly. Comes with test case also.

The following code snippets do not necessarily compile; they are provided solely for educational purposes.

Asynchronous Report Generation
Your JSP takes a long time to run and the browser times out before the page is done rendering. Here is how I worked around this problem: the servlet that gets the initial request, and the thread that creates the report.
JavaClassExec
You need to re-execute a VM from your current VM. Here is how to find the VM you're currently running within, and re-execute it: base class and JavaClassExec.

Copyright © 2000-2007 Renaud Waldura <renaud@waldura.com>