mikewadhera-jetty-rails 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -5,12 +5,12 @@ module JettyRails | |
| 5 5 | 
             
                # an additional listener for JMS queues
         | 
| 6 6 | 
             
                class RailsJmsAdapter < RailsAdapter
         | 
| 7 7 |  | 
| 8 | 
            -
                  # Defaults to  | 
| 8 | 
            +
                  # Defaults to expecting OpenMQ jars in lib_dir/jms_dir at startup
         | 
| 9 9 | 
             
                  @@defaults = {
         | 
| 10 | 
            -
                    :jms_dir | 
| 11 | 
            -
                    : | 
| 12 | 
            -
                    : | 
| 13 | 
            -
                    : | 
| 10 | 
            +
                    :jms_dir    => "jms",
         | 
| 11 | 
            +
                    :queue_name => "rails_queue",
         | 
| 12 | 
            +
                    :mq_host    => "localhost",
         | 
| 13 | 
            +
                    :mq_port    => 7676
         | 
| 14 14 | 
             
                  }
         | 
| 15 15 |  | 
| 16 16 | 
             
                  def initialize(config)
         | 
| @@ -24,9 +24,9 @@ module JettyRails | |
| 24 24 |  | 
| 25 25 | 
             
                  def queue_manager_factory
         | 
| 26 26 | 
             
                    factory = jndiless_default_queue_manager_factory_class()
         | 
| 27 | 
            -
                    factory. | 
| 28 | 
            -
                    factory. | 
| 29 | 
            -
                    factory. | 
| 27 | 
            +
                    factory.queue_name = config[:queue_name]
         | 
| 28 | 
            +
                    factory.mq_host    = config[:mq_host]
         | 
| 29 | 
            +
                    factory.mq_port    = config[:mq_port]
         | 
| 30 30 | 
             
                    factory.new
         | 
| 31 31 | 
             
                  end
         | 
| 32 32 |  | 
| @@ -47,9 +47,7 @@ module JettyRails | |
| 47 47 | 
             
                  # which produces a JNDI-less Rack::JMS::DefaultQueueManager
         | 
| 48 48 | 
             
                  def jndiless_default_queue_manager_factory_class
         | 
| 49 49 | 
             
                    factory_class = Class.new
         | 
| 50 | 
            -
                    factory_class.send :cattr_accessor, : | 
| 51 | 
            -
                                                        :queue_class, 
         | 
| 52 | 
            -
                                                        :queue_name
         | 
| 50 | 
            +
                    factory_class.send :cattr_accessor, :queue_name, :mq_host, :mq_port
         | 
| 53 51 |  | 
| 54 52 | 
             
                    # Implement Rack::JMS::QueueManagerFactory Interface
         | 
| 55 53 | 
             
                    factory_class.send :include, Rack::JMS::QueueManagerFactory
         | 
| @@ -61,9 +59,7 @@ module JettyRails | |
| 61 59 | 
             
                        manager_class.send :field_accessor, :context, 
         | 
| 62 60 | 
             
                                                            :connectionFactory
         | 
| 63 61 |  | 
| 64 | 
            -
                        manager_class.send :attr_accessor, : | 
| 65 | 
            -
                                                           :queue_class, 
         | 
| 66 | 
            -
                                                           :queue_name
         | 
| 62 | 
            +
                        manager_class.send :attr_accessor, :queue_name, :mq_host, :mq_port
         | 
| 67 63 |  | 
| 68 64 | 
             
                        # Overrides JNDI parts of DefaultQueueManager
         | 
| 69 65 | 
             
                        manager_class.module_eval do
         | 
| @@ -72,8 +68,10 @@ module JettyRails | |
| 72 68 | 
             
                          def init(context)
         | 
| 73 69 | 
             
                            self.context = context
         | 
| 74 70 | 
             
                            unless self.connectionFactory
         | 
| 75 | 
            -
                              import  | 
| 76 | 
            -
                              factory =  | 
| 71 | 
            +
                              import "com.sun.messaging.ConnectionFactory"
         | 
| 72 | 
            +
                              factory = com.sun.messaging.ConnectionFactory.new
         | 
| 73 | 
            +
                              config  = com.sun.messaging.ConnectionConfiguration
         | 
