commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <dev.jerem...@greenmail.ch>
Subject [morphos] Idea for building morpher pipelines
Date Fri, 21 Feb 2003 09:49:23 GMT
I've spent some time playing around in Morphos lately, doing some
cleaning-up and javadocing. I'll probably submit a patch next week.

Anyway. ATM building a morpher pipeline is more or less a manual thing.
Of course, there's the possibility to do getMorpher(inputFlavor,
outputFlavor), but that doesn't sound like enough to me. I was thinking
about adding something like the following (Names can be discussed):

MorpherFactory.getMorher(MorphingWish mywish);

class MorphingWish {
   
   /*..*/
   
   public MorphingWish(ObjectFlavor inputFlavor, 
                       MorphingInstruction[] instructions,
                       ObjectFlavor outputFlavor);
   
   /*..*/
}

interface MorphingInstruction {

    // maybe empty, don't know yet
}

class XSLTMorphingInstruction implements MorphingInstruction {

    private Source xsltSource;
    
    public XSLTMorphingInstruction(Source xsltSource);
    
    public Templates getTemplates();
}


So, let's say I want to get an XLS file from some arbitrary XML file I
could do the following:

Morpher m = myfactory.getMorpher(new ObjectFlavor("text/xml", "stream/unix"),
        new MorphingInstruction[] {new XSLTMorphingInstruction(new
            Source("myxml2gnumeric.xsl"))},
        new ObjectFlavor("application/x-excel", "stream/unix"));
        
That seems doable to me and makes building a morpher pipeline pretty
easy. It may also make the StylesheetAware interface superfluous which
IMO is problematic.

((StylesheetAware)morpher).setStylesheet(new StreamSource(new
    File(baseDir, "stylesheets/test2.xsl")));

Doing this line is easy, but getting the right morpher to set the right
stylesheet on it is difficult depending on how the pipeline is put
together.

If you think this approach is worth investigating, I could give it a try
sometime next week. Comments welcome.

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message