Sha256: 589a8e8e3f16839ecd6576f6bf388055f7cc87b0f45953cdcd913c1325be9eee

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

#!/usr/bin/ruby

unless defined? ADAPTOR_ROOT
  ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
end

environment = "development"
ARGV.each do |arg|
  if arg[0..14] == "ADAPTATION_ENV="
    environment = arg[15..arg.length]
  end
end

require 'yaml'
config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/mom.yml"))[environment.to_s]

case config["mom"]["type"]
  when "druby"
    require 'drb'

    mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"

    mom = DRbObject.new(nil, mom_uri)
    mom.publish ARGV[1], ARGV[0]

  when "xmlblaster"
    require "rubygems"
    require "adaptation/xmlblaster_client"

    xbc = XmlblasterClient.new(config["mom"]["host"], config["mom"]["port"])
    xbc.login( "OAP_USER", "OAP_PASS" )
    xbc.publish( "<key oid='#{ARGV[0]}' contentMime='text/xml'/>", ARGV[1] , "<qos></qos>" )
    xbc.logout
end
  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adaptation-0.1.2 dispatches/publish.rb
adaptation-0.1.3 dispatches/publish.rb