[Bug 950] New: Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Summary: Add corba option.
Product: Toolchain
Version: master
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P3
Component: Lua
AssignedTo: orocos-dev [..] ...
ReportedBy: paul [dot] chavent [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Created attachment 794
--> http://bugs.orocos.org/attachment.cgi?id=794
Lua : add corba option

This patch add corba option for deployment.

It builds a new exec rttlua-corba, that can take an optional "-- -ORBInitRef
NameService=corbaloc:iiop:${HOSTNAME}:2809/NameService" argument that enable
the usage of corba.

Whithout changing my old xml files i launch my app with :

HOSTNAME=`hostname`
DEPLOYER=`which rttlua-corba-gnulinux`

${DEPLOYER} -l rttlib -e " \
rtt.setLogLevel(\"Info\"); \
rttlib.color = true; \
tc = rtt.getTC(); \
depl = tc:getPeer(\"deployer\"); \
depl:kickStart(\"${1}\")" -i -- -ORBInitRef
NameService=corbaloc:iiop:${HOSTNAME}:2809/NameService

That should be roughly equivalent to

HOSTNAME=`hostname`
DEPLOYER=`which deployer-corba-gnulinux`
${DEPLOYER} -s ${1} -- -ORBInitRef
NameService=corbaloc:iiop:${HOSTNAME}:2809/NameService

Paul.

[Bug 950] Add corba option.

[Bug 950] Add corba option.

[Bug 950] Add corba option.

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Chavent Paul <paul [dot] chavent [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #804 is|0 |1
obsolete| |

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |peter [..] ...

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Chavent Paul <paul [dot] chavent [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #797 is|0 |1
obsolete| |

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Chavent Paul <paul [dot] chavent [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #796 is|0 |1
obsolete| |

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Chavent Paul <paul [dot] chavent [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #795 is|0 |1
obsolete| |

[Bug 950] Add corba option.

Hi Paul,

On Fri, Apr 27, 2012 at 12:07:49PM +0000, Chavent Paul wrote:
>
> http://bugs.orocos.org/show_bug.cgi?id=950
>
> Chavent Paul <paul [dot] chavent [..] ...> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Attachment #795 is|0 |1
> obsolete| |
>

[Bug 950] Add corba option.

http://bugs.orocos.org/show_bug.cgi?id=950

Chavent Paul <paul [dot] chavent [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #794 is|0 |1
obsolete| |

[Bug 950] Add corba option.

Hi Paul,

Thanks for the patch. I just discussed with Peter and we agreed that
in the long run the -corba tools should disappear and instead you only
load the corba deployer (from the basic deployer) and configure the
parameters using properties. But this will take some time, so I can
apply your patch.

Just one minor issue below:

[...]

+#if defined(LUA_RTT_CORBA)
+ int orb_argc = argc;
+ char** orb_argv = 0;
+
+ while(orb_argc) {
+ if(0 == strcmp("--", argv[argc - orb_argc])) {
+ argv[argc - orb_argc] = argv[0];
+ orb_argv = &argv[argc - orb_argc];
+ argc -= orb_argc;
+ break;
+ }
+ orb_argc--;
+ }
+
+ if(orb_argc) {
+ try {
+ TaskContextServer::InitOrb(orb_argc, orb_argv);
+
+ dc = new CorbaDeploymentComponent("deployer");
+
+ TaskContextServer::Create( dc, true, true );
+
+ // The orb thread accepts incomming CORBA calls.
+ TaskContextServer::ThreadOrb();
+ }
+ catch( CORBA::Exception &e ) {
+ log(Error) << argv[0] <<" ORO_main : CORBA exception raised!" << Logger::nl;
+ log() << CORBA_EXCEPTION_INFO(e) << endlog();
+ } catch (...) {
+ log(Error) << "Uncaught exception." << endlog();
+ }
+
+ // lua_repl doesn't use argc ?
+ argv[argc] = NULL;

Lua repl _does_ use the arguments, which is very useful to write
standalone scripts (#!/bin/env rttlua) taking arguments. For example:

test.lua:
<lua>
require "utils"
print(utils.tab2str(arg))
<lua>

$ rttlua-gnulinux test.lua --foo --bar 33
{"--foo","--bar","33",[-1]="rttlua-gnulinux",[0]="test.lua"}

Does this still work?
Markus

[Bug 950] Add corba option.

Le 04/26/2012 05:08 PM, Markus Klotzbuecher a écrit :
> + // lua_repl doesn't use argc ?
> + argv[argc] = NULL;
>
> Lua repl _does_ use the arguments, which is very useful to write
> standalone scripts (#!/bin/env rttlua) taking arguments. For example:
>
> test.lua:
> <lua>
> require "utils"
> print(utils.tab2str(arg))
> <lua>
>
> $ rttlua-gnulinux test.lua --foo --bar 33
> {"--foo","--bar","33",[-1]="rttlua-gnulinux",[0]="test.lua"}
>
> Does this still work?
> Markus
>

If we call rttlua-gnulinux it will work.

If we call
$ rttlua-corba-gnulinux test.lua --foo --bar 33
it should display
{[-1]="rttlua-gnulinux",[0]="test.lua"}

That's because i thought that rttlua-corba-gnulinux expects '-ORBInitRef
NameService=corbaloc' after '--'.
So instead of writing
argv[argc] = NULL;
i should have written
argv[argc] = "--";

Thank you for your review.

Paul.