December 11, 2007

November 14, 2007

Iterations for SOA

SOA platform migration plan.

Resolve Dependency Among Applications

If you are planing to move your old applications to a SOA platform for all its benefits. You should resolve the dependency and the relation between applications. Any direct database/file/library access should be clearly defined.

Write Clear Interfaces to Connect Applications(WS)

Refactor your applications and extract interfaces that will be used among applications. You can easy export those interfaces with your app server or use XFIRE for easy wsdl and webs ervices.
This steps also includes java/XML binds XSD/WSDL definetions.

Generate notifications for external Listener(JMS)
to bind listeners, applications should trigger event via JMS. you can create Queues for any third party implementations.

Extract Process form code base to a BPM engine
define your process add flow via a visiual BPM/BPEL editor add run your process on the machine

September 28, 2007

moving to my notebook :)

Yesterday I got my notebook and today I am busy with it:)
or let's say enjoying it:)

nice notebook pretty notebook I'll format you delete all files, I'll setup lot of project nice notebook pretty notebook

And As you can guess I will be whole week event :)

what I have done up to now

jdk 6u2
idea 6.0.6
maven 2.0.7
postgres 8.2

and checkout my projects to test the performance :)

July 3, 2007

Multi-Tier Clusters

Today most of projects are build upon a composite structure that has multiple different APIs. Since many of them is unaware of the others and has its of implementation and dependency , every one of them should be have its own configuration which will make them work as a single application.

This is the hard point in fact "To bundle them in single application"

An Example:

in a sample medium size application like AppFuse would be using Hibernate/JPA, Acegi,SpringFramework,JasperReports, JSF, Tomcat/Jetty and so on. it is all good even perfect when you are run in a single JVM. but if you want to build a cluster for only a load balancing you should configure every one by one.

In other world you be building a multi tier cluster for each APIs , which would be harder rhan implemation for some old fashioned singleton type application (a type of application which has lots of static variable and caches)

your applcation would be looking like this.

what should be your success criteria

performance : cluster should not slow down the application in a critical point
transaction: any rollback should be noticed
failover: in case of any instance fail over any other one can replace it.
seamless: the cluster mode should be seamless. should be hidden behind proper interfaces

today most open and commercial API support clusters. but in most cases you would implement a yous own schema for your own needs . before start you should read some articles about "Distributed Application" , you can use any distributable caching, maps, or JMS bridges between your components

June 13, 2007

Clustering Acegi via JGroups (DistributedHashtable)

moved my blog to
please click to continue

May 28, 2007

May 7, 2007

Rapid Java : Part I (Platform)

For rapid and non-painful development and products here's some java libraries (startup dependencies)  I choose from bottom to top:

Module I: Core
  • postgresql / mysql / hsql depends on project's size if you don't large size of startup data try to use hsql
  • log4j : logging (alternative commons-logging)
  • hibernate: Simple and high quality open source ORM (alternative:)
  • springframework:  high quality IoC container and very good integration library (a framework to rule them all)
  • quartz: scheduled task
  • osworkflow: Simple workflow and state engine, to manage actions and states
  • velocity: simple and useful template engine for formatted text/html/csv outputs (alternative freemarker)
  • beanshell for providing business point (alternative groovy)
  • acegi: Authentication and authorization
Module II : Report
  • jfreechart:for impressive charts
  • jasperreport: for pdf reports
  • mondrian: for BI
  • jxls: for excel reports
Module III: Web Layer
  • Struts : here, you have lots of choice from popular jsf to tapestry,spring mvc, I choose struts because of two reason simple life cycle and it is action based current I am STILL using struts  1.2.x  but I will move to Struts2
  • Prototype.js  standard js for web 2.0
  • very useful js lib for effects and more
  • DWR for extra js calls from client browser to your java codes
  • displaytag: very useful jsp taglib
  • jstl: standard jsp taglib
  • tomcat/jetty: choose one that you are familiar

It looks so complex at first sight and I'm sure it could be so painful to you but where All become one you would have quite clear Framework. 
for how to integrate them look at appfuse.

