Wednesday, December 1, 2010

Deploying Alfresco Share portlets in Liferay

In Web Scripts as Portlets tutorials, how to deploy Alfresco Web Scripts as Liferay Portlets have been discussed. In this tutorial we will see how to deploy Alfresco Share 3.4 portlets in Liferay.

In the latest community release 3.4b, Alfresco has come up with three new portlets as part of the Share distribution.
  1. Repository Browser
  2. Site Document Library
  3. My Document Library
These are more popularly called as Share DocLib portlets.

Some of the important capabilities of these portlets are -
  • Create Content, Create Folder, Upload
  • Navigate Breadcrumbs, RSS Feed, Hide/Show Folders
  • Simple/Detailed View
  • Filters - All Documents/I'm Editing/Others are Editing/Recently Modified, Recently Added, My Favorites
  • Hierarchical folder browsing
  • Tag browsing
  • Simple Document Details Page
  • Document Details Page including all existing standard Document Actions, Version history, Commenting
  • Edit Document Metadata
  • Simple Folder Details Page (Popup)
  • Folder Details Page - All existing standard folder actions
  • Edit Folder Metadata
In this tutorial, we will explore the steps to deploy these portlets in Liferay.
This is what it would look like.


  • Liferay 5.2.3
  • Alfresco 3.4b
  • Tomcat 6.0.18
  • MySQL 5
  • Windows 7
  • JDK 6


