Wednesday, November 23, 2011

Good Java Utils

If you want to map Object (Domain object) to Object  (Transfer Object) use dozer mapping (http://dozer.sourceforge.net/ , Object Mapping Example again - http://developers-blog.org/blog/default/2010/04/11/Java-Object-Mapping-Dozer-Example)

If the attribute name and data-type is same in both the objects  you should be good with below code. If you have different attributes create MapId and declare a class and b class and the map name and pass the mapId to the map method.

import org.dozer.Mapper;

salesOrderExportTemplateTO = mapper.map(template, SalesOrderExportTemplateTO.class);
---------------------------------------------------------------------
Simple Logging Facade for Java (SLF4J) 
(http://slf4j.org/, Check out Example in : http://slf4j.org/manual.html)
The Simple Logging Facade for Java or (SLF4J) serves as a simple facade or abstraction for various logging frameworks, e.g. java.util.logging, log4j and logback, allowing the end-user to plug in the desired logging framework at deployment time. Note that SLF4J-enabling your library/application implies the addition of only a single mandatory dependency, namely slf4j-api-1.6.4.jar. If no binding is found on the class path, then SLF4J will default to a no-operation implementation.

Its a Wrapped Implementation of : AVSL, A Very Simple Logger, Class JDK14LoggerAdapter, Class Log4jLoggerAdapter,Class SimpleLogger


EhCache : (http://ehcache.org/http://eiconsulting.blogspot.com/2011/10/ehcache-implementation-in-spring.html)
Ehcache is a cache library introduced in October 2003 with the key goal of improving performance by reducing the load on underlying resources. Ehcache is not just for general-purpose caching, however, but also for caching Hibernate (second-level cache), data access objects, security credentials, web pages. It can also be used for SOAP and RESTful server caching, application persistence, and distributed caching.


This link contains sample code to fetch data from CacheManager, Cache and from element http://ehcache.org/documentation/recipes

Mock Objects for Unit Testing : http://easymock.org/EasyMock3_1_Documentation.html -
In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways. A programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.



Hadoop
http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/


 Apache Lucene  Vs  Apache Solr (http://www.lucenetutorial.com/lucene-in-5-minutes.html, http://www.ibm.com/developerworks/java/library/os-apache-lucenesearch/index.html)
Lucene is a search library built in Java. Solr is a web application built on top of Lucene. Certainly Solr = Lucene + Added features. Often there would a question, when to choose Solr and when to choose Lucene. (Lucene is a engine, solr is a car) (If there's the need to embed search functionality into your own application (like a desktop application for example), Lucene is the more appropriate choice.)


jhat - Java Heap Analysis Tool
jconsole - Java Monitoring and Management Console


Performance Monitoring Tool : 

jvisualvm - /usr/lib/jvm/java-6-sun/bin/jvisualvm . This tool exist in jdk itself. You can create a symlink in /usr/bin directory on linux.
a. cd /usr/bin
b. sudo ln -s /usr/lib/jvm/java-6-sun/bin/jvisualvm ./jvisualvm


SuperCSV - http://supercsv.sourceforge.net/codeExamples_general.html (Reading CSV data into Domain Objects / Bean Objects)

No comments :

// Below script tag for SyntaxHighLighter