Tuesday, October 12, 2010

Hibernate Validator

This is an alternative to the spring validation framework. The difference is , spring validation framework is mainly for validating the forms at the web layer. Hibernate validator can be used to validate the bean at any of the layers e.g. web, business, data etc. Here is the tutorial on how to use it. Hibernate valuators are annotation based so only java 5 onwards its supported.
http://wheelersoftware.com/articles/hibernate-validator.html

Asynchronous method invocation

Its in Java EE 6. Its in EJB 3.1. Caller does not wait for the called object to return , that is the method invocation happens in asynchronous mode.
http://en.wikipedia.org/wiki/Asynchronous_method_invocation?wwparam=1284477244

Volatile

A variable which is declared as volatile will have its up to date value published to all the threads which are accessing it. Reading the volatile variable is less performance intensive as compared to writing to it.
http://www.ibm.com/developerworks/java/library/j-jtp06197.html?wwparam=1284476923

Java concurrency

This is introduced in java 5 and like collections util, there is concurrency utilities. The variables declared are atomic. This is mainly used in concurrent thread execution, background processing etc.

http://www.books24x7.com/book/id_12090/viewer.asp?bookid=12090&chunkid=656179286

Hessian and Burlap

These are the binary and xml protocols for webservices. Its mainly used by the mobile applications. The web application needs to implement hessian sevlet interface to make this type of webservice available.

http://hessian.caucho.com/?wwparam=1284415435


http://caucho.com/resin-3.1/examples/burlap-add/index.xtp

RESTful webservices

http://en.wikipedia.org/wiki/Representational_state_trasfer

Friday, May 11, 2007

rules implementation

9 May 2007
While calling the unmarshall method in jaxb it takes FileInputStream, File, etc.
If we give anything other than File then internally a field called system identifier remains null. And when this is null it throws a warning saying [WARNING]: URI was not reported to parser for entity [document]. To avoid this warning use File while unmarshlling.
9 May 2007
The Drool or JBOSS rules is a rule engine. We have used it in our application to get the dispositions that are performed on the task. I pass the task details to the rule engine, and the rule file to be executed, the rule engine in response returns the exact disposition by executing the rule that is specified in the rule file.
e.g.


package com.application.swa.rules;
import com.application.swa.bean.InboxDetailsBean;
rule "AutoLoan_Submit_SM"
no-loop true
when
m : InboxDetailsBean(taskStepId == 1)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Submit_SM");
end
#step 1 end
rule "AutoLoan_Prequal_False"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_False");
end
rule "AutoLoan_Prequal_True_RuleMet_True"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_True_RuleMet_True");
end
rule "AutoLoan_Prequal_True_RuleMet_False"
no-loop true
when
m : InboxDetailsBean(taskStepId == 2)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Prequal_True_RuleMet_False");
end
#step 2 end
rule "AutoLoan_Approval_False_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 3)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_False_LO");
end
rule "AutoLoan_Approval_True_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 3)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_True_LO");
end
#step 3 end
rule "AutoLoan_Approval_False_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 4)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_False_App");
end
rule "AutoLoan_Approval_True_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 4)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_Approval_True_App");
end
#step 4 end
rule "AutoLoan_End_LO"
no-loop true
when
m : InboxDetailsBean(taskStepId == 5)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_LO");
end
#step 5 end
rule "AutoLoan_End_App"
no-loop true
when
m : InboxDetailsBean(taskStepId == 6)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_App");
end
#step 6 end
rule "AutoLoan_End_SM"
no-loop true
when
m : InboxDetailsBean(taskStepId == 7)
then
System.out.println( " The loan amount is not big enough " + m.getField_4_data());
m.setDipositionName("AutoLoan_End_SM");
end
#step 7 end


The jboss rule uses rete algorithm to execute rules.

I am writing the rule file GUI editor.

Another implementation of rules can be in the Skill based allocation.