Liferay
offered different ways to extend and customize liferay portal.
Liferay have come up with mechanism called plugins to extend and
customize liferay portal.
Liferay
Plugin environment offers different types of plugins based on their
contextual use and what exactly they act upon liferay portal. One of
the Plugin type is HOOK.
In
general meaning of hook is a piece or item which can give additional
capability where we use it and it can easily add or removable item.
Liferay
hook plugins are is part of Liferay Plugins SDK so we can use Plugins
SDK to develop hook plugins. when we look into parent directory of
Plugins SDK you can see hooks directory there all created plugins are
resided
Liferay
Hook Plugin
Liferay
Hook Plugin is used to customize liferay portal. Hooks are hot
deployable plugins so when we modify we need not to restart server to apply changes in the portal.
We
can modify portal web resources such as JSP , JSPF, CSS, Java Scrip
files, Language properties files,some of portal properties,customize
actions, modify portal struts actions,portlet struts
actions,overriding portal services,create servlet filters and create
indexser post processors.
When
we create any hook Plugin we need to know one important file called
liferay-hook.xml configuration files.
Liferay-hook.xml
files consist set of predefined xml tags and there we will defined
all configuratiion so that portlet container modify the files
according to this file.
Liferay-hook.xml
tags and its description are available in liferay-hook_6_x_x.dtd
file.
The
main parent tags as below
<!ELEMENT
hook (portal-properties?, language-properties*, custom-jsp-dir?,
custom-jsp-global?,
indexer-post-processor*, service*, servlet-filter*,
servlet-filter-mapping*,
struts-action*)>
We
have following types of Hooks
JSP
Hooks
Application
Adopter Hooks
Custom
Action Hooks
Portal
Properties Hooks
Language
Properties Hooks
Struts
Action Hooks
Indexer
Post Processor Hooks
Portal
Service Hooks
Servlet
Filter Hooks
JSP
Hooks
When
ever we want modify the portal jsp pages or existed portlet JSP pages
then we will use JSP hooks.
Assume
we want add some new fields or write some new text in create account
JSP pages then we can do it from JSP hooks.
We
can create JSP hooks using Liferay IDE or we can use Command Line
Interface to create hooks.
Reference:
Application
Adopter Hooks
Application
adopter hooks are special types of JSP hooks and we can define scope
to the customization.
Generally
when we use JSP hooks then changes will be applicable to through out
the portal but we need a requirement the changes should be specific
to particular site or site template then we will use Application
Adopter Hooks.
Application
Adapters are used to Customizing Sites and Site Templates and the
changes are applicable to site level. They are used for overriding
JSPs.
Reference:
Custom
Action Hooks
Hooks
are useful for triggering custom actions on common portal events,
like user login or system startup. The actions for each of these
events are defined in portal.properties so we need to extend this
file to create a custom action. Hooks make this a simple task.
Reference:
Portal
Properties Hooks
Portal
properties hook overriding the existing portal properties and Portal
properties hook can modify the some of the portal properties not all
the portal properties. The modifiable list of properties are
specified in liferay-hook_6_x_x.dtd file.
If
the properties are not listen in the liferay-hook_6_x_x.dtd file then
we cannot modify it from portal properties hooks.Assume we want
to modify login.events.pre ,login.events.post properties then we will use
Portal Properties Hooks.
Reference:
Language
Properties Hooks
Language
Properties Hooks are used to overriding the existed portal language
properties.
We
can aslo add new properties and we can modify existing portal
properties lets we want change some properties French language
properties i.e. Language_fr.properties then we can create Language
Properties Hooks to make the changes.
Reference:
Struts
Action Hooks
Struts
Action Hooks are used to adding or overriding struts action Java
classes. We have portal struts actions and portlet struts actions.
Struts Action Hooks can modify the both struts actions.
Reference:
Indexer
Post Processor Hooks
Indexer
Post Processor Hooks can modify search summaries , indexes and
queries in the existed portal.
We
can create new Indexer post processor to create new search summaries
lets say if want perform search on all fields of User then we can do
it by Indexer Post Processor Hooks
Reference:
Portal
Service Hooks
portal service hooks
are used to modify the existed portal services. When we want
overriding the existed portal services then portal service hooks are
best choice. Lets say we want to modify the User services then we can
use portal service hooks.
Reference:
Servlet
Filter Hooks
Servlet
filter hook: Servlet filters allow you to pre-process requests going
to a servlet and post-process responses coming from a servlet. As
server requests are received that match URL patterns or match servlet
names specified in your servlet filter mappings, your specified
servlet filters are applied. Hook elements servlet-filter and
servlet-filter-mapping have been added to liferay-hook.xml so you can
configure your servlet filters.
Reference:
Important
Points
Liferay
Hook plugins are hot deployable so we can easy deploy and undeploy it
without restart servers the changes will be applied.
When
we want customize liferay portal hooks are best choice and if it not
possible form hook then only we should prefer some other choices like
ext plugins.
Hooks
plugins have xml configuration file liferay-hook.xml
and it consist of predefined tags and these tags information
available in liferay-hook_6_x_x.dtd there all tags
are defined and we should use specified tags.
Liferay
hook plugins are is part of Liferay Plugins SDK so we can use Plugins
SDK to develop hook plugins.
Author
I am developer. I am so thankful for this information. I get more learn from this. Similarly, I am try to solve your home interior and exteriors problems from providing the Pressure Washing Services in Knoxville TN. You can get more detail about it.
ReplyDeleteDo not take this subject matter lightly because it performs a decisive function in these exams. To put together well read NCERT books on History (Class 6-12), Geography (Class 6-12), Science (Class 6-10), Social Science (Class 6-10). Reading or extra newspapers together with Times of India, Hindustan Times, and The Hindu, day by day is mandatory. Do instruction preceding years’ check papers. Read in details topics like awards and their fields, Noble Prize winners, listing of Bharat Ratna Awardee, discoveries and innovations, countries foreign money and capital, list of critical days and dates, well-known countrywide parks and wild existence sanctuaries in India.
ReplyDeleteTamilNadu Govt Jobs
When packing for a move, sooner or later you’ll get to packing a few cables here and there in the residence. In maximum cases, the ones cables can be electricity cords of digital devices and electric household home equipment but you’ll additionally get to packing connection cables of diverse peripheral devices, and extension cords as nicely. Click Here for more Details:
ReplyDeleteInterstate Movers