lib/openwfe/service.rb in openwferu-0.9.15 vs lib/openwfe/service.rb in openwferu-0.9.16
- old
+ new
@@ -28,12 +28,10 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#++
#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
-#
#
# "made in Japan"
#
# John Mettraux at openwfe.org
@@ -43,15 +41,22 @@
require 'openwfe/contextual'
module OpenWFE
+ #
+ # 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.
+ #
module ServiceMixin
include Contextual, Logging
- attr_accessor \
- :service_name
+ #
+ # The name of the service
+ #
+ attr_accessor :service_name
#
# 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.
@@ -72,17 +77,21 @@
#
def stop
end
end
+ #
+ # A service has a service_name and a link to its application_context.
+ # Via the application_context, it can lookup other services (if it
+ # knows their names).
+ #
class Service
include ServiceMixin
def initialize (service_name, application_context)
- service_init(service_name, application_context)
+ service_init service_name, application_context
end
-
end
#def register (service)
# service.application_context[service.service_name] = service
# return service