Monday, July 16, 2007

Using Alfresco's WCM

Alfresco is supplying a nicely looking evaluation guide for using their Web Content Management package.
After briefly giving an overview of the Web Content Management Package, a scenario can be followed along while reading.
The scenario describes using Alfresco WCM with a couple of different users, each having a different role in the system.



I followed this scenario from creating new users and assigning roles to them, creating a new web project, creating new web forms for the project, etc. until I came to the point of creating new web content. When trying expand the list of web forms next to my sandbox, I stumbled into a NullPointerException:


So a good citizen of the open source world, I immediately went to Alfresco's issue tracker and found a report about this issue (WCM-486).


Sadly this prevents me from finishing the scenario, So today I will see if the issue report can help me fix this on my system.

Thursday, July 12, 2007

How to setup a WCMS

OK I am going to try to setup alfresco 2.0 WCM on JBoss AS using Hypersonic SQL as database.
I am using HSQL because the can easily be zipped and distributed to fellow developers.

As usual I'll first create a dedicated server configuration and name it alfresco20, this instance can be started using <jboss-root>/bin/run.sh -c alfresco20.

Upfront I know that the alfresco.war must be deployed exploded in JBoss. So the war file is unzipped into <jboss-root>/server/alfresco20/deploy/alfresco.war.

Two issue's arise immediately:
  1. Alfresco has a version of log4j packaged in the war, this generates ClassCastExceptions, so the log4j is removed from alfresco.war/WEB-INF/lib.
  2. The log4j configuration in JBoss lacks a root logger, and alfresco generates a lot log messages, so I opened <jboss-root>/server/alfresco20/conf/log4j.xml, and added <level value="warn"/> to the <root> element.
Configuring HSQL as database for alfresco is properly documented at the alfresco wiki, I know because I did it myself ;-)

When starting JBoss, after quite a while and a lot of warn and info log messages on the console, the server is started. Checking the base functionality at http://localhost:8080/alfresco shows the login page.
But this merrily is alfresco's CMS not the WCM version, so stop the server again, either via the jmx-console or using Ctrl-C.
According to the readme that comes with alfresco's WCM, the wcm-bootstrap-context.xml file needs to be placed in the <jboss-root>/server/alfresco20/conf/alfresco/extension directory.

That should be it, unless the website preview feature is needed. For now lets first try if this works as suggested. After starting JBoss again using the above command, the server starts without a problem, and when browsing to the alfresco page, I get presented with the login screen. So the JBoss server appears to be working fine.
Now lets start the virtualization server.

Out of the box, the virtualization server did not need any configuration and it started without any problem. Great.

Now I want to evaluate the functionality supplied, but that'll have to wait till next time.

Wednesday, July 11, 2007

Alfresco Content Package

One of my colleague suggested to look at ACP, Alfresco's content package. This could be useful in the publication of content from one repository into the other, but we have a JCR compliant repository on the published end, not necessarily an Alfresco repository.

An ACP package is a zipped directory structure, that has the extension '.acp'.
When doing an export, an acp file is created inside alfresco itself, in a space that can be arbitrarily chosen.
Besides the target space, the package name must be provided.
The acp file, assuming package as package name, has the following structure:
/package.xml
/package
/content0.html
/content1.pdf
/content2.jpg

