Module: OpenWFE::ServiceMixin

Overview

Most of the functionalities of an OpenWFEru service are implemented here as a mixin. It’s then easy to either extend Service or include ServiceMixin, to compose an OpenWFEru service class.

Instance Attribute Summary collapse

Attributes included from Contextual

#application_context

Instance Method Summary collapse

Methods included from Contextual

#get_work_directory, #init_service, #lookup

Methods included from Logging

#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn

Instance Attribute Details

#service_nameObject

The name of the service



57
58
59
# File 'lib/openwfe/service.rb', line 57

def service_name
  @service_name
end

Instance Method Details

#service_init(service_name, application_context) ⇒ Object

Inits the service by setting the service name and the application context. Does also bind the service under the service name in the application context.



64
65
66
67
68
69
70
71
# File 'lib/openwfe/service.rb', line 64

def service_init (service_name, application_context)

    @service_name = service_name
    @application_context = application_context

    @application_context[@service_name.to_s] = self \
        if @service_name and @application_context
end

#stopObject

Some services (like the scheduler one for example) need to free some resources upon stopping. This can be achieved by overwriting this method.



78
79
# File 'lib/openwfe/service.rb', line 78

def stop
end