You are viewing a plain text version of this content. The canonical link for it is here.
Posted to droids-dev@incubator.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2008/11/15 11:37:22 UTC
Hanlder -> ContentHandler?
Folks
I can't help thinking Handler is a bit too generic and not descriptive
enough. How do you feel about renaming it to ContentHandler or some
such?
Oleg
Re: Hanlder -> ContentHandler?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2008-11-15 at 21:09 +0100, Thorsten Scherler wrote:
> On Sat, 2008-11-15 at 17:24 +0100, Oleg Kalnichevski wrote:
> > On Sat, 2008-11-15 at 16:23 +0100, Thorsten Scherler wrote:
> ...
> > > see my other mail. Maybe the contentEntity can be extended to contain
> > > the result of the parser stage as well.
> > >
> > > wdyt?
> > >
> >
> > Works for me. Do you wan me to take a stab at it?
>
> yeah, go for it.
>
> +1
>
> salu2
Done. Please review.
Oleg
Re: Hanlder -> ContentHandler?
Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2008-11-15 at 17:24 +0100, Oleg Kalnichevski wrote:
> On Sat, 2008-11-15 at 16:23 +0100, Thorsten Scherler wrote:
...
> > see my other mail. Maybe the contentEntity can be extended to contain
> > the result of the parser stage as well.
> >
> > wdyt?
> >
>
> Works for me. Do you wan me to take a stab at it?
yeah, go for it.
+1
salu2
--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>
Re: Hanlder -> ContentHandler?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2008-11-15 at 16:23 +0100, Thorsten Scherler wrote:
> On Sat, 2008-11-15 at 14:49 +0100, Oleg Kalnichevski wrote:
> > On Sat, 2008-11-15 at 13:52 +0100, Thorsten Scherler wrote:
> > > On Sat, 2008-11-15 at 12:37 +0100, Oleg Kalnichevski wrote:
> > > > Folks
> > > >
> > > > I can't help thinking Handler is a bit too generic and not descriptive
> > > > enough. How do you feel about renaming it to ContentHandler or some
> > > > such?
> > >
> > > I chatted with Henri about this a while @apachecon. We came to the
> > > conclusion that the current API is to open:
> > > public interface Handler {
> > > /**
> > > * @param openStream
> > > * the underlying stream
> > > * @param uri
> > > * the uri we are currently processing
> > > * @param parse
> > > * the parse object from a former processing step
> > > * @throws Exception
> > > */
> > > void handle(InputStream openStream, URI uri, Parse parse)
> > > throws IOException, DroidsException;
> > > }
> > >
> > > We have access to the parse object, the original stream and the underlying URI.
> > > Back in the days I thought it was a good idea since every possible usecase could
> > > be handled but maybe we it is way too brought.
> > >
> > > So maybe we want have different type of handlers:
> > > - content handler (using parse)
> > > - stream handler (using the openStream)
> >
> > BTW, would it be okay to replace InputStream parameter with
> > ContentEntity? It may also be useful to have access to entity's MIME
> > type and charset in some Handler implementations
>
> see my other mail. Maybe the contentEntity can be extended to contain
> the result of the parser stage as well.
>
> wdyt?
>
Works for me. Do you wan me to take a stab at it?
Oleg
> salu2
Re: Hanlder -> ContentHandler?
Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2008-11-15 at 14:49 +0100, Oleg Kalnichevski wrote:
> On Sat, 2008-11-15 at 13:52 +0100, Thorsten Scherler wrote:
> > On Sat, 2008-11-15 at 12:37 +0100, Oleg Kalnichevski wrote:
> > > Folks
> > >
> > > I can't help thinking Handler is a bit too generic and not descriptive
> > > enough. How do you feel about renaming it to ContentHandler or some
> > > such?
> >
> > I chatted with Henri about this a while @apachecon. We came to the
> > conclusion that the current API is to open:
> > public interface Handler {
> > /**
> > * @param openStream
> > * the underlying stream
> > * @param uri
> > * the uri we are currently processing
> > * @param parse
> > * the parse object from a former processing step
> > * @throws Exception
> > */
> > void handle(InputStream openStream, URI uri, Parse parse)
> > throws IOException, DroidsException;
> > }
> >
> > We have access to the parse object, the original stream and the underlying URI.
> > Back in the days I thought it was a good idea since every possible usecase could
> > be handled but maybe we it is way too brought.
> >
> > So maybe we want have different type of handlers:
> > - content handler (using parse)
> > - stream handler (using the openStream)
>
> BTW, would it be okay to replace InputStream parameter with
> ContentEntity? It may also be useful to have access to entity's MIME
> type and charset in some Handler implementations
see my other mail. Maybe the contentEntity can be extended to contain
the result of the parser stage as well.
wdyt?
salu2
--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>
Re: Hanlder -> ContentHandler?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2008-11-15 at 13:52 +0100, Thorsten Scherler wrote:
> On Sat, 2008-11-15 at 12:37 +0100, Oleg Kalnichevski wrote:
> > Folks
> >
> > I can't help thinking Handler is a bit too generic and not descriptive
> > enough. How do you feel about renaming it to ContentHandler or some
> > such?
>
> I chatted with Henri about this a while @apachecon. We came to the
> conclusion that the current API is to open:
> public interface Handler {
> /**
> * @param openStream
> * the underlying stream
> * @param uri
> * the uri we are currently processing
> * @param parse
> * the parse object from a former processing step
> * @throws Exception
> */
> void handle(InputStream openStream, URI uri, Parse parse)
> throws IOException, DroidsException;
> }
>
> We have access to the parse object, the original stream and the underlying URI.
> Back in the days I thought it was a good idea since every possible usecase could
> be handled but maybe we it is way too brought.
>
> So maybe we want have different type of handlers:
> - content handler (using parse)
> - stream handler (using the openStream)
BTW, would it be okay to replace InputStream parameter with
ContentEntity? It may also be useful to have access to entity's MIME
type and charset in some Handler implementations
Oleg
> - uri handler (using the uri)
>
> The super interface could look like
> public interface Handler {
> void handle(Object object)
> }
>
> WDYT?
>
> salu2
Re: Hanlder -> ContentHandler?
Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2008-11-15 at 14:24 +0100, Oleg Kalnichevski wrote:
...
> > So maybe we want have different type of handlers:
> > - content handler (using parse)
> > - stream handler (using the openStream)
> > - uri handler (using the uri)
> >
>
> I think there are cases where those bits are not mutually exclusive and
> one may want to have them all, or at least more than one representation.
Yeah Henri and I thought we may want to wrap the three into one object
(a wee bit like the ContentEntity).
>>From a process flow point of view it much goes
protocol -> receive the org. content
parser -> parse the org. content to get a textual representation
handler -> handle either the org. content or the parse object. Since
both earlier stages are optional a handler may just need to use the url.
salu2
--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>
Re: Hanlder -> ContentHandler?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2008-11-15 at 13:52 +0100, Thorsten Scherler wrote:
> On Sat, 2008-11-15 at 12:37 +0100, Oleg Kalnichevski wrote:
> > Folks
> >
> > I can't help thinking Handler is a bit too generic and not descriptive
> > enough. How do you feel about renaming it to ContentHandler or some
> > such?
>
> I chatted with Henri about this a while @apachecon. We came to the
> conclusion that the current API is to open:
> public interface Handler {
> /**
> * @param openStream
> * the underlying stream
> * @param uri
> * the uri we are currently processing
> * @param parse
> * the parse object from a former processing step
> * @throws Exception
> */
> void handle(InputStream openStream, URI uri, Parse parse)
> throws IOException, DroidsException;
> }
>
> We have access to the parse object, the original stream and the underlying URI.
> Back in the days I thought it was a good idea since every possible usecase could
> be handled but maybe we it is way too brought.
>
So, this interface was always meant to be more generic than just a
content processor? I see now.
> So maybe we want have different type of handlers:
> - content handler (using parse)
> - stream handler (using the openStream)
> - uri handler (using the uri)
>
I think there are cases where those bits are not mutually exclusive and
one may want to have them all, or at least more than one representation.
Oleg
> The super interface could look like
> public interface Handler {
> void handle(Object object)
> }
>
> WDYT?
>
> salu2
Re: Hanlder -> ContentHandler?
Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2008-11-15 at 12:37 +0100, Oleg Kalnichevski wrote:
> Folks
>
> I can't help thinking Handler is a bit too generic and not descriptive
> enough. How do you feel about renaming it to ContentHandler or some
> such?
I chatted with Henri about this a while @apachecon. We came to the
conclusion that the current API is to open:
public interface Handler {
/**
* @param openStream
* the underlying stream
* @param uri
* the uri we are currently processing
* @param parse
* the parse object from a former processing step
* @throws Exception
*/
void handle(InputStream openStream, URI uri, Parse parse)
throws IOException, DroidsException;
}
We have access to the parse object, the original stream and the underlying URI.
Back in the days I thought it was a good idea since every possible usecase could
be handled but maybe we it is way too brought.
So maybe we want have different type of handlers:
- content handler (using parse)
- stream handler (using the openStream)
- uri handler (using the uri)
The super interface could look like
public interface Handler {
void handle(Object object)
}
WDYT?
salu2
--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>
Re: Hanlder -> ContentHandler?
Posted by Ryan McKinley <ry...@gmail.com>.
On Nov 15, 2008, at 6:37 AM, Oleg Kalnichevski wrote:
> Folks
>
> I can't help thinking Handler is a bit too generic and not descriptive
> enough. How do you feel about renaming it to ContentHandler or some
> such?
>
Ya --
Likewise it would be good to rename o.a.d.tika.EchoHandler to
EchoSaxHandler or something. It seems every framework has its own
default "handler"
ryan