Sunteți pe pagina 1din 13

What is a Liferay Portal?

Hook
Liferay portal comes with a bundle where all the default
In general, a web portal represents a web application that built in portlets exist. Typically if any customization
provides a single point of access to variety of information. required in terms of JSP (UI) and portal properties.
We need to go by Hook implementation. Hook is supported
Functionality of a portal can extended very easily by by hot deployment.
creating custom applications that can run inside a portal. Liferay documentation suggests that - Whenever possible,
These applications are called portlets. hooks should be used in place of Ext plugins, as they are
hot-deployable and more forward compatible.
For running portlets you need application server that can
run a portlet container spec (JSR168 or JSR286). There are Some common scenarios that require the use of a hook are
dozens of free and enterprise portal products available.  When you have to perform a custom action on portal
startup
Liferay portal is an open source portal and below are the  When you have to perform a custom action on user
benefits of using Liferay portal: login
 Content management system(Documents, Articles).  When you need to overwrite or extend portal JSPs
 2-stage,3-stage workflows and publishing.  When you need to modify portal properties
 Social networking. 4)Sites and organization basis  When you need to replace a portal service with your
pages. own implementation.
 Integration with third party like LDAP, Solr, SSO(CAS,
Siteminder). EXT
 Portlets realted to Wiki's, News, Finance, Social, Liferay EXT Plugins are the most powerful way to extend
Workflow, Collaboration. the portal functionality. If any customization required in the
 Compatible with different Operating systems, core level classes then it can be done through EXT for
databases and APP servers. example LDAP users and user groups import modification.
 Compatible with UI technologies and web services. but here in EXT, restart would be required.
 Compatible with different scripts like PHP, Ruby, Grails,
EXT Plugins should be used only in case the portal
Python.
functionality can not be extended using Portlet of Hooks.
 Suppport of hot deployment feature. The EXT plugins are complex to develop and may cause
…………………………………………… maintenance issues in case you are trying to upgrade.
What is a Portlet?
From liferay documents, The main use cases in which an
Liferay portal comes with different portlets by default.
Ext plugin may be used are:
These portlets are nothing but different small applications
 Customizations to portal.properties (that is not
running in the instance(portal). Portlets are pluggable
supported by Hook Plugins)
software components that are managed in a web portal.
 Customizing and making changes to the Struts Actions
