Sha256: 42960b4239b602f5574fbfdd0b8b50d0c807f02ce511912655aa8413c7da326d

Contents?: true

Size: 1.76 KB

Versions: 12

Compression:

Stored size: 1.76 KB

Contents

package Javonet::Core::Interpreter::Interpreter;
use strict;
use warnings;
use lib 'lib';
use aliased 'Javonet::Core::Handler::PerlHandler' => 'PerlHandler';
use aliased 'Javonet::Core::Protocol::CommandSerializer' => 'CommandSerializer', qw(encode);
use aliased 'Javonet::Core::Protocol::CommandDeserializer' => 'CommandDeserializer', qw(decode);

my $handler = PerlHandler->new();

sub execute_ {
    my $self = shift;
    my $command = shift;
    my $connection_type = shift;
    my $tcp_address = shift;

    my $commandSerializer = Javonet::Core::Protocol::CommandSerializer->new();
    my @serialized_command = $commandSerializer->encode($command, $connection_type, $tcp_address, 0);
    my $response_byte_array_ref;
    if ($command->{runtime} eq Javonet::Sdk::Core::RuntimeLib::get_runtime('Perl')) {
        require Javonet::Core::Receiver::Receiver;
        $response_byte_array_ref = Javonet::Core::Receiver::Receiver->send_command(\@serialized_command);
    } else {
        require Javonet::Core::Transmitter::PerlTransmitter;
        $response_byte_array_ref = Javonet::Core::Transmitter::PerlTransmitter->send_command(\@serialized_command);
    }

    my $commandDeserializer = CommandDeserializer->new($response_byte_array_ref);
    return $commandDeserializer->decode();
}

sub process {
    my ($self, $message_byte_array_ref) = @_;
    my @message_byte_array = @$message_byte_array_ref;
    my $commandDeserializer = CommandDeserializer->new(\@message_byte_array);
    my $command = $commandDeserializer->decode();
    my $response = $handler->handle_command($command);
    my $commandSerializer = CommandSerializer->new();
    my @response_byte_array = $commandSerializer->encode($response, 0, 0, 0);
    return @response_byte_array;
}

1;

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Interpreter/Interpreter.pm