Class: Hypertube::Sdk::ConfigRuntimeFactory
- Inherits:
-
Internal::AbstractConfigRuntimeFactory
- Object
- Internal::AbstractConfigRuntimeFactory
- Hypertube::Sdk::ConfigRuntimeFactory
- Defined in:
- lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb
Instance Method Summary collapse
-
#clr(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with CLR runtime.
- #get_runtime_context(runtime, config_name) ⇒ Object
-
#initialize(path) ⇒ ConfigRuntimeFactory
constructor
A new instance of ConfigRuntimeFactory.
-
#jvm(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with JVM runtime.
- #load_modules(runtime, config_name, jfr, rtm_ctx) ⇒ Object
-
#netcore(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with .NET runtime.
-
#nodejs(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Node.js runtime.
-
#perl(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Perl runtime.
-
#php(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with PHP runtime.
-
#python(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Python runtime.
-
#python27(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Python 2.7 runtime.
-
#ruby(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Ruby runtime.
Constructor Details
#initialize(path) ⇒ ConfigRuntimeFactory
Returns a new instance of ConfigRuntimeFactory.
15 16 17 18 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 15 def initialize(path) @path = path Hypertube::Core::Transmitter::Transmitter.set_config_source(path) end |
Instance Method Details
#clr(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with CLR runtime.
24 25 26 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 24 def clr(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::CLR, config_name) end |
#get_runtime_context(runtime, config_name) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 92 def get_runtime_context(runtime, config_name) jfr = Hypertube::Sdk::Tools::JsonFileResolver.new(@path) begin license_key = jfr.get_license_key Hypertube::Core::Transmitter::Transmitter.activate_with_credentials(license_key) rescue StandardError # licenseKey not found - do nothing end conn_type = jfr.get_channel_type(Hypertube::Utils::RuntimeNameHandler.get_name(runtime), config_name) conn_type = conn_type.to_s.downcase if conn_type == 'tcp' conn_data = Hypertube::Utils::TcpConnectionData.new(jfr.get_channel_host(Hypertube::Utils::RuntimeNameHandler.get_name(runtime), config_name)) rtm_ctx = Hypertube::Sdk::RuntimeContext.get_instance(runtime, Hypertube::Utils::ConnectionType::TCP, conn_data) elsif conn_type == 'websocket' || conn_type == 'ws' conn_data = Hypertube::Utils::WsConnectionData.new(jfr.get_channel_host(Hypertube::Utils::RuntimeNameHandler.get_name(runtime), config_name)) rtm_ctx = Hypertube::Sdk::RuntimeContext.get_instance(runtime, Hypertube::Utils::ConnectionType::WEB_SOCKET, conn_data) elsif conn_type == 'http2' || conn_type == 'h2' conn_data = Hypertube::Utils::Http2ConnectionData.new(jfr.get_channel_host(Hypertube::Utils::RuntimeNameHandler.get_name(runtime), config_name)) rtm_ctx = Hypertube::Sdk::RuntimeContext.get_instance(runtime, Hypertube::Utils::ConnectionType::HTTP2, conn_data) elsif conn_type == 'inmemory' || conn_type == 'memory' rtm_ctx = Hypertube::Sdk::RuntimeContext.get_instance(runtime, Hypertube::Utils::ConnectionType::IN_MEMORY, nil) else raise 'Invalid connection type' end load_modules(runtime, config_name, jfr, rtm_ctx) rtm_ctx end |
#jvm(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with JVM runtime.
32 33 34 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 32 def jvm(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::JVM, config_name) end |
#load_modules(runtime, config_name, jfr, rtm_ctx) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 122 def load_modules(runtime, config_name, jfr, rtm_ctx) modules = jfr.get_modules(Hypertube::Utils::RuntimeNameHandler.get_name(runtime), config_name) .split(',') .reject(&:empty?) config_directory_absolute_path = File.dirname(@path) modules.each do |mod| if Pathname.new(mod).absolute? rtm_ctx.load_library(mod) else rtm_ctx.load_library(File.join(config_directory_absolute_path, mod)) end end end |
#netcore(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with .NET runtime.
40 41 42 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 40 def netcore(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::NETCORE, config_name) end |
#nodejs(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Node.js runtime.
64 65 66 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 64 def nodejs(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::NODEJS, config_name) end |
#perl(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Perl runtime.
48 49 50 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 48 def perl(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::PERL, config_name) end |
#php(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with PHP runtime.
80 81 82 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 80 def php(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::PHP, config_name) end |
#python(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Python runtime.
72 73 74 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 72 def python(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::PYTHON, config_name) end |
#python27(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Python 2.7 runtime.
88 89 90 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 88 def python27(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::PYTHON27, config_name) end |
#ruby(config_name = 'default') ⇒ Hypertube::Sdk::RuntimeContext
Creates a Hypertube::Sdk::RuntimeContext instance to interact with Ruby runtime.
56 57 58 |
# File 'lib/hypertube-ruby-sdk/sdk/config_runtime_factory.rb', line 56 def ruby(config_name = 'default') get_runtime_context(Hypertube::Utils::RuntimeNameHt::RUBY, config_name) end |