Skip to main content

Posts

Showing posts from April, 2011

Enterprise Application's Logical Layers and where to manage Transactions

Recently I came across an application which manage transaction's at Dao layer that means there is no proper transaction management and if an exception occurs during runtime will leave inappropriate data in database. Consider this simple Architectural layers Brief description of each block starting from the bottom. DB1 .. DBn → Databases, an application sometimes refers to multiple databases and simple application has one. Dao Layer →  Encapsulates logic to add, update, delete and read data from Databases using JPA, Hibernate or JDBC. Entity/Dto → Simple Pojo classes which encapsulate database entities WebServices Client → Another Integration Layers like Dao which communicates with other systems via SOAP, JMS etc. Service Layer → This layer contains business logic which encapsulate the data (Dao & Webservices client) they operate on and provide hardened interfaces as the only way to access their functionality. This approach reduces side effects and allows

Reverse Engineer UML from Maven project

I am a Netbeans user and after they discontinued UML plugin I started looking at other options which will work with my Maven projects and found this open source tool UMLGraph which does a good job but only lacks in proper documentation. Good thing about this tool is, It works as a Maven plugin so all my UML gets automatically updated with any changes to code. Setup is very straight forward and takes less then a minute. Step 1 Install   Graphviz     Is an open source graph visualization software.    Note : Only install in a non-space directory (i.e "Program Files" won't work)    Website :  http://www.graphviz.org/    Download link :  Windows download Step 2     http://www.umlgraph.org/  Is the Maven plugin which does the job        Setup UMLGraph plugin to your pom.xml      <project>    ..      <build>         <plugins>             <plugin>                 <groupId>org.apache.maven.plugins</groupId>             

Simple Reverse Lookup Enum in Java

Documentation inline with the code. import java.util.EnumSet; import java.util.HashMap; import java.util.Map; /**  *  * @author Intesar Mohammed  *  *  Reverse Enum Lookup example using Map and EnumSet  */ public enum Status {      WAITING(0),     READY(1),     SKIPPED(-1),     COMPLETED(5);        /**     *    code or your required variable can be of any type     */       private int code;     private Status(int code) {         this.code = code;     }        private static final Map<Integer, Status> lookup =                    new HashMap<Integer, Status>();        /**      * Stores all Enum's into lookup      */      static {         for (Status s : EnumSet.allOf(Status.class)) {             lookup.put(s.code, s);         }     }     /**      *      * toString() is the only api to print Enum value      * All Enum classes can consistently override toString() and provide a simple api      * across different Enums      *

Why Gmail Motion and why not Gmail Speech ?

Why the heck I will use my body to interact with the Gmail rather I prefer speech to do basic operations like. Speech command which triggers Gmail to Read a particular email. Gmail  converting my speech to text and sending as email Search using speech commands etc I can hook a simple bluetooth headset and be connected to my Gmail. Also this will be handy on my touch pads and phones etc. And I don't think people will be using this regularly rather they will use it for fun few times and a total waste of time. Learning body language for one particular Application doesn't work out for me.  Incase if you don't know what is Gmail Motion Gmail Motion