Month: April 2008

My Summer Project: a Book

I’ve been doing a lot of writing lately, but as faithful readers have noticed, it hasn’t been in the blog. What’s the cause of the post slowdown? I’ve taken on a project that I hope you’ll be excited about. This Spring, Packt approached me about writing an Alfresco developer’s guide. Honestly, I went back-and-forth with the idea. Ultimately, it was the encouragement from ecmarchitect.com readers that swayed my decision.

I began writing on President’s Day. I thought the Alfresco Developer Series articles would be a good start and would save some time, and they have, but they represent a relatively small portion of the overall work and I’m doing a fair amount of restructuring of that content. The current schedule has the writing finishing up toward the end of summer with us going to press some time after that.

Optaros is fully behind the project–there’s no way I could do this without their support. Alfresco is excited about it too, although we’re all expecting the timing to be a bit tricky with 3.0 coming out in roughly the same time frame. I’m currently making sure all example code runs on both the latest Enterprise release as well as the latest Community release–we’ll see if I can keep that up. It remains to be seen how much of the new 3.0 web client I’ll be able to cover based on the timing.

So that’s why posts and comment responses have slowed down a bit. I think I’ve caught up on responding to comments (and keep those coming, by the way). If you posted a comment within the last month or so and never saw anything from me, you might have a look to see if I’ve addressed your question, especially on the Web Scripts as Liferay Portlets post, which saw a lot of activity.

Dopplr Counts your Carbon

I’m not sure when they added this, but Dopplr has a new feature that keeps track of your carbon totals by month and year. For 2008, I’m already at 6,000 kilograms. I’ll bet I’m not in Optaros’ top ten. Hey, Optaros, in the spirit of Earth Week, how about making carbon offsets a reimbursable business expense for us road warriors?

Running Alfresco web scripts as Liferay portlets

I’ve seen a lot of Liferay and Alfresco forum posts from people having trouble getting Alfresco running within a Liferay portal. Once that’s done, people usually want to invoke Alfresco web scripts as portlets without requiring a separate single sign-on (SSO) infrastructure. Some people have pointed to the Alfresco wiki (Deploying 2.1 WAR Liferay 4.3). That is a helpful reference but it isn’t the full story. Here are some notes that may help.

1. Download the Liferay 4.3.6 + Tomcat 5.5 JDK5 bundle. I had mixed results with the latest release 4.4.2. You may be tempted to try to download the WAR-only distribution and configure it in your existing Tomcat instance. In this case, save yourself the time and headache and get the bundle. Fool with the WAR distribution later.

2. Unpack the Liferay distribution and fire it up. Make sure you can log in as the test@liferay.com (password: test) user to validate that all is well with the Liferay install.

2a. Create a test user. (“Create Account” on the Liferay login screen). Remember the email address. This will matter shortly. For this discussion I’ll assume Foo User with a screen name of fuser and an email address of fuser@foo.com. Make sure you create a home directory. In this example, we’ll call it “fuser”.

2b. Verify that you can log in as your test user.

3. Shut down the server.

4. Download Alfresco 2.1.2 Enterprise, WAR only. Alfresco 2.1.1 has a known issue (AWC-1686) with the way authentication is handled for web scripts in the context of Liferay so make sure you are using 2.1.2.

5. Expand the Alfresco 2.1.2 WAR into the Tomcat webapps/alfresco directory (which you’ll have to create the first time). If you are tweaking the install (such as pointing to a specific MySQL database, using something other than MySQL, pointing to a different data directory, etc.) make sure you have copied your good set of extensions into Tomcat’s shared/classes/alfresco/extension directory.

6. Copy the MySQL connector into Tomcat’s common/lib directory.

7. Start Tomcat. When it comes up, you’ll have Liferay running and you’ll have Alfresco running, but Liferay doesn’t yet know about Alfresco. Verify that you can log in to Alfresco as admin.

7a. While you are here, create a test user account. You need to create a user account that has an email address that matches the test user account you created in Liferay. In this example you created Foo User with a screen name of fuser and an email address of fuser@foo.com so you need to create an Alfresco user with the same settings. You’ll log in to Alfresco as fuser. You’ll log in to Liferay as fuser@foo.com.

7b. Verify that you can log in to Alfresco as fuser.

8. Shut down Tomcat.

9. Now you need to configure Alfresco as a Liferay plug-in. This involves adding four files to Alfresco’s WEB-INF directory: liferay-display.xml, liferay-plugin-package.xml, liferay-portlet.xml, and portlet.xml. Why aren’t these available in the Alfresco source or on the wiki? Apparently someone tried to address this at some point because there is a link on the wiki but it is broken. Until that’s addressed, I’ve put them here.

