<< | Index | >>
ODBA (Open DataBase Access)
in ODBA::Stub
... def method_missing(meth_symbol, *args, &block) if(NO_OVERRIDE.include?(meth_symbol)) super else odba_instance.send(meth_symbol, *args, &block) end end def respond_to?(msg_id, *args) case msg_id when :_dump, :marshal_dump false when *NO_OVERRIDE super else odba_instance.respond_to?(msg_id, *args) end end ...
check via bin/admin
ch.oddb> registrations.first -> ["00035", #<ODBA::Stub:74052420#712139 @odba_class=ODDB::Registration @odba_container=111505790#22>] ch.oddb> registrations.values.first.class ODDB::Registration ch.oddb> registrations.values.first.is_a? ODBA::Stub -> true
ch.oddb> ODBA.cache.class -> ODBA::Cache ch.oddb> ODBA.cache.count(Registration) -> 10978
check with "inderal"
ch.oddb> registration('31706') -> #<ODDB::Registration:0xdbf24f0> ch.oddb> registration('31706').company -> AstraZeneca AG ch.oddb> registration('31706').odba_id -> 28487 ch.oddb> ODBA.cache.fetch(28487, :bin_admin) -> #<ODDB::Registration:0xdbf24f0> ch.oddb> ODBA.cache.fetch(28487, :bin_admin).company -> AstraZeneca AG
I started to create sample application with most tiny codes
src/util/sampleapp.rb
module SAMPLE class App < SBSM::DRbServer MEMORY_LIMIT = 20480 def initialize opts={} start = Time.now puts "init system" puts "init system: #{Time.now - start}" puts "setup drb-delegation" # pending puts "system initialized" puts "initialized: #{Time.now - start}" super() end end end
NOTE: make sure to call SBSM::DRbServer.initialize() in this server application.
created simple state class, and wiew, template.
then send request from browser, got following errors,
error in SBSM::Session#process: / NoMethodError undefined method `validate' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:241:in `block in import_user_input' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:224:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:224:in `import_user_input' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:359:in `process' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:170:in `block in drb_process' error in SBSM::Session#to_html: / NoMethodError undefined method `new' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/state.rb:243:in `view' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/state.rb:179:in `to_html' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:447:in `to_html' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:171:in `block in drb_process' <internal:prelude>:10:in `synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:169:in `drb_process' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop' error in SBSM::Session#http_headers: / NoMethodError undefined method `new' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/state.rb:243:in `view' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/state.rb:144:in `http_headers' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.4/lib/sbsm/session.rb:320:in `http_headers' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
Are my some definitions in State and Session and wrong ?
in /path/to/sbsm/state.rb
Note by Masa:
The error comes from Nil of @klass in SBSM::State class
http://dev.ywesee.com/wiki.php/Yasu/20120227-odba-and-drbprocess#response_from_drbserver
This probably means that your original State class is not called. Please check if your State and Session class is actually called or not.
.... def view klass = @default_view if(klass.is_a?(Hash)) klass = klass.fetch(@session.user.class) { klass[:default] } end model = @filter ? @filter.call(@model) : @model view = klass.new(model, @session) @http_headers = view.http_headers view end ...