Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 279562 - Allow console to accept sessions from multiple sources
Summary: Allow console to accept sessions from multiple sources
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.5   Edit
Hardware: All Windows Vista
: P3 enhancement with 1 vote (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 162415 (view as bug list)
Depends on:
Blocks: 287900
  Show dependency tree
 
Reported: 2009-06-09 02:05 EDT by Lazar Kirchev CLA
Modified: 2010-03-13 04:36 EST (History)
7 users (show)

See Also:


Attachments
patch adding functionality to the telnet console (25.59 KB, patch)
2009-06-09 02:05 EDT, Lazar Kirchev CLA
no flags Details | Diff
patch adding functionality to the telnet console, compliant with OSGi minimum 1.2 (26.65 KB, patch)
2009-06-10 02:59 EDT, Lazar Kirchev CLA
no flags Details | Diff
console session patch (29.83 KB, patch)
2009-08-25 15:54 EDT, Thomas Watson CLA
no flags Details | Diff
telnet example bundle (27.47 KB, application/octet-stream)
2009-08-25 15:57 EDT, Thomas Watson CLA
no flags Details
org.eclipse.pde.ui.console (6.67 KB, application/zip)
2009-08-25 22:50 EDT, Chris Aniszczyk CLA
no flags Details
updated pde.ui.console (8.00 KB, application/octet-stream)
2009-08-26 15:49 EDT, Thomas Watson CLA
no flags Details
updated framework patch (29.88 KB, text/plain)
2009-08-26 16:22 EDT, Thomas Watson CLA
no flags Details
updated framework patch (35.94 KB, text/plain)
2009-08-27 18:05 EDT, Thomas Watson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lazar Kirchev CLA 2009-06-09 02:05:15 EDT
Created attachment 138645 [details]
patch adding functionality to the telnet console

Currently the telnet console is not user-friendly. Here I provide a patch, which adds some features to the telnet console, which make it easier to use. The patch provides history and line editing - deletion with the del and backspace keys, insert/replace, movement with the left and right arrow.
Comment 1 Thomas Watson CLA 2009-06-09 10:00:01 EDT
The patch uses J2SE 1.5 for loops and generics.  Can you provide a patch that can compile against the OSGi minimum 1.2 execution environment?
Comment 2 Lazar Kirchev CLA 2009-06-10 02:59:25 EDT
Created attachment 138754 [details]
patch adding functionality to the telnet console, compliant with OSGi minimum 1.2

The previously submitted patch, but compliant with OSGi minimum 1.2
Comment 3 Bernd Kolb CLA 2009-08-11 06:51:31 EDT
Hi Tom,

any update on this?

Cheers,

Bernd
Comment 4 Thomas Watson CLA 2009-08-11 09:09:22 EDT
I will put this on my plate to review for M2.

Comment 5 Bernd Kolb CLA 2009-08-11 10:35:14 EDT
Thanks!
Comment 6 Thomas Watson CLA 2009-08-25 15:54:12 EDT
Created attachment 145585 [details]
console session patch

This is a great idea.  But I am reluctant to add so much code to the core framework console implementation.  Here is an alternate proposal.

This patch adds a new API to the console (ConsoleSession service).  This service allows anyone to publish a console session service which provides the input/output to a console session in any way they want.  I think this is a good thing to do because:

1) It finally removes the silly restriction of only allowing one console session at a time.
2) It is very flexible in allowing advanced front ends to provide the session input and output (I will attach a project that uses your code to provide the added functionality you want in another bundle).
3) It opens up the framework console so that it can be connected to by PDE, something I know Chris has been wanting to do for some time now.
Comment 7 Thomas Watson CLA 2009-08-25 15:57:12 EDT
Created attachment 145587 [details]
telnet example bundle

Here is the separate telnet bundle.  In order for this to work you have to use the -console option to enable the basic console support in the framework.  If we go this route then we would have to make this work without specifying -console I think.
Comment 8 Chris Aniszczyk CLA 2009-08-25 22:50:07 EDT
Created attachment 145621 [details]
org.eclipse.pde.ui.console

Here's a quick bundle that contributes a dummy console Tom.

If you can hook the output and inputstream's to the bundle, I think we're golden.

I didn't have time to do it tonight but hopefully it's enough to get you started.

If you selfhost with this bundle and your patch, you should notice an "OSGi Console" available to you in the Console view.
Comment 9 Chris Aniszczyk CLA 2009-08-25 22:50:41 EDT
If we refine the code enough, I'd be willing to have it in PDE.

It would be useful for some plug-in developers ;)
Comment 10 Lazar Kirchev CLA 2009-08-26 10:44:46 EDT
(In reply to comment #7)
> Created an attachment (id=145587) [details]
> telnet example bundle
> 
> Here is the separate telnet bundle.  In order for this to work you have to use
> the -console option to enable the basic console support in the framework.  If
> we go this route then we would have to make this work without specifying
> -console I think.
> 

I am fine with this solution. 

My only concern is that if the telnet service listens on an arbitrary port (the server socket is created to listen on any free port), then it may happen that the user does not know on which port to connect to with telnet.  

Is the telnet service going to be included in the framework, as part of the console, or not?
Comment 11 Thomas Watson CLA 2009-08-26 10:54:40 EDT
(In reply to comment #10)
> I am fine with this solution. 
> 
> My only concern is that if the telnet service listens on an arbitrary port (the
> server socket is created to listen on any free port), then it may happen that
> the user does not know on which port to connect to with telnet.  
> 
> Is the telnet service going to be included in the framework, as part of the
> console, or not?
> 

We would keep the current functionality of the console where the built-in input/output comes from the System.in/System.out or from the dinky and brain dead telnet server (using -console <port>).

The beauty of this solution is that you can build a more sophisticated telnet front end that does everything you want.  In my example, I just used port 0 for simplicity, but you can get a configuration port from what ever source you want (simple thing would be to use BundleContext.getProperty("fancy.telnet.port")).

This layered approach is much better because we don't have to build into the framework every new function that others may want.  For example, we have had requests for user login over telnet and for a secure/encrypted connection.  That is nothing we would want to build into the framework.  But if it is built on top in a separate bundle then we give developers the freedom to do what they need.
Comment 12 Thomas Watson CLA 2009-08-26 15:49:21 EDT
Created attachment 145710 [details]
updated pde.ui.console

Here is an updated pde.ui.console.  I hooked it into a ConsoleSession.  I modified it a bit to allow for multiple OSGiConsoles to be created.  This was just for testing, I'm not sure it makes sense to allow multiple consoles to be created.  To disconnect from a console you use the disconnect command.  That will remove the console from the view.
Comment 13 Thomas Watson CLA 2009-08-26 16:22:52 EDT
Created attachment 145714 [details]
updated framework patch

Here is an updated patch that enables console sessions even when -console is not specified.  I also allow for "-console none" to be used to disable all console sessions.
Comment 14 Thomas Watson CLA 2009-08-27 18:05:47 EDT
Created attachment 145866 [details]
updated framework patch

A few more tweaks to javadoc and the implementation.  I plan to release this patch to HEAD.
Comment 15 Thomas Watson CLA 2009-08-27 18:10:30 EDT
I released the patch, with one addition to update the version of the exported console package.  I renamed the summary to more accurately reflect the solution.
Comment 16 Chris Aniszczyk CLA 2009-08-27 18:22:33 EDT
I'll work on creating a patch against PDE UI for the console functionality.
Comment 17 Thomas Watson CLA 2009-11-13 10:09:34 EST
*** Bug 162415 has been marked as a duplicate of this bug. ***