Category: Alfresco

Alfresco open source content management

New Alfresco tutorial on implementing custom behaviors

I’ve written a follow-on article to “Alfresco Developer: Working with Custom Types”. This one is on implementing custom behavior. In the new article (with accompanying source code), I build on the SomeCo Whitepapers example by adding support to the content model for user-contributed ratings of whitepapers. The custom behavior is used to calculate the average rating for each piece of rated content.

My plan is to follow on shortly with an article that shows how to use Alfresco’s new REST-based Web Script framework to enable the front-end to rate (and get the rating of) content in the Alfresco repository.

So take a look and let me know what you think.

More about the Alfresco Developer Series.

Alfresco 2.1 Enterprise is available

Looks like Alfresco 2.1 Enterprise is now available. Congrats, Alfresco. I know you’ve been very busy since the Community release of 2.1 a couple of months ago getting the Enterprise release ready.

We’ve been implementing an Alfresco WCM solution for a client on the west coast this summer based on the 2.1 code. We’ve been pleased with the new release and with Alfresco’s responsiveness to Jira issues we created as we uncovered the inevitable bugs in the beta builds.

The web content publish date/expiration date functionality and the web script framework (roll your own REST API) are probably the most significant 2.1 features leveraged in the solution.
At some point I’ll probably be able to do a case study or a podcast on what we built. Until then I will say that the solution leverages Alfresco’s document management capabilities, web content management capabilities, and a client-built, custom application loosely-coupled with the repository through REST. The strengths of each of those sub-systems is leveraged to achieve the overall set of business requirements.

This approach of letting individual parts make up the solution rather than trying to implement a monolithic WCM package that is responsible for every aspect of a web site worked very well for this particular client. Alfresco was a good fit specifically because it doesn’t try to handle both the content management and the content presentation. Instead, it focuses on being a solid repository with lots of options for integrating the repository with other systems. It is this separation from the presentation layer that really distinguishes Alfresco from other open source content management systems. The ease with which solutions can be built on top of the repository is what distinguishes it from proprietary content management systems. (That and the licensing model).
While I’m thinking about it, one side note on the web script/REST framework. I’ve seen some analysts and even John Newton mention Alfresco’s new REST-based functionality as “architecture”. I don’t want to diminish the value of the web scripts framework–it is a great way to set up an API for other apps to leverage without the heaviness of a SOAP-based service call. But to call it an “architecture” or to imply that something was fundamentally changed in how Alfresco works is a bit much. I really see it simply as an additional–albeit powerful and flexible–way to work with the repository.
It may seem like hair-splitting but when I saw an analyst (sorry, I’ve misplaced the reference) voice concern over Alfresco “moving to a new architecture” it seemed like maybe Alfresco had over-played it a bit. At the end of the day, the new REST framework is a great tool that you might choose to leverage or you might not. If Alfresco refactors some of its web client to use it, great. If other projects like Liferay decide to build integrations with Alfresco based on the REST framework, that’s a good thing too. But people shouldn’t get the impression that Alfresco has changed anything fundamental about the repository with the addition of this new framework.

New Alfresco tutorial on working with a custom content model

UPDATE (2012): I’ve recently published a second edition of this tutorial that updates the original with Alfresco Share and CMIS.

UPDATE (2014): I’ve moved the tutorial and the source code to GitHub. The HTML version of the tutorial is here. It has been updated for Maven and AMPs.

I’ve written a new article (with sample files) that talks about how to extend Alfresco with your own content model and how to work with content that leverages that model via the Web Services API. All of the examples are written in Java but I do include one in PHP just for grins.

Most of the code is based on the Alfresco SDK Web Services sample code, but I’ve tweaked it here and there and I break it down into smaller chunks with commentary. I also think it is good to have one example to follow that takes you from designing the content model to implementing it to writing code that might leverage it.

More about the Alfresco Developer Series.

West Coast Alfresco/Liferay Meetup July 18th

