Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Torquebox
- module EJB
- def self.included(host_class)
- host_class.extend(ClassMethods)
- end
- module ClassMethods
- private
- def ejb(session_bean,method_sym)
- @contexts ||= {}
- unless @contexts.include?(name)
- define_method("#{method_sym.to_s}") do
- @contexts[name] = javax.naming.InitialContext.new.lookup(name)
- end
- else
- @contexts[name]
- end
- end
- end
- end
- end
- class A
- include Torquebox::EJB
- ejb("PomocnikDentystyEAR/CompanyManagerBean/local",:company_manager)
- def initialize
- company_manager.some_businness_method()
- end
- end
Add Comment
Please, Sign In to add comment