To construct and send a configure message
topic.configure(membership: ['a', 'b', 'c'], name: 'bob', some_id: 100)
Serialise to XML
labwiki: | |
repositories: | |
default: | |
type: git | |
top_dir: ~/tmp/labwiki | |
is_primary: true | |
plugins: | |
experiment: | |
plugin_dir: labwiki_experiment_plugin | |
job_service: |
# EXISTING options | |
# By default it loads node proxy, and this is its id | |
uid: bob | |
# How to connect to pubsub server | |
uri: xmpp://localhost | |
# Which environment to use, the value is the one of pre-defined ones in omf_common | |
environment: development |
class ResourceFactory | |
def self.create(res_type, res_options, creation_options, &callback) | |
# Find out Resource Module by resource type then: | |
# | |
# Initialise AbstractResource with provided resource parameters | |
AbstractResource.new(res_type, options, creation_options) do |resource| | |
# Then calling optional supplied callback | |
callback.call(resource) | |
end | |
end |
# @bob is the object binding to the form | |
-if @bob.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@bob.errors.count, "error")} prohibited this from being saved:" | |
%ul | |
- @bob.errors.full_messages.each do |msg| | |
%li= msg |
require 'pp' | |
require 'omf_rete/store' | |
N = 100 | |
s = OMF::Rete::Store.create 3 | |
(1..N).each do |i| | |
s.addTuple(["node_#{i}", 'status', 'ok']) | |
end | |
# Original ruby script | |
# | |
require "xmlrpc/client" | |
require "pp" | |
XMLRPC::Config.module_eval do | |
remove_const :ENABLE_NIL_PARSER | |
const_set :ENABLE_NIL_PARSER, true | |
end |
# Given the asynchronous nature of all operations, | |
# a simple property assignment is actually a chain of callbacks behind the scene. | |
# Take this not too simple example | |
g.applications[:name => 'app_foo'].target_ip = g[:name => 'node1'].interfaces[:name => 'wlan0'].ip | |
# If we think about xmpp communication, the work flow would be sth like this. (simplified pseudo code) | |
g[:name => 'node1'].request_interfaces[:name => 'wlan0'] do |i| |
# Original test01.rb | |
defProperty('res1', "unconfigured-node-1", "ID of a node") | |
defProperty('res2', "unconfigured-node-2", "ID of a node") | |
defGroup('Actor', property.res1) | |
onEvent(:ALL_UP) do |event| | |
wait 3 | |
info "TEST - allGroups" |
@node = @comm.get_topic(`hostname`.chomp) | |
@node.on_message lambda {|m| m.operation == :inform && m.read_content('inform_type') == 'FAILED' } do |message| | |
logger.error message | |
end | |
device_request = @comm.request_message([:devices]) | |
device_request.on_inform_status do |message| | |
@devices = message.read_property('devices').items |