domingo 15 de febrero de 2009

Hands on with Alfresco WCM

Recently, during a pre-sales meeting, I was asked to prepare a demo of Alfresco's Web Content Manager solution. They were interested in a product that could ease the work with the static part of the web. Basically, they needed a tool to generate dynamic content that could then be exported to static HTML resources served by an Apache. In Alfresco this means filling templates based on web forms.


I hadn't touched Alfresco since version 2 so I was glad with the opportunity. As a matter of fact I hadn't ever even launched the WCM module as I've been always more interested in the Enterprise Content Manager (the document manager). But Alfresco is growing fast in this space and now has an important set of tools (in beta) like Studio or Share that handle this kind of environments.

All in all, Alfresco WCM is pretty complete. In fact, it only has a weak point, the total lack of useful documentation (not commercial pamphlets). I guess this is a corollary of the OSS business model they've chosen. Sometimes community support just means exactly that, COMMUNITY SUPPORT.

So, let's make the platform work in some quick steps!

The first thing to do is to download the latest nightly build of Alfresco Labs 3 from http://dev.alfresco.com/downloads/nightly/dist/. The nightly build has been more stable than the promoted versions in my tests. Go figure. I'm assuming you have MySQL working already here (if you don't, install it first). Once downloaded just install it (keep the defaults except, may be, the OpenOffice integration tools).

Unfortunately, this version is affected by a notorious bug that impedes rendering content from a XForm (and hence publishing anything useful). A custom build of the web-client JAR file is required. To do it check out the HEAD revision from their repository (svn://svn.alfresco.com/alfresco/HEAD) and modify two source files as explained in http://forums.alfresco.com/en/viewtopic.php?f=30&t=7467&st=0&sk=t&sd=a&start=15. Build just by issuing an ant command. Keep the generated JAR.

Download now the deployment module from http://sourceforge.net/project/showfiles.php?group_id=143373&package_id=157460. This one is needed to publish generated content in a file system (even if local).


It should be installed inside /deployment. Once installed modify the application context XML file and indicate the target directory.

<property name="targetData">
   <map>
      <entry key="default">
         <map>
            <entry key="root"><value>C:/../Apache/htdocs</value></entry>
            <entry key="user"><value>admin</value></entry>
            <entry key="password"><value>admin</value></entry>
            <entry key="autoFix"><value>true</value></entry>
         </map>
      </entry>
   </map>
</property>

Start Alfresco for the first time using the alf_start script. It will generate the database schema and explode the application(s). Stop it and replace the WCM JAR with the one built from Subversion (in WEB-INF/lib).


The installation is complete (for now). To start Alfresco follow this steps:
  • Start the Tomcat virtual server support executing virtual_start script
  • Start Alfresco using alf_start script
  • Go to the deployment folder and start the server with deployment_start

The login console is available now in at /alfresco. The Web Projects space should be available under the Company Home menu option.


A new web project can now be created. Everything should be working so you can add a test server,


some web forms (the "extras" folder in the Alfresco installation includes several XSD and XSLT templates)


and/or the default workflow.


A nice addition to any installation today is docasu, a web/desktop (AIR based) UI to the Alfresco repository with a focus on easier document handling.


To install it, once again, checkout from SVN at http://code.optaros.com/svn/docasu/branches/docasu-on-air
and follow the instructions at their wiki. Basically you need to build the plugin, copy it to the amps folder in the Alfresco installation and execute the apply script (if the generated WAR does not include the modified web client JAR override it again). The desktop app requires an additional step (two if you don't have the air SDK already). I had to modify the exec task in the ant build file to include the complete path and manually download the mnt jar (from sourceforge) though. Once done, double click the icon in your installation directory and login to http://localhost:8080/alfresco. Just the same as with the web client!