In general words you can call them as different catalogues for portal
as portlets produce fragments of markup code that are  Customizations of the Liferay beans declared in
aggregated into a portal. So a portal page is displayed as a Liferay's Spring files
collection of portlet, thease multiple small applications  Adding JSPs that are referenced from portal properties
together making a page of the site and these all pages that can only be changed from an ext plugin (be sure
together makes one community or enterprise portal. Hence to check if the property can be modified from a hook
a portlet (or collection of portlets) resembles a web-based plugin before doing this)
application that is hosted in a portal.  Direct overwriting of a class (not recommended unless
it's strictly necessary)
Portlet is a small application to fulfill the requirement of
certain domain. Inter portlet communication is supported Portlet
under Liferay portal. Portlet support hot deployment Portlets are the most common and easiest way to extend
feature of Liferay Portal. and provide a custom functionality for a liferay portal. This
…………………………………….. is a small application to fulfill the requirement of certain
What is the difference between Hook, EXT and domain. It is basically a bunch of code(Java Files, JSP, CSS,
Portlet? Java Scripts etc.). Portlet is supported by hot deployment.

Liferay provides 3 ways to extend the functionality of a Liferay also has a marketplace where a lot of useful
Liferay portal. Each of the way fits is good for different portlets are available for download and these portlets can
needs. contributed by anyone in the world. We recently
contributed a Speed reading portlet and a My IP Address
portlet in this marketplace for free use by liferay portlet.
community.
Each portlet mode has a method which handles it:
…………………………………………… doView()
doEdit()
doHelp()
What JSR version Liferay implements? Why JSR
compatibility is important while choosing a These methods will contain mainly our "traffic directing"
portal? logic, which are responsible to decide what view the user
wants to see.
JSR is a "Java Specification Request". Liferay Portal is Once the view has been determined, we will forward on to
developed to adhere to JSR 168 and JSR 286 specifications. methods which actually implement that view.

This specification is created by committee of JEE portal For standard portlet view modes have two views:
vendors. This specification is designed to achieve  The default view which shows the list of items.
interoperability between different portals and portlets.  The form, where users will mainly do the add and edit
action.
Liferay supports mainly below JSRs.
In this where end user can edit the particular item, is
JSR-168(Portlet 1.0) called edit mode of portlet.
JSR-286(Portlet 2.0) ………………………………….
JSR-127(JSF 1.0) What Is A Liferay Theme? What Are The Advantages
JSR-170 Of Using Them?
JSR-314(JSF 2.0)
JSR-329 Liferay themes are the way to customize look and feel of a
liferay portal page. The themes are extendable
Why these standards are defined? components that can be deployed separately on a portal
These standards are defined for the benefit of portal users and each page on the portal can choose a different theme
(end customers). Before these standards were born, portal (if required).
customer were required to use one portal and there was no
easy way to switch between different portal vendors. Themes are really powerful way to run multiple websites
Earlier portal were very vendor specific and all from a single portal. You can host multiple websites on a
functionality were developed using proprietary API, single liferay portal with totally different look and feel. This
technology and programming techniques. The JSR 168 and allows you to be unique at the same time save a lot
JSR 286 standards have defined the way portlets can be resources on website hosting.
developed that will help users in long run.
A lot of companies use liferay for creating multiple unique
Benefits of Following JSR Standards websites with the help of extraordinary themes that can be
Following these standards will ensure that there is no easily developed.
vendor lock in. However this can be guaranteed only when
the portlets are developed sticking to the standards. Themes are also available from marketplace.
…………………………………………….
What is a Portlet Lifecycle? For developing on our own, we have option of using VM
pages(Velocity templates). Liferay provides the feature to
Following is the portlet lifecycle: deploy the different themes into the portal same like
 init():It mainly initializes the portlet. portlets war files. So number of themes we can be
 render(): It takes the HTML output to User Interface. It deployed into Liferay portal and we can further select
mainly render the view in term of JSP/HTML code and those themes for user interface as per the requirement of
show into the respective portlet. end user for different site or organization
 Destroy: This method takes care of releasing the pages.
portlet resources. …………………………………………….
……………………………………… How To Use LDAP Authentication With Liferay?
What Is The Difference Between View Mode And Edit
Mode Of Portlets? LDAP is lightweight directory access protocol that is most
commonly used for authentication and authorization of
The modes of a portlet are typically related to the types of users. LDAP mainly consists users and usergroups of any
operations a user can perform on the portlet. A view mode organization with certain serach filter like DN entries. In
is where users are allowed to do read only operations, the control panel of liferay we have option to provide the
whereas in edit mode user can add/update the data in the LDAP settings so that portal can contact the third party like
LDAP and fetch the required users and groups as per given however, is kept in the same database.
mappings.
Each portal instance requires its own domain name. Liferay
For example Active directory is a LDAP implementation will direct users to the proper portal instance based on this
which can store users. Liferay support integration of any domain name. So before you configure an instance, we
LDAP implementation through its admin control panel. need to configure its domain name in our network first.
When we are ready to add an instance, click the Instances
We need to provide the settings in control panel - > portal tab - > Add button.
settings -> LDAP It will be prompted for four fields and a check box:
This will require LDAP URL, username, password, users  Web ID : A general convention is to use the domain
search filters mappings, groups search filters mapping etc. name for this. It’s a user-generated ID for the instance.
……………………………..  Virtual Host : Put the domain name you configured in
What Is Portal-ext.properties File? How This Can Be your network here. When users are directed to your
Configured And Used In Liferay? Liferay server via this domain name, Liferay will then
be able to send them to the proper portal instance.
Liferay Portal comes with default configurations that are
 Mail Domain : Enter the domain name for the mail
stored in portal.property file. You can use portal-
host for this instance. Liferay will use this to send
ext.properties file to override the values in
email notifications from the portal.
portal.properties file.
 Max Users : Enter the maximum numbers of user
accounts you would like your portal instance to
This allows you a clean way to keep your own copy of
support.
configurations that can be used outside the portal at the
same time you can easily upgrade the portal.  Active : Use this check box to choose whether to
………………………………. create an active or an inactive portal instance.
What Is Inter-portlet Communication? Why Is It
Required To Use JSR Style Inter-portlet Now we need to click Save. Now navigate to the portal
Communication? using new domain name. We will see that looks like a clean
install of Liferay. This is our new portal instance which can
Sometimes we have the requirement where we need to now be up and running.
establish communication in between two portlets for ………………………….
example any action done in one portlet redirecting the end
user to other portlet where some kind of result is How Can I Configure Two Different Domain Names
displaying as per action done on first portlet. (e.g. First.example.com And
Second.example.com) On Liferay?
So in this use case we have to use liferay inter-portlet At the time of creation of any site we need to provide
communication mechanism which serve the action domain names which further take it as site domain name.
performed by end user in one portlet and provide the We need to provide the certain domain name as required
result to the second portlet where the action result needs through the control panel of liferay portal. Single instance
to be displayed. We can say that it works on striker-catcher of Liferay Portal supports hosting of two or more domain
mechanism. names via communities(sites).

JSR style inter portlet communication ensures that your When we will go to control panel -> Site settings -> we can
portlets are going to work on any other JSR compliant provide the site URL, details like site(community)
portal server. If you use a liferay specific way to description, membership type, active status and virtual
communicate between portlets than you may not be able host.
to deploy and run the same portlet war on another JSR ……………………………..
compliant portal (e.g. Apache Pluto) How Can I Configure Liferay To Use Email Address As
………………………….. User Name Instead Of Screen Name?
What Is A Liferay Portal Instance?
We can set this from control panel -> portal settings ->
Liferay portal ships with the one liferay portal tomcat Authentication -> LDAP -> How do users authenticate?.
bundle which is up and running in any server with certain Here we can select whatever we require from email
database settings. We can have more than one liferay address,screen name or user ID. At the time of LDAP
instances running from one database. authentication, we need to provide the required LDAP
mappings which basically reads all the details related to
Liferay Portal allows you to run more than one portal users and usergroups from LDAP directory and import into
instance on a single server. The Portal Instances page of Liferay portal. At the time of this connection with third
the control panel lets you manage these instances. Data party we need to give the required field like authentication
for each portal instance are kept separate. All portal data, should be by email address or screen name or user ID.
…………………..
How To Customize The Behavior Of Liferay Default We can set the display category like below mentioned
Out Of The Box Portlets (e.g. Document View, liferay-display.xml. Suppose we have developed one portlet
Calendar, Blog, Wiki Etc) ? where portlet ID we have provided. We need to enter the
custom built liferay portlet into certain category like name
If we need any customization, related to JSP and UI then "category.cms", "category.collaboration" etc. By doing this
we can implement this using Hooks. Liferay portal comes custom built liferay portlet would come in required
with a bundle where all the default built in portlets exist. If category by clicking the add application feature of liferay
any customixation required in the core level classes then it as there would be many of portlets under different
can be done through EXT for example LDAP users and user categories. So below tag we need to enter for the entry of
groups import modification. but here in EXT, restart would a portlet into certain category.
be required.
………………………… <display>
What Is Liferay Service Builder? Is There Any <category name="category.cms">
Alternative To Use Service Builder? What Are <portlet id="20" />
The Advantages And Disadvantages Of Using </category>
It? </display>
…………………………..
Liferay service builder is basically used to create the How To Support Internationalization (i18n) On
service layers for any business logic implementation. From Liferay Portlets? How Do You Support Multiple
developer point of view it is very helpfull as it used to Languages Without Writing Java Code In
create all the service layers automatic. Suppose we want Liferay?
to develop a portlet, for this we need to write all the
required implementation classes, utility cleasses and other We can support internationalization (i18n) on Liferay
required classes. Service builder is used to create all these portlets and through out this whole Liferay portal. We need
classes for developer, where they can add their business to provide whatever language we need to support into
logic further and process the data and render the output to LIferay portal. This is mainly reads the regions number and
view as per the requirement. provide the available language like en_US(english),
SG(singapore), zh_
As per the advantage, this service builder will create whole CN(simple chinease), zh_TW(traditional chinease),
structure of the service layers for developer mainly. It ja_JP(Japanease).
really helps them to write the code and their logic in
service builder created model implementations and service In the same way to provide support of multiple languages
implementation classes. These classes comes with normal without writing java code in Liferay, we can use Locales
CRUD (create, update and delete)operations. For this through out the portal,
developer, no need to add anything extra as whole service portlet, hooks and themes. This entry we can provide into
and utility layers are already got created by service same portal-ext.properties which Liferay portal would read
builder. It really speed up the developement process. and provide all the translation accordingly.
locales=en_US,zh_CN,zh_TW,ja_JP,ko_KR
Service builder requires service.xml which is having some
of the required entries. Each of the entry is basically called If we are writing some custom messages in out code then
entity, which is having it's primary key fields with some we need to provide the below property files also as per the
other required fields. If we want to implement order and called language and using of Locales would convert it
finder method, we can implement it by using this accordingly. We can use LocaleUtil in our code which will
service.xml. convert the certain message given in language files.

Each entity creates table into liferay configured database For example we want the assetCategory title in multi
with the given column names and their types. We can languages then we need to use this
create service.xml related local-service and remote-service assetCategory.getTitle(locale). So here whatever locale we
by setting them value as "true". When we would run this have mentioned earlier would be in action and pick the
build-service like below, this would create all the service given title name from certain locale related
layers(implementation, utility etc.) where developer can language.property file.
write their required business logic further. Creation of all
the service-classes would be done by the build.xml, we Language_en_US.properties
need to build-services using this xml file into Ant view of Language_zh_CN.properties
IDE. Language_zh_TW.properties
………………………. ……………………………
How To Set The Display Category Of A Custom Built What Are The Advantages Of Using Tomcat Bundle
Liferay Portlet ? Of Liferay Against Other App Servers (e.g.
JBoss, Glassfish Or Others)?
How Can You Integrate Liferay With An External
It is possible to use Liferay with Liferay IDE with other then Content Management System (e.g. Alfresco)
tomcat server bundles but there are some features or
benefits that will not be available: Liferay passes user credentials through CMIS to the
Native eclipse server adapter that supports launching and alfresco in order to connect. To enable this in liferay, we
debugging. need to enter following below property in portal-
Deployment via add/remove modules wizard would not be ext.properties which will allow liferay to store password in
available. session.
Auto redeployment based on changes to project resources. session.store.password=true
…………………………
Which One Is Best To Start In A Clean Setup? Also one more thing we need to take into consideration is
that Liferay passes logged in user's credentials to CMIS
Liferay bundle with tomcat app server is the best one to Repository (whihc is alfresco
start in a clean setup. here) as described above. What this means is that
……………………….. userid/password in liferay must match userid/password in
How Do You Perform Junit Tests On Your Portlet? Alfresco. Alfresco by default uses a loginid (which is similar
to screen-name in liferay) to authenticate user. So we need
Junit tests are there to check the code mainly by providing to make liferay also authenticate using screen name by
the value of any method input parameter, how the method making following entry into portal-ext.properties.
would work and gives the values.
company.security.auth.type=screenName
public class MyEmployeeTest {
ClassPathXmlApplicationContext context = new So we need to start Liferay. Login as administrator and go
ClassPathXmlApplicationContext( to control panel. we need to go to Document and Media
"ApplicationContext-service.xml"); which will bring up a screen where we need to click on Add
public void testMyMethod() { -> New Repository. this will bring one screen where we
UserService employeeService = (UserService) basically provide connection details to connect to Alfresco
context.getBean("userService"); like below.

//Provide the user Id as 101581 Name: Give any name you want to give to your repository
User user = storeService.findUserByUserId(1234); view in liferay. For example, I will give Alfresco repository
//get the employee name.
Set employee = user.getEmployeesForUserId(); Description: A brief description about it.
System.out.println("Employee Name : Repository Type: We can connect either using AtomPub or
"+employee.getName()); using web services.
} AtomPub URL: This will be the CMIS repository URL where
} our alfresco is running. In our case, it's would be
……………………………… http://localhost:8080/alfresco/service/api/cmis (Note: In
How Will You Configure A Portlet That Can Be Added case of Alfresco 4.0, it will be
Multiple Times On A Portal Page? http://host:port/alfresco/cmisatom).
Repository ID: It is basically used to connect to a specific
One property is there in portlet.xml which is as follows: repository incase we have multiple repositories available. If
<instanceable>true</instanceable> we do not enter a repositoryId, then it will just look for the
………………………… first repository using the given parameters and set it to
How Can You Customize Liferay Search Feature? that.
What Are The APIs To Do It? …………………………………
How To Setup A Liferay Cluster From Scratch?
We can customize Liferay Search feature, depends upon
our requirement by below two ways. We need to setup below properties in our portal-
ext.properties(this is for one instance represented by 1p,
Hook : If changes are required as per the view side like we same properties we need to add for second instance also
need to change the search result form view then we can represented by 2p) and some required IP addresses.
write the Hook #cluster configurations - these settings are for cluster
to customize it. net.sf.ehcache.configurationResourceName=/myehcache/h
ibernate-clustered.xml
EXT : If changes are required as per the core functionality dl.store.file.system.root.dir=/webapps/document_library_cl
like we need to change the search query term, we can uster
implement EXT. #other settings for cluster
……………………………..
liferay.home=/webapps/liferay-1p/liferay-portal-6.1.10-ee-
ga1/ factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
lucene.dir=/webapps/liferay-1p/liferay-portal-6.1.10-ee- driverClassName="com.mysql.jdbc.Driver"
ga1/data/lucene url="jdbc:mysql://<IP-Address>/<database_name>?
cluster.link.enabled=true autoReconnect=true&amp;useUnicode=true&amp;charact
lucene.replicate.write=true erEncoding=UTF-
multicast.group.address["cluster-link- 8&amp;useFastDateParsing=false&amp;noAccessToProced
control"]=239.255.4.1 ureBodies=true"
username="liferay"
………………………………….. password="0bknSWE2zzl"
How To Use AUI In Liferay? What Are The initialSize="10"
Advantages Of Using It In Liferay Instead Of maxActive="200"
JQuery Or Some Other JS Library? minIdle="0"
/>
AlloyUI (AUI) is Liferay's open-source javascript library. It is
built on Yahoo User Interface (YUI) and has support for a Below is the entry of resource where
variety of advanced javascript functions specifically c3p0.ComboPooledDataSource is configured.
designed for portlets. As it is Liferay provided JS library <Resource
here no need to merge this code. It is designed to take name="jdbc/LiferayPool"
advantage of and incorporate patterns from the best auth="Container"
libraries to make building robust and flexible web type="com.mchange.v2.c3p0.ComboPooledDataSource"
applications. It is a JavaScript library, a CSS framework, a factory="org.apache.naming.factory.BeanFactory"
set of HTML recipes and a taglib library, all combined to driverClass="com.mysql.jdbc.Driver"
empower developers across multi-skilled teams deliver rich jdbcUrl="jdbc:mysql://<server-IP>/<database-name>?
and dynamic applications. Only we need to add certain tag useUnicode=true&amp;characterEncoding=UTF-
library like below in order to use Liferay Alloy UI libraries. 8&amp;useFastDateParsing=false&amp;noAccessToProced
<taglib> ureBodies=true"
<taglib-uri>http://liferay.com/tld/aui</taglib-uri> user="liferay"
<taglib-location>/WEB-INF/tld/liferay-aui.tld</taglib- password="0bknSWE2zzl"
location> minPoolSize="10"
</taglib> maxPoolSize="100"
/>
So further we can use these all form and fields like below
in our JSP code. I hope you find this list useful. Are you a Liferay developer?
<aui:form> Feel free to suggest any questions we may have missed
<aui:input name="Name" size="45" /> out on this list.
</aui:form> …………………….
………………………………

How To Use JQuery In Liferay?


What are the various ways in which you can
We need to provide the entry like below in our JSP files. So customize the default behavior of Liferay that ships
that it can read the provided java script path very easily to you?
and we can use jQuery accordingly.
<script type="text/javascript" src="< One can customize Liferay by writing:
%=themeDisplay.getPathThemeCss()%>/../js/jquery- Portlets
1.7.2.min.js"></script> Themes
………………………… Layout Templates
How To Configure Liferay To Use A JNDI JDBC Webs
Datasource Instead Of Internal C3p0 Hooks
Connection Pool?
……………………….
We need to do the entry of perticular resource with some
certain parameter like name, factory, driverclassname, url What is the difference between a Liferay Hook and
of database, uaername and password. Liferay EXT?
Below is the entry of resource where JDBC datasource is
configured.
Hook:
<Resource type="javax.sql.DataSource"
Hooks is a feature to catch hold of the properties and JSP
name="jdbc/LiferayPool"
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 service.xml is also used by the Liferay server to create the
web modules. A hook plugin is always combined with a database tables and columns for entities mentioned in
portlet plugin. For instance, the portlet social-portlet is a service.xml.
portlet plugin for Social Office with hooks. In general, …………………………………..
hooks would be very helpful tools to customize the portal Suppose I have a portlet written for Liferay 5.2.3
without touching the code part of the portal. In addition, and I want to run it on Liferay 6, how can I do that?
you would use hooks to provide patches for the portal What if I get some spring and hibernate related
systems or social office products. exceptions with Liferay 6?

source:Liferay Portal 6 Enterprise Intranets It is very difficult to find the technology updates done in
Liferay versions. The plugins SDK was modified in Liferay 6
EXT: so if your Liferay 5.3 portlet doesn’t run properly on Liferay
EXT is used to customize and extend the Liferay portal. 6 then it is better to write a new portlet for Liferay 6 rather
EXT builds a new ROOT webapp and replaces by a huge than trying to modify the portlet or source code for Liferay
build mechanism your existing Liferay portal. 6.
The Liferay EXT Environment is where you would ideally ……………………………….
make changes to the portal itself. In other words, this is
where you customize or “extend” the portal. You may ask, There is a requirement from the client that out of 4
“Why can’t we just make the changes to the portal source portlets that you have written only 2 should be
directly?” The answer is that you technically CAN, but if visible to a particular category of users. How will
and when you have to upgrade, you will have a tough time you achieve that? What if some fields in the
sorting out what is out-of-the-box and what is customized. remaining 2 portlets have also to be controlled
EXT Environment keeps things separate. based on user role?
……………………………. Ans: ???
Suppose I want to customize the behavior of ………………………………….
Calendar portlet that comes out of the box with
Liferay, how can I do that? What is the purpose of portal-ext.properties?

The behavior of Calendar portlet can be modified using portal-ext.properties contains various configuration
EXT or write a separate Calendar portlet meeting the user parameters. These settings can be modified or further
requirements. settings can be added. For example, there is no existing
…………………………………. section for database pool in portal-ext.properties but one
How will you configure Liferay to authenticate users can add the same as described in question 25.
from LDAP? …………………………………….
What steps will you follow to change the layout and
Go to configuring liferay with LDAP theme of the portal pages?
…………………………………..
What is inter portlet communication and how can Follow this excellent guide for Liferay theme and layout
that be achieved? customization
……………………………………….
Inter portlet communication (IPC) was introduced in JSR
286 Suppose I want to change the background color of
the footer in Liferay, what steps should I follow?
What is the difference between view and edit modes Ans : ???
of a portlet? …………………………………………

view mode is what is displayed a user logs in to the liferay Which JSR is being implemented by Liferay?
portal and various portlets are displayed to him.
edit mode is the configuration options that are displayed
when the edit button is clicked on the portlet. JSR 286 which is the reference for Portals from Oracle.
………………………………. …………………………………
What is service.xml and how will you use Liferay
service builder? What improvements would you like to see in Liferay
6 portal?
service.xml is a configuration file which consists the details There is no end to what features a CMS server can provide.
for database entities that are used in a portlet. The service For good and valid points read the following which are the
builder uses the service.xml to generate the DAO/DTO changes done in Liferay 6.1.
classes for a portlet.
a) Documents, video, audio, images, and other media
types are now stored in a single unified library. The steps to run multiple Tomcat instances on Linux are
“Speaking my language”—For each document type given Run Multiple Tomcat Instances.
(i.e., financial report, surveillance video, etc.) …………………………………..
administrators can customize metadata (i.e., author,
reporting period, etc.) into terms familiar to the end user. What are the minimum Java methods one needs to
override in order to write a portlet?
b) Mount multiple repositories (e.g. Liferay, Alfresco,
Documentum) while maintaining a common UI. One needs to override the doView(RenderRequest
Website planning and updating made easy—Multiple teams renderRequest, RenderResponse renderResponse) method
can work on several variations of a site simultaneously after overriding the MVCPortlet class.
(e.g. Halloween, Thanksgiving, Christmas variations) and …………………………………..
schedule publication dates for each.
How will you make the user to go from one JSP to
c) Enhanced staging means automatic versioning with another JSP page in a portlet?
history, undo support at the site and page level, and
preview based on scheduled publications. The hyper links to other JSP pages should be encoded
using renderURL tags as shown below:
d) Specific pages and page areas can be designated as
user customizeable Dynamic site templates become an &amp;lt;portlet:renderurl&amp;gt;&amp;lt;portlet:param
option—changes to the parent template force changes on name=&amp;quot;jspPage&amp;quot;
any associated children sites. value=&amp;quot;/myPage.jsp&amp;quot;&amp;gt;&amp;l
t;/
e) Users can create Sites without the need to designate portlet:param&amp;gt;&amp;lt;/portlet:renderurl&amp;gt;
ties to Organizations or Communities. The use of these render tags causes the next JSP page to
Direct links between web content enables users to specify open within the portlet window. If the links don’t use
relationships, such as linking an invitation list to a render tags then the next JSP will open in a new
Christmas party calendar event. window/tab in the web browser.
…………………………………...
f) Data lists can be published as workflow-enabled forms While building a service using service builder, what
that capture information such as an RSVP, tasks tracking is the purpose of specifying remoteservice=true in
and managing issues. service.xml?
Ans : ???
g) Open participation is encouraged in 6.1—users who ………………………………….
have yet to create Liferay accounts can still rate content How to control the category in which the liferay
and have their say in forums, message boards, and wikis. portlet created by me will be displayed?
…………………………………..
There are 1000 users using the portlet developed by The category of liferay portlet can be controlled by using
you, how will you take care of transaction liferay-display.xml.
management. The category is configured by adding the following:

