Friday, 26 October 2012

Creating a plugin to extend other plugin



Creating a plugin to extend other plugin
This is a great feature of Liferay plugins which I come across. It has been available since 4.3. If you find a plugin that you like but you would like to modify something, you can create another plugin which extends the original one keeping your changes isolated from the original one.
In order to create a plugin which extends another, you just need to follow these steps:
  1. Create a new empty plugin in the Plugins SDK
  2. Remove all the auto generated files except build.xml and the docroot folder which should be empty
  3. Take original WAR of the plugin you want to extend, place outside of docroot folder (for example, social-networking-portlet-6.1.10.1-ee-ga1.war)
  4. Add the following line to your build.xml inside of the tag <project> in order to reference the original war file you are going to extend.
<property name="original.war.file" value="social-networking-portlet-6.1.10.1-ee-ga1.war" />
  1. Add any files you want to add or overwrite from the original plugin in your plugin (following the same folder structure of your original) and run the ant target merge. Please note that the merge target is called whenever the plugin is compiled. All you have to do is to check the ant output:
  2. This will generate a plugin (you can find the WAR file in the /dist folder of your plugins SDK) which combines the original one plus your changes.
  3. Just deploy and see the changes

Thursday, 25 October 2012

LDAP

Frequently Asked Questions on LDAP Integration

1.How do I login by another field instead of an email address? 

Your company may want to have users login using some value other than their email address. For example, if you have your LPAD configured and want your users to login using their another value, say their "userid" (see picture below)
 For the configuration above, you would use the following settings in portlal-ext. properties
 
    ldap.auth.enabled=true
    ldap.auth.required=true

    company.security.auth.type=screenName
    ldap.auth.search.filter=(uid=@screen_name@)
ldap.user.mappings=screenName=uid\npassword=
userPassword\nemailAddress=
mail\nfirstName=givenName\nlastName=sn\njobTitle=
title\ngroup=groupMembership 
 
 
ldap.user.default.object.classes=
top,person,inetOrgPerson,organizationalPerson,account
This maps Liferay's "screenName" value to LDAP's "uid" value.
For example, lets say we have a user in LDAP with the userid of "112143134". Because of the properties (see above), when this user tries to log in, Liferay will try to find a user with a screenname of "112143134" using the specified search filter "(uid=@screen_name@)". When Liferay finds this user, it will import this user into Liferay according to the specified user mappings.

Or
You can do that from liferay administrative set up from the control pannel.

Liferay Basic itervew Questions

(1) What is a Portal?
Ans: A portal is generally defined as a software platform for building websites and web applications

(2 )what is portlet?
Ans: A portlet is a Web-based component that will process requests and generate dynamic content.
portlets are small web applications written in Java that follow a certain set of rules to allow cohabitation within the same portal or even within the same page.

(3)portlet lifecycle in liferay
Ans: 1 Init
2. Render
3. ProcessAction
4. ServResorce
5. Destroy

(4) Difference B/T Servlet and Portlet
Ans:
A. Portlets are part of JSR-168 standard that regulates portal containers and components. This is
different standard from standards for web containers and servlets.
B.
Servlets have a java definition (applications which handle HTTP GET/POST requests), while
portlets have a user interface definition
C.
A portlet is used in the context of a
"Portal", But Servlet used Whole Body

(5) How Many Role in Liferay
A. Portal role
B . community role
C . organigation role

(6) Diffrence B/T Organigation And Community
Ans: Organizations can form a hierarchy while communities are independent of each other

(7) What is Instansable and NonInstable portlet

Ans: Instansable means one portlet plased on portal so many times but Noninstable is only one.

(8) what is User and UserGroup
Ans : User is Itself And UserGroup has Communation of user.

(9) What is power user
Ans: Power Users get their own community that they can edit called "My Community". That is
the difference between Regular and Power Users
Ex: Blog

(10) What is use of Portel-ext.properties
Ans: For DataBse Configuration,To point your Liferay bundle to your dataBase

(11) What is Use Of build.${user.name}.properties
Ans: For Sdk Configuration

(12) IPC in Which version Supported
Ans: Jsr 286                                                                                                                                             

(13) Ajax which version Suported
Ans: Jsr 286

(14) How to Start Liferay:
Ans: Windows: navigate with the file browser to liferay-portal-[version]/tomcat-[tomcatversion]/ bin and double click startup.bat.

(15) Tell Me command of Portlet creation in Windows
Ans: create.bat my-greeting "My Greeting"

(16)Deploying the Portlet on cmd
Ans: ant deploy

(17)Tell Me standard directory structure of Portlet
Ans: /PORTLET-NAME/
build.xml
/docroot/
/css/
/js/
/WEB-INF/
/src/ (not created by default)
liferay-display.xml
liferay-plugin-package.properties
liferay-portlet.xml
portlet.xml
web.xml
icon.png
view.jsp

(18) What is use of liferay-display.xml:
Ans: This file describes what category the portlet should appear under in the Add menu in the dockbar

(19) What is use of liferay-portlet.xml:
Ans : This file describes some optional Liferay-specific enhancements for JSR-286
portlets that are installed on a Liferay Portal server. For example, you can set whether
a portlet is instanceable, which means that you can place more than one portlet
instance on a page, and each one will have its own separate data.

(20) what is use of This tag <expiration-ache>0</expiration-cache>
Ans:
Expiration-cache defines expiration-based caching for this portlet.The parameter
indicates the time in seconds after which the portlet output expires. -1 indicates that the output never
expires.

(21) ByDefault This tag Contain True or False
Ans: <instanceable>XXXXXXX</instanceable> : False

(22) How many types of URL In portlet
Ans: there are three types of URLs that can be generated by a portlet
(a) renderURL: this is the type of URL that we have used so far. It invokes a portlet using only its render
phase.
(b)actionURL: this type of URL tells the portlet that it should execute its action phase before rendering all
the portlets in the page.
© resourceURL: this type of URL can be used to retrieve images, XML, JSON or any other type of resource. It
is often used to generate images or other media types dynamically.

(23) What is use of Friendly URL
Ans: friendly URL mapping, takes unnecessary parameters out of the URL and allows you to
place the important parameters in the URL path rather than the query string

(24) What is Themes and what is use of Themes.
Ans: Themes are hot deployable plugins which can completely transform the look and
feel of the portal. Theme creators can make themes to provide an interface that is unique to the site that the portal will serve.
Themes make it possible to change the user interface so completely that it would be difficult or impossible to tell that the site is
running on Liferay

(25) Which folder use to customize the Themes
Ans: _diffs

(26) How Many Folder Created inside _diffs folder
Ans: only four
/css/
/images/
/js/
/templates/

(27) What is hooks
Ans: Hooks can fill a wide variety of the common needs for overriding Liferay
core functionality. And It is hot deployable plugins.

(28) What is EXT
Ans: Ext plugins provide the most advanced method of extending Liferay. This
comes with some tradeoffs in complexity, and so Ext plugins are designed to be
used only in special scenarios in which all other plugin types cannot meet the needs
of the project. It is not Hot Deployable plugins\

(29) What is layout
Ans: A Liferay layout provides a template (or framework) for arranging your
portlets. It is what creates the columns and rows that can be used to arrange your
portlets.