Class: TorqueBox::Service
- Inherits:
-
Object
- Object
- TorqueBox::Service
- Defined in:
- lib/torquebox/service.rb
Overview
This class is a Ruby API to manipulating TorqueBox services (daemons).
Class Method Summary collapse
-
.list ⇒ Array<org.torquebox.services.RubyService>
List all services of this application.
-
.lookup(name) ⇒ org.torquebox.services.RubyService
Lookup a service of this application by name.
Class Method Details
.list ⇒ Array<org.torquebox.services.RubyService>
List all services of this application.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/torquebox/service.rb', line 28 def list prefix = service_prefix.canonical_name suffix = '.create' service_names = TorqueBox::MSC.service_names.select do |service_name| name = service_name.canonical_name name.start_with?(prefix) && name.end_with?(suffix) end service_names.map do |service_name| TorqueBox::MSC.get_service(service_name).value end end |
.lookup(name) ⇒ org.torquebox.services.RubyService
Note:
The RubyService instances returned by this and the list methods are not instances of this class but are instead Java objects of type org.torquebox.services.RubyService. There are more methods available on these instances than what’s shown in the example here, but only the methods shown are part of our documented API.
Lookup a service of this application by name.
63 64 65 66 67 |
# File 'lib/torquebox/service.rb', line 63 def lookup(name) service_name = service_prefix.append(name).append('create') service = TorqueBox::MSC.get_service(service_name) service.nil? ? nil : service.value end |