Class: XMLService::I_CMD

Inherits:
I_CALL show all
Defined in:
lib/xmlservice.rb

Overview


xmlservice call CMD


Instance Attribute Summary

Attributes inherited from I_CALL

#input, #reponse, #return

Instance Method Summary collapse

Methods inherited from I_CALL

#call, #call_recursive, #dump, #dump_all, #dump_error, #dump_inspect, #dump_inspect_input, #dump_inspect_response, #dump_inspect_returndata, #execute, #format_inspect, #format_inspect_include, #format_inspect_recursive, #out_xml, #reserved_words, #response, #returndata, #xmlservice, #xmlservice_diag_parse, #xmlservice_error

Methods inherited from I_Meta

#add_user_accessor, #instance_variable_forward_get, #instance_variable_forward_set, #remove_user_accessor, #shortCut

Constructor Details

#initialize(cmd, options = nil) ⇒ I_CMD

Returns a new instance of I_CMD.



2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
# File 'lib/xmlservice.rb', line 2291

def initialize(cmd,options=nil)
  @xml_cmd = cmd
  super(options)
  if cmd.include? '?'
    if options == nil
      @xml_options = Hash.new
    end
    @xml_options[:exec] = 'rexx'
  end
  @xml_cmd_desc = Array.new
end

Instance Method Details

#parse_diag_attrObject



2320
2321
2322
# File 'lib/xmlservice.rb', line 2320

def parse_diag_attr()
  return self.xmlservice_diag_parse("/myscript/cmd")
end

#parse_output_attrObject



2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
# File 'lib/xmlservice.rb', line 2302

def parse_output_attr()
  super()
  @xml_doc.elements.each("/myscript/cmd/success") do |element|
    @response.add_user_accessor("output", element.text)
    break
  end
  @xml_doc.elements.each("/myscript/cmd/error") do |element|
    @response.add_user_accessor("output", element.text)
    break
  end
end

#parse_return_attrObject



2313
2314
2315
2316
2317
2318
2319
# File 'lib/xmlservice.rb', line 2313

def parse_return_attr()
  super()
  @xml_doc.elements.each("/myscript/cmd/row/data") do |element|
    @xml_cmd_desc[@xml_cmd_desc.count] = element.attributes['desc']
    @returndata.add_user_accessor(element.attributes['desc'],element.text)
  end
end

#to_xmlObject



2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
# File 'lib/xmlservice.rb', line 2323

def to_xml
  error = " error='fast'"
  exec = " exec='system'"
  if @xml_options
    if @xml_options.has_key?(:error)
      error = " error='#{@xml_options[:error]}'"
    end
    if @xml_options.has_key?(:exec)
      exec = " exec='#{@xml_options[:exec]}'"
    end
  end
  xml = "<cmd #{exec}#{error}>"
  xml << @xml_cmd.to_s
  xml << "</cmd>\n"
  xml
end