Archive for the 'cocoon' Category

Cocoonus

cocoon_gt_2007_125x125.jpgAfter having skipped last year’s edition, I am happy to report that this year I will attend the 2007 edition of the Cocoon GetTogether. What makes this edition special is the fact that, after five years in the cold and misty lands of Belgium first and, more recently, of the Netherlands, we will meet in beautiful, sunny Rome for a change.

Another reason why this edition is special is that it’s the first time that Sourcesense is in charge of organizing the event. In other words, we will be playing hosts and matching the hospitality that was generously provided by Outerthought and Hippo before us won’t be an easy task. Still, Italian food is on another level entirely with respect to even the best Belgian and Dutch spare ribs, so this will certainly help us gain some points.

So mark October 3rd to 5th on your calendars for three days of talks, hacking, community, open source, good food and wine. We await for you!

Cocoon supports Ajax

Ajax v. InterNo, I’m not referring to Ajax as in Asynchronous Javascript and XMLApache Cocoon has actually been supporting Ajax for quite a long time — but to Ajax as the football team from Amsterdam.

The reason why I’m putting Cocoon supports Ajax in the title of this post is that yesterday a bunch of Apache Cocoon developers (including three committers) went to the Amsterdam Arena to show their support for the home team in the Champions League football match against Inter F.C.

(If you thought that I, as an Italian, should have supported Inter, think again.)

Ajax, with a young and unexperienced lineup, started off briskly and hit Inter twice, with Huntelaar and Rosales in the first 20 minutes. We were cheering together with the other 49,000 people at the Arena, but our enthusiasm lasted only until the beginning of the second half, when Stankovic scored a lucky hit and then, just four minutes before the end of regular time, Julio Cruz (ex-Feyenoord) equalized for Inter from a short distance, thanks to an illuminating pass by Figo and then Cambiasso.

All in all, it was a nice match but I think Ajax has little hope of going through, having to win against Inter in Milan in two weeks: hardly probable. I also managed to shoot a fair number of good photographs (including two of the goals) and finally resolved to upgrade my Flickr account to “pro” level in order to be able to upload most of them. You can see the results in my Ajav vs. Inter set. I must say that my Panasonic DMC-FZ20 performed very well, thanks to its long zoom lens and incredibly useful image stabilizer.

Technorati Tags: ,

Cocoon 3.0

Sylvain Wallez: “Now should we still call it Cocoon? More than 3 years after Cocoon brought continuations-driven web applications to the world, many people still consider it as a ‘rendering engine’. A different name would allow to clearly show once for all that it is much more than that. Any ideas?”

How about Butterfly? ;)

Apache Cocoon 2.1.8 released

cocoon.gifAlmost seven months after the release of version 2.1.7, we finally have a new version of Apache Cocoon. Don’t be fooled by the small increment in the version number. There are many new features and bug fixes in this release, compared to 2.1.7.

However, it’s maybe the first time that I’m not very excited by a new Cocoon release. I am growing old and jaded, probably. I still like, use, and recommend Cocoon, but the initial excitement has worn off. We’ll need some groundbreaking news to rekindle the fire, but I can’t see who is going to bring them.

Anyway, many thanks to all the people who contributed towards this release. They deserve only gratitude and free beer, so I should probably stop complaining like a grumpy old man.

More info can be found via Andrew, Carsten, and Matthew.

Get ready for ApacheCon US 2005!

ApacheCon US 2005 logoWe just finished recovering from the Cocoon GetTogether and a new event is alreaddy approaching. From December 10 to December 14, 2005, San Diego will host ApacheCon US 2005. It’s nice that they moved from Las Vegas, but a more eastward location would be great for us Europeans. Orlando maybe? Let’s hope for next year.

Anyway, the distance shouldn’t discourage any of you from attending. As always, a great time is guaranteed to all. This year, moreover, I will be doing a tutorial on Advanced Cocoon: Flowscript and Forms. We need a minimum number of people to sign up for it, so don’t be shy and sign up now!

