Tuesday, July 24, 2012

Use of PortalClassInvoker in Liferay-Portlet...

Some times we need to use portal-impl classes functionality,but we can't access that in our custom portlet. Hence,we require to PortalClassInvoker class.

for example : we need to access PortalLDAPUtil.getLdapServerId()(method for get LDAP ServerId) in our costum portlet and it's there in portal-impl ,so access is the issue. For that , we use PortalClassInvoker.invoke() (This method have many forms) with MethodKey.

Following are steps to use PortalClassInvoker.invoke() method to access utility of portal-impl class PortalLDAPUtil.

1) Initialize MethodKey object.
   
    Syntax : MethodKey portalLDAPUtilMethodKey = new MethodKey("classNameWithPackagePath", "methodName",argClassType1,argClassType2......);
   
    Example : MethodKey portalLDAPUtilMethodKey = new MethodKey("com.liferay.portal.security.ldap.PortalLDAPUtil", "getLdapServerId",Long.class,String.class);
   
2) Use PortalClassInvoker.invoke() to access portal-impl classes using MethodKey.
    Syntax : PortalClassInvoker.invoke(newInstance, methodKey, argumentList);
   
    Example : Long ldapServerId = (Long) PortalClassInvoker.invoke(false, portalLDAPUtilMethodKey, new Object[] {Long.valueOf(themeDisplay.getCompanyId()),screenName});
here screenName is ldap user screenName. i.e. “ketan.savaliya”.

Thursday, July 19, 2012

Deployment/ReDeployment ext in liferay


I assume that you have WAR file ready for deployment and name of ext is abc-ext.war.

1          1.       First of all, shutdown your tomcat if it's already running and delete your work and temp folder.
2          2.       Now go to \tomcat\lib\ext folder , and remove ext-abc-ext-service.jar.
3          3.       Go inside webapps, and remove the abc-ext.
4          4.       Go inside webapps\ROOT\WEB-INF and remove
·         liferay-display-ext.xml
·         ext-abc-ext.xml
·         liferay-portlet-ext.xml
·         portlet-ext.xml,
   5.     Go inside webapps\ROOT\WEB-INF\lib and delete
·         ext-abc-ext-impl.jar,
·         ext-abc-ext-util-bridges.jar,
·         ext-abc-ext-util-java.jar
·         ext-abc-ext-util-taglib.jar.

    Start the tomcat.
    Put WAR file inside hot deploy folder and wait till it expends and give message to reboot your server.
    Restart tomcat and its done.

SVN with eclipse configuration in Windows





To configure svn in eclipse for windows, we need to process below steps...

1) Install svn plugins in eclipse

    Go to : Help Menu->eclipse marketplace...->Popular(tab)
    install below two plugins one after other
        I) Subeclipse
        II)Subversive - SVN Team Provider

2) After that restart eclipse

3) Now go to SVN Repositories window for useing svn repository.

That's it. enjoy :))