Sha256: 4b18cf19294dd9328450d2e84a574bd9d331776dc2d6ae69b8bc642ddc9ee1b4
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
require 'cocaine' require 'json' module Fairdom module OpenbisApi class JavaExecution attr_reader :query_object def initialize(query_object) @query_object = query_object end def execute(options) command = execute_command(options) output = Cocaine::CommandLine.new(command).run JSON.parse(output.strip) rescue Cocaine::ExitStatusError => exception raise OpenbisQueryException, exception.message end private def execute_command(options) "#{java_root_command} -#{query_object.command_option_key} {#{command_from_options(options)}}" end def command_from_options(options) options.collect do |key, value| "%#{key}%:%#{value.tr(' ', '+')}%" end.join("\,") end def java_root_command "java -jar #{jar_path} #{query_object.root_command_options}" end def jar_path File.join(File.dirname(__dir__), "../../jars/#{jar_file}") end def jar_file "openseek-api-#{Fairdom::OpenbisApi::JAR_VERSION}.jar" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
openseek-api-0.11.0 | lib/fairdom/openbis_api/java_execution.rb |
openseek-api-0.9.2 | lib/fairdom/openbis_api/java_execution.rb |
openseek-api-0.9.1 | lib/fairdom/openbis_api/java_execution.rb |