Showing posts with label Alfresco. Show all posts
Showing posts with label Alfresco. Show all posts

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.

Tuesday, June 19, 2007

Problems exporting content

The export process seemed to work fine, until I took a close look at the actual exported XML.

It appears that the actual content is stored in a binary format, which prevents adjustments within the actual HTML itself, like references to content stored in the same repository.

To try to circumvent this, I changed the cm:content property of the cm:content type, as defined in alfresco's contentModel.xml, to d:text instead of d:content, but this gave the following error:

11:11:58,926 ERROR [Utils] A system error happened during the operation: The node property must be of type content:
  node: workspace://SpacesStore/221a7c69-1e45-11dc-a1bf-4985acca4591
  property name: {http://www.alfresco.org/model/content/1.0}content
  property type: {http://www.alfresco.org/model/dictionary/1.0}text

So its time to create our own model for alfresco.

Monday, June 11, 2007

Exporting content from Alfresco

The JCR defines a standard format for importing/exporting content: the system view mapping. So how can I export a particular node from alfresco as final part of a work flow?

First I need to create a simple work flow in alfresco that allows me to edit content and then mark that content for publication. In alfresco I created a space to contain draft content and a space to contain to be published content. I added a rule to the draft content space that allows the author to submit content for publication, this rule copies the selected content item to the publish space.

I added another rule, this time to the publish space, that activates the publication process. For this a custom alfresco 'action' is developed that exports the selected node to an XML stream that complies to the JCR system view.

The resulting XML stream must be converted because it contains e.g. node types that are not supported on the serving repository. So these node types must be converted into supported node types.

The conversion is implemented using the Java rules engine API (JSR-94). This API defines how rules engines can be acquired and used, it does not describe how rules are defined.

Using the Java rule engine API allows changing the rules engine without the need to change the code. For starters I chose JBossRules as rule engine.

Publishing content

The company I am currently working for wants its new website implemented using a JBoss Portal system.
The current website uses Apache Lenya as CMS but with a nightly export to static HTML pages. This prevents instant publishing of single items.
Some of the entry pages contain lists showing recently changed items, news items etc. These lists are handcrafted while based on certain criteria, these lists could be generated automagically.

Other area's of the companies presence on the internet provided web applications like my.epoline and esp@cenet, these applications, and others, need to be part of the main website, hence a portal solution is chosen.
Based on some demo content, portlets have been developed that shows the content and provides means of navigating through the content.

In the architecture it has been chosen that each portal server instance will have its own dedicated read only JCR compliant repository (A.K.A. the rendering repository), physically separated from the CMS's repository (A.K.A. the authoring repository).

Since content written by authors in the end will have to enter the rendering repositopry, we need a process that takes care of that, the publication process. Currently I am working on that publication process.

As CMS system we have chosen alfresco. So my first task is to get alfresco up and running on JBoss on my dev box.

Since I don't like prepackaged downloads, I downloaded the war file package of alfresco 2.0, the alfresco sdk and the alfresco WCM package.
I wanted to create a dedicated JBoss server instance for alfresco so I copied the default server configuration and named it alfresco. I dumped the war file in JBoss's deploy directory, changed the database configuration following the database configuration topic at alfresco wiki.

The app server started up fine, so far so good...

Next thing, exporting content, is the subject of a future posting.

CU then