Commit 0bc60dab authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-1961] Fazer experimentações para tratar problemas atuais com a API

- Renomear operações para seguir o padrão de CamelCase das operação do OpenBus
	openbus.newkey --> openbus.newKey
	openbus.readkey --> openbus.readKey
	openbus.readkeyfile --> openbus.readKeyFile
- Operações específicas para cada serviço núcleo para evitar 'narrow'
	Context:getCoreService('OfferRegistry') --> Context:getOfferRegistry()
- Operações que mudam conexão corrente devolvem o valor antigo para permtir restaurar a configuração anterior
  old = Context:setDefaultConnection(new)
  old = Context:setCurrentConnection(new)


git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/openbus_v2_proto@132140 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 9959f867
......@@ -28,7 +28,7 @@ local ok, result = pcall(function ()
OpenBusContext:getCurrentConnection():loginByPassword(entity, password
or entity)
-- find the offered service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
return OfferRegistry:findServices{
{name="openbus.component.interface",value=repID},
{name="offer.domain",value="Demo Chain Validation"},
......
......@@ -11,7 +11,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
local params = {
bushost = bushost,
busport = busport,
......@@ -22,7 +22,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -85,7 +85,7 @@ local ok, result = pcall(function ()
OpenBusContext:getCurrentConnection():loginByCertificate(entity, privatekey)
-- get offer registry
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
-- find the offered service
offers = OfferRegistry:findServices{
......
......@@ -11,7 +11,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
local params = {
bushost = bushost,
busport = busport,
......@@ -22,7 +22,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -72,7 +72,7 @@ local ok, result = pcall(function ()
-- login to the bus
OpenBusContext:getCurrentConnection():loginByCertificate(entity, privatekey)
-- register service at the bus
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, {
{name="offer.role",value="actual messenger"},
{name="offer.domain",value="Demo Chain Validation"},
......
......@@ -62,7 +62,7 @@ conn:onInvalidLogin()
local timestamp
local props = {{name="offer.domain",value="Demo Independent Clock"}}
repeat
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
local ok, result = pcall(OfferRegistry.findServices, OfferRegistry, props)
if not ok then
utils.showerror(result, params, utils.errmsg.BusCore)
......
......@@ -11,7 +11,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
interval = assert(tonumber(interval or 1), "o 5o. argumento é um tempo entre "..
"tentativas de acesso ao barramento em virtude de falhas")
local params = {
......@@ -31,7 +31,7 @@ end
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definition
local iface = orb:loadidl("interface Clock { double getTime(); };")
......@@ -59,11 +59,11 @@ function registerer:enable()
end
function registerer:activate()
if not self.disabled and self.active == nil then
openbus.newthread(function ()
openbus.newThread(function ()
self.active = true
repeat
local ok, result = pcall(function ()
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, props)
self.disabled = true
end)
......
......@@ -28,7 +28,7 @@ local ok, result = pcall(function ()
OpenBusContext:getCurrentConnection():loginByPassword(entity, password
or entity)
-- find the offered service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
return OfferRegistry:findServices{
{name="offer.domain",value="Demo Greetings"},
{name="greetings.language",value=language},
......
......@@ -12,7 +12,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
local params = {
bushost = bushost,
busport = busport,
......@@ -23,7 +23,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -88,7 +88,7 @@ local ok, result = pcall(function ()
-- login to the bus
OpenBusContext:getCurrentConnection():loginByCertificate(entity, privatekey)
-- register service at the bus
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, info in ipairs(components) do
OfferRegistry:registerService(info.component.IComponent, info.properties)
end
......
......@@ -26,7 +26,7 @@ local ok, result = pcall(function ()
OpenBusContext:getCurrentConnection():loginByPassword(entity, password
or entity)
-- find the offered service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
return OfferRegistry:findServices{{name="offer.domain",value="Hello Demo"}}
end)
if not ok then
......
......@@ -11,7 +11,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
local params = {
bushost = bushost,
busport = busport,
......@@ -22,7 +22,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -58,7 +58,7 @@ local ok, result = pcall(function ()
-- login to the bus
OpenBusContext:getCurrentConnection():loginByCertificate(entity, privatekey)
-- register service at the bus
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent,
{{name="offer.domain",value="Hello Demo"}})
end)
......
......@@ -27,7 +27,7 @@ local OpenBusContext = orb.OpenBusContext
-- independent clock thread
local finder = {}
openbus.newthread(function ()
openbus.newThread(function ()
for i = 1, 10 do
local time
local clock = finder.found
......@@ -73,10 +73,10 @@ end
-- create object to search for offer after (re)login
function finder:activate()
if self.found == nil and self.active == nil then
openbus.newthread(function ()
openbus.newThread(function ()
self.active = true
repeat
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
local ok, result = pcall(OfferRegistry.findServices, OfferRegistry,
{{name="offer.domain",value="Demo Independent Clock"}})
if not ok then
......
......@@ -11,7 +11,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
interval = assert(tonumber(interval or 1), "o 5o. argumento é um tempo entre "..
"tentativas de acesso ao barramento em virtude de falhas")
local params = {
......@@ -29,7 +29,7 @@ function clock:getTime()
end
-- independent clock thread
openbus.newthread(function ()
openbus.newThread(function ()
repeat
print(os.date(nil, clock:getTime()))
openbus.sleep(1)
......@@ -39,7 +39,7 @@ end)
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definition
local iface = orb:loadidl("interface Clock { double getTime(); };")
......@@ -67,11 +67,11 @@ function registerer:enable()
end
function registerer:activate()
if not self.disabled and self.active == nil then
openbus.newthread(function ()
openbus.newThread(function ()
self.active = true
repeat
local ok, result = pcall(function ()
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, props)
self.disabled = true
end)
......
......@@ -18,7 +18,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -58,7 +58,7 @@ end
-- function that creates connections logged to the bus
local connprops = { accesskey = assert(openbus.newkey()) }
local connprops = { accesskey = assert(openbus.newKey()) }
local function newLogin()
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
......@@ -73,7 +73,7 @@ local ok, result = pcall(function ()
-- connect to the bus
OpenBusContext:setDefaultConnection(newLogin())
-- find the offered service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
return OfferRegistry:findServices{
{name="offer.domain",value="Demo Multiplexing"},
{name="openbus.component.interface",value=iface.repID},
......@@ -86,7 +86,7 @@ else
-- for each service offer found
for index, offer in ipairs(result) do
-- use offer in a separated thread
openbus.newthread(function ()
openbus.newThread(function ()
-- get new login in protected mode
local ok, result = pcall(newLogin)
if not ok then
......
......@@ -12,7 +12,7 @@ busport = assert(tonumber(busport), "o 2o. argumento é um número de porta")
entity = assert(entity, "o 3o. argumento é a entidade a ser autenticada")
privatekeypath = assert(privatekeypath,
"o 4o. argumento é o caminho da chave privada de autenticação da entidade")
local privatekey = assert(openbus.readkeyfile(privatekeypath))
local privatekey = assert(openbus.readKeyFile(privatekeypath))
local params = {
bushost = bushost,
busport = busport,
......@@ -23,7 +23,7 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -34,7 +34,7 @@ local Timer = oo.class()
function Timer:newTrigger(timeout, callback)
local chain = OpenBusContext:getCallerChain()
local conn = OpenBusContext:getCurrentConnection()
openbus.newthread(function ()
openbus.newThread(function ()
openbus.sleep(timeout)
OpenBusContext:setCurrentConnection(conn)
OpenBusContext:joinChain(chain)
......@@ -81,7 +81,7 @@ for i = 1, 3 do
-- login to the bus
conn:loginByCertificate(entity, privatekey)
-- register service at the bus
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent,
{{name="offer.domain",value="Demo Multiplexing"}})
end)
......
......@@ -7,7 +7,7 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("messages.idl")
......@@ -55,7 +55,7 @@ local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readkeyfile(syskey)))
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- define service properties
local iface = orb.types:lookup("tecgraf::openbus::interop::delegation::Messenger")
......@@ -63,7 +63,7 @@ local props = {{name="openbus.component.interface",value=iface.repID}}
-- retrieve messenger service
log:TEST("retrieve messenger service")
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, props)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
log:TEST("found messenger service of ",entity,"!")
......
......@@ -24,7 +24,7 @@ OpenBusContext:setDefaultConnection(conn)
conn:loginByPassword(user, password)
-- retrieve services
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
local services = {}
for _, name in ipairs{"Messenger", "Broadcaster", "Forwarder"} do
-- define service properties
......
......@@ -8,7 +8,7 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("messages.idl")
......@@ -77,7 +77,7 @@ local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readkeyfile(syskey)))
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- define service properties
local iface = orb.types:lookup("tecgraf::openbus::interop::delegation::Messenger")
......@@ -85,7 +85,7 @@ local props = {{name="openbus.component.interface",value=iface.repID}}
-- retrieve messenger service
log:TEST("retrieve messenger service")
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, props)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
log:TEST("found messenger service of ",entity,"!")
......
......@@ -7,7 +7,7 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("messages.idl")
......@@ -52,10 +52,10 @@ local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readkeyfile(syskey)))
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- offer messenger service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, properties)
log:TEST("messenger service ready!")
......@@ -37,7 +37,7 @@ for _, businfo in ipairs{
log:TEST("retrieve hello services from bus ",conn.busid,"!")
local expected = businfo.offers
local services = table.memoize(function() return {} end)
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, properties, expected)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
local login = getprop(offer.properties, "openbus.offer.login")
......
......@@ -6,9 +6,9 @@ require "openbus.test.util"
-- setup and start the ORBs
local orb1 = openbus.initORB()
openbus.newthread(orb1.run, orb1)
openbus.newThread(orb1.run, orb1)
local orb2 = openbus.initORB()
openbus.newthread(orb2.run, orb2)
openbus.newThread(orb2.run, orb2)
-- load interface definition
orb1:loadidlfile("hello.idl")
......@@ -65,26 +65,26 @@ OpenBusContext1:setCurrentConnection(connAtBus2WithOrb1)
OpenBusContext2:setDefaultConnection(connAtBus1WithOrb2)
-- login to the bus
local prvkey = assert(openbus.readkeyfile(syskey))
local prvkey = assert(openbus.readKeyFile(syskey))
conn1AtBus1WithOrb1:loginByCertificate(system, prvkey)
conn2AtBus1WithOrb1:loginByCertificate(system, prvkey)
connAtBus2WithOrb1:loginByCertificate(system, prvkey)
connAtBus1WithOrb2:loginByCertificate(system, prvkey)
-- offer the service
openbus.newthread(function()
openbus.newThread(function()
OpenBusContext1:setCurrentConnection(conn1AtBus1WithOrb1)
local OfferRegistry = OpenBusContext1:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext1:getOfferRegistry()
OfferRegistry:registerService(component1.IComponent, properties)
end)
openbus.newthread(function()
openbus.newThread(function()
OpenBusContext1:setCurrentConnection(conn2AtBus1WithOrb1)
local OfferRegistry = OpenBusContext1:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext1:getOfferRegistry()
OfferRegistry:registerService(component1.IComponent, properties)
end)
local OfferRegistry1 = OpenBusContext1:getCoreService("OfferRegistry")
local OfferRegistry1 = OpenBusContext1:getOfferRegistry()
OfferRegistry1:registerService(component1.IComponent, properties)
local OfferRegistry2 = OpenBusContext2:getCoreService("OfferRegistry")
local OfferRegistry2 = OpenBusContext2:getOfferRegistry()
OfferRegistry2:registerService(component2.IComponent, properties)
log:TEST("hello service ready!")
......@@ -37,7 +37,7 @@ local props = {{name="openbus.component.interface",value=iface.repID}}
-- find the offered service
log:TEST("retrieve hello service")
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, props)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
log:TEST("found service of ",entity,"!")
......
......@@ -6,7 +6,7 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("hello.idl")
......@@ -41,10 +41,10 @@ local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readkeyfile(syskey)))
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- offer service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, properties)
log:TEST("hello service ready!")
......
......@@ -29,7 +29,7 @@ properties[#properties+1] =
-- find the offered service
log:TEST("retrieve hello service")
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, properties)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
log:TEST("found service of ",entity,"!")
......
......@@ -6,7 +6,7 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newthread(orb.run, orb)
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("hello.idl")
......@@ -41,10 +41,10 @@ local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readkeyfile(syskey)))
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- offer service
local OfferRegistry = OpenBusContext:getCoreService("OfferRegistry")
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, properties)
log:TEST("hello service ready!")
This diff is collapsed.
......@@ -190,16 +190,14 @@ local function getDispatcherFor(self, request)
end
local pcallWithin do
local function continuation(connectionOf, thread, backup, ...)
connectionOf[thread] = backup
local function continuation(manager, backup, ...)
manager:setCurrentConnection(backup)
return ...
end
function pcallWithin(self, obj, op, ...)
local thread = running()
local connectionOf = self.manager.connectionOf
local backup = connectionOf[thread]
connectionOf[thread] = self
return continuation(connectionOf, thread, backup, pcall(obj[op], obj, ...))
local manager = self.manager
local backup = manager:setCurrentConnection(self)
return continuation(manager, backup, pcall(obj[op], obj, ...))
end
end
......@@ -607,7 +605,7 @@ local IgnoredThreads = {}
local WeakKeys = { __mode="k" }
local BusContext = class{
local Context = class{
getCallerChain = CoreInterceptor.getCallerChain,
joinChain = CoreInterceptor.joinChain,
exitChain = CoreInterceptor.exitChain,
......@@ -619,7 +617,7 @@ local BusContext = class{
--[[TODO: REMOVE THIS!!!]] CoreInterceptor.exitChain = nil
--[[TODO: REMOVE THIS!!!]] CoreInterceptor.getJoinedChain = nil
function BusContext:__init()
function Context:__init()
self.connectionOf = setmetatable({}, WeakKeyMeta) -- [thread]=connection
local orb = self.orb
self.types = {
......@@ -632,7 +630,7 @@ function BusContext:__init()
self.joinedChainOf = setmetatable({}, WeakKeys) -- [thread] = joinedChain
end
function BusContext:sendrequest(request)
function Context:sendrequest(request)
if IgnoredThreads[running()] == nil then
local conn = self:getCurrentConnection()
if conn ~= nil then
......@@ -651,7 +649,7 @@ function BusContext:sendrequest(request)
end
end
function BusContext:receivereply(request)
function Context:receivereply(request)
local conn = request[self]
if conn ~= nil then
conn:receivereply(request)
......@@ -661,7 +659,7 @@ function BusContext:receivereply(request)
end
end
function BusContext:receiverequest(request)
function Context:receiverequest(request)
local conn = getDispatcherFor(self, request) or self.defaultConnection
if conn ~= nil then
request[self] = conn
......@@ -675,7 +673,7 @@ function BusContext:receiverequest(request)
end
end
function BusContext:sendreply(request)
function Context:sendreply(request)
local conn = request[self]
if conn ~= nil then
request[self] = nil
......@@ -684,7 +682,7 @@ function BusContext:sendreply(request)
end
function BusContext:createConnection(host, port, props)
function Context:createConnection(host, port, props)
if props == nil then props = {} end
local orb = self.orb
local legacy = not props.nolegacy
......@@ -739,27 +737,33 @@ function BusContext:createConnection(host, port, props)
}
end
function BusContext:setDefaultConnection(conn)
function Context:setDefaultConnection(conn)
local old = self.defaultConnection
self.defaultConnection = conn
return old
end
function BusContext:getDefaultConnection()
function Context:getDefaultConnection()
return self.defaultConnection
end
function BusContext:setCurrentConnection(conn)
self.connectionOf[running()] = conn
function Context:setCurrentConnection(conn)
local connectionOf = self.connectionOf
local thread = running()
local old = connectionOf[thread]
connectionOf[thread] = conn
return old
end
function BusContext:getCurrentConnection()
function Context:getCurrentConnection()
return self.connectionOf[running()]
or self.defaultConnection
end
function BusContext:getCoreService(name)
local conn = self:getCurrentConnection()
if conn ~= nil and CoreServices[name] ~= nil then
return conn[name] or getCoreFacet(conn, name)
for name in pairs(CoreServices) do