lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Marcelo.

On 24 Jul 2008, at 17:26, Marcelo Samartini wrote:
I've been successfully using OiL (both the old and the new versions -- 0.4) by reading/writing IOR files directly. But now I need to implement a nameserver-based system. I've tried the same steps for acquiring the nameserver IOR, trying to connect to the server and issuing resolve and bind operations, but without success.

Sorry for the slow response. But could you provide more details about the errors or the specific problem you are having? You can use the OiL mail-list to send further questions (http://lists.luaforge.net/mailman/listinfo/oil-users/ ).

I've searched the documentation and the demo files but couldn't find concrete examples on how to correctly use the nameserver.


It should be easy to use a name server with OiL. For example, if you have its IOR stored in a file named 'ns.ior' you could write:

-- WARNING: Untested code. Assuming OiL 0.4 beta
require 'oil'
oil.main(function()
	local orb = oil.init()
	local MyServant = orb:newservant(MyObject, nil,
		orb:loadidl("interface MyInterface {};"))
	
	orb:loadidlfile("CosNaming.idl") -- this is necessary if the nameserver
	                                 -- does not provide IR support, so OiL
-- won't be able to discover its interface.
	local ns = orb:newproxy(oil.readfrom("ns.ior"))
	ns = orb:narrow(ns) -- this is necessary if the IOR references a more
	                    -- general interface than the one you want to use,
	                    -- e.g. CORBA::Object
	ns:rebind({{id="MyServant",king="OiL Servant"}}, MyServant)
	
	orb:run()
end)

You can also find examples of servers that access a NamingService in 'demo/cos/channeld.lua' and 'demo/cos/ird.lua' inside the OiL package. Check out the 'demo/cos/execute' bash script to see how the example is executed.

Best regards.


--
Renato Maia
PhD student at PUC-Rio
__________________________
http://www.inf.puc-rio.br/~maia/