| 74 | 
            +
                              factory.setProperty(config.imqAddressList, "mq://" + self.mq_host + ":" + self.mq_port.to_s)
         | 
| 77 75 | 
             
                              self.connectionFactory = factory
         | 
| 78 76 | 
             
                            end
         | 
| 79 77 | 
             
                          end
         | 
| @@ -81,8 +79,7 @@ module JettyRails | |
| 81 79 | 
             
                          # Overrides in order to perform lookup of queue w/o JNDI
         | 
| 82 80 | 
             
                          def lookup(name)
         | 
| 83 81 | 
             
                            if name == self.queue_name
         | 
| 84 | 
            -
                              @jndiless_queue ||=
         | 
| 85 | 
            -
                                eval(self.queue_class).new(self.queue_name)
         | 
| 82 | 
            +
                              @jndiless_queue ||= com.sun.messaging.Queue.new(self.queue_name)
         | 
| 86 83 | 
             
                            else
         | 
| 87 84 | 
             
                              super(name)
         | 
| 88 85 | 
             
                            end
         | 
| @@ -91,9 +88,9 @@ module JettyRails | |
| 91 88 | 
             
                        end
         | 
| 92 89 |  | 
| 93 90 | 
             
                        returning manager_class.new do |m|
         | 
| 94 | 
            -
                          m. | 
| 95 | 
            -
                          m. | 
| 96 | 
            -
                          m. | 
| 91 | 
            +
                          m.queue_name = self.class.queue_name
         | 
| 92 | 
            +
                          m.mq_host    = self.class.mq_host
         | 
| 93 | 
            +
                          m.mq_port    = self.class.mq_port
         | 
| 97 94 | 
             
                        end
         | 
| 98 95 | 
             
                      end
         | 
| 99 96 | 
             
                    EOS
         | 
| @@ -10,7 +10,8 @@ class CommandLineReader | |
| 10 10 | 
             
                    :base => Dir.pwd,
         | 
| 11 11 | 
             
                    :port => 3000,
         | 
| 12 12 | 
             
                    :config_file => "#{File.join(Dir.pwd, 'config', 'jetty_rails.yml')}",
         | 
| 13 | 
            -
                    :adapter => :rails
         | 
| 13 | 
            +
                    :adapter => :rails,
         | 
| 14 | 
            +
                    :environment => "development"
         | 
| 14 15 | 
             
                  },
         | 
| 15 16 | 
             
                  :merb => {
         | 
| 16 17 | 
             
                    :base => Dir.pwd,
         | 
| @@ -61,7 +62,8 @@ class CommandLineReader | |
| 61 62 | 
             
                config[:base] = ARGV.shift unless ARGV.empty?
         | 
| 62 63 |  | 
| 63 64 | 
             
                if File.exists?(config[:config_file])
         | 
| 64 | 
            -
                   | 
| 65 | 
            +
                  config_file = YAML.load_file(config[:config_file])
         | 
| 66 | 
            +
                  config.merge!(config_file[config[:environment]] || config_file) # check for env scope
         | 
| 65 67 | 
             
                  puts "Loaded #{config[:config_file]}"
         | 
| 66 68 | 
             
                end
         | 
| 67 69 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: mikewadhera-jetty-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Fabio Kung
         | 
| @@ -103,6 +103,7 @@ files: | |
| 103 103 | 
             
            - tasks/website.rake
         | 
| 104 104 | 
             
            has_rdoc: true
         | 
| 105 105 | 
             
            homepage: http://jetty-rails.rubyforge.org
         | 
| 106 | 
            +
            licenses: 
         | 
| 106 107 | 
             
            post_install_message: |
         | 
| 107 108 |  | 
| 108 109 | 
             
              For more information on jetty-rails, see http://jetty-rails.rubyforge.org
         | 
| @@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 127 128 | 
             
            requirements: []
         | 
| 128 129 |  | 
| 129 130 | 
             
            rubyforge_project: jetty-rails
         | 
| 130 | 
            -
            rubygems_version: 1. | 
| 131 | 
            +
            rubygems_version: 1.3.5
         | 
| 131 132 | 
             
            signing_key: 
         | 
| 132 133 | 
             
            specification_version: 2
         | 
| 133 134 | 
             
            summary: jetty server for rails applications
         |