A word of caution. My friend and colleague Gianugo will hold his Taming Apache Cocoon tutorial on the morning of the same day, Sunday December 11th. Don’t be confused by the apparent overlap in the subjects covered. We are working together to ensure that people attending both tutorials won’t hear any repetitions, but will instead be presented with a linear progression of concepts. Of course it’s entirely possible that you want to follow the morning tutorial only, to get your feet wet before diving deeply into Cocoon later. Or that you are already familiar with the basic concepts and only want to hear about the latest developments. The choice is yours!

CocoonGT wrapup

Amsterdam dock at sunsetJust a few words on this year’s annual Cocoon GetTogether, which ended yesterday. As always, great fun was had by everyone and it was great to meet once again with the usual folks and get to know someone else for the first time. Sadly, I could stop in Amsterdam just one night, so I hadn’t much time to talk with everyone I wanted to.

Kudos to Arjé and Steven for brilliantly taking care of the organization!

As for the matters that were discussed most at the hackathon and at the conference, pretty much everyone agrees that what emerged was a strong drive towards greater simplicity for our beloved framework. And almost everyone agrees that this simplification can be obtained without compromising the huge investment that many people and companies have done on Cocoon in the past.

Personally, as I wrote before, I am not so convinced, but I heartily applaud all efforts towards this elusive goal. I too have made a huge investment on this platform and will have to maintain and enhance projects that use it, possibly for a long time, and I’m not going to jump on the RoR bandwagon soon.

Photos here. Slides and podcasts from the presentations here.

Comparative Performance of XSLT Processors in Cocoon

I just finished listening to this talk here at the Cocoon GT and boy! How I wish I had been able to know about its conclusions earlier (in a nutshell: Xalan 2.4 sucks). I have a customer who has been having memory problems with a Cocoon application under load for some days. The least expensive and resolutive move, in retrospect, would have been upgrading Xalan to release 2.7: painless and probably definitive.

Actually, I had suspected problems with the XSLT processor for a while, but not trusting Xalan I had suggested replacing it with Saxon, which would have probably been less painless, as Saxon is much more strict than Xalan when it comes to not-so-kosher stylesheets.

In any case, this lesson should be useful for the future.

Amsterdam

Just made it to Amsterdam for the second day of the Cocoon GetTogether. My plane was delayed almost two hours, officially because of the fog, but some people here told me they found an old WW2 bomb while digging near Schiphol, so that maybe the real cause of the delay. Anyway, it really is foggy, so I couldn’t see much of the city yet.

More later.

Is Cocoon Obsolete?

Just when we’re about to gather and celebrate once again, our founding father Stefano drops this bombshell:

Stefano Mazzocchi, [RT] Is Cocoon Obsolete?: “But as a researcher, a scientist and one that likes to push the edge, I sense that cocoon is kinda ‘done’, not as in ‘finished, passe”, but more as in ‘been there, done that’.

Sure, lots of things to polish and little things to continue to improve, but I wonder if the action is somewhere else. “

The point here is that much of the action is moving from the server to smarter and richer web client platforms like Mozilla (and Ajax, I would add, if you can call that a platform):

I do that for my latest web sites and the more I learn how to driven the
client, the less I feel the need for advanced server frameworks. Is it
just me?

Is client side advancement making cocoon and all its machinery to
compensate for advanced web client obsolete and archaic?

For a long time, I’ve been convinced that Cocoon must do less, much less than what it currently does if it wants to thrive and survive. Now it tries to be everything to everyone: a web publishing framework, a web application framework, a portal framework and possibly a business integration platform. I don’t think you can do all of this and at the same time be simple, lightweight and easy.

Another issue I’ve been obsessed with for a long time is the fact that the weight of Cocoon’s internal machinery, combined with the desire to keep it backward compatible at all costs, is bound to drag down all the current efforts to make it more modular. Designing a new kernel that will allow all existing applications to run on it unmodified is a worthwhile task and using OSGi to build it is a great idea, but I’m afraid that by the time we get there, Stefano’s fear of obsolescence will have materialized.