The package.xml has a proprietary XML structure and looks like:
<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0">
<view:metadata>
<view:exportBy>admin</view:exportBy>
<view:exportDate>2007-07-10T13:45:02.277+02:00</view:exportDate>
<view:exporterVersion>2.0.0 (build-185)</view:exporterVersion>
<view:exportOf>/app:company_home/cm:Books</view:exportOf>
</view:metadata>
<cm:content xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:wf="http://www.alfresco.org/model/workflow/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:wcm="http://www.alfresco.org/model/wcmmodel/1.0" xmlns:wca="http://www.alfresco.org/model/wcmappmodel/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:wcmwf="http://www.alfresco.org/model/wcmworkflow/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:bpm="http://www.alfresco.org/model/bpm/1.0" xmlns:custom="custom.model" xmlns="" view:childName="cm:index.html">
<view:aspects>
<cm:titled></cm:titled>
<cm:auditable></cm:auditable>
<sys:referenceable></sys:referenceable>
<cm:author></cm:author>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:description>Index page for books</cm:description>
<sys:node-uuid>59d1c1dc-2e12-11dc-8613-e518334e1caa</sys:node-uuid>
<sys:node-dbid>397</sys:node-dbid>
<cm:content>contentUrl=backup\content0.html|mimetype=text/html|size=51|encoding=UTF-8|locale=nl_NL_</cm:content>
<cm:title>Books</cm:title>
<cm:author>Stephen King</cm:author>
<cm:created>2007-07-09T13:48:46.673+02:00</cm:created>
<cm:modifier>admin</cm:modifier>
<cm:modified>2007-07-10T12:15:31.346+02:00</cm:modified>
<cm:creator>admin</cm:creator>
<sys:store-protocol>workspace</sys:store-protocol>
<cm:name>index.html</cm:name>
<sys:store-identifier>SpacesStore</sys:store-identifier>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:wf="http://www.alfresco.org/model/workflow/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:wcm="http://www.alfresco.org/model/wcmmodel/1.0" xmlns:wca="http://www.alfresco.org/model/wcmappmodel/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:wcmwf="http://www.alfresco.org/model/wcmworkflow/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:bpm="http://www.alfresco.org/model/bpm/1.0" xmlns:custom="custom.model" xmlns="" view:childName="cm:DarkTower.pdf">
<view:aspects>
<cm:auditable></cm:auditable>
<cm:titled></cm:titled>
<sys:referenceable></sys:referenceable>
<cm:author></cm:author>
</view:aspects>
<view:properties>
<cm:description></cm:description>
<sys:node-uuid>c0db7bd5-2eda-11dc-96f5-878a8c8564f1</sys:node-uuid>
<sys:node-dbid>404</sys:node-dbid>
<cm:content>contentUrl=backup\content1.pdf|mimetype=application/pdf|size=1366321|encoding=UTF-8|locale=nl_NL_</cm:content>
<cm:title>DarkTower.pdf</cm:title>
<cm:author>Stephen King</cm:author>
<cm:created>2007-07-10T13:43:18.809+02:00</cm:created>
<cm:modifier>admin</cm:modifier>
<cm:modified>2007-07-10T13:43:26.637+02:00</cm:modified>
<cm:creator>admin</cm:creator>
<sys:store-protocol>workspace</sys:store-protocol>
<cm:name>DarkTower.pdf</cm:name>
<sys:store-identifier>SpacesStore</sys:store-identifier>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:wf="http://www.alfresco.org/model/workflow/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:wcm="http://www.alfresco.org/model/wcmmodel/1.0" xmlns:wca="http://www.alfresco.org/model/wcmappmodel/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:wcmwf="http://www.alfresco.org/model/wcmworkflow/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:bpm="http://www.alfresco.org/model/bpm/1.0" xmlns:custom="custom.model" xmlns="" view:childName="cm:Cover.jpg">
<view:aspects>
<cm:auditable></cm:auditable>
<cm:titled></cm:titled>
<sys:referenceable></sys:referenceable>
<cm:author></cm:author>
</view:aspects>
<view:properties>
<cm:description></cm:description>
<sys:node-uuid>cf782d38-2eda-11dc-96f5-878a8c8564f1</sys:node-uuid>
<sys:node-dbid>405</sys:node-dbid>
<cm:content>contentUrl=backup\content2.jpg|mimetype=image/jpeg|size=64599|encoding=UTF-8|locale=nl_NL_</cm:content>
<cm:title>Cover.jpg</cm:title>
<cm:author>Stephen King</cm:author>
<cm:created>2007-07-10T13:43:43.309+02:00</cm:created>
<cm:modifier>admin</cm:modifier>
<cm:modified>2007-07-10T13:43:49.106+02:00</cm:modified>
<cm:creator>admin</cm:creator>
<sys:store-protocol>workspace</sys:store-protocol>
<cm:name>Cover.jpg</cm:name>
<sys:store-identifier>SpacesStore</sys:store-identifier>
</view:properties>
<view:associations></view:associations>
</cm:content>
</view:view>

This view does contain most of the information I need. The jcr system view as exported by alfresco, lacks the mime type, which is included in alfresco's acp descriptor:
<cm:content>contentUrl=backup\content2.jpg|mimetype=image/jpeg|size=64599|encoding=UTF-8|locale=nl_NL_</cm:content>
.

Maybe I am overseeing something, but shouldn't the mime type info be part of JCR's system view as well?

Thursday, July 05, 2007

Custom JCR node types in Alfresco

With the document "Working with Custom Content Types" on my desk, I started to develop my own content model to be used in alfresco.
Naive as I can be, I tried to convert the jackrabbit based cnd into alfresco's content definition. Obviously that failed, alfresco does not support multiple inheritance. Alright, that one can be circumvented.
After deploying, correcting and re-deploying the model until satisfied, I tried to add the model to the web client user interface, but it was not accepted. It appears that if you want to expose your custom content model to the web client user interface, the defined types must extend cm:content or one of its descendants. Sadly this is not mentioned in the named document.