Class: TorqueBox::Webconsole

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/webconsole.rb

Class Method Summary collapse

Class Method Details

.list_runtimesObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/torquebox/webconsole.rb', line 28

def list_runtimes
  prefix = TorqueBox.fetch('deployment-unit').
    service_name.
    append(org.torquebox.core.as.CoreServices::RUNTIME).
    append("pool").
    canonical_name
  
  TorqueBox.fetch('service-registry').service_names.to_a.map do |x|
    $1 if x.canonical_name =~ %r{#{prefix}\.([^.]+)$}
  end.reject(&:nil?)
end

.lookup_runtime(name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/torquebox/webconsole.rb', line 10

def lookup_runtime(name)
 service_registry = TorqueBox.fetch('service-registry')
 unit = TorqueBox.fetch('deployment-unit')
 
 service_name = org.torquebox.core.as.CoreServices.runtimePoolName(unit, name)
 service_controller = service_registry.get_service(service_name)
 
 return nil unless service_controller
 pool = service_controller.service.value
 pool.evaluate "require 'torquebox/webconsole'"
 
 [pool, name]
end

.web_runtimeObject



24
25
26
# File 'lib/torquebox/webconsole.rb', line 24

def web_runtime
  lookup_runtime('web')
end