Dev @ Work

A day in the life of a developer

Securing your Liferay Service using PermissionChecker

May 3rd, 2010 by Bert Willems

Welcome to 3rd article in this series of articles showing you how you can develop custom Liferay services. In the previous article I showed you how you can implement a custom Liferay service and expose it as a web service. In this article I will show you how you can secure your service using Liferay’s build-in permission model.

The permission system in Liferay is pretty powerful: you configure permissions on roles or teams. Next you apply roles to either groups (communities, organizations) or individual users. In this article we will define a new permission: the permission to access our “very exiting business logic” sayHello. After all, we have invested countless hours in developing it; we don’t want everybody to use it without us knowing ;) .

I hope this article is useful to you. Please let me know if you have any questions or comments; just drop me a message and I will get back to you as soon as I can.
Read the rest of this entry »

Posted in Java | No Comments »

Expose a Liferay Service as a Web Service

April 26th, 2010 by Bert Willems

In my previous article I showed you how you can implement a reusable Liferay Service without using Ext or  the Service Builder utility. In this article we will take it one step further and expose the service we have created as web service again without using Ext or the Service Builder.

Liferay exposes the services based on Axis using a separate web application called tunnel-web. We will hook into tunnel-web so our service will be exposed in exactly the same way Liferay services are externalized. Let’s get started.
Read the rest of this entry »

Posted in Java | No Comments »

Implementing a reusable Liferay Service Without Ext or Service Builder

April 19th, 2010 by Bert Willems

In Liferay you can split your application logic vertically exposing each component as a separate independent service. This service can be consumed by your portlet applications and any other applications. Liferay itself exposes several services to you: GroupService (for managing communities) and UserService (for managing users) for example. In this article I will show you how you can create a reusable service yourself and host it in Liferay.

In this article we will build a simple hello world service, nothing to fancy (I want to leave something for you to do yourself ;) ). We will code the service from scratch without using tools like service builder.

The project will contain 3 modules:

  1. A library containing the service contract
  2. A web application implementing the service contract
  3. A web application consuming the service

I hope you like this article, please let me know if you have any questions or comments. Lets get started. I assume you have read my previous article about using Maven to build Liferay applications. If not please read it first.
Read the rest of this entry »

Posted in Java | 5 Comments »

Setting up Maven for Liferay Development

April 17th, 2010 by Bert Willems

Welcome to the third article in these series about Liferay usage, maintenance and development. In this post I will show you how to set up your Liferay development enviroment using Apaches Maven2 build tool. We will develop a really simple JSR-168 portlet which can be deployed into Liferay. I assume you have read my previous articles and that you are using Liferay 5.2.3 on JBoss 5.1. I hope you like this post as much as the previous ones, if you have any feedback feel free to contact me or post a response.

The next version of Liferay, release date end Q1 begin Q2, will have complete support for maven including custom archetypes. Some of the steps described in this article will be obsolete then, but lets get started. Read the rest of this entry »

Posted in Java | 1 Comment »

Setting up Liferay with MySQL

January 24th, 2010 by Bert Willems

Welcome to the second article in a series of articles on Liferay. In this series I will show you various aspects of Liferay, Liferay installation, Liferay maintenance and Liferay development so lets get started. These articles assume that you have basic Java development skills.

In this post I will show you how to configure Liferay to use MySQL instead of Hypersonic. I assume you have followed all the steps in the previous post or that you are using a JNDI datasource. I also assume that you have installed MySQL on your system already. If not, please install it first. If the portal is still running stop it first before continuing with the next steps.

Read the rest of this entry »

Posted in Java | No Comments »

Setting up Liferay in JBoss 5.1

January 24th, 2010 by Bert Willems

Welcome to the first article in a series of articles on Liferay. In this series I will show you various aspects of Liferay, Liferay installation, Liferay maintenance and Liferay development so lets get started. These articles assume that you have basic Java development skills.

In this post I will show you how to install Liferay 5.2.3, the latest communitie edition, on your local machine in the JBoss 5.1 application server, I assume you have a Windows machine. If you are running a different OS you can take the same steps but some paths will change depending on your OS. There are quite a few steps that need to be taken in order to set up Liferay, I will go through each and every step in detail. Read the rest of this entry »

