| 1 | package Javonet::Sdk::Internal::RuntimeFactory; | ||
| 2 | use strict; | ||
| 3 | use warnings FATAL => 'all'; | ||
| 4 | use Moose; | ||
| 5 | use aliased 'Javonet::Sdk::Internal::RuntimeContext' => 'RuntimeContext'; | ||
| 6 | extends 'Javonet::Sdk::Internal::Abstract::AbstractRuntimeFactory'; | ||
| 7 | |||
| 8 | my $connection_type; | ||
| 9 | my $tcp_address; | ||
| 10 | my $path; | ||
| 11 | |||
| 12 | #@override | ||
| 13 | sub new { | ||
| 14 | my $class = shift; | ||
| 15 | my $self = { | ||
| 16 | connection_type => shift, | ||
| 17 | tcp_address => shift, | ||
| 18 | path => shift | ||
| 19 | }; | ||
| 20 | $connection_type = $self->{connection_type}; | ||
| 21 | $tcp_address = $self->{tcp_address}; | ||
| 22 | $path = $self->{path}; | ||
| 23 | if($connection_type eq Javonet::Sdk::Internal::ConnectionType::get_connection_type('Tcp')){ | ||
| 24 | if(not( defined $tcp_address || $tcp_address eq "" )){ | ||
| 25 | die("Error: Tcp ip address must be specified"); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | bless $self, $class; | ||
| 29 | return $self; | ||
| 30 | } | ||
| 31 | |||
| 32 | #@override | ||
| 33 | sub clr { | ||
| 34 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 35 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Clr'), | ||
| 36 | $connection_type, | ||
| 37 | $tcp_address, | ||
| 38 | $path | ||
| 39 | ); | ||
| 40 | } | ||
| 41 | |||
| 42 | #@override | ||
| 43 | sub jvm { | ||
| 44 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 45 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Jvm'), | ||
| 46 | $connection_type, | ||
| 47 | $tcp_address, | ||
| 48 | $path | ||
| 49 | ); | ||
| 50 | } | ||
| 51 | |||
| 52 | #@override | ||
| 53 | sub netcore { | ||
| 54 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 55 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Netcore'), | ||
| 56 | $connection_type, | ||
| 57 | $tcp_address, | ||
| 58 | $path | ||
| 59 | ); | ||
| 60 | } | ||
| 61 | |||
| 62 | #@override | ||
| 63 | sub perl { | ||
| 64 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 65 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Perl'), | ||
| 66 | $connection_type, | ||
| 67 | $tcp_address, | ||
| 68 | $path | ||
| 69 | ); | ||
| 70 | } | ||
| 71 | |||
| 72 | #@override | ||
| 73 | sub ruby { | ||
| 74 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 75 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Ruby'), | ||
| 76 | $connection_type, | ||
| 77 | $tcp_address, | ||
| 78 | $path | ||
| 79 | ); | ||
| 80 | } | ||
| 81 | |||
| 82 | #@override | ||
| 83 | sub nodejs { | ||
| 84 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 85 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Nodejs'), | ||
| 86 | $connection_type, | ||
| 87 | $tcp_address, | ||
| 88 | $path | ||
| 89 | ); | ||
| 90 | } | ||
| 91 | |||
| 92 | #@override | ||
| 93 | sub python { | ||
| 94 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 95 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Python'), | ||
| 96 | $connection_type, | ||
| 97 | $tcp_address, | ||
| 98 | $path | ||
| 99 | ); | ||
| 100 | } | ||
| 101 | |||
| 102 | #@override | ||
| 103 | sub php { | ||
| 104 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 105 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Php'), | ||
| 106 | $connection_type, | ||
| 107 | $tcp_address, | ||
| 108 | $path | ||
| 109 | ); | ||
| 110 | } | ||
| 111 | |||
| 112 | #@override | ||
| 113 | sub python27 { | ||
| 114 | return Javonet::Sdk::Internal::RuntimeContext::get_instance( | ||
| 115 | Javonet::Sdk::Core::RuntimeLib::get_runtime('Python27'), | ||
| 116 | $connection_type, | ||
| 117 | $tcp_address, | ||
| 118 | $path | ||
| 119 | ); | ||
| 120 | } | ||
| 121 | |||
| 122 | |||
| 123 | no Moose; | ||
| 124 | 1; |