Hi Francesco,
Now, could I get outputStream and InputStream of the process (with
getOutputStream and getInputStream respectively) and join them to my
VT100Terminal through getOutputStream and getInputStream of new IhostShell
interface?
Yes this
seems exactly like the right thing to do!
The one thing
to consider or decide will be, who should do the character
encoding: The
Service (LocalHostShell / TelnetHostShell / SshHostShell)
or the
Terminal.
You may know
that the plain OutputStream just writes bytes and byte
arrays,
whereas Java uses Unicode representation of characters
internally.
At some
point, a conversion needs to be made to convert Unicode into
the Shell's
understanding of how characters are represented by bytes.
In the
LocalHostShell, the OutputStreamWriter does exactly that: It
is
the bridge
between the Unicode characters and the shell's bytes.
If you look
at the SshHostShell constructor, you see how it constructs
the
OutputStreamWriter based on the specfied encoding, and
passes
it into the
SshShellWriterThread.
I'm not yet
exactly sure whether it's better to surface the internal
(byte-oriented) outoutStream through the new IHostShell
interface,
or better
surface the (character-oriented) Writer. My feeling is that
the
outputStream will be better, because this allows for
verbatim
characters to
be sent, which is necessary when using a program
like lrzsz to
transfer files to the remote through x/y/zmodem protocol.
The downside
of surfacing the outputStream is that the Terminal
needs to care
for proper encoding itself, both on the input and
on the
output. Currently, the terminal does not care for encodings,
so that would
be another small feature to be added to the Terminal
when it's not
provided from RSE.
Probably it
would even make sense to surface _both_ the byte/streams
based
interface _and_ the character/writer based interface.
Cheers, -- Martin Oberhuber Wind River Systems, Inc. Target
Management Project Lead, DSDP PMC Member http://www.eclipse.org/dsdp/tm
Hi martin
in the LocalHostShell class which extends IHostShell there's
a writeToShell method:
public void writeToShell(String
command) {
_shellThread.sendInput(command); }
where
_shellThread is a LocalShellThread istance. Well, in the _shellThread
there's a "Process"
Process _theProcess =
Runtime.getRuntime().exec(....);
and "writeToShell" directly writes
into its outputStream:
public void sendInput(String
input) { if
(!_isDone) {
OutputStream output =
_theProcess.getOutputStream();
BufferedWriter writer = new BufferedWriter(new
OutputStreamWriter(output));
try
{
writer.write(input);
writer.write('\n');
writer.flush(); .....
Now,
could I get outputStream and InputStream of the process (with getOutputStream
and getInputStream respectively) and join them to my VT100Terminal through
getOutputStream and getInputStream of new IhostShell interface?
I am
studying the other classes such as SshHostShell, DStoreHostShell and
TelnetHostShell to find a way to modify their wiriteToShell method.
Thanks and greetings,
Crivelli
Francesco
> Date: Thu, 29 Nov 2007 09:31:21 +0100 >
From: martin.oberhuber@xxxxxxxxxxxxx > To:
francescocriv@xxxxxxxxxxx > Subject: Re: Target Management Project -
Undergraduate Level thesis to Politecnico di Milano > > You have
to change existing RSE code, i.e. change the current IHostShell >
interface > as well as SshHostShell / DStoreHostShell / TelnetHostShell
implementations. > Perhaps I was not clear on that when saying that an
API change is required. > > You'll need to check out RSE Source
Code from CVS, see >
http://www.eclipse.org/dsdp/tm/development/cvs_setup.php > > I
was aware of that from the very beginning, and I think having to
change > existing API is one important part of learning for your
thesis. > > Cheers, >
Martin >
|