commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "b.davanzo@inwind.it" <b.dava...@inwind.it>
Subject Re: Adding TERMINAL-TYPE option to TelnetClient
Date Mon, 17 Mar 2003 14:20:00 GMT
Hi,

last thursaday 3 13th I submitted a patch for an extended version of commons net's TelnetClient
containing new functionalities.

The support for an external option handler was through the TelnetOptionHAndler interface.
The same object was used to handle all the options, with the result of a somehow reduced reusability
of the option handlers.

To improve reusability and cleanness of the interface I worked out a second patch in which
the support for external option handlers is implemented in a different way:

- An abstract base class for option handlers has been defined.
- The user builds the actual option handler class for each option by extending the base class.
the option hadler class takes care of whether to activate the option or not (local and remote
side) and manages the subnegotiation
- for each option the user registers a different option handler to TelnetClient

This new patch is an alternative to the patch I sent on 3 13th, in that it doesn't provide
new functionality, rather the same functionality is offered through a different API.
I suggest that you take a look at both alternatives, even if I think that this new alternative
goes a bit beyond in providing a reusable way of dealing with option handling.

This new patch also includes a correction to the option handling mechanism (a flush() of the
output stream has been added after sending option negotiation sequences, to ensure that negotiation
occurs ASAP).

A brief description of the new patch:
- TelnetOptionHandler is an abstract base class for option handling. User extends this class
specifying how to do subnegotiation for each of the options he wants to support.
- EchoOptionHandler, TerminalTypeOptionHandler, SuppressGAOptionHandler, SimpleOptionHandler
are a library of already provided option handlers. SimpleOptionHandler allows managing all
options that don't require subnegotiation.
- TelnetInputStream has been modifies to handle option subnegotiation and AYT response checking.
- Telnet has been modified by adding new constructors, for handling TERMINAL-TYPE and for
driving the control of option negotiation through the user provided TelnetOptionHandler instances.
Also, methods for adding/removing the TelnetOptionHandler instances have been added.
- TelnetClient has been modified by adding new constructors and interface methods.
- TelnetClientExample1 is an example terminal that uses external TelnetOptionHandler instances
 and demonstrates use of sendAYT(), getLocalOptionState(), getRemoteOptionState(), SimpleOptionHandler,
addOptionHAndler(), removeOptionHandler(). 
- TelnetClientExample2 is the same example terminal without use of the external option handler
but using the built in TERMINAL-TYPE support.

I know that I'm providing too much patches for the same functionality and this can be confusing.
Sorry for that!
Again, I think that the best is evaluating the last two patches (I prefer the second one).

Any comment or suggestion will be welcome.

Bruno


Mime
View raw message