Java Pipeline API
April 3, 2008 by Reinhard Pötz
The most famous concept of Cocoon is pipelines. The first component of a pipeline generates a stream that is passed to components that can modify this stream and finally you get the result, e.g. a java.io.OutputStream. I guess that developers have wished to have a library that makes this easy:
Pipeline pipeline = new NonCachingPipeline(); pipeline.addComponent( new URLGenerator(new URL("/home/reinhard/file.xml"))); pipeline.addComponent( new XSLTTransformer(new URL("/home/reinhard/stylesheet.xslt"))); pipeline.addComponent( new XMLSerializer()); pipeline.invoke(System.out);
The brave of us have tried to make this code run with Cocoon 2.x. But as far
as I know all attempts have failed because Cocoon was designed to a web
application and publishing framework. And even if you make this code run, you
get a huge stack of dependencies that you have to add to your application.
I think that this has to change. We should develop Cocoon in a bottom-up style: For this a pipeline API is the natural first step. After that we can put all the other stuff like sitemap language interpreters on top of it.
Steven Dolg, one of my colleagues at Indoqa started to reimplement Cocoon based on a layered design that has a pipeline API as its basic layer. You can already checkout working code. Further goals are content-based routing in pipelines and supporting pipeline fragements. By the way, the pipeline API that we want to design shouldn't impose any limitations on the content that flows between its components. One of the things that I've missed desperatly is pipelines that support pull parsing.
Does this sound interesting for you? Then join us at the developer mailing list of Apache Cocoon. Or, if you happen to attend the ApacheConEU hackathon in Amsterdam next week, I will be happy to have discussion about all this stuff! Things are still in flux and there is much room to be creative!