There is no need to worry about transaction management &amp;lt;display&amp;gt;


when using the Liferay server. The server itself takes care &amp;lt;category
of transactions. The code generated using Service Builder name=&amp;quot;category.admin&amp;quot;&amp;gt;
can also be used with the need to think about transaction &amp;lt;portlet id=&amp;quot;9&amp;quot;
management. &amp;gt;&amp;lt;/portlet&amp;gt;
&amp;lt;portlet id=&amp;quot;40&amp;quot;
………………………………… &amp;gt;&amp;lt;/portlet&amp;gt;
&amp;lt;portlet id=&amp;quot;79&amp;quot;
A client has two different portal applications for &amp;gt;&amp;lt;/portlet&amp;gt;
Sales and HR department. The client wants to run &amp;lt;portlet id=&amp;quot;80&amp;quot;
these portal applications on same server but with &amp;gt;&amp;lt;/portlet&amp;gt;
separate URL’s like http://[ip]:[port]/sales and http:// &amp;lt;/category&amp;gt;
[ip]:[port]/hr. How will you achieve that? &amp;lt;category
Two instances of the server can be made to run on single name=&amp;quot;category.cms&amp;quot;&amp;gt;
machine which will make the two instances to run on &amp;lt;category
different ports but with same IP address. The configuration name=&amp;quot;category.alfresco&amp;quot;&amp;gt;
for running multiple Liferay servers on single machine is &amp;lt;portlet id=&amp;quot;91&amp;quot;
dependent upon the server being used like Tomcat, JBoss &amp;gt;&amp;lt;/portlet&amp;gt;
and GlassFish etc. &amp;lt;/category&amp;gt;
&amp;lt;/category&amp;gt; # directly to the provider. For example, the property
... # &amp;quot;jdbc.default.acquireIncrement&amp;quot; is
&amp;lt;display&amp;gt; read by C3PO, the property
……………………………… # &amp;quot;jdbc.default.maxActive&amp;quot; is read by
DBCP, and the property
What is hot deployment feature of Liferay? Where # &amp;quot;jdbc.default.base&amp;quot; is read by
will you place your portlets for them to be deployed Primrose.
without server restart? #
# The default provider is C3PO.
Hot deployment of Liferay portlets allows one to deploy/re- #
deploy portlets without the need to restart the Liferay jdbc.default.liferay.pool.provider=c3po
server. For hot deployment one can use the deploy target #jdbc.default.liferay.pool.provider=dbcp
of ANT build script that ships with Liferay or use Eclipse #jdbc.default.liferay.pool.provider=primrose
plugin which also internally uses this ANT script.
…………………………. #
# The following properties will be read by C3PO if Liferay is
Does Liferay support email notifications out of the configured to
box for portlets involving workflow? # use C3PO in the property
Ans: ??? &amp;quot;jdbc.default.liferay.pool.provider&amp;quot;.
……………………………… See
What is the purpose of mode and persistence #
packages which are created by the Liferay service http://www.mchange.com/projects/c3p0/index.html#config
builder? uration for a list
Ans: ??? # of additional fields used by C3PO for configuring
………………………………. database connections.
#
If there are 3 portlets and all of them need to talk to jdbc.default.acquireIncrement=5
different database systems (say MysSQL, Oracle and jdbc.default.connectionCustomizerClassName=com.liferay.
SQL Server) because of some legacy application portal.dao.jdbc.pool.c3p0.PortalConnectionCustomizer
requirements. How will you make them connect to jdbc.default.idleConnectionTestPeriod=60
different databases? jdbc.default.maxIdleTime=3600
jdbc.default.maxPoolSize=100
jdbc.default.minPoolSize=10
Liferay server doesn’t support multiple database
jdbc.default.numHelperThreads=3
connectivity out of the box. One needs to use JDBC or
#jdbc.default.transactionIsolation=1
other database interaction technologies in order to use
different databases for various portlets.
#
……………………………..
# The following properties will be read by DBCP if Liferay is
configured to
Can you configure the database connection pool
# use DBCP in the property
created by Liferay?
&amp;quot;jdbc.default.liferay.pool.provider&amp;quot;.
See
One can configure database connection pool by editing # http://commons.apache.org/dbcp/configuration.html for
portal-ext.properties by adding the following snipped. a list of additional
# fields used by DBCP for configuring database
The portal-ext.properties file is present in connections.
[tomcat_home]/webapps/ROOT/WEB-INF/classes/ #
#jdbc.default.defaultTransactionIsolation=READ_UNCOMMI
#
TTED
# Liferay can use C3PO, DBCP, or Primrose for connection
jdbc.default.maxActive=100
pooling. See
jdbc.default.minIdle=10
# com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean
jdbc.default.removeAbandonedTimeout=3600
for the actual
# implementation. It is important to understand the
#
strengths and weaknesses
# The following properties will be read by Primrose if
Liferay is configured
# of each provider so that you can choose the best one
# to use Primrose in the property
that fits your
&amp;quot;jdbc.default.liferay.pool.provider&amp;quot;.
# deployment scenario. Provider specific properties can
See
also be passed along
# ………………………………………….
http://www.primrose.org.uk/primrose3/primroseConfig.html Can I run my Struts 1.3 based legacy application as
for a list of a portlet application? How?
# additional fields used by Primrose for configuring
database connections. Yes it is possible to convert legacy application into a portlet
# by making the legacy application to follow the
jdbc.default.base=100 requirements of a Liferay plugin and then deploying the
#jdbc.default.connectionTransactionIsolation=TRANSACTIO same on Liferay server.
N_READ_UNCOMMITTED ………………………..
jdbc.default.idleTime=1800000
jdbc.default.numberOfConnectionsToInitializeWith=10 Is it a good design to meet the customer
……………………………
requirements by creating a single portlet or
splitting them into multiple portlets? What criteria
Can you list down various tools and frameworks
will you use to split the functionality into multiple
used by Liferay? e.g. It uses Lucene for search
portlets?

