Sha256: 051670a8b94c27e3e99accc4c37f6ab52e75f6448934db87801bcbc675451ec6

Contents?: true

Size: 1.45 KB

Versions: 55

Compression:

Stored size: 1.45 KB

Contents

require 'nutella_lib'
require 'config/runlist'

# APIs sub-modules
require_relative 'framework_net'
require_relative 'framework_log'
require_relative 'framework_persist'


module Nutella

  # Accessor to the framework APIs sub-module
  def Nutella.f
    Nutella::Framework
  end


  #  Framework-level APIs sub-module
  module Framework

    # Initializes this component as a framework component
    # @param [String] broker_hostname
    # @param [String] component_id
    def self.init( broker_hostname, component_id )
      Nutella.app_id = nil
      Nutella.run_id = nil
      Nutella.component_id = component_id
      Nutella.resource_id = nil
      Nutella.mongo_host = broker_hostname
      Nutella.mqtt = SimpleMQTTClient.new broker_hostname
      # Start pinging
      Nutella.net.start_pinging
    end

    # Accessors for sub-modules
    def self.net; Nutella::Framework::Net; end
    def self.log; Nutella::Framework::Log; end
    def self.persist; Nutella::Framework::Persist; end


    # Utility functions

    # Extracts the component name from the folder where the code for this component is located
    #
    # @return [String] the component name
    def self.extract_component_id
      Nutella.extract_component_id
    end

    # Sets the resource id
    #
    # @param [String] resource_id the resource id (i.e. the particular instance of this component)
    def self.set_resource_id( resource_id )
      Nutella.set_resource_id resource_id
    end


  end

end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
nutella_framework-0.4.23 nutella_lib/framework_core.rb
nutella_framework-0.4.22 nutella_lib/framework_core.rb
nutella_framework-0.4.21 nutella_lib/framework_core.rb
nutella_framework-0.4.20 nutella_lib/framework_core.rb
nutella_framework-0.4.19 nutella_lib/framework_core.rb
nutella_framework-0.4.18 nutella_lib/framework_core.rb
nutella_framework-0.4.17 nutella_lib/framework_core.rb
nutella_framework-0.4.16 nutella_lib/framework_core.rb
nutella_framework-0.4.13 nutella_lib/framework_core.rb
nutella_framework-0.4.12 nutella_lib/framework_core.rb
nutella_framework-0.4.11 nutella_lib/framework_core.rb
nutella_framework-0.4.10 nutella_lib/framework_core.rb
nutella_framework-0.4.9 nutella_lib/framework_core.rb
nutella_framework-0.4.8 nutella_lib/framework_core.rb
nutella_framework-0.4.5 nutella_lib/framework_core.rb