What is missing?
 your  application specs you can need JMS (eg: activemq)  ,networking (eg:jgroups) libs 

April 30, 2007

"Too many open files" but what are they? /opt/tb55/s3/conf/web.xml (Too many open files) at Method) at<init>(
this shows the open file limit has been reached.. you can check this by JMX
java.lang:type=OperatingSystem >  OpenFileDescriptorCount

but what are these files ? you can see this by linux shell script

lsof -u tomcat

solution: increase systems open file limit !!!

vi /etc/security/limits.conf

and edit the line to increase open file limit

* soft nofile 3072
* hard nofile 4048

April 12, 2007

Clustering Acegi

Acegi is a well known security framework. Some really good features:
  • method level based security configuration
  • url level auth configuration
  • easy login mechanism
  • so on.
But there only one point that is missing in current version (1.0.3) distributable SessionRegistry, in fact there is one implemantion to this interface but it do not support multiple JVM.This is used for concurrent access with username.

Quick Fix:
replace the Maps in SessionRegistryImpl with your distributable caching mechanism (can be ehcache,oscache,vs) and reimplement it. Or you can use some JMS mechanism to fix this cap but it should be used only in complex architectures.

Acegi Concurrent Setup:

<bean id=" org.acegisecurity.concurrent.SessionRegistry" class="org.acegisecurity.concurrent.SessionRegistryImpl"/> <bean id="org.acegisecurity.concurrent.ConcurrentSessionController" class="org.acegisecurity.concurrent.ConcurrentSessionControllerImpl"> <property name="maximumSessions"> <value>1</value> </property> <property name="sessionRegistry"> <ref local="org.acegisecurity.concurrent.SessionRegistry"/> </property> <property name="sessionRegistry" ref="org.acegisecurity.concurrent.SessionRegistry"/> </bean> <bean id="org.acegisecurity.AuthenticationManager" class="org.acegisecurity.providers.ProviderManager "> <property name="providers"> <list> <ref local="org.acegisecurity.providers.dao.DaoAuthenticationProvider"/> <ref local="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider"/> </list> </property> <property name="sessionController" ref="org.acegisecurity.concurrent.ConcurrentSessionController "/> </bean> <bean id="org.acegisecurity.concurrent.ConcurrentSessionFilter" class="org.acegisecurity.concurrent.ConcurrentSessionFilter "> <property name="sessionRegistry" ref="org.acegisecurity.concurrent.SessionRegistry"/> <property name="expiredUrl" value="/myself/"/> </bean>

And add org.acegisecurity.concurrent.ConcurrentSessionFilter to your filter list

check my new blog Clustering Acegi via JGroups (DistributedHashtable)

April 11, 2007

when do not generate code !

     Currently code generation is very common way of some handling common repeating code fragments and some initial setup task like startup configurations and so on. Some clear benefits are:
  • ease your setup process
  • protects your code form some common coding mistakes
  • maintain some coding pattern practices and standards.
  • keep your effort on complex tasks
But on the other hand when you evaluate code generator or while writing your code should thing about " why you generate this code ? and not writing some generic component to evolute such business"
 this is the most common mistake while using this technology. you generate code to customize the generated code. If you not need this fragment to customization. DO NOT GENERATE IT. otherwise in most case any enhancement in these fragments will require great effort or worse (to generate again).

so what is important.
  • more less code generated more perfect it is
  • more easily you customize it more useful it is
Some code generators:

March 26, 2007

URI Encoding for tomcat 5.5.X

encoding problem with paramater while GET ?

for tomcat 5.5.x

<Server ...> <Service ...> <Connector ... URIEncoding="UTF-8" /> ... </Connector> </Service> </Server>

March 25, 2007

moved to postgres

I change my development database to postgres SQL for a several reasons :
  • I'am bored to mysql :)
  • mysql do not give me entreprise database trust: looks so simple even too simple to offer to my customers. it suites for less complicated fast application.
  • Last but most important reason it its Licensing !!!
Since I am very new to postgres I am playing with it. looking for new features and trying to solve compatibility problems :(

One good referance for people like me :

since I am using hibernate and so on no development required for this migration...