10. Remove the portlet-api-lib.jar file from Alfresco’s WEB-INF/lib directory.

11. Re-package alfresco.war. It is now ready to hand over to Liferay.

12. Start Tomcat.

13. Find your Liferay deploy directory. If you are running out-of-the-box on Linux, Liferay’s “deploy” directory is called liferay/deploy and it resides in the home directory of the user who started Tomcat. I’m running it as root so my Liferay deploy directory is /root/liferay/deploy.

14. Copy the alfresco.war you just created into the deploy directory. Watch the log. You should see Liferay working on the WAR. He’s finding the plug-in config files and essentially deploying the Alfresco portlets.

15. Now log in to Liferay using the Liferay admin account (test@liferay.com). Go to a page, then use the global navigation dropdown to select “Add Content”. The list of portlets should appear and you should see the “Alfresco” category. If you don’t, look at the log because something is amiss. Add the My Spaces portlet to the page. You may see an error at this point but ignore it. The problem is you probably don’t have a user in Alfresco that has an email address of “test@liferay.com”, which is the currently-logged in user.

16. Log out.

17. Log in as your test user that exists in both Alfresco and Liferay (fuser@foo.com).

18. Go to the page. You should see the “My Spaces” portlet. You should be able to upload content, create spaces, etc.

Exposing your own web scripts as portlets

All Alfresco web scripts are automatically exposed as JSR-168 portlets, including the ones you create. To add your web scripts as portlets, first make sure you have authentication set to “user” and transaction set to “required” in your web script’s descriptor. Then, update portlet.xml, liferay-portlet.xml, and liferay-display.xml. Follow the pattern that’s in those files already and you’ll be fine. For example, if you deploy the Hello World web script from my web script tutorial, you need to add a new portlet to portlet.xml with a “scriptUrl” like: /alfresco/168s/someco/helloworld?name=jeff. Then you update liferay-portlet.xml and liferay-display.xml with the new portlet name or portlet ID.

Single sign-on with no single sign-on?

The web script runtime has a JSR-168 authenticator. So when your web scripts get invoked by the portlet, the current credentials are passed in. That’s why your web script can run without requiring an additional sign in. Prior to this being put in place, people had to implement Yale CAS (or an equivalent) to get SSO between Liferay and Alfresco web scripts.

What’s not covered in these instructions is that you’ll probably want to (1) configure both Alfresco and Liferay to authenticate against LDAP and (2) change the configuration of either Alfresco or Liferay to use the same credential (either username or email address) for both systems so that if you do have users logging in to both, they don’t have to remember that one requires the full email address but the other doesn’t.

Troubleshooting

If you see one of the Alfresco portlets displaying “Data is not currently available” or somesuch, try hitting
Alfresco in another tab. Log in, then log out. Then go back to the
portal and open the page again. It should work now. I’m not sure what’s going on there. I think it may have to do with me switching back-and-forth between Liferay instances (4.3.2 versus 4.4.2) so maybe you won’t see it.

Open issues

You may see an error like this:

21:22:15,965 WARN [BaseDeployer:1038] Unable to format /usr/local/bin/liferay-4.3.6/temp/20080408212212978/WEB-INF/faces-config-jbpm.xml: Error on line 5 of document file:///usr/local/bin/liferay-4.3.6/temp/20080408212212978/WEB-INF/faces-config-jbpm.xml : A ‘)’ is required in the declaration of element type “application”. Nested exception: A ‘)’ is required in the declaration of element type “application”.

I haven’t chased that down yet. I’ll update this post with a comment when I find out. I’m sure fixing that will also fix the problem that you’ll see if you try to start an advanced workflow from a piece of content displayed in the My Spaces portlet.

I was also seeing an error when trying to use the “Add Content” link in the straight Alfresco client. I think it is JSF-related. Again, I’ll update this post with a comment when it is resolved (or when I find a Jira ticket).

MPXJ is a Java API for Microsoft Project files

Reading Microsoft files from Java code is one of the little joys in life (he said sarcastically, through clenched teeth). I’ve worked with the Apache POI project to do this successfully in the past. I recently came across MPXJ. It sits on top of POI to allow Java developers to manipulate Microsoft Project Exchange (MPX), Microsoft
Project (MPP, MPT), and Microsoft Project Data Interchange (MSPDI) files. The project is at SourceForge.

For readers interested in Alfresco, one thing you can do with this library is use it to create metadata extractors and content transformers for Microsoft Project. The latter enables Project files to be full-text indexed by the Lucene search engine. The MPXJ library depends on the same version of Apache POI that is shipped with Alfresco 2.2 Enterprise and 2.9 Community (Apache POI 3.0.2).

