Commit d85a45ca authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2770] Documentação do core do OpenBus 2.1

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/trunk@163621 ae0415b3-e90b-0410-900d-d0be9363c56b
parent dcd9efdf
......@@ -572,9 +572,9 @@ return {
},
{
type = "table",
title = "Offer Authorization Management",
title = "Registered Entity Management",
description = [[
Functions to manage offer authorizations.
Functions to manage registered entities.
]],
fields = {
entities = {
......@@ -833,6 +833,16 @@ return {
},
},
},
set = {
type = "table",
title = "Value Set",
description = [[
contains values stored as keys, therefore it cannot contain duplicates and elements are stored without a particular order.
]],
fields = {
__tostring = ToStringMetaMethod(),
},
},
list = {
type = "table",
title = "Value Sequence",
......@@ -943,6 +953,20 @@ return {
type = "string",
title = "Value of Property <code>openbus.component.platform</code>",
},
facets = {
type = "set",
title = "Value of Properties <code>openbus.component.facet</code>",
description = [[
contains all values of properties <code>openbus.component.facet</code>.
]],
},
interfaces = {
type = "set",
title = "Value of Properties <code>openbus.component.interface</code>",
description = [[
contains all values of properties <code>openbus.component.interface</code>.
]],
},
},
},
category = {
......@@ -977,6 +1001,24 @@ return {
description = [[
registers an entity in the category so it can be authorized to offer services in the bus.
]],
parameters = {
{
type = "string",
name = "category",
title = "Entity Name",
description = [[
contains the name of the entity to be registered.
]]
},
{
type = "string",
name = "name",
title = "Entity's Description",
description = [[
contains the textual description of the entity to be registered.
]],
},
},
results = {
{
type = "entity",
......
......@@ -64,7 +64,7 @@ return function(...)
local executables = {}
local Configs = ConfigArgs{
busref = "",
entity = "",
entity = "admin",
privatekey = "",
password = "",
domain = "",
......
......@@ -12,6 +12,7 @@ local type = _G.type
local array = require "table"
local concat = array.concat
local sort = array.sort
local string = require "string"
local match = string.match
......@@ -146,6 +147,21 @@ end
local PrintableSet = class()
function PrintableSet:__tostring()
local res = {}
local index = 0
for item in pairs(self) do
index = index+1
res[index] = tostring(item)
end
sort(res)
return concat(res, "\n")
end
local PrintableList = class()
function PrintableList:__tostring()
......@@ -191,17 +207,29 @@ local ReservedProperties = {
["openbus.component.version.minor"] = "minorversion",
["openbus.component.version.patch"] = "patchversion",
["openbus.component.platform"] = "platform",
["openbus.component.facet"] = "facets",
["openbus.component.interface"] = "interfaces",
}
local PropertyAliases = {}
for name, alias in pairs(ReservedProperties) do
PropertyAliases[alias] = name
end
local ListAliases = {
facets = true,
interfaces = true,
}
local function makePropList(props)
for alias, name in pairs(PropertyAliases) do
local value = props[alias]
if value ~= nil then
props[#props+1] = {name=name,value=value}
if ListAliases[alias] == nil then
props[#props+1] = {name=name,value=value}
else
for value in pairs(value) do
props[#props+1] = {name=name,value=value}
end
end
props[alias] = nil
end
end
......@@ -225,10 +253,17 @@ local ServiceOffer = class()
--end
function ServiceOffer:__init()
for _, prop in ipairs(self.properties) do
for alias in pairs(ListAliases) do
self[alias] = PrintableSet()
end
for index, prop in ipairs(self.properties) do
local alias = ReservedProperties[prop.name]
if alias ~= nil and self[alias] == nil then
self[alias] = prop.value
if alias ~= nil then
if ListAliases[alias] then
self[alias][prop.value] = index
elseif self[alias] == nil then
self[alias] = prop.value
end
end
end
OfferProperties(self.properties)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment