Showing posts with label webscripts. Show all posts
Showing posts with label webscripts. Show all posts

Tuesday, December 16, 2008

Book review : Alfresco Developer Guide

You think you are an Alfresco expert ... well, read this book and think again. This is actually my conclusion and I was thinking about only having that sentence in this review, because while reading this you are wasting your precious time as you could read the Alfresco Developer Guide.

For sure this is not a book for "Java enterprise" novice people and some knowledge and understanding of the Java enterprise stack is required to fully enjoy your reading time. Since I am working with Alfresco for more than 3 years now, I had some development habits that sometimes were not that good, which I realized after reading this book.

You know or you heard about JBPM, the workflow engine Alfresco is using, it is not a problem, a complete guide is explaining all you need to know to start writing your own flow and to get it deployed. Creating your application model, customizing actions, localizing your messages ... nothing is a secret any more.

If you want to learn how to get all the benefits out of your "electronical" content then check out the "chapter 4" and see how to add your own content extraction, create business specific content transformation or use Alfresco's Java behavior cut points. After all, an enterprise solution should be able to provide easy integrations with other systems, especially for SSO and LDAP - you want it, Alfresco's has it, Jeff Potts explains it.

If you are still fan of JSF than you could learn how to customize the default Alfresco User Interface, which is JSF based or learn how to write a custom UI using the webscript framework.

Jeff also helps you to bring some best practices in your Alfresco development and deployment lifecycle. However, I would prefer to see some more words about Alfresco Module Packages.

This book was published just before Alfresco 3.0 Enterprise edition was released and is based on Alfresco 2.2 and 3.0 Labs (or community version). Alfresco did some refactoring but nothing was changed that should bother you. Do not be afraid of getting the book as this is probably the best Alfresco book written for developers by a, more than professional, developer.

Alfresco's ECM capabilities are explained by example but you would like to see Alfesco's WCM possibilities, simply check the "chapter 8" and you will find anything you need to start using it.

Do you still think you are an expert ? :) I do not ...

Book details could be found at http://www.packtpub.com/alfresco-developer-guide/book

Wednesday, April 16, 2008

Alfresco webscripts with Groovy

After being a little bit disappointed about using Grails in Alfresco (see my post below), I decided to see how could Alfresco be integrated with Groovy.

Alfresco introduced a while ago the "webscripts", with that they added a powerful scripting API based on JavaScript and the Rhino engine. When you add FreeMarker templates to that, what you could get is a nice output that you could customize to be some JSON data, XML or whatever suites you. That is amazing but I was not that happy as we have to wait for Alfresco to expose more of their services via the scripting API. Adding Groovy capabilities to any application and not only to Alfresco seems "natural" and I think that it helps in prototyping without having to recompile.

I took the groovy.servlet.GroovyServlet implementation and added a few lines that allows to configure a Spring bean as servlet parameters and to make them available in the groovy scripts.
The code is not yet published somewhere as a forge project but you can find it here. All you have to do is have Spring and Spring MVC on your classpath (Alfresco already has it) add Groovy libraries (groovy-all is a good solution, at least version 1.5.x) and configure your web.xml with the Groovy servlet that I am providing, an example could be found here. That example is using spring's DispatcherServlet but you could use the GroovyServlet as any other servlet, directly in your web.xml. If your are also using the DispatcherServlet then you have to configure it correctly as shown here.

Once you are done with those configuration just add the desired beans to the servlet configuration and you are on "rails" with Alfresco.

The samples provided here are using the ServiceRegistry bean and it is mapped in Groovy as registry, so to get any other Alfresco service you have to start from there. But you are free to map whatever bean you want.

Although, some people are saying that there are problems using Alfresco beans with Groovy, I did not have those problems till now, but I am not saying it will happen.