Everex should have gone with straight Ubuntu

I’ve been slowly tweaking the way my family uses their computer to make it easier to migrate everyone to Linux. First, I completely removed Internet Explorer and got everyone used to Firefox. Then, I moved my wife off of her thick email client and onto Gmail. Next, I replaced Office with OpenOffice. Each of those moves was relatively painless. Spreading them out over time helped.

The kids were even easier. When they were younger, they used a lot of PC-based CD-ROM games and educational software. Now ages 6 and 10, they are exclusively into web-based Flash games and virtual worlds. All browser, all the time, although they do seem to enjoy tweaking their wallpaper, changing themes, resetting their passwords, and, oddly, watching the CPU performance graphs. They can out control panel most adults.

Anyway, the spare computer finally became unbearably slow compared to the primary machine and my laptop. I decided I’d get a decent monitor (20″ Dell Ultrasharp 2009W) with a low-end workstation. I went with an Everex gPC2.

I’ve been running Ubuntu for two years, and the gPC’s gOS is based on Ubuntu so I figured it ought to be easy enough for me to support. But I had to do a bit more work than I thought I should based on that fact that this was aimed at the masses. I mean it used to be sold at Wal-Mart for crying out loud. I guess the ideal target end-user is a single user who connects to the net to do absolutely everything. At first blush, my family fits that description. But they also want to share files on the local network. And they want their own login. And they want a decent file manager. And they want to be able to “switch user” instead of logging out to let someone else log in. These are all done effortlessly on Windows and fairly painlessly on straight Ubuntu. On gOS, these seemingly rudimentary feats require additional installs. For those already familiar with Linux, these are fairly simple. But for families without a command-line lover in the house, it would get very frustrating, very fast.

I pushed through it because I’m the only one that has to deal with installation and config. If my family is happy, and if they can get their “work” done without coming to the “help desk”, I’m happy. And at first, my family was excited about the new box. It started up fast, the UI was pretty (my son loved the Mac-ish iBar), and the browser and OO.o worked like they’d expect. After a few days, though, the bleeding edge nature of some of the gOS components started to turn into annoyances:

  • Segment fault messages on every logout meant an extra close the error dialog.
  • Fairly often, Firefox complained that it was already running. (This usually happened when someone had just logged out and a new user was logging in and starting up Firefox.)
  • There was no easy way to mount and navigate Windows shares in the file manager. (I did see a workaround involving Thunar and Fuse but Fuse seemed to be acting a bit fishy–I wasn’t seeing consistent good behavior there).
  • Reported system freeze-ups. (I never saw any of these first-hand).

After less than a week I finally had enough. What was the gOS buying me? Nothing. Instead, it was costing me time. Today I slapped in the Ubuntu install CD and never looked back.

I still think the $199 I paid for the Everex box was worth it. And judging from the partial success of the gOS experiment, the family is definitely not going to miss Windows. I wonder if there is a group of happy gPC2 users still using gOS out there or if Everex would have done better forgoing some of the eye candy and distributing with a straight Ubuntu install.

ScribeFire’s blogging client is sweet

I am totally digging ScribeFire. It’s a Firefox extension that lets me write blog posts without leaving the web page I’m on. It can post to any blog server that can speak XML-RPC. For me the benefits are:

  • I don’t have to leave the page or open a new tab to log in to my blog or write a post.
  • I don’t have to give up any functionality like tagging or categorizing my posts.
  • The editor seems more reliable than the one built in to WordPress and Drupal.
  • I can easily write one post and publish it to both ecmarchitect.com and optaros.com.

Regarding this last point, I try not to have much duplication between the two blogs. There is some overlap, but the purpose and audience of the two blogs are generally separate. Still, when I need to post in both places, ScribeFire saves me a lot of time. I can write the post once, categorize it for ecmarchitect.com, post it, then tweak it if needed, categorize it for optaros.com, then post it there, all in a single UI.

Web 2.0 & the Open Source CMS

Dr. Ian Howells, Alfresco’s Chief Marketing Officer, and I will be doing a webinar on Web 2.0 trends in the enterprise and the impact of these trends on content management.

This web seminar will cover:

  • The importance of Web 2.0 in the context of content management strategies and the competitive landscape.
  • How to get beyond the hype and leverage Web 2.0 techniques and technologies to deliver dynamic and interactive content.
  • How to tap into the fast-growing value of the Web 2.0 ecosystem to drive organizational productivity and competitive advantage, while still meeting the compliance and security needs of business.
  • How these ideas have been put into practice by Optaros for companies like Endeca and Swisscom using Alfresco Enterprise as the technology platform for a Web 2.0 solution

If you are interested, you can register online here.