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.6.8 nutella_lib/framework_core.rb
nutella_framework-0.6.7 nutella_lib/framework_core.rb
nutella_framework-0.6.6 nutella_lib/framework_core.rb
nutella_framework-0.6.5 nutella_lib/framework_core.rb
nutella_framework-0.6.4 nutella_lib/framework_core.rb
nutella_framework-0.6.3 nutella_lib/framework_core.rb
nutella_framework-0.6.2 nutella_lib/framework_core.rb
nutella_framework-0.6.1 nutella_lib/framework_core.rb
nutella_framework-0.6.0 nutella_lib/framework_core.rb
nutella_framework-0.5.1 nutella_lib/framework_core.rb
nutella_framework-0.5.0 nutella_lib/framework_core.rb
nutella_framework-0.4.32 nutella_lib/framework_core.rb
nutella_framework-0.4.31 nutella_lib/framework_core.rb
nutella_framework-0.4.30 nutella_lib/framework_core.rb
nutella_framework-0.4.29 nutella_lib/framework_core.rb
nutella_framework-0.4.28 nutella_lib/framework_core.rb
nutella_framework-0.4.27 nutella_lib/framework_core.rb
nutella_framework-0.4.26 nutella_lib/framework_core.rb
nutella_framework-0.4.25 nutella_lib/framework_core.rb
nutella_framework-0.4.24 nutella_lib/framework_core.rb