I’m terribly disappointed that I won’t be able to make it, but I wanted to pass it on: There’s an Alfresco/Liferay Meetup in Ontario, California on July 18th. The format will be a collection of small roundtables. It should be a great opportunity for people who are exploring Alfresco and Liferay (together or separately) to learn more and for others to share their knowledge and experiences. If you are on or near the West Coast you should check it out. Learn more and sign up at http://web.meetup.com/44/.

Alfresco-LDAP integration notes

Getting Alfresco to authenticate against LDAP is a pretty straightforward task that’s documented on the Alfresco wiki. But this week I’ve had to play around with a few specific implementation details beyond just users in a directory with plain-text passwords and simple authentication. Here are some rough notes that might save others some time.

Alfresco-LDAP notes

  • If “admin” is still your administrative user, don’t forget to set up a corresponding entry for the admin user in your LDAP directory.
  • “Simple” authentication works when OpenLDAP stores either plain text passwords or MD5 passwords (Base64-encoded). If your MD5 passwords happen to be in hex you can convert them to Base64 using your favorite programming language. I used perl.
  • “DIGEST-MD5” authentication works when OpenLDAP stores plain text passwords but I could not get it to work when using MD5 passwords.
  • “DIGEST-MD5” authentication only works when OpenLDAP is configured to support DIGEST-MD5 as a SASL mechanism. Query the LDAP server’s “Supported SASL Mechanisms” property to see if DIGEST-MD5 is listed.
  • If you are compiling OpenLDAP from source, you must configure it with the –with-cyrus-sasl flag. In order to be able to do this, you must already have Cyrus SASL installed.
  • There are two ways user home folders can get created: (1) When a user logs in for the first time, but before a user sync has occurred or (2) When a user sync occurs. How the user folder gets created is configured differently in each case. In the first case, the bean referenced by the defaultProvider property of the homeFolderManager bean configured in authentication-services-context.xml is used. For the sync, the cm:homeFolderProvider key value in the ldap authentication context XML file references the HomeFolderProvider bean. If you want the behavior to be consistent, you’ll need to make sure to point to the same HomeFolderProvider bean in both places.
  • There are several HomeFolderProvider beans configured OOTB. For example, the userHomesHomeFolderProvider bean creates the user’s home folder as a folder under User Homes named using the user’s user ID.
  • If you want to store a password in SASL’s database, use saslpasswd2 -c
  • If a user does not exist in SASL’s database it will look for the userPassword attribute in the LDAP directory.
  • You must add authz-regexp entries to slapd.conf to map the SASL authorization requests to actual LDAP entries.
  • Once your openldap server is running with SASL enabled, you may need to use the -x command-line switch when using things like ldapsearch, ldapadd, and ldapmodify if you still want to use simple authentication.

If I get some time I may reorganize these rough notes into an easier-to-follow step-by-step setup guide.

Using Alfresco’s PHP API

Alfresco is starting to incorporate more and more PHP into the platform. This is exciting for us at Optaros because we’ve built some great PHP-based solutions for clients and we’ve had a lot of success with the productivity PHP brings to front-end developers. But, the PHP world lacks an enterprise ready, highly-scalable, robust content management repository.

Now hold on! Hear me out. Projects like Drupal and Joomla are great for certain types of requirements. There are many large, extremely high-volume sites built with Drupal. What I’m talking about is something more generic. Something that makes zero assumptions about the presentation. I’m talking about a back-end repository for rich content plus the back-end “library services” typically associated with document management systems such as workflow, versioning, security, extensible data model, etc. Think “Zope” without the ZODB that can run in any servlet container.
Alfresco has had a PHP API for a while but until today I hadn’t had a chance to do anything with it. On the plane home from Boston today I decided to take it for a spin (details at the bottom of this post).

Using PHP with Alfresco

