Wednesday, 16 September 2009

AspectJ In Action 2nd Edition

Hi All,

For those of you who are interested in learning or developing AOP with AspectJ or Spring AOP then I would definitely recommend reading AspectJ in Action 2nd Edition. I was asked to be a technical reviewer for the book and I have to say it is an extremely valuable reference for learning AOP. It has clear and excellent examples of enterprise Aspects that you could probably use for your projects straightway.

Most people think of tracing and profiling when they think of AOP however this book provides more usecases for AOP than the traditional areas of cross cutting concerns.

Good reading!

Friday, 13 March 2009

Hi

It's been a while since I posted anything, sorry about that. There are tons of things going on at the moment, with work and family. My wife had another baby girl so my hands are full with the baby and the toddler who wants to 60 million of things at the same time!

So I thought I'd post something today and tell folks what I've been up to. Well apart from slaving away at work I have been looking at designing and building a complete search solution. A complete search solution? What does that mean? The complete search solution is basically one search manager that allows you to d0 free text search across both documents and domain objects. The client isn't exposed to the details of the search and as a result the complexities of the domain/documents are hidden.

The technology stack I am using to do is as follows:

Java 6
Lucene 2.4
Hibernate Search
Hibernate Annotations
Spring 2.5
Spring MVC (I've had enough of Struts 2, the support from Struts mailing sucks!)

It's been fun working on this in my spare time. Last christmas I was sitting on the sofa (kids and wife asleep) thinking about search (as you do...) and thought it would be really cool to have one search api that would delegate the work of searching documents and domain objects. The manager would return summary objects which meant other search components could be added to the search manager.

The design looks like this:















The Search Manager has the following as the API:

SearchResponse search (SearchRequest searchRequest).

A simple method with a simple parameter object (SearchRequest). Now folks I want to emphasis that the SearchRequest is not a command object it is a parameter object which encapsulate properties that will be used to do the search. It's amazing how many silly command objects I am seeing at work and other places now a days. It's the return of the form beans (aaahh!!!).

Anyway...so where am I with the project. Well I have got full document indexing and search working using native Lucene. I have also completed domain search component using Hibernate Search. The final glue code the search manager is also completed. The search manager uses a SearchCollector class which collects all search components (classes that implement the Search interface). I want to use OSGi to dynamically load/unload search components at runtime. I have downloaded Spring DM server.

The search manager takes the collection of searchers and creates a Executor service and submits callable jobs to execute the search1es. The final results are collected and added to the SearchResponse which is returned to the client.

Some resources that I have used are:

Lucene in Action
Hibernate Search In Action
Spring Recipes
Java Persistence with Hibernate
AspectJ in Action

On a side note I just want to mention that the Lucene community have been absolutely great at helping me with loads of stuff (search code validation, highlighting summary, etc). If you are thinking of looking at Lucene then remember the mailing list is your friend.

I am going to modify my tests and project structure and then I will upload the project to Google. Andy, I know you want me to put the code as soon as I can but I would like to put the project on Google as a self contained project with no external dependencies. So people can check it out and run the tests easily. It won't be long.

I'd be happy to provide more information about this if people are interested. Unfortunately I've got to sign off. So as per usual please free to leave any comments. I know this post seems rushed but I'll had some code samples from my project soon.

Cheers
Amin