Pages

Showing posts with label liferay. Show all posts
Showing posts with label liferay. Show all posts

Sunday, November 8, 2009

Liferay Extension Environment

1) Download the liferay source from liferay.com
2) Now you need to create two property files those are
release.< computerName > .proerties
app.server.< computeName > .properties
3) Add following content to newly created relese. < computeName > .property file

lp.ext.dir= -- location where to create extension folder--

Eg: lp.ext.dir=D:/hytv/source/ext-env
(Note: Remember this ext-env directory should not be existed physically in specified location)

Now add the below content to newly created file app.server. < computerName > . property file.

app.server.tomcat.dir= < Specify the Tomcat location >

Eg:

##
## Server Type
##

app.server.type=tomcat
app.server.tomcat.version=5.5
app.server.tomcat.dir=D:/hytv/source/apache-tomcat-5.5.27
app.server.tomcat.classes.global.dir=${app.server.tomcat.dir}/lib
app.server.tomcat.lib.endorsed.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.support.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.zip.name=liferay-portal-tomcat-5.5-${downloads.version}.zip


Note: this file is useful to creates the total tomcat environment of Tomcat and replaces those in specified tomcat server files.


4) Now create a project in Netbeans
NewProject --> Java --> Java-freeform-Project.



5) Now specify the location of liferay source code folder, and build.xml location.




6) Here you can customize the ant build as per your requirement.



7) Now you can choose jdk source levels, and encoding technique.



8) Now click on finish button to get the src project. Here you can see the created project will be shown on netbeans IDE.



9) Ignore the errors if you got in Net beans project. Now expand the build.xml file by clicking on + button.

10) Right click on deploy option and then click on Run target.
11) Now Right click on build-ext option then click on Run target.
12) You have successfully created the liferay extension environment.
13) Now you can open the ext-env folder as netbeans project.
14) Here you need to copy the app.server. < computerName > . properties
and release. < computerName > . properties files from liferay source to ext-env folders.

15) Now if you want to change database, or any other related things then you can just add the necessary changes in portal-ext.properties file of ext-env file.

Eg: Adding new database specification.

# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal234?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=kmipl


16) Click on build.xml, run the deploy option for every modification.
17) Now Start the tomcat server. (which is specified in app.server. < computerName > . properties file).

Monday, October 12, 2009

Blog - Liferay

Steps to Create Blogs in liferay

-->After login choose Add application button from the welcome menu.


--> Now choose Blogs from collaboration menu.

--> Now click on Add Blog Entry button for adding blog content




--> Enter the title and content details as you want. Then click on publish button.

--> You can give tags also to your posted blog content. After publishing you will get the blog list as follows. As a posted user you will have edit option to modify the content.


--> Now get the bloggers details, who are blogging on our site.

Add Applications >> Collaboration >> Recent Bloggers -- Add

--> Now you have completed the blog creation successfully.

--> best example of liferay Blog is














Liferay - Dynamic Virtual Hosting

Steps to use Virtual Hosting feature from Life ray

  1. Create virtual hosts in /windows/system32/drivers/etc/hosts file

127.0.0.1 localhost

127.0.0.1 localhost1

127.0.0.1 raj.com

  1. open control panel >> server >> Portal Instances

Add virtual hosts here



























Now open http://www.raj.com:8080/

Database Sharding:

To create database for each virtual Hosting:

Create three database schemas,Run minimal sql script for each database.

Restart liferay server, nowu are able to use three applications in same liferay server.

At present, sharding exists in Liferay from version 5.2.3+ for handling data across multiple portal instances. Here's what you do to get it up.

After you have a normally working development environment, make sure your hosts file is setup to allow virtual hosting (for our convenience, I will call the hosts abc1.com, abc2.com, abc3.com, etc.).

Use the create-minimal SQL script (from our Downloads section) to create three database schemas: lportal, lportal1, and lportal2.

Be careful and use the scripts for your liferay portal version, otherwise, it won't work. By default, the configuration files are setup for three schemas called default, one and two, but you can configure it for more.

All this configuration is set up in the file portal-impl/src/META-INF/shard-data-source-spring.xml .

