Wednesday, 30 April 2014

Liferay : How to apply patch in Lifeary?

Hi there,

This very common requirement when we need to install Liferay patch to our server, usually Lifeary team is provide steps along with patch but in case if you don't have it you can follow below mentioned steps.

Following are the steps for install patch in Liferay, Please go through it step by steps.

Here PATCHING_TOOL_HOME = Path to the “patching-tool” directory in your tomcat.

How to do it ?
  • Stop Tomcat.
  • Place the patch(.zip file) in the PATCHING_TOOL_HOME/patches/ directory.
  • Open command prompt.
  • Go to PATCHING_TOOL_HOME directory.
  • Give command “patching-tool auto-discovery” for Windows and “./patching-tool.sh auto-discovery” for Linux.
  • Check that default.properties file will be created in PATCHING_TOOL_HOME
    directory.
  • Give command “patching-tool install” for Windows and “./patching-tool.sh install” for Linux.
  • Patches will be installed successfully and you will get appropriate message for that.
  • Give command “patching-tool info” for Windows and “./patching-tool info” for Linux to know installed patches.
  • Start Tomcat.

Note:- 
For each patch you should have proper patching-tool version otherwise you might face error like
"The 'hotfix-440' patch's patching tool version number is higher than the patching tool version number: 2 > 1"

Where you get it ?

  • Login with authorized person credential in lifreray.com
  • Go to Places(right corner) > Customer portal > Downloads > Liferay Portal > All Downloads(Patches) > Select version + All patches in Filter type and download appropriate patching-tool zip.
Hope this help.

Thanks,
Sagar Vyas


Friday, 25 April 2014

Spring : First step in Spring Framewrok

Hello Friends,

This blog help us to understand basic feature and may give you an answer of question “Why I should use Spring framework in my development?”.

History: Friends when you start learning any new thing, I would say start with the history and purpose of it.
  • Rod Johnson is father of this framework,He has realised on June 2003.
  • V 1.0 in March 2004
  • V 2.0 in October 2006
  • V 3.0 in December 2009
  • V 4.0 in December 2013
I am presenting a Fantastic Four reasons/features with brief understanding of Spring framework.

1. Dependency injection or Inversion of Control.[ICO and DI]  
"Don't worry about create an instance just ask me whenever you require it,another words It says do not need to create an object of a class into another class."
  Ex.
          class A {
             function()
               {
                 B bObj = New B();
              }
            }
  • Class A is completely depend on Class B : Modification of Class B may force you to modify Class A.
    Ex. Change in name of methods or class name itself.
  • This is a simple example but in real time it may me much more complex then it looks.
  • To overcome with this problem,Spring came up with Dependency injection, with help of Spring-config.xml you can easily and effectively resolve this problem.

2.Aspect Oriented Programming :[AOP]
"It says do not mix business logic with non-business logic"
      Ex.
                      class FindNumber {
                          // logger
                               try{
                                   function callMe(a,b,c)
                                    {
                                       return a*b+c;
                                    }
                                   }
                               catch(Exception e)
                                  {
                                     //logger.error
                                  }
                                  //logger.info

                               }
    • Main purpose of this class is to find a number, but you can see there are lot of other things surrounding it, like logger, Exception handling etc..
    • We are simply mixing two things. [Functional + Non functional], we may increase our difficulty to mange our class in future.
    • It's not only logger we used to mix with our program but in real time there will be more like transaction management, cashing management etc and We will end up with a very confusing class which has plenty of line containing Non-functional as well functional. 
    • AOP help us to overcome this problem which provides the solution which help us to keep non functional things out side the class.
    3.Data access [JDBC,ORM,OXM,JMS,Transaction management]
    • Spring JDBC : If you are using Spring JDBC then you do not need to panic about following code.
             - Opening and Closing database connection.
             - Any exception handling code.
             - Prepare and execute statement and result set.
    • Spring ORM : [Spring Object Relational Mapping]

        - Provide full API support to integrate ORM tool like Hibernate, JPA etc.

    • Spring OXM :
            - Converting Java Object to XML and Vice Versa.
            - Fully support to integrate with JAXB, Castor etc..
    • Spring JMS: Java Message Services.
            -Provide support to produce and consume message.

    • Spring Transaction Management.
          - The Spring Framework provides both declarative and           programmatic transaction management. Most users prefer       declarative transaction management, which is                 recommended in most cases.
          - You write your code once, and it can benefit from             different transaction management strategies in               different environments.
    4.Spring MVC
          - Provide Complete MVC structure, Highly recommended in         web designing and development.
          - The Spring Web model-view-controller (MVC) framework         is designed around a DispatcherServlet that dispatches       requests to handlers, with configurable handler               mappings    
          - The default handler is based on the @Controller and          @RequestMapping annotations, offering a wide range of         flexible handling methods.




      Hope this will help you guys to understand spring at first look.

      Let me know in case of any questions/queries.

    Thanks,
    Sagar Vyas