Assuming you have Tomcat bundle of Liferay up and running (you can download from here), download Alfresco 3.4 packages.


  1. Unzip the downloaded alfresco 3.4 bundle, three folders will be there - bin, licenses and web-server.
  2. Copy the contents of bin folder in \tomcat-6.0.18\bin folder.
  3. Copy the contents of licenses folder in the license folder .
  4. Copy the files of web-server\endorsed folder in \tomcat-6.0.18\endorsed folder. You can create the folder in case it does not exist.
  5. Copy of the files of web-server\lib folder in \tomcat-6.0.18\lib folder.
  6. Copy the contents of web-server\shared folder in \tomcat-6.0.18\shared folder. Create the shared folder if it does not exist.
  7. Create a database in your local MySQL server named alfresco. Create a user named alfresco with same password; and give the user all permissions to the new database.
  8. Open the file from \tomcat-6.0.18\conf folder in your text editor; and put the value of shared.loader as ${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
    The line should look like
  9. Copy the web-server\webapps\alfresco.war file in tomcat's webapps folder - \tomcat-6.0.18\webapps folder.
  10. Now start your tomcat server (we haven't deployed share yet) . The server might take a few minutes to start up. Both liferay and alfresco should be deployed. The bootstrap should create tables required for alfresco to run in your MySQL database. Once the server is up and running, you can access Liferay portal as well as Alfresco Web Client application in your browser.
  11. Now copy the web-server\webapps\alfresco.war file in your liferay's deploy folder. This should ideally be located in parallel to your tomcat-6.0.18 folder.
  12. In the tomcat server log, you will be able to see that the share application is being deployed in the server.
    Notice the following log information properly appeared. This means your share portlets have been recognized and deployed by liferay.
    INFO [PortletHotDeployListener:227] Registering portlets for share
    INFO [PortletHotDeployListener:351] 3 portlets for share are available for use
  13. Once the deployment is done, we are just a few steps away. We need to configure the permission model of the alfresco and share application - so that the portlets can properly run in liferay. Stop the tomcat server.
  14. Rename the file as (in folder \tomcat-6.0.18\shared\classes); and open the file. Append the following two lines at the end of the file.

  15. Then open the share-config-custom.xml file from\tomcat-6.0.18\shared\classes\alfresco\web-extension folder, and append the following lines

    <!-- Overriding endpoints to reference a remote Alfresco server -->
    <config evaluator="string-compare" condition="Remote">

    <name>Alfresco - unauthenticated access</name>
    <description>Access to Alfresco Repository WebScripts that do not require authentication</description>

    <name>Alfresco Feed</name>
    <description>Alfresco Feed - supports basic HTTP authentication</description>

    <name>Alfresco Connector</name>
    <description>Connects to an Alfresco instance using cookie-based authentication</description> <class>org.springframework.extensions.webscripts.connector.AlfrescoConnector</class>

    <name>Alfresco - user access</name>
    <description>Access to Alfresco Repository WebScripts that require user authentication</description>


  16. Restart your tomcat server, once the server is up, open Liferay portal, log in as Administrator, try to add new portlet. In the available portlet list, you will be able to see a new group named Alfresco and three portlets available there.

You can add any of the portlets from here and test the functionalities. You have got the full alfresco share document library features in your portal!

Tuesday, November 23, 2010

Site create permission restriction on 3.4

Alfresco guys has been broadcasting about restricting Site Create permission to users. Earlier all users could create Site on their own. There was no feature or permission set to control who can create Site and who not.

However, in 3.4, they have introduced a mechanism to restrict this.

But is this solution good? This mechanism was there since long, this is not new in 3.4. However, in 3.4 you can manage this using Share interface - no need to go to the Web Client. What you need to do is to revoke the Contributor privilege from EVERYONE from Sites parent folder, and when a normal user tries to create a site, a nasty error is presented. It would have been better if the Create Site link itself disappear in case a user does not have permission to do so.

Thursday, September 16, 2010

Looking forward for OSIdays...

Going for a Panel Discussion on Open Source CMSs in OSIdays at Chennai. 19, 20, 21 Sep 2010.

Expecting tough competition from Drupal people... not surprisingly.

Sunday, September 12, 2010

Alfresco 3 Cookbook... progressing

Sent first couple of chapters for review to Packtpub. Looks Ok. I expected at least some feedback etc...

Curiously waiting for the dates of launch...

Monday, August 30, 2010

My First Book by Packtpub!!

Well, well, started writing my first book.
It is a Cookbook - for Alfresco 3.
Packtpub is the publisher for me.

Just completed the formalities a month earlier or so. It has been a very good experience till now working with the competent and understandable team of Packtpub. We signed the contract after a few initial glitches with my lawyer.

This has been my long kept aspiration for writing books. Well now its started. I have quite a number of titles in mind for writing books. Hope the first title starts well, and does well!!

Though have started this journey with a core technical one, I would want to explore non-technical titles as well. During my school days I had drafted a few science fiction plots. That period you read all those stuff, get amazed and react in several different ways. Well, I drafted some sci-fi's!!

Lets see how this journey keeps up...

Saturday, January 9, 2010

Building Solutions on top of Alfresco

Alfresco offers several products from its entire solution framework such as Document Management, Web Content Management, Collaboration. Furthermore, and more powerfully it offers the Content as Platform and Service.

This makes building your own business ready solution development very easy. As said in there area few features that developers like - what Alfresco has successfully achieved is exposing most (if not all) of its functionalities as REST services over HTTP. The source code bundle of Alfresco comes with around 300+ REST services, using which developers can very quickly implement a new solution altogether, and can integrate Alfresco in existing stack in a very loosely coupled SOA based architecture.

There are several models of building solutions on top of and using Alfresco. I will discuss one of the models here. It uses Alfresco REST services (more popularly known as Web Scripts).

In this model, Alfresco would act as a Content Database exposing various services and APIs to architect and develop solutions on top of it. Several services has been exposed such as Content (Nodes), Workflow, Rules, Security, Session, Thumbnail, Content Model etc. More importantly these services has been exposed as JavaScript API ( making it very easy for developers to implement different functionalities.

Using several JavaScript and/or Java services and APIs provided by the Alfresco engine, we can create REST services which can be invoked by any Client Application (irrespective of underlying technology on which the client application is implemented). In this way, we can implement a new client application altogether or we can add Alfresco's rich CMS and other functionalities in any existing systems.

This methodology can be also used in order to implement SOA architecture based systems in existing infrastructure.