dev@glassfish.java.net

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

From: Ancoron Luciferis <ancoron.luciferis_at_googlemail.com>
Date: Tue, 17 Jul 2012 00:48:04 +0200

Hi,

I've pushed another version (I've messed up my versioning, so this is
now a "1.1.0-rc1").

The new version now includes proper remote execution include the
interactive shell to remote instances (tested with local instances,
clustered instances to-be-tested).

By default, it uses the DAS itself as usual, but you can specify the
option "--instance" to use a different server instance. As this command
is intended to be used on DAS, standalone-instances or clustered
instances only a cluster as a target does not make any sense.

That's also the reason why I've not used the "target" automatism of the
asadmin commands, as it replicates commands in a way I don't want (or
just don't understand - esp. regarding the returned output). Instead, I
used the ServerRemoteAdminCommand manually, which works like a charm for
this.

In addition I've verified it with a secured admin infrastructure.

Please let me know what 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
>