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.9.2 nutella_lib/framework_core.rb
nutella_framework-0.9.1 nutella_lib/framework_core.rb
nutella_framework-0.9.0 nutella_lib/framework_core.rb
nutella_framework-0.8.0 nutella_lib/framework_core.rb
nutella_framework-0.7.3 nutella_lib/framework_core.rb
nutella_framework-0.7.2 nutella_lib/framework_core.rb
nutella_framework-0.7.1 nutella_lib/framework_core.rb
nutella_framework-0.7.0 nutella_lib/framework_core.rb
nutella_framework-0.6.21 nutella_lib/framework_core.rb
nutella_framework-0.6.20 nutella_lib/framework_core.rb
nutella_framework-0.6.19 nutella_lib/framework_core.rb
nutella_framework-0.6.18 nutella_lib/framework_core.rb
nutella_framework-0.6.17 nutella_lib/framework_core.rb
nutella_framework-0.6.16 nutella_lib/framework_core.rb
nutella_framework-0.6.15 nutella_lib/framework_core.rb
nutella_framework-0.6.13 nutella_lib/framework_core.rb
nutella_framework-0.6.12 nutella_lib/framework_core.rb
nutella_framework-0.6.11 nutella_lib/framework_core.rb
nutella_framework-0.6.10 nutella_lib/framework_core.rb
nutella_framework-0.6.9 nutella_lib/framework_core.rb