avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Component Design Question
Date Thu, 18 Apr 2002 05:46:42 GMT

Peter Donald wrote:
>
> <snip/>
>
> 2 options here.
>
> [1] We add an extra component to do conversion of stream to xml
> (I assume this
> is for converting things like excel into XML??? or .psd files to
> svga??). So
> what I would do in this case is then add a "getMimeType()" to the Source
> interface that returns a string about what type the underlying file. Then
> have another set of components that convert objects of different
> mimetypes to
> xml streams.
>
> This is the same architecture as used in the Java URL system ie they have
> stream handlers (which are like Source objects) and
> ContentHandlers (which
> are like converters between stream and object type).
>
Hi Peter,

believe me or not, but I thought about this problem the whole night
and finally came to the same conclusion as you propose above (it only
took much longer for me :( ).
I think the mistake I made is that a saw a relation between the protocol
and the type of content this protocol returns. But as we all know
this is not true. The protocol specifies the type of transport but
not the type of content.

So, my proposol is to add a getMimeType() method to the Source interface
and an "XMLizer" component to the xml package. This XMLizer gets
a mime-type and an input stream as input and creates sax events from this.
This will
- decouple the source and the xml package totally
- the XMLizer is not only usable for source objects
- the XMLizer is extensible...


> [2] Make the sources implement XMLizable ;) Personally I have no
> problem with
> the "object instanceof XMLizable" statement though and don't
> really consider
> it a problem.
>
> I really think [1] is the right way to go but it is also more
> work so I would
> suggest that you go with [2] for now if there is a deadline
> looming else go
> with [1]

I hope to make a first version of my proposal today, so there
should be no time problem.

>
> > The question is, is the coupling of the packages xml and source
> > really so bad?
>
> It would stop me using it :)
>
Argh, that's really bad.

Carsten


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message