One can go through the source code of Liferay and list the
It is better to split multiple requirements into individual
toll and technologies being used. I am listing my list here:
portlets and the use inter-portlet communication for
Struts, Vaadin, Lucene, Solr, Log4j, ANT, Axis, Apachemeeting the business requirements. The advantage of
Commons, Freemarker, EHCache, Hibernate, jFreeChart, splitting functionality is enhanced usability, reduced
JSPWiki, Xerces, Velocity, Spring, SLF4j, Quartz, POI,coupling, better maintainability. Using the typical
HyperSonic, Xalan, Ajax, HTML, JavaScript, Java, CSS, requirements, one can create separate portlets for Create,
…………………………………. Modify, View, Delete and Search of each entity but you
should have the user in confidence before making any UI
Suppose a client is pursuing a Liferay based solution decisions.
to their requirements, what non-functional ………………………..
clarifications will you ask from the customer?
What advantages do you see in running the Liferay
The non-functional requirements to look out for are: portal application on a application server like JBoss
a) Automated Startup on booting server than running it on a web server like Tomcat?
b) Automated database backup
c) Concurrent access to users The decision about using application or web server is
d) Ability to add more user roles totally dependent on the fact that some portlets may be
…………………………………….. using EJB/JMS and hence would require application server
instead of web server. As far as Liferay is concerned, there
Is there a build number associated to a portlet is no difference in features provided by Liferay depending
assigned by the service builder? Where can we find upon server.
the current build number? ………………………..
Ans : ???
…………………………………………. What all other portals have you heard of? How do
you compare them to Liferay?
Have you tried the Liferay 6 Eclipse plugin? What all
limitations have you found? Other vendors have also rolled out portals which are
Ans : ??? reference implementation of JSR 286. The list includes:
……………………………………. Apache JetSpeed
JBoss GateIn
How do you log events in a portlet? Do I need to Oracle WebLogic Portal
configure Log4J for every portlet or is there a IBM Websphere Portal
common place where one can configure Log4J so SAP NetWeaver
that all Liferay portlets can use logging API? ………………………..
Ans : ???
…………………………………….. How will you implement i18n in a portal application?
What if you want the user to choose his language
Do you know how to update your setup of Liferay preference?
5.2.3 to Liferay 6?
Follow the excellent guide on Liferay Internationalization
………………………..
Liferay website itself lists the steps for upgrading from
5.2.3 to Liferay 6. One should be though aware of how to
take database backup and how to patch Liferay in general.
There is a portlet application for managing images
similar to Flickr. The user wants to see the images in There is a JRE shipped with Liferay package, do we
full screen. Will Liferay allow you to do that? not need a JDK and what is the purpose of bundled
JRE?
The full screen option can be displayed for any portlet by
The JDK is required to create liferay portlets but the JRE is
adding
required for running the portlets.
&amp;lt;maximize-edit&amp;gt;true&amp;lt;/maximize-
………………………..
edit&amp;gt;
to the corresponding liferay-portlet.xml of the particular
Suppose there is a requirement from client to
portlet.
implement search functionality in Liferay portlet,
I have a war file of the portlet which is created
does Liferay provides any API out of the box to
using service builder, what is the difference
support search?
between pasting this war file in the deploy folder of
Ans : ???
Liferay and application folder of server (like
………………………..
webapps in case of Tomcat)?
What are the various ways in which one can
override the default behavior of Liferay?
Pasting the portlet in the deploy folder of liferay will cause Ans : ???
it to be deployed into the application folder of the server ………………………..
automatically when the server is started.
Copying the portlet war file to application folder of server The service builder can also build WSDL for you.
will also cause the war file to deployed as portlet. What is the benefit of this feature provided by
The only difference is that the ant script has deploy target Liferay?
which causes the portlet war to be copied to the deploy
folder of liferay server.
Using the build WSDL target of ANT, one can deploy the
………………………..
portlet as a web service. JSR 286 uses the term Web
Services for Remote Portals. The steps to create a web
How will you setup a clustered Liferay portal on 5
service portlet can be found Liferay Web Service portlets.
servers available to you?
………………………..
Clustering involves not only clustering server but also
How will you build a portlet that can be added only
configuring various services within Liferay. A complete
single or multiple times in to the portal application?
guide for Liferay clustering is available Clustering Liferay
Tutorial.
……………………….. The instanceable flag should be set to true in liferay-
portlet.xml present in the WEB-INF directory of every
How much user base can Liferay support without portlet application.
affecting performance? If the value for this flag is false then a portlet can be added
only once in the portal page
There are official numbers released by Liferay as shown ………………………..
below:
Is it possible to set a session time out for a portlet
which is different from other portlets and the
Liferay portal?

