Hi Simone,

I have one question to the current interface of Pipeline.  I know you wrote a 
SAXPipelineBuilder to allow chaining.

But it would have been much nicer if the Pipeline interface itself would have 
been chainable.

void addComponent(T pipelineComponent);  -->     Pipeline<T> addComponent(T 
pipelineComponent);

void setup(OutputStream outputStream);   -->     Pipeline<T> 
setup)(OutputStream outputStream);

Same for other methods for which it makes sense to chain them.

This would allow me to switch from

        @Test
        public void testXQuery1() throws Exception {
            Map<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("sentence", "split words test");
            XQJGenerator generator = new 
XQJGenerator(this.getClass().getResource("/xquery/stringtest.xquery")); 
            generator.setXQDataSource(xqds);
            Pipeline<SAXPipelineComponent> pipeline = new 
NonCachingPipeline<SAXPipelineComponent>();
            pipeline.addComponent(generator);
            pipeline.addComponent(new XMLSerializer().setIndent(true));
            pipeline.setup(System.out, parameters);      
            pipeline.execute();
        }

to 

        @Test
        public void testXQuery1() throws Exception {
            Map<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("sentence", "split words test");
            XQJGenerator generator = new 
XQJGenerator(this.getClass().getResource("/xquery/stringtest.xquery")); 
            generator.setXQDataSource(xqds);
            Pipeline<SAXPipelineComponent> pipeline = 
               new NonCachingPipeline<SAXPipelineComponent>()
               .addComponent(generator)
               .addComponent(new XMLSerializer().setIndent(true))
               .setup(System.out, parameters)
               .execute();
        }

which basically is what you intended to achieve if i'm correct.

I know it's quite a big API change but designing the API with chainability in 
mind makes sense.

Robby


Reply via email to