Les Hazlewood

Where Les is More

Apache Shiro San Francisco JUG presentation

For those that might be interested and if you are near the San Francisco/Bay area, I will be presenting Super Simple Application Security with Apache Shiro to the San Francisco Java User Group on 12 October 2010 at 6:30 pm PDT. Please see the link to RSVP – seats are limited!

OSGi, Maven, Pax, and web applications

This post is written for developers that are trying to deploy a .war file inside of an OSGi runtime environment.  I experienced a lot of pain along the way to making my solution work, so hopefully this will alleviate any pain that you might have. The Scenario This post primarily reflects the environment in which I am writing and deploying my application.  Here are the key points that led me up to my.. Read More

Java Class Naming Conventions

Ok, I’m about to go on a rant, because I come across something regularly that really, really, REALLY irritates me: Whenever you see a class that implements an interface SomeName, and the name of that class is SomeNameImpl. Guess what folks, EVERY implementation of an interface is an ‘Impl’. If you suffix ‘Impl’ at the end of your class name, you’re being short sighted and portraying a potential lack of understanding of Interface-Driven.. Read More

Root Persistent Class for ORM Hierarchies (Hibernate, et. al.)

Ok, I’m about to divulge to the world one of my little programming gems – something I’ve used on every single project for almost the last 4 years now. It is very easily translated to any other OO language as well, especially C# for the .NET/Hibernate.NET folks. I haven’t been keeping it secret or anything, I guess I just never took the time to write it out for general public. So when someone.. Read More

Configuration-hell remedy with Singleton injection – DON'T do it

So, I just finished reading this blog post about Spring configuration advocating static getInstance() methods in some places in your code to reduce the amount of Spring xml config. Since I posted a reply on that blog, and the author would probably be inclined to moderate my entry and delete it because I directly oppose his position, I’ve reposted it here for the benefit of others to read. THAT POST ADVOCATES POOR ARCHITECTURE… Read More

Consistent Cache Configuration: Spring, Hibernate, EhCache, Shiro, et. al.

Have you ever wanted to use caching in your Spring/Hibernate application beyond just supporting Hibernate’s 2nd-level cache? If you know what a Hibernate 2nd-level cache is, you really know how huge its performance benefits are. Wouldn’t it be useful to utilize caching for other things in your application? Even if you don’t explicitly use a caching API in your app, you still might already be using caching without knowing it – other open.. Read More

Spring Application Bootstrap Data

When you install an application for the first time, many times you want ‘bootstrap’ data to exist before the application is used for the very first time. Here’s a simple but easy technique to get bootstrap data inserted into your application upon first startup. Prior to the following approach, I used to have ‘default.data’ and ‘sample.data’ tasks in my ant scripts that either ran SQL manually, or started up a separate Spring ApplicationContext.. Read More

Java Email Address class

UPDATE: This Java class was updated on February 1st, 2008 to account for domain literals and quoted strings such as “John Smith” <john.smith@somewhere.com>. It is now effectively the only complete and semantically correct email validator for Java. PETTY REQUEST: The update required considerably more effort than the original as it now accounts for all valid RFC parsing conditions. Because of this, and that this page is easily my most visited, I’d appreciate it.. Read More

Full Circle to Smalltalk

While attempting to quench my thirst for the latest and greatest software that would make my life easiser, I went ‘a searchin’ on the net to find frameworks and technologies. Since I’m responsible for a lot of web 2.0 / enterprise software products, I wanted to find a framework and/or suite that I could leverage to cut my development time down. One of my biggest criteria in determining what is valuable is that.. Read More

Email Validation using Regular Expressions (the Right Way)

UPDATE: This article was updated on February 1st, 2008 to account for domain literals and quoted strings such as “John Smith” <john.smith@somewhere.com>. It is now effectively the only complete and semantically correct email validator for Java. PETTY REQUEST: The update required considerably more effort than the original as it now accounts for all valid RFC parsing conditions. Because of this, and that this page is easily my most visited, I’d appreciate it if.. Read More