You are here

Alfresco, WebScripts and SpringSurf: An Overview

One of the great selling points of Alfresco was that if you want to do something a bit different, there's probably a way to do it. In the past this has been via Java APIs and whilst they are still there and still very powerful, there's a new kid on the block that is shaking things up a bit.

Webscripts were introduced in 2006 and have gone from being a useful little addon to being the main focus of Alfresco development. So much so that Alfresco are pouring hundreds of hours of development time into a new framework called SpringSurf (previously just Surf) that utilises the power of webscripts.

What exactly are the benefits of using webscripts I hear you cry. Well first and foremost, the learning to curve for picking up webscripts compared to Java is far lower. Webscripts are based on JavaScript (or ECMA Script for the hardcore amongst you), so if you have any previous knowledge (as most web developers will have) then you are hitting the ground running. In saying that, getting your first webscripts off the ground is no trivial matter in some cases. Getting your head around exactly how to interact with the repository via the JavaScript API, what root scoped objects are available and exactly how to present information back through Freemarker templates (yup, yet another open source technology) is not for the faint of heart.

However webscripts are more than just a nifty little tool to make web developers lives easier. Alfresco have created a script framework called SpringSurf. This project was originally code named Surf, but Alfresco in their wisdom have turned it over to the Spring community for development. SpringSurf allows you to build you own custom application that makes calls to an Alfresco repository (or any CMIS compliant repository) and the great thing is that it doesn't need to be hosted on the same server as your Alfresco repository. You can think of it in the classic LAMP sense (Linux, Apache, MySQL, PHP). Your SpringSurf application are like your PHP files, Alfresco acts like a MySQL database by storing data, with it all being run by Tomcat (or other similar servlet/JSP container) acting like your apache httpd server.

SpringSurf uses the well tried and test MVC method of programming (Model View Controller). Your controller does most of the hard computational work whilst handing data retreival over to your Models and then passes presentational information back to the user via the View. It's not the most elegant of frameworks to use it has to be said. For every webscript you will need at least an XML descriptor file and a either a freemarker template. Any information retrieval gets carried out in an additional javascript file. I wont even get started on the complexities of getting an application running and binding components to regions via XML descriptor files and naming conventions.

There is huge potential for SpringSurf to become a major player. As the knowledge management sector becomes bigger and bigger, more and more we'll need to be storing our documents and files in some kind of Document Management System. As we move to that, organisations will want to customise the capabilities to suit their enviornment, rather than trying to use a one size fits all product. However, SpringSurf has a major drawback which is holding back widescale community buy in.

It's still young, and it's still changing. For those who first got their hands dirty with Surf from Alfresco, SpringSurf introduces some changes in the way things are done. Documentation is still very poor, examples and tutorials are sparse at best, and community participation in the SpringSurf forums just isn't there at present. Thankfully those taking the lead on SpringSurf have recognised their failings in this department and are working on boosting these areas. And that in essence is the great benefit of a system like Alfresco. The developers actually listen to their users and react to the issues being raised. I have to give much praise to the likes of Mike Uzquiano at Alfresco who very kindly helped me with some issues I was having and listened to my many moans.

SpringSurf is currently available in its milestone 3 release which was originally planned as the final milestone before becoming an official release. However because of community feedback they are going to make an M4 release as well, which is hopefully due in the not too distant future. This will hopefully address some of the failings identified above in relation to ease of use and speed of development.