Posted in Java | 10 Comments »

Liferay: Good, Bad or Ugly?

November 2nd, 2009 by Bert Willems

liferay logoHello, I have been developing application for Liferay for about one month now and I thought it would be a nice idea to share my experience. This is no thorough review of the product, just my personal experience with Liferay.

For those who don’t know what Liferay is: it is a portal server based on Java technology. It allows you to create portal and community websites easily. It provides more than 60 out-of-the-box and ready-to-use application called ‘portlets’. Those ‘portlets’ range from simple editorial blocks to blog engine and a chat portlet. It contains a full blown content management system and some powerful collaboration tools. See http://www.liferay.com/web/guest/products/portal/features for a comprehensive list of features.

Anyway, I have been working with Liferay for about one month now, specifically for one project. I won’t elaborate on the project in details but it is a career portal with jobs, resumes and company presentations. I have developed a considerable part of the code myself and it has been an interesting experience because I never wrote one line of Java before: I have a c++/.NET background. Fortunately, I have a good, experienced Java team to back me up.

Okay, lets get back to the subject now. I will separate my experiences into three categories:

The good

In my opinion Liferay is a complete product, the out of the box portlets are useful and you can actually create a full portal just with those portlets: that is impressive.

I also like the fact that Liferay provides pre-packaged version of their portal software which you can download and run without any special configuration. You can get a Liferay portal up and running in 5 minutes.

The Liferay community is active. You can find a lot of information in the WIKI and on the forum. I also like the fact that Liferay provides seminars around the world, to me that is a sign of professionalism.

I also like the fact that Liferay offers custom JS and CSS includes per portlet, this allows me add style and JavaScript without having to code it into the portlet itself  or in a Liferay theme.

The API is pretty powerful and usable, although it is hard to find out how it works (seen second point of The Bad).

The bad

What I think is really bad on Liferay is that there are still some major bugs open in version 5.2.3. Those bugs should have been fixed a long time ago IMHO. I am not sure if those bugs are fixed in the enterprise version of Liferay, so I am judging on that. For example LPS-114.

One other thing I think is bad on Liferay is the lack of API documentation. It is really hard to find how certain things are achieved or what methods do exactly. For example I have spend some hours finding out how I can retrieve a list of pages of the current community. I have searched the Liferay Wiki, the Liferay forums and used Google without success: I ended up reverse engineering Liferay itself. It is working beautifully now but it wasn’t a good experience figuring it out.

The Ugly

Even though Liferay is supposed to be fully compliant with JSR-168 and JSR-286, I can’t get the custom portlet mode to work properly. Although this seems to be an optional part of the JSR-286 I  assume that a enterprise product like Liferay would support this feature. I had to apply a work around which resulted in ugly code.

Considering all above points, I can say I am fairly impressed by the Liferay portal. I would choose it again for portal project.

Please let me know if you agree or disagree with me, lets get into a debate regardin Liferay! It deserves it!

Building a JSF Portlet for Liferay

August 30th, 2009 by Trilobyte

In this article I will show you how to build a portlet for the Liferay Portal using JavaServer Faces (JSF). I am not going to explain in detail how to setup Liferay, there are a lot of articles on that subject. I assume you have Java, Tomcat, Liferay, Ant and the Portal plugin SDK up and running.

Read the rest of this entry »

Posted in | 6 Comments »

My First Java Steps

August 25th, 2009 by Bert Willems

Hello all, sorry for the radio silence lately, you might wonder what I have been doing lately. Well I have committed a terrible sin against the .NET framework (my previous home :P ): I started learning Java.

Why Java? Because several clients of Liones demand that their applications must be build on the Java platform and I am deeply involved in the process. I am not going to bother you with the organizational side of the process, I will focus on sharing my experience.

Learning Java isn’t really the objective for me, it is just another programming language and C# is similar enough to not cause any problems for me to program in Java. The real objective is to be able to develop applications (called portlets) for the Liferay portal framework. The hidden challenge, for me, turned out to be setting up the environment.

I got everything up and running today: Java, Ant, Tomcat, Liferay and I developed my first custom portlet (an application for Liferay) using above technologies and Java Server Faces. I will post an article on how I did it soon!

Posted in Java | 1 Comment »