Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351328

Summary: [Gogo] Server console in Eclipse doesn't work in the same way it did with milestone 5
Product: [RT] Virgo Reporter: Frieder Heugel <frieder.heugel>
Component: runtimeAssignee: Lazar Kirchev <l.kirchev>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington, l.kirchev, leo.dos.santos, milesparker, mlippert
Version: unspecified   
Target Milestone: 3.5.1.RELEASE   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 351284    
Attachments:
Description Flags
Proposed patch
none
Proposed patch none

Description Frieder Heugel CLA 2011-07-06 09:33:03 EDT
Build Identifier: 3.0.0.M06

While with Virgo 3.0.0.M05 the 'ss' command was available in the Eclipse Server Console, since milestone 6 this command is not recognized anymore. When typing 'ss' (without ') into the console a list of ---Eclipse Runtime commands--- is displayed. The same issue exists for commands like 'refresh' or 'update'.



Reproducible: Always
Comment 1 Glyn Normington CLA 2011-07-19 07:13:48 EDT
Would be nice to have for 3.0, but we are running out of schedule and there is a workaround of using a telnet session to run a shell.
Comment 2 Lazar Kirchev CLA 2011-12-06 06:25:17 EST
Some more details for this issue. Actually, the commands registered by the default Equinox console are missing. The reason is that after introducing the new shell we disabled the default one. The new shell itself registers these commands, but the Virgo tooling uses its own implementation of CommandInterpreter (which actually copies the one from the default equinox console) - org.eclipse.virgo.ide.management.remote.ServerCommandInterpreter in org.eclipse.virgo.ide.management.remote project, and it is used by org.eclipse.virgo.ide.management.remote.StandardBundleAdmin in the same project. 

This could be fixed in two ways - either the custom CommandInterpreter is removed and a ConsoleSession is used to issue commands (this is the way things should be done with the old equinox console, but the new one also supports it), or the new Gogo API with CommandProcessor and CommandSession should be adopted.
Comment 3 Lazar Kirchev CLA 2011-12-06 07:59:46 EST
Hi Martin,

Could you please comment on this bug? We should decide what is the best way for the tooling to adopt the new shell.
Comment 4 Lazar Kirchev CLA 2012-01-08 10:25:25 EST
Hi Martin,

As agreed, I checked the code and I suggest the following approach:

The project org.eclipse.virgo.ide.management.remote adopts the new Gogo API by using the CommandProcessor and CommandSession instead of the old CommandInterpreter API. For this the class org.eclipse.virgo.ide.management.remote.ServerCommandInterpreter should be completely removed. The org.eclipse.virgo.ide.management.remote.StandardBundleAdmin will lookup CommandProcessor (instead of CommandProvider services), and will create CommandSession from the CommandProcessor. Then StandardBundleAdmin.execute will execute the passed command line by calling CommandSession.execute(cmdLine) instead of ServerCommandInterpreter.exdecute(...). 

I see that ServerCommandInterpreter.nextArgument() currently removes any quotation marks from the arguments. If the presence of quotation marks in the command line is a real scenario, then they should be removed before callingCommandSession.execute(cmdLine).

Martin, I could provide a patch for this, or you could contact me to further discuss the solution when you start refactoring the tooling. Just indicate what you prefer.
Comment 5 Lazar Kirchev CLA 2012-02-13 02:33:45 EST
Miles, I CC you in this bug to be aware of our discussions.
Comment 6 Miles Parker CLA 2012-06-20 11:55:27 EDT
Hi Lazar,

Sorry to miss this bug. Yes, your solution sounds great. If you can submit a patch for it we'll try to get it in asap.

cheers,

Miles
Comment 7 Lazar Kirchev CLA 2012-06-21 01:32:51 EDT
(In reply to comment #6)
> Hi Lazar,
> 
> Sorry to miss this bug. Yes, your solution sounds great. If you can submit a
> patch for it we'll try to get it in asap.
> 
> cheers,
> 
> Miles

Thanks Miles, 

I will take care to prepare a patch in the next one or two weeks and attach it here.

Regards,
Lazar
Comment 8 Miles Parker CLA 2012-07-02 13:25:58 EDT
We've decided to hold 3.5.0. for this, since we haven't pushed the release yet anyway. Let us know if you run into any issues that we can collaborate on.
Comment 9 Miles Parker CLA 2012-07-03 18:14:32 EDT
Moving to tooling as that is where the code will be. Lazar, do you think you might be able to accomplish this w/in the next week or so?
Comment 10 Miles Parker CLA 2012-07-03 18:26:49 EDT
*** Bug 379302 has been marked as a duplicate of this bug. ***
Comment 11 Lazar Kirchev CLA 2012-07-04 02:54:26 EDT
Created attachment 218243 [details]
Proposed patch

Patch implementing the proposed solution.
Comment 12 Lazar Kirchev CLA 2012-07-04 03:52:13 EDT
(In reply to comment #11)
> Created attachment 218243 [details]
> Proposed patch
> 
> Patch implementing the proposed solution.

How could I test this locally? I tried to install the tooling from the update site, built locally in the ide project, but the installation fails because of unsatisfied dependencies to virgo kernel.
Comment 13 Lazar Kirchev CLA 2012-07-04 09:06:55 EDT
Hi Miles, 

I think that the proposed patch will not be enough to adopt the new console. I used to think that this StandardBundleAdmin MBean is the connection between the Tooling console and the actual server, but it seems that this was wrong assumption. Do you know where exactly this connection is made? I cannot find it, and I think that this is the place which should be reworked. However, the attached patch also is relevant for the new version of Virgo.
Comment 14 Lazar Kirchev CLA 2012-07-04 10:02:50 EDT
I found why the console currently is not working. Actually after all of the changes Miles made it should be working. But in config.ini we have the property gosh.args=--nointeractive, which makes the console not open a session on  System.in and System.out, and to listen only for remote connections. If this property is removed and the server started, the console appears. However, its output is not in the Console View, but in the log file, because Virgo redirects the System.out to the log file. 

Does anybody know how the Eclipse Server Console in the tooling worked with Virgo versions prior to 2.1.1? There the output was still redirected to the log file. Or probably I am looking the wrong Console View?
Comment 15 Lazar Kirchev CLA 2012-07-04 10:04:56 EDT
> Virgo versions prior to 2.1.1? There the output was still redirected to the log

"prior to 2.1.1" should be read "prior to 3.0"
Comment 16 Miles Parker CLA 2012-07-04 12:35:32 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > Created attachment 218243 [details]
> > Proposed patch
> > 
> > Patch implementing the proposed solution.

Thanks! I'll take a look now.

> 
> How could I test this locally? I tried to install the tooling from the update
> site, built locally in the ide project, but the installation fails because of
> unsatisfied dependencies to virgo kernel.

Yes, I've fond that the target platform setup is not easy. We have some recent traffic on virgo-dev regarding this. The way I've made it work is to have all of the major dependencies -- including AspectJ and M2e tools installed into your Eclipse platform. Then I put some of the the other bits that I don't want in my Eclipse environment, plus the bits that don't like to live with each other :) into the target platform. You can try:

org.eclipse.virgo.ide/SuggestedTargetPlatform.target

But no promises! :)
Comment 17 Miles Parker CLA 2012-07-04 12:50:51 EDT
(In reply to comment #14)
> I found why the console currently is not working. Actually after all of the
> changes Miles made it should be working. But in config.ini we have the property
> gosh.args=--nointeractive, which makes the console not open a session on 
> System.in and System.out, and to listen only for remote connections. If this
> property is removed and the server started, the console appears. However, its
> output is not in the Console View, but in the log file, because Virgo redirects
> the System.out to the log file. 

Argh. Virgo runtime does that, or do you think tooling is? Libra is actually contributing the server console page, so something could be happening there as well. I'll take a look.

> 
> Does anybody know how the Eclipse Server Console in the tooling worked with
> Virgo versions prior to 2.1.1? There the output was still redirected to the log
> file. Or probably I am looking the wrong Console View?

I don't know, its all terribly confusing. What would make me really (not) happy is to discover that some of the crap logging tools that Eclipse seems to be accumulating are stealing this, but that's probably just paranoia on my part.
Comment 18 Miles Parker CLA 2012-07-04 12:54:39 EDT
Oh, to be clear..I thin there is a major source of confusion here. The (standard) Console View has always worked properly (hopefully it still does :D) -- what we're referring to hear is the Server Console page. If you double-click on a server and open the editor, that's the last page. It's an *interactive* console.

(We have a bug  374628 for a nicer solution to that.)
Comment 19 Lazar Kirchev CLA 2012-07-05 01:57:48 EDT
(In reply to comment #18)
> Oh, to be clear..I thin there is a major source of confusion here. The
> (standard) Console View has always worked properly (hopefully it still does :D)
> -- what we're referring to hear is the Server Console page. If you double-click
> on a server and open the editor, that's the last page. It's an *interactive*
> console.
> 
> (We have a bug  374628 for a nicer solution to that.)

I am afraid that for Juno the Libra console has some issues - bug 384304.
Comment 20 Lazar Kirchev CLA 2012-07-05 10:49:48 EDT
Miles, I have not looked on the Server Console - I mistakenly tried the Console View. Now I am pretty sure that the proposed patch will work for the Server Console - the patch does not work for the standard Console View, but the Server Console is completely different. 

I still haven't tested it, but I will shortly try your proposition for org.eclipse.virgo.ide/SuggestedTargetPlatform.target.
Comment 21 Lazar Kirchev CLA 2012-07-05 11:01:01 EDT
(In reply to comment #20)
> Miles, I have not looked on the Server Console - I mistakenly tried the Console
> View. Now I am pretty sure that the proposed patch will work for the Server
> Console - the patch does not work for the standard Console View, but the Server
> Console is completely different. 
> 
> I still haven't tested it, but I will shortly try your proposition for
> org.eclipse.virgo.ide/SuggestedTargetPlatform.target.

I found a way to try the patch and it is not working. I am investigating why.
Comment 22 Lazar Kirchev CLA 2012-07-05 11:04:42 EDT
And one more question arises - for which region of the server should the console work?
Comment 23 Lazar Kirchev CLA 2012-07-05 11:12:32 EDT
(In reply to comment #22)
> And one more question arises - for which region of the server should the
> console work?

Obviously the user region.
Comment 24 Lazar Kirchev CLA 2012-07-05 11:29:37 EDT
(In reply to comment #21)

> I found a way to try the patch and it is not working. I am investigating why.

It seems the problem is not in the patch, but in the way I tried to test it - I tried to replace the org.eclipse.virgo.ide.management.remote bundle in the ready installation of Eclipse + Virgo tooling, but this approach seems to not work. I will find a better way to try it.
Comment 25 Miles Parker CLA 2012-07-05 11:56:56 EDT
(In reply to comment #24)
> (In reply to comment #21)
> 
> > I found a way to try the patch and it is not working. I am investigating why.
> 
> It seems the problem is not in the patch, but in the way I tried to test it - I
> tried to replace the org.eclipse.virgo.ide.management.remote bundle in the
> ready installation of Eclipse + Virgo tooling, but this approach seems to not
> work. I will find a better way to try it.

Here's what you need to do there:

1. Make the changes in org.eclipse.virgo.ide.management.remote. This will require switching a different target platform that has the correct dependencies. That should be very simple, but I don't have one pre-made yet, sorry.

2. Export the plugin to o.e.virgo.ide.runtime.core.

3. Change org.eclipse.virgo.ide.runtime.internal.core.runtimes.Virgo35Provider#GEMINI_CONNECTOR_BUNDLE_NAME to point to the new bundle location.

4. Launch Eclipse runtime and start a server from there to get the bundle installed into Virgo.
Comment 26 Miles Parker CLA 2012-07-05 12:01:01 EDT
Lazar,

Also, please see http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions for the new way of handling patches. You'll need to open a fork on github, which you'll probably want anyway.

cheers,

Miles
Comment 27 Lazar Kirchev CLA 2012-07-05 12:03:58 EDT
(In reply to comment #26)
> Lazar,
> 
> Also, please see
> http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions for
> the new way of handling patches. You'll need to open a fork on github, which
> you'll probably want anyway.
> 
> cheers,
> 
> Miles

Miles, is this really necessary? I am a committer on the Virgo project.

Regards,
Lazar
Comment 28 Miles Parker CLA 2012-07-05 12:06:53 EDT
(In reply to comment #27)
> Miles, is this really necessary? I am a committer on the Virgo project.
> 
> Regards,
> Lazar

LOL. I'm sorry Lazar. Kind of out of it this am, I think I assumed because of the proposed patch. Actually you should just go ahead an commit. Ideally we'd run it through Gerrit, but I'm not really set up for that. Just let me know when you do that.

cheers,

Miles
Comment 29 Lazar Kirchev CLA 2012-07-05 12:10:11 EDT
(In reply to comment #28)
> (In reply to comment #27)
> > Miles, is this really necessary? I am a committer on the Virgo project.
> > 
> > Regards,
> > Lazar
> 
> LOL. I'm sorry Lazar. Kind of out of it this am, I think I assumed because of
> the proposed patch. Actually you should just go ahead an commit. Ideally we'd
> run it through Gerrit, but I'm not really set up for that. Just let me know
> when you do that.
> 
> cheers,
> 
> Miles

I proposed a patch so that you could have a look on it :) I didn't know if Virgo Tooling is set up to work with Gerrit - Virgo itself isn't. 
I'll let you know when I have verified the patch is working.

Regards,
Lazar
Comment 30 Lazar Kirchev CLA 2012-07-08 09:10:00 EDT
Created attachment 218420 [details]
Proposed patch

I tested the patch and it is working. I had to make e minor change in its MANIFEST.MF though, so a attached the fixed patch. You only will need probably to add Apache Felix Gogo Runtime to the target platform. It is available in the Orbit update site.

if you are fine with the patch, I can submit it.
Comment 31 Miles Parker CLA 2012-07-08 14:36:29 EDT
Lazar, since we don't have to worry about IP approval, just open a git branch using this bug as label.

thanks!

Miles
Comment 32 Lazar Kirchev CLA 2012-07-09 05:16:37 EDT
(In reply to comment #31)
> Lazar, since we don't have to worry about IP approval, just open a git branch
> using this bug as label.
> 
> thanks!
> 
> Miles

Change pushed to branch Bug351328_ServerConsole

Lazar
Comment 33 Lazar Kirchev CLA 2012-07-09 07:55:49 EDT
Miles,

Is there a reason why org.eclipse.virgo.management.remote subproject is not included as a module in the pom of org.eclipse.virgo.ide and respectvily is not built with all other subprojects?

Regards,
Lazar
Comment 34 Miles Parker CLA 2012-07-09 15:40:36 EDT
(In reply to comment #33)
> Is there a reason why org.eclipse.virgo.management.remote subproject is not
> included as a module in the pom of org.eclipse.virgo.ide and respectvily is not
> built with all other subprojects?

Yep, a very good one. :) Its one that took Leo and I quite a bit of puzzling to figure out. Turns out that it needs to be built against a totally different set of dependencies as its deployed to the server. It doesn't work to have a shared TP either because there are actually conflicting dependencies. So we really need a separate TP for it. Also process wise we can't have it part of integration build because it needs to actually be pre-built as a jar and then injected by the core.manifest plugin.

btw, thanks for your work getting this out. After making it such a rush, I now have to reverse myself and say that I probably won't get to review it right away. Hopefull later this week, but overall my availability won't be great this month and we're going to push off release until next month.
Comment 35 Miles Parker CLA 2012-08-29 19:39:23 EDT
Merged with new remote jar. This one was an epic, but works perfectly now. Thanks Lazar.
Comment 36 Lazar Kirchev CLA 2012-09-17 07:22:06 EDT
Closing the bug as fixed.