Class: DInstaller::DBus::ManagerService
- Inherits:
-
Object
- Object
- DInstaller::DBus::ManagerService
- Defined in:
- lib/dinstaller/dbus/manager_service.rb
Overview
D-Bus service (org.opensuse.DInstaller)
It connects to the system D-Bus and answers requests on objects below ‘/org/opensuse/DInstaller`.
Instance Attribute Summary collapse
-
#bus ⇒ ::DBus::Connection
readonly
System D-Bus.
-
#manager ⇒ DInstaller::Manager
readonly
Installation manager.
Instance Method Summary collapse
-
#dispatch ⇒ Object
Call this from some main loop to dispatch the D-Bus messages.
-
#export ⇒ Object
Exports the installer object through the D-Bus service.
-
#initialize(config, logger = nil) ⇒ ManagerService
constructor
A new instance of ManagerService.
-
#start ⇒ Object
Initializes and exports the D-Bus API.
Constructor Details
#initialize(config, logger = nil) ⇒ ManagerService
Returns a new instance of ManagerService.
55 56 57 58 59 60 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 55 def initialize(config, logger = nil) @config = config @manager = DInstaller::Manager.new(config, logger) @logger = logger || Logger.new($stdout) @bus = ::DBus::SystemBus.instance end |
Instance Attribute Details
#bus ⇒ ::DBus::Connection (readonly)
System D-Bus
46 47 48 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 46 def bus @bus end |
#manager ⇒ DInstaller::Manager (readonly)
Installation manager
51 52 53 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 51 def manager @manager end |
Instance Method Details
#dispatch ⇒ Object
Call this from some main loop to dispatch the D-Bus messages
81 82 83 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 81 def dispatch bus. end |
#export ⇒ Object
Exports the installer object through the D-Bus service
73 74 75 76 77 78 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 73 def export dbus_objects.each { |o| service.export(o) } paths = dbus_objects.map(&:path).join(", ") logger.info "Exported #{paths} objects" end |
#start ⇒ Object
Note:
The service runs its startup phase
Initializes and exports the D-Bus API
65 66 67 68 69 70 |
# File 'lib/dinstaller/dbus/manager_service.rb', line 65 def start setup_cockpit export manager.on_progress_change { dispatch } # make single thread more responsive manager.startup_phase end |