20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/adaptation/adaptor.rb', line 20
def publish *options
message_object = nil
if options.first.is_a?(Message)
message_object = options.first
elsif options.first.is_a?(String)
xml_message = options.first
message_type = xml_message[1..(xml_message.index(/(>| )/) - 1)]
message_class = Adaptation::Message.get_class_object(message_type.capitalize)
message_object = message_class.to_object(xml_message)
end
xml = message_object.to_xml.to_s.gsub("'", "\"")
publish_method = $config["oappublish"] || "#{ADAPTOR_ROOT}/script/publish"
topic = $config["application"] || "ADAPTATION"
unless system("#{publish_method} '#{$config["application"]}' '#{xml}'")
logger.error "Problem publishing: #{xml}"
end
end
|