"이희승 (Trustin Lee) <[EMAIL PROTECTED]>" wrote
The differences between IoHandler and IoFilter are:
* IoHandler doesn't have life cycle callbacks (onPreAdd,
onPostRemove...) while IoFilter has.
* IoHandler doesn't have handler methods for requests such as write,
setTrafficMask and close while IoFilter has.
This is why I'm proposing to split IoFilter into multiple interfaces:
* Interface A which provides handler methods for incoming events.
* Interface B which extends the interface A and provides handler methods
for outgoing requests
* Interface C which extends the interface B and provides lifecycle
management methods
This inheritance relationship might not be precise. For example, both
interface B and C could extend the interface A directly.
UpstreamFilter and DownstreamFilter sounds somewhat strange. :)
What about InputHandler, OutputHandler, IoHandler (extends InputHandler
and OutputHandler) and LifecycleAwareHandler?
Just a quick Q : do we really need those three interfaces ?
For instance, A and B can be merged, as I don't know a lot of protocol
who deal with incoming requests but never send back a reply (of course,
there are some, but it's not the general case). If you don't have any
outgoing requests, then an abstract class can implement a null operation
for outgoing requests.
The very same for C, I see no reason why we should not merge it with A
and B.
In any case, if you have an inheritance scheme like A <-- B <-- C (<-- =
extends), then I think we can merge those three interfaces, except if
implementing a specific interface will bring some specific function.
A class which will need to implement A and C for instance would be
better described as class MyClass implements A,C instead of having an
inheritence between C, B and A.
What I mean is that interfaces might not inherits from each other, if
they are just extending the API.
Here, if we don't merge the interface, something like :
class UpstreamFilter implements A
class DownStreamFilter implements B
class ManagedUpstreamFilter implements A,C
class ManagedDownStreamFilter implements B,C
class ManagedFullFilter implements A,B,C
covers all the case.
About the names, keep Filter. Handler has a different semantic to me...
(may be it's just me)
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org