If you want to write PHP applications that leverage content in Alfresco you can do that today with the PHP API. The PHP API leverages Alfresco Web Services. I have not yet confirmed whether you can do everything with the PHP API that you can with the Java-based Alfresco Web Services API but theoretically you should be able to. And, if you want to write your own Alfresco-centric web services you can–you could deploy them in the same Axis container as Alfresco’s and then hit them with PHP.

If you want to manage a web site using Alfresco WCM that uses PHP you can do that today. But when you use the Alfresco Virtualization Server your PHP scripts won’t run because the Virtualization Server is a customized version of Apache Tomcat and it doesn’t know how to run PHP. Alfresco may address that in the near future.

If Alfresco expands the use of PHP within the product, Alfresco may become more than just an ECM suite–it could become a powerful platform for Next Generation Internet applications. Until then, the next time your PHP application needs a loosely-coupled content repository, consider standing up Alfresco and hitting it with the PHP API.

Trying out the Alfresco PHP API

Once you get all of the pieces together it isn’t that hard to run the Alfresco PHP samples. But it’s not extremely well documented so I’ve included some pointers here. My stack is Ubuntu Dapper Drake, MySQL, Alfresco 2.0 Enterprise, PHP 5.2.1.

  1. Download PHP 5 from http://www.php.net. Follow the directions for building, configuring, and making PHP. When you configure php, make sure to include the –enable-soap flag. You’ll also need to uncomment the extension=php_soap.dll line in your php.ini file.
  2. Use Pear to install Pear::SOAP and its dependencies. (UPDATE: Per Lukas’ comment below, this step is not needed.)
  3. The Alfresco PHP API on the community download site is still at version 1.2. The latest and greatest Alfresco PHP API can be found in the source tree under “modules”.
  4. Follow the instructions in modules/php-sdk/source/php/remote/installation.txt to set up the samples. (See below for how my files were set up).
  • Created a directory called /usr/local/lib/alfresco.
  • Created an alias and a Directory entry in httpd.conf that points to /usr/local/lib/alfresco per the installation.txt file.
  • Copied the contents of modules/php-sdk/source/php/remote to /usr/local/lib/alfresco.
  • Added /usr/local/lib/alfresco to my include_path in my php.ini file.

If your Alfresco repository is running and you’ve restarted Apache with the updated httpd.conf and php.ini, you should be good to go. On my system, I can check /var/log/apache/error.log to troubleshoot. If everything is okay, when you point your browser to http://localhost/alfresco/Examples/SimpleBrowse you will see a list of the spaces and content in your Alfresco store. You can navigate the list, open documents, etc.

The other example is the QueryExecuter example. It performs a full-text query and presents a node list of the query results.

Both of these are very simple examples but by looking at the code, the PHP API source under the Alfresco directory, and the Alfresco Web Services SDK, you should be able to see how you can incorporate Alfresco into your PHP-based application.

Excellent turnout for 1st Alfresco Meet-up

Over thirty people showed up for the first-ever Alfresco Meet-up today at the Christian Science Monitor in Boston. Russ Danner, Christian Science Monitor developer, opened up the day with a short overview on Alfresco. I then led a short discussion on Alfresco as a platform which included talking about what Alfresco should and shouldn’t be used for. (Here‘s my deck. I’ve made small tweaks for clarification purposes.) Sumer Jabri, a consultant from D.C.-based Rivet Logic, drilled down on the Alfresco architecture. Sumer did a great job.

As is often the case, the most valuable tidbits came up during the roundtable discussion at the end of the day. Russ led the discussion but several others, including both integrators (Optaros, Eyestreet, Rivet Logic) and end-users (Shimano, MIT, Harvard, Kaplan), participated. The liveliest topic was why Alfresco WCM was rolled out without a practical static content deployment approach. Other topics included Liferay-Alfresco integration, JCR, and plans for future Meet-Ups.

Multiple participants said they were interested in seeing more case studies from production implementations. Everyone agreed the session was valuable. Thanks again, Russ, for putting it together.