Class: Trinidad::Lifecycle::Host
- Inherits:
-
Object
- Object
- Trinidad::Lifecycle::Host
- Includes:
- Tomcat::LifecycleListener
- Defined in:
- lib/trinidad/lifecycle/host.rb
Overview
Host listener - monitors deployed applications (re-invented HostConfig with Ruby/Rack semantics).
Defined Under Namespace
Classes: RestartReload, RollingReload
Constant Summary collapse
- EVENTS =
:nodoc:
Trinidad::Tomcat::Lifecycle
Instance Attribute Summary collapse
-
#app_holders ⇒ Object
(also: #contexts)
readonly
Returns the value of attribute app_holders.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #before_start(event) ⇒ Object
-
#initialize(server, *app_holders) ⇒ Host
constructor
#server current server instance #app_holders deployed web application holders.
-
#lifecycleEvent(event) ⇒ Object
:nodoc:.
- #periodic(event) ⇒ Object
-
#start(event) ⇒ Object
:nodoc:.
-
#stop(event) ⇒ Object
:nodoc:.
-
#tomcat ⇒ Object
:nodoc: for backwards compatibility.
Constructor Details
#initialize(server, *app_holders) ⇒ Host
#server current server instance #app_holders deployed web application holders
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trinidad/lifecycle/host.rb', line 19 def initialize(server, *app_holders) app_holders.map! do |app_holder| if app_holder.is_a?(Hash) # backwards compatibility Trinidad::WebApp::Holder.new(app_holder[:app], app_holder[:context]) else app_holder end end @server, @app_holders = server, app_holders end |
Instance Attribute Details
#app_holders ⇒ Object (readonly) Also known as: contexts
Returns the value of attribute app_holders.
13 14 15 |
# File 'lib/trinidad/lifecycle/host.rb', line 13 def app_holders @app_holders end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
13 14 15 |
# File 'lib/trinidad/lifecycle/host.rb', line 13 def server @server end |
Instance Method Details
#before_start(event) ⇒ Object
43 44 45 |
# File 'lib/trinidad/lifecycle/host.rb', line 43 def before_start(event) init_monitors end |
#lifecycleEvent(event) ⇒ Object
:nodoc:
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/trinidad/lifecycle/host.rb', line 30 def lifecycleEvent(event) # :nodoc: case event.type when EVENTS::BEFORE_START_EVENT then before_start(event) when EVENTS::START_EVENT then start(event) when EVENTS::STOP_EVENT then stop(event) when EVENTS::PERIODIC_EVENT then periodic(event) end end |
#periodic(event) ⇒ Object
49 50 51 |
# File 'lib/trinidad/lifecycle/host.rb', line 49 def periodic(event) check_changes event.lifecycle end |
#start(event) ⇒ Object
:nodoc:
47 |
# File 'lib/trinidad/lifecycle/host.rb', line 47 def start(event); end |
#stop(event) ⇒ Object
:nodoc:
53 |
# File 'lib/trinidad/lifecycle/host.rb', line 53 def stop(event); end |
#tomcat ⇒ Object
:nodoc: for backwards compatibility
55 |
# File 'lib/trinidad/lifecycle/host.rb', line 55 def tomcat; @server.tomcat; end |