Monday, February 22, 2010

Generate Maven2 Archetype from existing project

It's not hard to create custom archetype in Maven 2.2 from existing project. I had multi-module .ear Maven project which I want to reuse. So, I decided to play a little with custom archetypes to create my own and don't repeat myself again and again. Fixing dependencies manually - is not the best way to spend lifetime :)

To jumpstart archetype creaton there is a special maven goal of archetype plugin archetype:create-from-project. So,

mvn clean archetype:create-from-project
Now we have prototype of our archetype in target\generated-sources\archetype\ directory.

cd target\generated-sources\archetype\
mvn install
Friendly speaking, I had to do some tweaking to successfully generate normal .ear Maven 2 project which can be compiled and run without problems. It was fixing some of dependencies at Logic and EAR modules, bit it was not hard - just specifying ${groupId} where necessary. To use this archetype after "mvn install" just type

mvn archetype:generate
and choose EnterpriseApp-archetype from the list. It will looks like....
2: local -> EnterpriseApp-archetype (EnterpriseApp-archetype)
in the list.

Source code is here :

To build it use
svn co

mvn install
You'll need to specify your jboss home location at parent pom.xml file to use cargo-jboss deployment. In my case it is


If you have any comments/issues/suggestions give me to know.

Tuesday, January 19, 2010

Quartz Scheduler uptime

My RIA application I've mentioned before seems to be working. One week (7 days) without any failure or restart. The interesting part is the number of jobs executed by scheduler. At the moment of writing it's 584,038. It's because job being executed every second. Take a look here:

Actually, it's output of org.quartz.Scheduler.getMetaData().getSummary();

Tuesday, January 12, 2010

Adobe Flex and Java with data push live example

Today I want to present to your attention my Adobe Flex 3 + Java rich internet application. auth: user/user. Under "user" account you'll not able to control scheduler behavior - start and stop. Declarative, role-based method-level security using Spring Security rocks ! :)

I have to say few words about what my RIA actually can do. It could be useful for live JVM memory monitoring and visualization. Or maybe not... Anyway, this is my playground. In the future, source of data for visualization could be anything else. I suppose that approach will remain the same.

I have a Quartz scheduler which is asking for a memory state every 1 sec. Then this data goes to Flex using data push. To view live chart click on menu Live data> Subscribe. BlazeDS is responsible for Flex-Java interaction. I have to admit that it's pleasant to work with Spring-Flex integration. So, if you using Flex and and Spring together - try Spring BlazeDS integration !

You can make a screen shot of current state of free memory chart or go full screen. You can change a number of frames to show on live chart. It was not very hard to implement. I've spent much more time to implement "make snapshot" functionality. The idea is to record memory state every 5 seconds for later analysis. Well, I can add cron job to Quartz scheduler dynamically, but there is no notification functionality for managing "ready state" or "still in progress". I'll implement it later... I have some ideas. So, adding a job to scheduler works and this job can successfully write data to database for later reuse or export. Hibernate is used here. Maybe to heavyweight, but nobody stops me to implement new service implementation using JDBC. Spring and DI should work here. Work on ability to store different snapshots in right way is still in progress. At this moment every data from any request for snapshot goes into the same database table. It's alpha... User registration is also under development. Don't try to register yet, just use credentials I've mentioned before - user/user.

If you have any issues with this application give me a sign, please. Any comments or emails with suggestions or improvements are welcome ! It's early alpha and there is a lot of work to be done to make it looking nice and shiny. So, I hope for your feedback. Maybe I'll share the sources. Thanks !

Thursday, January 07, 2010

My Twitter

Yep, I'm started. Here it is - Lets see WTF it is... if so many people using it, there is should be something I've missed before.