I am confident that at present, for the type of applications we are doing, Cocoon is still the best choice, but at the same time I’m trying to look into the future. Until now, I concentrated myself on the server side of things, but it didn’t dawn on me that a new breed of client-side technologies and platforms might require a rethinking of the classical server-side paradigms.

Granted, this is not applicable to a lot of real-world scenarios and it might never be for a large segment of users (think mobile ones), but it is something that is worth spending a few neurons on.

Meanwhile, I am looking forward to attending Andrew’s talk on “Simplifying Cocoon”. Should be interesting.

Cocoon GetTogether 2005

cocoon.gifI haven’t had much time to post anything this week, since we have a deadline by Friday and still some issues to fix by then. But I managed to book a plane to Amsterdam and do a last-minute registration for the annual Apache Cocoon GetTogether. I’ll be there on Thursday (leaving very early in the morning) and Friday. Once more, we’ll be able to exchange real beers and not just virtual ones.

ApacheCon EU 2005: Getting Up to Speed with Apache Geronimo - Tom McQueeney

I’m not really into J2EE application servers, but I have an interest in following what’s happening in this field, since from time to time it happens that one of your applications needs to be deployed inside one of them. Open Source J2EE appservers, in particular, are becoming more and more used. Though Geronimo is the new kid on the block, it seems to have enough momentum to become a worthwhile competitor to the established leader in this field: JBoss.

I even briefly considered exploring GBeans as a mechanism for enabling Cocoon “Real Blocks” once. Even though it seems like we’re headed in the OSGi direction, it might still be cool to be able to deploy the Cocoon core as a GBean inside Geronimo.

Weather in Stuttgart

The Cocoon Blockathon is well underway in Stuttgart. Unfortunately, I won’t be there until tomorrow night. Meanwhile, I’m looking at the weather forecasts and feeling a bit worried. With 12/14C less degrees on the average, I’ll be leaving shorts home and bring a jacket instead.

The weather in Pavia The weather in Stuttgart

The best things in life are free…

…at least according to Infoworld.

textxml-vs-daisy.jpg

Kudos to Steven, Marc and Bruno.

Paul Murphy on Cocoon

Paul Murphy writes some very nice words about Cocoon:

I have one overwhelming reaction to the difference between Cocoon then, and Cocoon now. Fundamentally it seems to have evolved from science experiment to professional product - there is now a clarity of purpose and design simplicity that promises to make it a joy to work with.

[…] I haven’t downloaded and started up the new Cocoon technologies yet, but it’s clear from the documentation, demonstration sites, and sample code that they’ve gone in the opposite direction: from a scattergun agenda including ritual bowing to market realities (like com) to a clear focus on doing one job as well as possible at each stage in a pipelined processing framework. Looking at it, I’d guess Doug McIlroy in particular, but also Thompson, Ritchie, and the other original Unix creators, would be proud to see one of their core ideas carried forward and expressed so well in a working application.

Thanks Mr. Murphy. We’re glad that you like Cocoon, even though the design is not exactly the simplest possible one, to be honest. I would love to expand on this, but having risen at 4AM to board a plane, I’m not in the right state of mind to do a longish blog post. Maybe later.

Cocoon going to Amsterdam

I always wanted to visit Amsterdam. Looks like this will be a valid pretext:

Arjé and I are spilling the news on the new location of the yearly Cocoon GetTogether: we’re dropping the anchor in Amsterdam this year!

The EuroOSCON is going to be in Amsterdam too, just a couple of weeks later. It would be great to be able to be there as well, but it all depends on what the boss and the wife think.

Mozilla Rhino to be included in J2SE 6.0

rhino50.jpgLooks like the next release of Java will have support for Javascript built-in:

Another language-related JSR planned for Mustang is JSR 223. This defines a framework to allow scripting language programs to access information developed in the Java platform. We currently plan to integrate this into Mustang for b40. Aside from the framework, we will also include a JavaScript engine based on the Mozilla Rhino implementation. Later, we hope to include a scripting shell that is script language independent. This will be a very cool way to create a prototype, do some exploratory coding, and learn new APIs.

