dev@glassfish.java.net

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

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Fri, 13 Jul 2012 11:16:59 +0530

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