Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1519

Show
Ignore:
Timestamp:
04/27/05 23:19:24 (4 years ago)
Author:
nahi
Message:

change implementation variable names: soap_* -> xml{attr,ele}

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/mapping/mapping.rb

    r1515 r1519  
    270270    if obj.is_a?(::SOAP::Mapping::Object) 
    271271      values.each do |attr_name, value| 
    272         obj.__soap_set_property(attr_name, value) 
     272        obj.__set_xmlele(attr_name, value) 
    273273      end 
    274274    else 
  • trunk/lib/soap/mapping/registry.rb

    r1515 r1519  
    6565class Object; include Marshallable 
    6666  def initialize 
    67     @__soap_value_type = {} 
    68     @__soap_value = {} 
    69     @__soap_attribute = {} 
     67    @__xmlele_type = {} 
     68    @__xmlele = {} 
     69    @__xmlattr = {} 
    7070  end 
    7171 
    7272  def inspect 
    7373    sprintf("#<%s:0x%x%s>", self.class.name, __id__, 
    74       @__soap_value.collect { |name, value| " #{name}=#{value.inspect}" }.join) 
    75   end 
    76  
    77   def __soap_attribute 
    78     @__soap_attribute 
     74      @__xmlele.collect { |name, value| " #{name}=#{value.inspect}" }.join) 
     75  end 
     76 
     77  def __xmlattr 
     78    @__xmlattr 
     79  end 
     80 
     81  def __xmlele 
     82    @__xmlele 
    7983  end 
    8084 
    8185  def [](name) 
    82     @__soap_value[name] 
     86    @__xmlele[name] 
    8387  end 
    8488 
    8589  def []=(name, value) 
    86     @__soap_value[name] = value 
    87   end 
    88  
    89   def __soap_set_property(name, value) 
    90     unless @__soap_value.key?(name) 
     90    @__xmlele[name] = value 
     91  end 
     92 
     93  def __set_xmlele(name, value) 
     94    unless @__xmlele.key?(name) 
    9195      __define_attr_accessor(name) 
    9296    end 
    93     __soap_set_property_value(name, value) 
    94   end 
    95  
    96   def __soap_get_properties 
    97     @__soap_value 
     97    __set_xmlele_value(name, value) 
    9898  end 
    9999 
    100100private 
    101101 
    102   def __soap_set_property_value(name, value) 
     102  def __set_xmlele_value(name, value) 
    103103    org = self[name] 
    104     case @__soap_value_type[name] 
     104    case @__xmlele_type[name] 
    105105    when :single 
    106106      self[name] = [org, value] 
    107       @__soap_value_type[name] = :multi 
     107      @__xmlele_type[name] = :multi 
    108108    when :multi 
    109109      org << value 
    110110    else 
    111111      self[name] = value 
    112       @__soap_value_type[name] = :single 
     112      @__xmlele_type[name] = :single 
    113113    end 
    114114    value 
  • trunk/lib/soap/mapping/rubytypeFactory.rb

    r1492 r1519  
    223223      param = SOAPStruct.new(XSD::AnyTypeName) 
    224224      mark_marshalled_obj(obj, param) 
    225       obj.__soap_get_properties.each do |key, value| 
     225      obj.__xmlele.each do |key, value| 
    226226        param.add(key, Mapping._obj2soap(value, map)) 
    227227      end 
    228       obj.__soap_attribute.each do |key, value| 
     228      obj.__xmlattr.each do |key, value| 
    229229        param.extraattr[key] = value 
    230230      end 
     
    384384      mark_unmarshalled_obj(node, obj) 
    385385      node.each do |name, value| 
    386         obj.__soap_set_property(name, Mapping._soap2obj(value, map)) 
     386        obj.__set_xmlele(name, Mapping._soap2obj(value, map)) 
    387387      end 
    388388      unless node.extraattr.empty? 
    389         obj.instance_variable_set('@__soap_attribute', node.extraattr) 
     389        obj.instance_variable_set('@__xmlattr', node.extraattr) 
    390390      end 
    391391      return true, obj 
  • trunk/lib/soap/mapping/wsdlliteralregistry.rb

    r1515 r1519  
    2424  attr_accessor :excn_handler_soap2obj 
    2525 
    26   def initialize(definedtypes = XSD::NamedElements::Empty, definedelements = XSD::NamedElements::Empty) 
     26  def initialize(definedtypes = XSD::NamedElements::Empty, 
     27      definedelements = XSD::NamedElements::Empty) 
    2728    @definedtypes = definedtypes 
    2829    @definedelements = definedelements 
     
    176177    if attributes 
    177178      attributes.each do |attrname, param| 
    178         attr = obj.__send__('attr_' + 
     179        attr = obj.__send__('xmlattr_' + 
    179180          XSD::CodeGen::GenSupport.safevarname(attrname)) 
    180181        ele.extraattr[attrname] = attr 
     
    216217    else 
    217218      result, obj = @rubytype_factory.soap2obj(nil, node, nil, self) 
     219      if result 
     220        add_attributes2undefinedobj(node, obj) 
     221      end 
    218222      obj 
    219223    end 
     
    267271    if attributes = schema_attribute_definition(obj.class) 
    268272      vars = {} 
    269       obj.instance_variable_set('@__soap_attribute', {}) 
     273      obj.instance_variable_set('@__xmlattr', {}) 
    270274      attributes.each do |attrname, class_name| 
    271275        attr = node.extraattr[XSD::QName.new(nil, attrname)] 
     
    277281          child = attr 
    278282        end 
    279         vars['attr_' + attrname] = child 
     283        vars['xmlattr_' + attrname] = child 
    280284      end 
    281285      Mapping.set_attributes(obj, vars) 
     
    285289  def add_elements2undefinedobj(node, obj) 
    286290    node.each do |name, value| 
    287       obj.__soap_set_property(name, soapele2obj(value)) 
     291      obj.__set_xmlele(name, soapele2obj(value)) 
    288292    end 
    289293  end 
     
    291295  def add_attributes2undefinedobj(node, obj) 
    292296    return if node.extraattr.empty? 
    293     obj.instance_variable_set('@__soap_attribute', node.extraattr) 
    294     unless obj.respond_to?(:__soap_attribute
     297    obj.instance_variable_set('@__xmlattr', node.extraattr) 
     298    unless obj.respond_to?(:__xmlattr
    295299      class << obj 
    296         define_method(:__soap_attribute, proc { @__soap_attribute }) 
     300        define_method(:__xmlattr, proc { @__xmlattr }) 
    297301      end 
    298302    end 
  • trunk/lib/wsdl/soap/classDefCreator.rb

    r1515 r1519  
    164164    unless typedef.attributes.empty? 
    165165      define_attribute(c, typedef.attributes) 
    166       init_lines << "@__soap_attribute = {}\n" 
     166      init_lines << "@__xmlattr = {}\n" 
    167167    end 
    168168    c.def_classvar('schema_element', 
     
    225225        type = nil 
    226226      end 
    227       varname = safevarname('attr_' + name) 
     227      varname = safevarname('xmlattr_' + name) 
    228228      c.def_method(varname) do <<-__EOD__ 
    229           (@__soap_attribute ||= {})[#{name.dump}] 
     229          (@__xmlattr ||= {})[#{name.dump}] 
    230230        __EOD__ 
    231231      end 
    232232      c.def_method(varname + '=', 'value') do <<-__EOD__ 
    233           (@__soap_attribute ||= {})[#{name.dump}] = value 
     233          (@__xmlattr ||= {})[#{name.dump}] = value 
    234234        __EOD__ 
    235235      end 
  • trunk/test/wsdl/document/echo.rb

    r1501 r1519  
    1111  attr_accessor :struct_2 
    1212 
    13   def attr_attr_string 
    14     (@__soap_attribute ||= {})["attr_string"] 
     13  def xmlattr_attr_string 
     14    (@__xmlattr ||= {})["attr_string"] 
    1515  end 
    1616 
    17   def attr_attr_string=(value) 
    18     (@__soap_attribute ||= {})["attr_string"] = value 
     17  def xmlattr_attr_string=(value) 
     18    (@__xmlattr ||= {})["attr_string"] = value 
    1919  end 
    2020 
    21   def attr_attr_int 
    22     (@__soap_attribute ||= {})["attr-int"] 
     21  def xmlattr_attr_int 
     22    (@__xmlattr ||= {})["attr-int"] 
    2323  end 
    2424 
    25   def attr_attr_int=(value) 
    26     (@__soap_attribute ||= {})["attr-int"] = value 
     25  def xmlattr_attr_int=(value) 
     26    (@__xmlattr ||= {})["attr-int"] = value 
    2727  end 
    2828 
     
    3030    @struct1 = struct1 
    3131    @struct_2 = struct_2 
    32     @__soap_attribute = {} 
     32    @__xmlattr = {} 
    3333  end 
    3434end 
     
    4444  attr_accessor :struct_2 
    4545 
    46   def attr_attr_string 
    47     (@__soap_attribute ||= {})["attr_string"] 
     46  def xmlattr_attr_string 
     47    (@__xmlattr ||= {})["attr_string"] 
    4848  end 
    4949 
    50   def attr_attr_string=(value) 
    51     (@__soap_attribute ||= {})["attr_string"] = value 
     50  def xmlattr_attr_string=(value) 
     51    (@__xmlattr ||= {})["attr_string"] = value 
    5252  end 
    5353 
    54   def attr_attr_int 
    55     (@__soap_attribute ||= {})["attr-int"] 
     54  def xmlattr_attr_int 
     55    (@__xmlattr ||= {})["attr-int"] 
    5656  end 
    5757 
    58   def attr_attr_int=(value) 
    59     (@__soap_attribute ||= {})["attr-int"] = value 
     58  def xmlattr_attr_int=(value) 
     59    (@__xmlattr ||= {})["attr-int"] = value 
    6060  end 
    6161 
     
    6363    @struct1 = struct1 
    6464    @struct_2 = struct_2 
    65     @__soap_attribute = {} 
     65    @__xmlattr = {} 
    6666  end 
    6767end 
     
    7777  attr_accessor :m_datetime 
    7878 
    79   def attr_m_attr 
    80     (@__soap_attribute ||= {})["m_attr"] 
     79  def xmlattr_m_attr 
     80    (@__xmlattr ||= {})["m_attr"] 
    8181  end 
    8282 
    83   def attr_m_attr=(value) 
    84     (@__soap_attribute ||= {})["m_attr"] = value 
     83  def xmlattr_m_attr=(value) 
     84    (@__xmlattr ||= {})["m_attr"] = value 
    8585  end 
    8686 
     
    8888    @m_string = m_string 
    8989    @m_datetime = m_datetime 
    90     @__soap_attribute = {} 
     90    @__xmlattr = {} 
    9191  end 
    9292end 
  • trunk/test/wsdl/document/test_rpc.rb

    r1492 r1519  
    5252  def teardown 
    5353    teardown_server 
    54     File.unlink(pathname('echo.rb')) 
     54    #File.unlink(pathname('echo.rb')) 
    5555    @client.reset_stream if @client 
    5656  end 
     
    9898 
    9999    struct1 = Echo_struct.new("mystring1", now1 = Time.now) 
    100     struct1.attr_m_attr = 'myattr1' 
     100    struct1.xmlattr_m_attr = 'myattr1' 
    101101    struct2 = Echo_struct.new("mystring2", now2 = Time.now) 
    102     struct2.attr_m_attr = 'myattr2' 
     102    struct2.xmlattr_m_attr = 'myattr2' 
    103103    echo = Echoele.new(struct1, struct2) 
    104     echo.attr_attr_string = 'attr_string' 
    105     echo.attr_attr_int = 5 
     104    echo.xmlattr_attr_string = 'attr_string' 
     105    echo.xmlattr_attr_int = 5 
    106106    ret = @client.echo(echo) 
    107107 
     
    111111    assert_equal("mystring1", ret.struct_2.m_string) 
    112112    assert_equal(now1.strftime(timeformat), ret.struct_2.m_datetime.strftime(timeformat)) 
    113     assert_equal("attr_string", ret.attr_attr_string) 
    114     assert_equal(5, ret.attr_attr_int) 
     113    assert_equal("attr_string", ret.xmlattr_attr_string) 
     114    assert_equal(5, ret.xmlattr_attr_int) 
    115115  end 
    116116 
     
    142142    assert_equal("mystring1", ret.struct_2.m_string) 
    143143    assert_equal('2005-03-17T19:47:31', ret.struct_2.m_datetime.strftime(timeformat)) 
    144     assert_equal('attr_string', ret.attr_attr_string) 
    145     assert_equal(5, ret.attr_attr_int) 
     144    assert_equal('attr_string', ret.xmlattr_attr_string) 
     145    assert_equal(5, ret.xmlattr_attr_int) 
    146146 
    147147    echo = {'struct1' => {'m_string' => 'mystring1', 'm_datetime' => '2005-03-17T19:47:31+01:00'},  
  • trunk/test/wsdl/ref/expectedProduct.rb

    r1486 r1519  
    2828  end 
    2929 
    30   def attr_version 
    31     (@__soap_attribute ||= {})["version"] 
     30  def xmlattr_version 
     31    (@__xmlattr ||= {})["version"] 
    3232  end 
    3333 
    34   def attr_version=(value) 
    35     (@__soap_attribute ||= {})["version"] = value 
     34  def xmlattr_version=(value) 
     35    (@__xmlattr ||= {})["version"] = value 
    3636  end 
    3737 
    38   def attr_yesno 
    39     (@__soap_attribute ||= {})["yesno"] 
     38  def xmlattr_yesno 
     39    (@__xmlattr ||= {})["yesno"] 
    4040  end 
    4141 
    42   def attr_yesno=(value) 
    43     (@__soap_attribute ||= {})["yesno"] = value 
     42  def xmlattr_yesno=(value) 
     43    (@__xmlattr ||= {})["yesno"] = value 
    4444  end 
    4545 
     
    5050    @comment_1 = comment_1 
    5151    @comment_2 = comment_2 
    52     @__soap_attribute = {} 
     52    @__xmlattr = {} 
    5353  end 
    5454end