Module: R2CORBA::CORBA::ServerRequest

Defined in:
lib/corba/jbase/ServerRequest.rb

Constant Summary collapse

@@wrapper_klass =
Class.new do
  include CORBA::ServerRequest
  def initialize(jsrvreq, jorb)
    @srvreq_ = jsrvreq
    @orb_ = jorb
    @nvlist_ = nil
    @result_type_ = nil
    @arg_list_ = nil
    @exc_list_ = nil
    @arg_ = nil
    @arg_index_ = nil
    @arg_out_ = 0
  end
  attr_reader :srvreq_
  attr_reader :orb_
  attr_reader :arg_list_
  attr_reader :result_type_
  attr_reader :exc_list_
  attr_reader :nvlist_
  attr_reader :arg_out_
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._wrap_native(jsrvreq, jorb) ⇒ Object

Raises:

  • (ArgumentError)


41
42
43
44
45
# File 'lib/corba/jbase/ServerRequest.rb', line 41

def self._wrap_native(jsrvreq, jorb)
  raise ArgumentError, 'Expected org.omg.CORBA.ServerRequest' unless jsrvreq.is_a?(Native::ServerRequest)
  raise ArgumentError, 'Expected org.omg.CORBA.ORB' unless jorb.is_a?(Native::ORB)
  @@wrapper_klass.new(jsrvreq, jorb)
end

Instance Method Details

#[](key) ⇒ Object

Raises:

  • (CORBA::BAD_PARAM)


81
82
83
84
85
86
87
# File 'lib/corba/jbase/ServerRequest.rb', line 81

def [](key)
  self.arguments # make sure the @arg_ member has been initialized
  key = arg_index_from_name(key) if String === key
  key = key.to_i if key
  raise CORBA::BAD_PARAM.new('', 0, CORBA::COMPLETD_NO) unless key && (key>=0) && (key<@arg_.size)
  @arg_[key]
end

#[]=(key, val) ⇒ Object

Raises:

  • (CORBA::BAD_PARAM)


89
90
91
92
93
94
95
96
97
98
# File 'lib/corba/jbase/ServerRequest.rb', line 89

def []=(key, val)
  self.arguments # make sure the @arg_ member has been initialized
  key = arg_index_from_name(key) if String === key
  key = key.to_i if key
  raise CORBA::BAD_PARAM.new('', 0, CORBA::COMPLETD_NO) unless key && (key>=0) && (key<@arg_.size)
  jnv = @nvlist_.item(key)
  rtc = @arg_list_[key][2]
  CORBA::Any.to_any(val, rtc).to_java(self.orb_, jnv.value())
  @arg_[key] = val
end

#argumentsObject

Raises:

  • (CORBA::BAD_INV_ORDER)


68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/corba/jbase/ServerRequest.rb', line 68

def arguments
  raise CORBA::BAD_INV_ORDER.new('',0,CORBA::COMPLETED_NO) unless @nvlist_
  unless @arg_
    @arg_ = []
    @nvlist_.count().times do |i|
      jnv = @nvlist_.item(i)
      @arg_ << CORBA::Any.from_java(jnv.value, self.orb_, @arg_list_[i][2]) if [CORBA::ARG_IN, CORBA::ARG_INOUT].include?(jnv.flags)
      @arg_out_ += 1 if [CORBA::ARG_OUT, CORBA::ARG_INOUT].include?(jnv.flags)
    end
  end
  @arg_
end

#describe(opsig) ⇒ Object

Raises:

  • (CORBA::BAD_INV_ORDER)


55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/corba/jbase/ServerRequest.rb', line 55

def describe(opsig)
  raise CORBA::BAD_INV_ORDER.new('',0,CORBA::COMPLETED_NO) if @nvlist_
  raise CORBA::NO_IMPLEMENT.new('',0,CORBA::COMPLETED_NO) unless opsig && (Hash === opsig)
  @arg_list_ = opsig[:arg_list]
  @result_type_ = opsig[:result_type]
  @exc_list_ = opsig[:exc_list]
  raise CORBA::BAD_PARAM.new('',0,CORBA::COMPLETED_NO) unless (@arg_list_.nil? || @arg_list_.is_a?(Array)) &&
                                                              (@result_type_.nil? || @result_type_.is_a?(CORBA::TypeCode)) &&
                                                              (@exc_list_.nil? || @exc_list_.is_a?(Array))
  @nvlist_ = extract_arguments_(@arg_list_)
  self
end

#operationObject



47
48
49
50
51
52
53
# File 'lib/corba/jbase/ServerRequest.rb', line 47

def operation
  begin
    self.srvreq_.operation
  rescue ::NativeException
    CORBA::Exception.native2r($!)
  end
end