Welcome

Experiences with JSR-170 and Alfresco, Part I

Nowadays, I have found chance to read about Java Content Repository API specification aka JSR-170 and play with Alfreco which is a nice implementation of it.

More specifically I have focused on developing a wiki model using content repository constructs available in the Alfresco. It is obvious that contents which are hierarchical in nature, eg. wiki systems, have a very nice fit within JSR-170 concepts. More will come about that wiki model later, for now I want to mention about some initial observations related with Alfresco Content Management System.

First of all, I admit that they have nicely introduced aspect oriented programming concepts into their architecture to dynamically add and remove behaviours to the content types. You have basically two different ways to declare new types. The first one is the static way. Your content type can inherit from one of parent content types available in the model.

 <type name="wiki:entry">
  <title>Wiki Entry Base</title>
  <parent>cm:content</parent>
  <properties>
        <property name="wiki:category">
              <type>d:text</type>
              <multiple>true</multiple>
        </property>
  </properties>
</type>

For example wiki:entry type inherits from parent type cm:content. It is similar to inheriting from a Java class. By that way, you inherit all the properties and behaviours of your parent type. But what about if you want to introduce additional behaviours in your custom type even during runtime? They have employed AOP to overcome this problem. For example, we want to add versioning behaviour in our wiki:entry type in addition to the cm:content. To do that we add an aspect into our type definition.

<type name="wiki:entry">
  <title>Wiki Entry Base</title>
  <parent>cm:content</parent>
  <properties>
        <property name="wiki:category">
              <type>d:text</type>
              <multiple>true</multiple>
        </property>
  </properties>

  <mandatory-aspects>
        <aspect>cm:versionable</aspect>
  </mandatory-aspects>
</type>

cm:versionable is a pre defined aspect in content model of Alfresco. It has properties like, version label, version no etc. Whenever a new node with type wiki:entry is created that aspect is applied, and those properties and any other behaviour applied to that wiki:entry instance. You can even programatically add and remove such behaviour into your nodes.

In summary, I am happy to see AOP concepts in action other than basic logging and tracing AOP samples and classic Spring interceptor practices.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.