Thursday, June 07, 2012

Liferay Tomcat Performance

Motive

To get performance improvement in terms of time taken by liferay tomcat to start.

Solution

Tomcat's core libraries are available in Java Byte code normally. Apache Tomcat Native Library is a Java Native Interface that provide most of the core functionality in native code. Using these libraries only mean one thing to you and i.e. SPEED.
 For Windows
  1. Download http://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.1.15/binaries/win64/x64/
  2. Copy tcnative-1-ip4.dll to %TOMCAT_HOME%/bin
  3. Restart Tomcat and check the tomcat startup performance.




Tuesday, May 15, 2012

Liferay: Working with model listeners

What 

Model Listener - as the name specifies that there is some class that in continuously looking to a entity model in liferay. More technically its a call back class which is called when some operation happens on the model (operation can be add/edit/delete).

Model Listener

public interface ModelListener<T> {
 public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK) throws ModelListenerException;

public void onAfterCreate(T model) throws ModelListenerException;

public void onAfterRemove(T model) throws ModelListenerException;

public void onAfterRemoveAssociation(Object classPK, String associationClassName,  Object associationClassPK) throws ModelListenerException;

public void onAfterUpdate(T model) throws ModelListenerException;

public void onBeforeAddAssociation(Object classPK, String associationClassName, Object associationClassPK) throws ModelListenerException;

public void onBeforeCreate(T model) throws ModelListenerException;

public void onBeforeRemove(T model) throws ModelListenerException;

public void onBeforeRemoveAssociation(Object classPK, String associationClassName, Object associationClassPK) throws ModelListenerException;

public void onBeforeUpdate(T model) throws ModelListenerException;
}
 

How

To implement own listener on some Model (for example User) yin your portlet you need:
<hook>
 <portal-properties>portal.properties</portal-properties>
</hook>
 
Make an entry in file WEB-INF/src/portal.properties to define hook for specific model:
value.object.listener.com.liferay.portal.model.User=my.hook.UserListener 

Implement class by inheriting it from BaseModelListener<T> in our case BaseModelListener<User> and implementing only
  method we want to call-back:

    public class GroupListener extends BaseModelListener<Group> {
@Override public void    onAfterUpdate(User u) throws ModelListenerException { // do something here } }



Rounded



Use firebug and check the style of this below black background to get the css for making corners rounded.
 
 

Thursday, March 29, 2012

End of Version Announcement for Liferay 5.2 EE

On February 29, 2012, Liferay announces the End of Version for Liferay 5.2 EE. The last date to order Liferay 5.2 EE (Last Ship Date) is May 31, 2012.

For more details see the original post

Saturday, August 20, 2011

Liferay >>> open Liferay popup in web content

This post is about the solution to the problem i faced in liferay where i need to open one or more Liferay styled modal popups from web content portlet or similarly from any other portlet. In my case the popup i need to open is that of feedback from user. The steps i took to get it working are:

  1. To start with add an anchor tag in the web content portlet on which you want to open up a feedback popup
    <a id="" class="feedback_popup"> Submit Feedback</a>

  2. Now you need to go to the theme/javascript folder and edit javascript.js file. Add to it the code

    jQuery(document).ready(
    function() {
    th_FeedbackPopup()
    }
    );

    function th_FeedbackPopup() {
    jQuery(document).find("a.feedback_popup").click(function() {
    var url = new Liferay.PortletURL.createRenderURL();
    url.setPortletId("FEEDBACK_1");
    url.setWindowState("exclusive");
    url.setPortletMode("view");
    url.setParameter("struts_action", "/ext/feedvack/view");
    var popup = Liferay.Popup({
    draggable:false,
    width:500,
    height:'auto',
    url:url.toString(),
    resizable:false,
    modal:true,
    title:'Submit Feedback',
    position:[250,20]
    });
    });
    }
    The idea behing javascript is to bind the click event of all anchor elements on page having class "feedback_popup" to open a modal popup. Make sure that you should bind the event based on class name and not on element id as a page can have multiple such elements.