As you will see, we will include this file in the property spring.configs in the next step. In case we want to modify it we just should write our own file in the Extension Environment and include it in this property instead of the default one.

In your portal-ext.properties, you will need to set the following:

Enable META-INF/shard-data-source-spring.xml under spring.configs.

Configure the jdbc schema settings for jdbc.default.*, jdbc.one.*, and jdbc.two.*.

Enable the shard names: shard.available.names=default,one,two

Don't forget to set the appropriate username and password for each schema.

Startup the server and create several (2-3) portal instances (e.g., abc1.com, abc2.com, abc3.com).

Using your favorite database browser, do a query on each of your schemas for the User_ table, and you will notice that the data is now distributed across different schemas. That's it!

Additional Settings

Remember that default, one, and two are default values defined in portal-impl/src/META-INF/shard-data-source-spring.xml and portal-ext.properties. If you want to change it, make sure to propagate the changes to the spring XML file as well as portal-ext.properties.

If you want to manually select the shard (via the GUI when creating portal instances), you need to enable in your portal-ext.properties file: shard.selector=com.liferay.portal.dao.shard.ManualShardSelector. Otherwise, the shard for the data will be chosen using a round robin technique.

Monday, August 31, 2009

Liferay theme objects

To get Liferay Theme object please follow the below code.


--><%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
-lt-portlet:defineObjects /-gt-

To get the portlet related objects.

<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
-lt- liferay-theme:defineObjects -gt-

To get the theme related Objects.
Example: To get selected theme folder path.
script type="text/javascript"
src="-lt-%=themeDisplay.getPathJavaScript ()%-gt-/jquery/ui.dialog.js"

--> The objects that are injected into the pageContext by the
-lt- liferay-theme:defineObjects /-gt- tag are:

* themeDisplay - com.liferay.portal.theme.ThemeDisplay
* company - com.liferay.portal.model.Company
* account - com.liferay.portal.model.Account (deprecated)
* user - com.liferay.portal.model.User
* realUser - com.liferay.portal.model.User
* contact - com.liferay.portal.model.Contact
* ?layout - com.liferay.portal.model.Layout
* ?layouts - List
* plid - java.lang.Long
* ?layoutTypePortlet - com.liferay.portal.model.LayoutTypePortlet
* portletGroupId - java.lang.Long
* permissionChecker - com.liferay.portal.security.permission.PermissionChecker
* locale - java.util.Locale
* timeZone - java.util.TimeZone
* theme - com.liferay.portal.model.Theme
* colorScheme - com.liferay.portal.model.ColorScheme
* portletDisplay - com.liferay.portal.theme.PortletDisplay



Note: -lt- with lessthan symbol
-gt- with greaterthan symbol

Liferay-Connecting to the Database in the way of liferay

We can directly use the Liferay Database connection while writing our own portlets. By following the below procedure.

step 1- import com.liferay.portal.kernel.util.InfrastructureUtil;
which will available under portlet-kernal jar file.

Step 2- import javax.sql.DataSource;
liferay uses DataSource mechanism for maintaining the database connections.

step 3- Connection connection = null;
DataSource dataSource = null;

create above variable for getting and storing datasource and connection to the database.

step 4- dataSource = InfrastructureUtil.getDataSource();
connection = dataSource.getConnection();

This is it here we are having the liferay datasource and from that datasource object we
will get the connection object.

Note: In general way it will raises sql exceptions so dont forget to handle the exceptions. ;)

Wednesday, March 18, 2009

You do not have the roles required to access this portlet.

"You do not have the roles required to access this portlet." if you are getting this error while showing the portlets in your pages. You can hide them by setting

layout.show.portlet.access.denied=false in portal.properties file.

by default its value is true.

PortletURL

This tutorial demonstrates how to get a Portlet to link back to itself within a JSP or even with the HTML code spit out within the doView method of a Portlet. The key is the PortletURL object... T...

URL :http://www.youtube.com/watch?v=SUlgKvWaZwo



Tuesday, March 10, 2009

Liferay

Liferay Portal provides jQuery as the default javascript library. This tutorial demonstrates how to build Standard tabbed page for your portlet using the jQuery library's tabs() method.

URL: http://www.youtube.com/watch?v=QBeomic29uc