dev@glassfish.java.net

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

From: Ancoron Luciferis <ancoron.luciferis_at_googlemail.com>
Date: Fri, 13 Jul 2012 08:45:33 +0200

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

Well, it was ~02:00 AM here when I wrote this and I somehow knew that I
was missing something. :)

Currently, I just create a session for one command using the remote
command. So I just have to add a bit of session management.

Cheers,

        Ancoron