Class: Javonet
- Inherits:
-
Object
- Object
- Javonet
- Defined in:
- lib/javonet-ruby-sdk/sdk/javonet.rb
Overview
The Javonet class is a singleton class that serves as the entry point for interacting with Javonet. It provides methods to activate and initialize the Javonet SDK. It supports both in-memory and TCP connections.
Class Method Summary collapse
-
.activate(license_key) ⇒ Integer
Activates Javonet with the provided license key and optionally with proxy data.
-
.get_runtime_info(get_loaded_modules) ⇒ String
Gets information about the current runtime.
-
.in_memory ⇒ RuntimeFactory
Initializes Javonet using an in-memory channel on the same machine.
-
.set_config_source(config_source) ⇒ Object
Sets the configuration source for the Javonet SDK.
-
.set_javonet_working_directory(path) ⇒ Object
Sets the working directory for the Javonet SDK.
-
.tcp(tcp_connection_data) ⇒ RuntimeFactory
Initializes Javonet with a TCP connection to a remote machine.
-
.web_socket(ws_connection_data) ⇒ RuntimeFactory
Initializes Javonet with a WebSocket connection to a remote machine.
-
.with_config(path) ⇒ ConfigRuntimeFactory
Initializes Javonet with a custom configuration file.
Class Method Details
.activate(license_key) ⇒ Integer
Activates Javonet with the provided license key and optionally with proxy data.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 58 def self.activate(license_key) begin if license_key != ActivationHelper.temporary_license_key ActivationHelper.temporary_license_key = license_key SdkMessageHelper.("SdkMessage", "Activation") end ActivationHelper.temporary_license_key = license_key return Transmitter.activate(license_key) rescue Exception => e SdkMessageHelper.("SdkException", e.) raise e end end |
.get_runtime_info(get_loaded_modules) ⇒ String
Gets information about the current runtime.
102 103 104 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 102 def self.get_runtime_info(get_loaded_modules) RuntimeLogger.get_runtime_info(get_loaded_modules) end |
.in_memory ⇒ RuntimeFactory
Initializes Javonet using an in-memory channel on the same machine.
20 21 22 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 20 def self.in_memory RuntimeFactory.new(ConnectionType::IN_MEMORY, nil) end |
.set_config_source(config_source) ⇒ Object
Sets the configuration source for the Javonet SDK.
75 76 77 78 79 80 81 82 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 75 def self.set_config_source(config_source) begin Transmitter.set_config_source(config_source) rescue Exception => e SdkMessageHelper.("SdkException", e.) raise e end end |
.set_javonet_working_directory(path) ⇒ Object
Sets the working directory for the Javonet SDK.
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 86 def self.set_javonet_working_directory(path) begin path.gsub!("\\", "/") path += "/" unless path.end_with?("/") FileUtils.mkdir_p(path, mode: 0700) ActivationHelper.working_directory = path Transmitter.set_javonet_working_directory(path) rescue Exception => e SdkMessageHelper.("SdkException", e.) raise e end end |
.tcp(tcp_connection_data) ⇒ RuntimeFactory
Initializes Javonet with a TCP connection to a remote machine.
28 29 30 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 28 def self.tcp(tcp_connection_data) RuntimeFactory.new(ConnectionType::TCP, tcp_connection_data) end |
.web_socket(ws_connection_data) ⇒ RuntimeFactory
Initializes Javonet with a WebSocket connection to a remote machine.
36 37 38 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 36 def self.web_socket(ws_connection_data) RuntimeFactory.new(ConnectionType::WEB_SOCKET, ws_connection_data) end |
.with_config(path) ⇒ ConfigRuntimeFactory
Initializes Javonet with a custom configuration file.
44 45 46 47 48 49 50 51 52 |
# File 'lib/javonet-ruby-sdk/sdk/javonet.rb', line 44 def self.with_config(path) begin ConfigRuntimeFactory.new(path) rescue Exception => e SdkMessageHelper.("SdkException", e.) raise e end end |