No every portlet can not be configured to have a different


session timeout interval than the portal itself. If a portlet
should not work after some amount of inactive time period
then it can be managed using Ajax calls and keeping track
of inactive time in portlet code.

What is the flow of HTTP request in Liferay?


Ans : ???
………………………..

The JSPPortlet.java extends the MVCPortlet.java


class. What purpose does MVCPortlet.java fulfill?
Ans : ???
………………………..
………………………..
Struts, Vaadin, Lucene, Solr, Log4j, ANT, Axis, Apache
How do you perform Junit tests on your portlet? How Commons, Freemarker, EHCache, Hibernate, jFreeChart,
do tackle the dependency on the MVCPortlet.java? JSPWiki, Xerces, Velocity, Spring, SLF4j, Quartz, POI,
HyperSonic, Xalan, Ajax, HTML, JavaScript, Java, CSS,
Ans : ???
………………………….
………………………..
If there are 3 portlets and all of them need to talk
Is it mandatory to have the view logic in view.jsp? to different database systems (say
Can one configure some other JSP (say MyJSP.jsp) to MysSQL, Oracle and SQL Server) because
be default view page than view.jsp? of some legacy application requirements.
Ans : ??? How will you make them connect to
………………………… different databases?
There is a portlet application for managing images
similar to Flickr. The user wants to see the Liferay server doesn’t support multiple database
images in full screen. Will Liferay allow connectivity out of the box. One needs to use JDBC or
you to do that? other database interaction technologies in order to use
different databases for various portlets.
The full screen option can be displayed for any portlet by ………………………….
adding.
…………………………. What is hot deployment feature of Liferay? Where
will you place your portlets for them to be
What all other portals have you heard of? How do deployed without server restart?
you compare them to Liferay?
Hot deployment of Liferay portlets allows one to deploy/re-
Other vendors have also rolled out portals which are deploy portlets without the need to restart the Liferay
reference implementation of JSR 286. The list includes: server. For hot deployment one can use the deploy target
Apache JetSpeed of ANT build script that ships with Liferay or use Eclipse
plugin which also internally uses this ANT script.
…………………………… ………………………….
Can I run my Struts 1.3 based legacy application as
How to control the category in which the liferay
a portlet application? How?
portlet created by me will be displayed?
Yes it is possible to convert legacy application into a
portlet by making the legacy application to follow the The category of liferay portlet can be controlled by using
requirements of a Liferay plugin and then deploying the liferay-display.xml. The category is configured by adding
same on Liferay server. the following: < category name="category.admin"> ... <
…………………………. display>
………………………….
Do you know how to update your setup of Liferay
How will you make the user to go from one JSP to
5.2.3 to Liferay 6?
another JSP page in a portlet?
Liferay website itself lists the steps for upgrading from
5.2.3 to Liferay 6. One should be though aware of how to The hyper links to other JSP pages should be encoded
take database backup and how to patch Liferay in general. using renderURL tags as shown below:
…………………………. The use of these render tags causes the next JSP page to
open within the portlet window. If the links don’t use
Suppose a client is pursuing a Liferay based render tags then the next JSP will open in a new
window/tab in the web browser.
solution to their requirements, what non-
functional clarifications will you ask from
………………………..
the customer?
There are 1000 users using the portlet developed by
you, how will you take care of transaction
The non-functional requirements to look out for are:
management.
a) Automated Startup on booting server
b) Automated database backup
c) Concurrent access to users There is no need to worry about transaction management
d) Ability to add more user roles when using the Liferay server. The server itself takes care
…………………………. of transactions. The code generated using Service Builder
can also be used with the need to think about transaction
Can you list down various tools and frameworks management.
used by Liferay? e.g. It uses Lucene for ……………………….
What improvements would you like to see in Liferay
search
6 portal?
One can go through the source code of Liferay and list the
toll and technologies being used. I am listing my list here:
There is no end to what features a CMS server can What are the various ways in which you can
provide… customize the default behavior of Liferay
Documents, video, audio, images, and other media types that ships to you?
are now stored in a single unified library. “Speaking my
language”—For each document type (i.e., financial report,
surveillance video, etc.) administrators can customize One can customize Liferay by writing:
metadata (i.e., author, reporting period, etc.) into terms Portlets
familiar to the end user. Themes
Mount multiple repositories (e.g. Liferay, Alfresco, Layout Templates
Documentum) while maintaining a common UI. Website Webs
planning and upd .... Hooks
……………………….
What steps will you follow to change the layout and
theme of the portal pages?