This is incredibly important for Cocoon, whose Flowscript is currently based on Mozilla’s Rhino Javascript interpreter. Actually, the Flowscript is somewhat language agnostic, but the only working implementation right now is in Javascript.

In the past there have been doubts concerning the viability of Rhino and its licensing terms, but when it’s become an integral part of the J2SE platforms, there will be no more doubts.

Now the question is: How long will it take to add continuations support to Groovy, so that developers will be able to choose between two great scripting languages for their flowscripts?

(Via Dion.)

The Open Source Zone - Tech writeup

oszone-beta.gifThe Open Source Zone is a web application that exploits a large number of Open Source libraries, frameworks and services, namely:

It would have been impossible to create The Open Source Zone in such a short amount of time if all this great code had not been contributed to the Open Source community. Our most sincere thanks go to the people who created these packages.

The heart of the system is a Java web application whose main building blocks are:

The Spring Framework, a powerful container based on dependency injection, which is used to configure and bring together the services provided by the other components, most notably Hibernate and Lucene.

Hibernate, an object-relational mapping (ORM) framework which guarantees the persistence of Java objects by abstracting away the relational model of the underlying database and hiding the complexities of JDBC programming.

Apache Lucene, which is used to provide indexing and search services.

Apache Cocoon, a powerful, XML-based web application framework, which implements the presentation layer and manages the flow of user interactions using an innovative continuations-based approach.

Spring, Hibernate, Lucene and Cocoon, together with the PostgreSQL JDBC driver are hosted inside the Jetty servlet container.

Storage of data is guaranteed by the PostgreSQL Relational DataBase Management System (RDBMS). The interface between the Java application and the RDBMS is managed by the PostgreSQL JDBC driver.

The Apache HTTPD 2.0 server is placed in front of the Jetty Servlet container as a caching proxy, using the mod_proxy and mod_cache modules. This solution provides the following benefits:

  • Static resources (images, CSS stylesheets, Javascript files) are served directly by Apache HTTPD and don’t cause unnecessary load on the Servlet container.
  • Infrequently changing data can be cached and served directly by Apache HTTPD without forwarding requests to the Java application and to the database, thus ensuring larger scalability in case of numerous concurrent requests.
  • When the Java application must be taken down for maintenance and upgrades, Apache HTTPD can show a warning page, informing users of the downtime and avoiding the dreaded “Connection refused” message.

Load balancing and clustering could be implemented in the future, simply by having one HTTPD server forwarding requests to more than one Java application server.

The exact configuration of Apache mod_proxy and mod_cache is similar to the one used by Pier and described in this wiki entry.

CAPTCHA validator for Cocoon Forms

Since I’m going to need some form of spam prevention for Source.zone, I opted to forego user registration and authentication and use CAPTCHA instead to verify that submissions come from human beings and not robots. Hope this keeps spam down to a reasonable level while lowering the entry barrier for would-be contributors.

My first approach consisted in looking at jcaptcha to see if there was some code to reuse. Unfortunately, jcaptcha has several drawbacks:

  • The website is the usual Maven-generated load of crap. Why there’s no link to a comprehensive tutorial on the home page or the navigation menu? Beats me.
  • It’s LGPL, which means I wouldn’t be allowed to commit anything I did into Cocoon’s repository.
  • It’s probably too complex for what I need.

Don’t get me wrong, jcaptcha is probably a nice piece of software, but it’s just not the right solution at the moment.

Back to the drawing board. I remembered reading on Cocoon’s developers’ mailing list something about image-based authentication and indeed I could find a sample contributed by Tony Collen and tucked away inside Cocoon’s scratchpad that, among other things, generated a blurred image of a text string. The nice thing is that doing this doesn’t need any coding at all, since it’s just an SVG file rasterized using components that are already included in Cocoon. “Internet Glue” indeed.

auth.jpg

Next, I decided that this feature would be useful in many instances, so I decided to write a Cocoon Forms validator. Cocoon Forms has this nice, pluggable architecture that makes it easy to expand it with new widgets, datatypes, convertors and validators.

