Wednesday, 24 July 2013

HOOKS PlugIn

Hooks is a feature to catch hold of the properties and JSP files into an instance of the portal as if catching them with a hook. Hook plugins are more powerful plugins that come to complement portlets, themes, layout templates, and web modules. A hook plugin is always combined with a portlet plugin. For instance, the portlet so-portlet is a portlet plugin for Social Office with hooks. In general, hooks would be very helpful tools to customize the portal without touching the code part of the portal. In addition, you would use hooks to provide patches for the portal systems or social office products.

Here  we  have  TWO  types  of   Enviornment.
1) EXT
2) HOOK

EXT  :
It   used to have its own SDK, now that it is also a plugIn. Ext is used only for huge modifications. 

Hook
Hook is a PlugIn and here plugin means whenever we want we can use and otherwise can undeploy.
Hooks  are  defined  in   liferay-hook.xml

Types of Hook
In general, there are four kinds of hook parameters: 
portal-properties (called portal properties hooks), 
language-properties (called language properties hooks), 
custom-jsp-dir (called custom JSPs hooks
service(calledportalservicehooks)as specified in $PORTAL_ROOT_HOME/dtd/liferay-hook_6_0_0.dtd.

<!ELEMENT hook (portal-properties?, language-properties*, custom-jsp-dir?, service*)>
<!ELEMENT portal-properties (#PCDATA)>
<!ELEMENT language-properties (#PCDATA)>
<!ELEMENT custom-jsp-dir (#PCDATA)>
<!ELEMENT service (service-type, service-impl)>
<!ELEMENT service-type (#PCDATA)>
<!ELEMENT service-impl (#PCDATA)>

As shown in the preceding code, the ordering of elements is significant in the DTD (Document Type Definition) - you need to have your portal properties (only one marked by ?), language properties (could be many marked by *), custom-jsp-dir (only one marked by ?) and service (could be many marked by *) declared in the same order.

In general, we sub-categorize into…

1.  Properties hook
2.  JSP hook
3.  Event hook
4.  Language hook
5.  Service
6.  Model-Listener


No comments:

Post a Comment