Guest User

Untitled

a guest
Jul 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1.  
  2. module Torquebox
  3. module EJB
  4. def self.included(host_class)
  5. host_class.extend(ClassMethods)
  6. end
  7.  
  8. module ClassMethods
  9. private
  10. def ejb(session_bean,method_sym)
  11.  
  12. @contexts ||= {}
  13.  
  14. unless @contexts.include?(name)
  15. define_method("#{method_sym.to_s}") do
  16. @contexts[name] = javax.naming.InitialContext.new.lookup(name)
  17. end
  18. else
  19. @contexts[name]
  20. end
  21.  
  22. end
  23. end
  24. end
  25. end
  26.  
  27.  
  28. class A
  29. include Torquebox::EJB
  30. ejb("PomocnikDentystyEAR/CompanyManagerBean/local",:company_manager)
  31.  
  32. def initialize
  33. company_manager.some_businness_method()
  34. end
  35. end
Add Comment
Please, Sign In to add comment