Table of Contents [-]

This article is pending deletion because this article is a loose collection of uncategorized information. please break this out into focused articles or integrate into other articles For more information, see Wiki - Pending Deletion

Source organization #

There are two major groups of modules: those in the various ../portal dirs represent the "core" modules to the portal system, and those in the various ../portlet dirs represent individual portlet modules. Some of the "portlets" are actually critical to the administration of the portal, so not all modules in ../portlet are optional. It is unclear (to me at this point) which are and which are not "critical."

Most of the "core" portal code can be found in /portal/portal-ejb/src, esp in the package com.liferay.portal.service.impl.

The "entry point" into the system (if you want to do a code trace) is com.liferay.portal.servlet.MainServlet (assuming the request URL starts with "/c"). It is a specialized version of org.apache.struts.action.ActionServlet (the standard Struts "controller"). A custom request processor (com.liferay.portal.struts.PortletRequestProcessor) handles the actual requests. It is an extension of org.apache.struts.tiles.TilesRequestProcessor. The primary struts config file can be found in the source tree at /portal/portal-web/docroot/WEB-INF/struts-config.xml. It is ultimately merged in with other Struts config files and stored in the deployed app at WEB-INF/struts-config.xml

The most common "forward path" found in the struts-config.xml are .jsp files with a doc root found in the source tree at /portal/portal-web/docroot/html

A "new" company id, upon first entry to the first portal, is created (i.e. added to the database) by the code at com.liferay.portal.service.impl.CompanyLocalServiceImpl::checkCompany(). Note: CompanyLocalServiceImpl implements the CompanyLocalService interface. A NEW service could be written, and replaced using the Spring configuration if a custom "new company" configuration were desireable!

com.liferay.portal.util.WebKeys holds a series of identifiers for attributes that are stored in the "portal context" (i.e. the javax.servlet.ServletContext), the session, and/or the request. Many of these values are initialized by the com.liferay.portal.servlet.MainServlet

The default main path to be displayed (assuming no specific path is asked of by the caller) is "/c", and it is defined as the "Root path" plug the com.liferay.portal.servlet.MainServlet.DEFAULT_MAIN_PATH. The "root path" is defined as a serverlet configuration parameter to the MainServlet in its web.xml.

com.liferay.portal.util.PortalUtil is a helper class that can be used to retrieve a variety of information about the portal runtime environment.

.properties files are read and managed by the open source library EasyConf. See http://easyconf.sourceforge.net/index.html Notes on EasyConf: it appears that for each property file named <someprefix>.properties, a "development environment override" file named <someprefix>.<username>.properties can be created, where <username> is the user name of the OS. My Windows XP has a user name of "Joel", so indiviual build properties can by overridden by creating a file named build.Joel.properties, and making entries for just the entries I wanted changed for my dev environment.

:Category:Understanding and Improving Liferay A key configuration file is /portal-ejb/classes/portal.properties. It contains many configuration settings. Studying this file reveals a lot about the functionality available in Liferay.

Entries in portal.properties should be overridden by defining properties in the "extension" version named /ext/ext-ejb/classes/portal-ext.properties (not by modifying portal.properties). They can also be overridden on a virtual host basis by defining a portal-companyId.properties file.

Values are retrieved from the portal.properties file in code using com.liferay.portal.util.PropsUtil::get(). The value returned by this get() method can optionally be passed through one of the methods in com.liferay.util.GetterUtil to translate into various data types (e.g. GetterUtil.getBoolean(PropsUtil.get(PropsUtil.AUTO_DEPLOY_ENABLED)) )

com.liferay.portal.events.ServicePreAction is a key class that is the "pre-processor" action for all calls to the portlet. It handles validating the current user, determining which theme and layout to display, etc. "Which layout to display" is a key part of the "guest" page.

Portlet definitions (i.e. which portlets exist and are available to users) are defined in:

  • Source tree
    • /portal/portal-web/docroot/WEB-INF/portlet.xml
    • /portal/portal-web/docroot/WEB-INF/liferay-portlet.xml
    • /portal/portal-web/docroot/WEB-INF/liferay-display.xml
    • /portal/portal-ejb/classes/content/Language.properties

explanations of these structures can be found at http://content.liferay.com/4.0.0/docs/developers/ch08s01.html

/ext/sql/portal-tables.sql contains the database definitions (generic definitions). This file is a mix of "core" and portlet required tables.

The build of the database script is executed by the DBBuilder class, which supports macro expansion, and sql dialect translation.

The class DBBuilder reads sql fragments, with the primary fragment being in ext/sql/portal.sql

Hibernate mappings are stored primarily in /portal/portal-ejb/classes/META-INF/portal-hbm.xml in the source tree, but there are others. All Hibernate mapping files to be used are defined under the hibernate.configs option of portal.properties.

The hibernate session is managed by com.liferay.portal.spring.hibernate.HibernateUtil.

Spring definitions are stored primarily in /portal/portal-ejb/classes/META-INF/portal-spring-enterprise.xml (or /portal/portal-ejb/classes/META-INF/portal-spring-professional.xml for the "professional" version). Spring definitions to load are listed in portal.properties under the spring.configs entry.

In general, "services" of the portal container have their interfaces defined in the source tree at /portal/portal-ejb/src/com/liferay/portal/service/spring (or ./ejb, or ./http), and the implementation is located in portal/portal-ejb/src/com/liferay/portal/service/impl

Th default user roles "Guest", "Power User", and "User" are hard coded, defined in com.liferay.portal.util.RoleNames

The default pre-defined system group "Guest" is hard coded and defined in com.liferay.portal.util.GroupNames

0 Attachments
14998 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
Threaded Replies Author Date
Very useful info. for developers! Wishing for... Gaurang G May 18, 2010 12:39 AM

Very useful info. for developers!
Wishing for more ;)
Posted on 5/18/10 12:39 AM.