Well, “easy” is a bit of an exaggeration, as the plot started to thicken after a while. First, I came upon an apparent bug in Cocoon Forms and tried to ask for guidance on the mailing list. Unfortunately, Apache’s mailing list aren’t working too well today. Maybe it’s all that fscking nazi spam that’s been circulating lately that’s giving the servers a hard time.

Anyway, after an hour or so of debugging, I devised a quick fix, but I’ll wait for some comments from some developer that is more confident with Forms internals before committing.

The other hurdle I came upon is the fact that it’s not enough to return false from your validator in order to trigger a validation error. You also need to set a validation error, otherwise validation of the whole form will succeed without even a warning.

After working around these problems, I got it working quite nicely. Adding CAPTCHA validation to your Cocoon forms is as simple as:

<fd:captcha id='f1' required='true'>
  <fd:datatype base='string'/>
  <fd:validation>
    <fd:captcha>
  </fd:validation>
</fd:captcha>

It would be nice to have a pluggable strategy for generating random strings, as the current one is fixed, but I’m waiting for someone else to have this particular itch to scratch.

I’m not quite ready to commit, however. I’d rather have some feedback on my proposed fix before risking breakage somewhere else.

Update: the ASF mail server is still struggling under the load but I’ve managed to get feedback from Sylvain, so I went ahead and committed. CAPTCHA validation is now available in SVN (2.1 branch only for now).

Ajax in Cocoon: dead simple!

Sylvain Wallez: Ajax in Cocoon: dead simple!: “Today, I added Ajax support to Cocoon, starting with form handling.”

Sylvain as Mr.IncredibleIf you’re not familiar with Cocoon Forms, let me tell you why this is important and not just the latest indulgence to a passing fad. We actually discussed adding this to Cocoon Forms at the latest GetTogether, long before the term Ajax was even invented.

Cocoon Forms is arguably the coolest web forms framework out there that is entirely HTML-based. In other words it is compatible with most browsers and does not require plugins, XForms support or other proprietary extensions, which can be very important.

Cocoon Forms makes it very easy to add some amount of dynamism to forms, ranging from simple cascading drop-downs (selecting an item in a drop-down list causes another list’s contents to change) to repeaters (repeating sets of input fields where you can add, remove and move items) and to more exotic use cases like unions (sort of variants).

All very cool, but whenever the structure of a form changes, a complete HTTP request-response cycle is executed and this has some unpleasant side-effects:

  1. A round-trip to the server and back can be slow.
  2. The entire page is refreshed and you lose input focus and scrollbar position.
  3. The back button does not bring you back to the page before the form, but to the previous version of the form itself.

This is where using XMLHttpRequest comes into play. Using it, you can refresh only the portion of the form that needs changing and you can do it much faster, resolving all of the above-mentioned annoyances. The fact that XMLHttpRequest support in Cocoon Forms is completely transparent, as far as I understand, and falls back to the traditional behavior when the browser does not support it, is simply incredible.

Kudos to Sylvain for coming up with this brilliant solution which will undoubtedly strengthen Cocoon’s position as the most powerful web application development platform!

Spring Web Flow supports continuations, or does it?

Geert Bevin has a nice write-up here of Spring Web Flow’s “out-of-the-box continuations support”:

Spring Web Flow however only provides continuations in the flow declaration (can be both in XML and in Java), thus lacking what in my opinion is the single most interesting feature of continuations.

Having used Cocoon’s continuation-based Flowscript, I tend to agree with him. The real difference between Cocoon and RIFE, on one side, and Spring Web Flow on the other, is the fact that continuations are a native feature of the flow language and you can create a continuation everywhere in the code.

Rewriting Geert’s example with Cocoon, you’d get:

while (guess != answer)
{
    // print the guess form and wait for a response
    cocoon.sendPageAndWait(template); 

    // obtain the guess
    guess = cocoon.request["guess"];
    ....
}

Not that different from the RIFE version, really. Spring’s version would look more like this.

Now, if someone would take Cocoon’s Flowscript (or Javaflow, if you don’t like Javascript) and adapt it to Spring’s Web framework, that would be interesting.