Follow this excellent guide for Liferay theme and layout


customization
……………………….
What is the purpose of portal-ext.properties?

portal-ext.properties contains various configuration


parameters. These settings can be modified or further
settings can be added. For example, there is no existing
section for database pool in portal-ext.properties
……………………….
Suppose I have a portlet written for Liferay 5.2.3
and I want to run it on Liferay 6, how can I
do that? What if I get some spring and
hibernate related exceptions with Liferay
6?

It is very difficult to find the technology updates done in


Liferay versions. The plugins SDK was modified in Liferay 6
so if your Liferay 5.3 portlet doesn’t run properly on Liferay
6 then it is better to write a new portlet for Liferay 6 rather
than trying to modify the portlet or source code for Liferay
6.
……………………….
What is service.xml and how will you use Liferay
service builder?

service.xml is a configuration file which consists the


details for database entities that are used in a portlet. The
service builder uses the service.xml to generate the
DAO/DTO classes for a portlet. service.xml is also used by
the Liferay server to create the database tables and
columns for entities mentioned in service.xml.
……………………….
What is the difference between view and edit modes
of a portlet?

view mode is what is displayed a user logs in to the liferay


portal and various portlets are displayed to him. edit mode
is the configuration options that are displayed when the
edit button is clicked on the portlet.
……………………….
What is inter portlet communication and how can
that be achieved?

Inter portlet communication (IPC) was introduced in JSR


286

……………………

S-ar putea să vă placă și