dev@glassfish.java.net

Re: [Design Idea]About GLASSFISH-16998 and GLASSFISH-13006

From: Ancoron Luciferis <ancoron.luciferis_at_googlemail.com>
Date: Sat, 14 Jul 2012 01:49:24 +0200

OK,

so besides fixing the problem with the real multi-mode command (I had to
introduce remote session handling - feels quite awful), I also embedded
jline classes (https://github.com/jline/jline2) inside the local command
HK2-Jar to support some features I always wanted to work on inside asadmin:

* command completion (still static for now and very basic)
* command history
* user shell behavior (e.g. CTRL + ALT + BACK_SPACE deletes a word)
* no more weird control characters printed on the terminal
* no additional new-lines

So now this works:

gogo$ x=y
gogo$ echo $x
y
gogo$

I did a first release for this (as it also requires an updated felix
remote command):

Local:
https://oss.sonatype.org/content/repositories/releases/org/ancoron/glassfish/asadmin/org.ancoron.glassfish.asadmin.felix.shell.interactive/1.0.6/org.ancoron.glassfish.asadmin.felix.shell.interactive-1.0.6.jar

Remote:
https://oss.sonatype.org/content/repositories/releases/org/ancoron/glassfish/asadmin/org.ancoron.glassfish.asadmin.felix.shell/1.0.6/org.ancoron.glassfish.asadmin.felix.shell-1.0.6.jar

However, for the pure felix shell there are no sessions available and so
sessions are only supported for gogo.

What do you think?

Cheers,

        Ancoron


On 07/13/2012 07:46 AM, Sahoo wrote:
> On Friday 13 July 2012 05:19 AM, Ancoron Luciferis wrote:
>> On 07/12/2012 08:27 PM, Tom Mueller wrote:
>>> Agreed. But with Ancoron's felix command it is now possible to use the
>>> OSGi shell without having to open the security hole. That's what's
>>> really nice about this.
>>>
>>> Tom
>>>
>> Well... guess what?
>>
>> It was so easy:
>>
>> * copy MultimodeCommand
>> * modify prompt
>> * introduce remote command prefix
>>
>> Usually my code is in Apache 2 license, but as I forked off some code
>> here I complied to use the CDDL + GPL 1.1.
>>
>> However, it would have been much much easier with a MultimodeCommand
>> that is a bit more open for extensions so that I just have to provide a
>> custom prompt and a custom command execution so that I can re-use the
>> infrastructure and just have to extend it instead of copying code.
>>
>> Attached a very first little patch for this extensibility approach.
>>
>> Code:
>>
>> https://github.com/ancoron/gf-samples/tree/master/asadmin-ext/felix-shell-interactive
>>
>> Snapshot binary:
>>
>> https://oss.sonatype.org/content/repositories/snapshots/org/ancoron/glassfish/asadmin/org.ancoron.glassfish.asadmin.felix.shell.interactive/1.0.6-SNAPSHOT/org.ancoron.glassfish.asadmin.felix.shell.interactive-1.0.6-20120712.231354-1.jar
>>
>> Installation:
>> * put it in .../glassfish/lib/asadmin/
> First of all, thanks very much for your effort. Although I have not
> looked at your sources yet, I did try the binary. I tried by copying
> org.ancoron.glassfish.asadmin.felix.shell-1.0.5.jar to modules/autostart
> and copying
> org.ancoron.glassfish.asadmin.felix.shell.interactive-1.0.6-20120712.231354-1.jar
> to lib/asadmin of my 3.1.2 installation. I had to enable the shell
> bundles to get things working, which is understandable. I observed one
> issue though. I still don't see true multimode command execution. The
> commands seem to be not associated with one CommandSession in the
> backend. As a result, I can't use the last command result in next
> command. e.g., try this:
>
> $ asadmin -t felix-shell
>
> felix> x=y
>
> felix> echo $x
>
> null<-- See it prints null instead of y
>
> Now try this instead:
>
> $asadmin -t felix telnetd start -i 127.0.0.1 -p 6667 # This starts gogo telnet daemon
>
> telnetd is running on 127.0.0.1:6667
>
> $telnet 127.0.0.1 6667
>
> g! x=y
>
> y
>
> g! echo $x
>
> y
>
> Thanks,
> Sahoo