Liferay Hook Plugin Support | Netbeans Portal Pack 3.0.2
General Blogs 22 de Março de 2009 Por Santh Chetan Chadalavada
Portal Pack makes life easier yet again !!. This time with the NetBeans Hook Plugin for Liferay.
Available @ Netbeans PortalPack 3.0.2
on Liferay Hook checkout the Portal Hook Plugins Wiki
This new feature will help creating different kinds of hooks supported by Liferay Portal. Lets look each type of hook and how we can create them using Netbeans Portal Pack plugin.
- Event Type Hook : Liferay provides different kind of event type hooks and Portal Pack now supports all the different kinds of event hooks. For example, add a post login hook to do your custom stuff after each user login.
- Create a web project:
- In Server and Settings choose Liferay Portal Server 5.2.2 and click on Finish the create the project.
- Right click on the project. In Categories Select WebSpace/Liferay Plugins -> Hook Plugin.
- Click On Next. From the Hooks Wizard top dropdown choose Event Handler Hook.
- Provide ClassName and Package. Choose the Event Type from the bottom drop down and click Finish.
- liferay-hook.xml, portal.properties, Event class files will be generated with the provided information.You can edit the java file put some code and save.
- Right click on the project and select Deploy.
- Model Listener Hook : Using this hooks, you can do specific tasks whenever there is any CRUD operation in a specific model.
- Right click on the project-> Select Hook Plugin -> Choose Model Listeners Hook.
- Choose the model by Clicking on Search.
- Click Finish. Modify the code generated by Portal Pack Plugin, save it, Right click on the project and deploy.
- Jsp Hook : Using this hook, user can customize the core portal jsps/portlet in a decoupled manner without touching the core. For example, you can change the look and feel of the blog portlet in your hook application. And once you undeploy the hook application, the customization will go away. The Portal Pack provides wizard to create jsp hooks where user can select the core portal components which he/she wants to customize and the required files will be automatically imported to the hooks application. This feature can be used by SI for the portal customization.
- From the Hook Plugin Wizard choose the Jsp Hook from the drop down. Liferay Core jsp root folder(html) will be populated in the left pane.
- Once clicked on Finish, folder structure will be created under the default custom jsp directory "/WEB-INF/jsp".
- Portal.properties Hook : You can override certain portal.properties through your hooks application.
- Select the Properties Hook from the drop down on a Clean Web Project(Which does not have a hook created to it).
- portal.properties will be create with commented pre entires supported to be overriden.
All the deployed hook plugins can be undeployed from Netbeans -> Services -> Liferay Server -> Global -> Hooks.
Right Click on the Hook Plugin and selecting Undeploy will undeploy it from the Portal Server.