Class: SOAP::Mapping::EncodedRegistry

Inherits:
Object
  • Object
show all
Includes:
RegistrySupport, TraverseSupport
Defined in:
lib/soap/mapping/encodedregistry.rb

Direct Known Subclasses

WSDLEncodedRegistry

Defined Under Namespace

Classes: Map

Constant Summary collapse

StringFactory =
StringFactory_.new
BasetypeFactory =
BasetypeFactory_.new
FixnumFactory =
FixnumFactory_.new
DateTimeFactory =
DateTimeFactory_.new
ArrayFactory =
ArrayFactory_.new
Base64Factory =
Base64Factory_.new
URIFactory =
URIFactory_.new
TypedArrayFactory =
TypedArrayFactory_.new
TypedStructFactory =
TypedStructFactory_.new
HashFactory =
HashFactory_.new
SOAPBaseMap =
[
   [::NilClass,     ::SOAP::SOAPNil,        BasetypeFactory],
   [::TrueClass,    ::SOAP::SOAPBoolean,    BasetypeFactory],
   [::FalseClass,   ::SOAP::SOAPBoolean,    BasetypeFactory],
   [::String,       ::SOAP::SOAPString,     StringFactory,
     {:derived_class => true}],
   [::DateTime,     ::SOAP::SOAPDateTime,   DateTimeFactory],
   [::Date,         ::SOAP::SOAPDate,       DateTimeFactory],
   [::Time,         ::SOAP::SOAPDateTime,   DateTimeFactory],
   [::Time,         ::SOAP::SOAPTime,       DateTimeFactory],
   [::Float,        ::SOAP::SOAPDouble,     BasetypeFactory,
     {:derived_class => true}],
   [::Float,        ::SOAP::SOAPFloat,      BasetypeFactory,
     {:derived_class => true}],
   [::Fixnum,       ::SOAP::SOAPInt,        FixnumFactory],
   [::Integer,      ::SOAP::SOAPInt,        BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPLong,       BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPInteger,    BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPShort,      BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPByte,       BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPNegativeInteger, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPPositiveInteger, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPUnsignedLong, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPUnsignedInt, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPUnsignedShort, BasetypeFactory,
     {:derived_class => true}],
   [::Integer,      ::SOAP::SOAPUnsignedByte, BasetypeFactory,
     {:derived_class => true}],
   [::URI::Generic, ::SOAP::SOAPAnyURI,     URIFactory,
     {:derived_class => true}],
   [::String,       ::SOAP::SOAPBase64,     Base64Factory],
   [::String,       ::SOAP::SOAPHexBinary,  Base64Factory],
   [::String,       ::SOAP::SOAPDecimal,    BasetypeFactory],
   [::String,       ::SOAP::SOAPDuration,   BasetypeFactory],
   [::String,       ::SOAP::SOAPGYearMonth, BasetypeFactory],
   [::String,       ::SOAP::SOAPGYear,      BasetypeFactory],
   [::String,       ::SOAP::SOAPGMonthDay,  BasetypeFactory],
   [::String,       ::SOAP::SOAPGDay,       BasetypeFactory],
   [::String,       ::SOAP::SOAPGMonth,     BasetypeFactory],
   [::String,       ::SOAP::SOAPQName,      BasetypeFactory],

   [::Hash,         ::SOAP::SOAPArray,      HashFactory,
     {:derived_class => true}],
   [::Hash,         ::SOAP::SOAPStruct,     HashFactory,
     {:derived_class => true}],

   [::Array,        ::SOAP::SOAPArray,      ArrayFactory,
     {:derived_class => true}],

   [::SOAP::Mapping::SOAPException,
	     ::SOAP::SOAPStruct,     TypedStructFactory,
     {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
]
RubyOriginalMap =
[
  [::NilClass,     ::SOAP::SOAPNil,        BasetypeFactory],
  [::TrueClass,    ::SOAP::SOAPBoolean,    BasetypeFactory],
  [::FalseClass,   ::SOAP::SOAPBoolean,    BasetypeFactory],
  [::String,       ::SOAP::SOAPString,     StringFactory],
  [::DateTime,     ::SOAP::SOAPDateTime,   DateTimeFactory],
  [::Date,         ::SOAP::SOAPDate,       DateTimeFactory],
  [::Time,         ::SOAP::SOAPDateTime,   DateTimeFactory],
  [::Time,         ::SOAP::SOAPTime,       DateTimeFactory],
  [::Float,        ::SOAP::SOAPDouble,     BasetypeFactory,
    {:derived_class => true}],
  [::Float,        ::SOAP::SOAPFloat,      BasetypeFactory,
    {:derived_class => true}],
  [::Fixnum,       ::SOAP::SOAPInt,        FixnumFactory],
  [::Integer,      ::SOAP::SOAPInt,        BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPLong,       BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPInteger,    BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPShort,      BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPByte,       BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPNegativeInteger, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPPositiveInteger, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPUnsignedLong, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPUnsignedInt, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPUnsignedShort, BasetypeFactory,
    {:derived_class => true}],
  [::Integer,      ::SOAP::SOAPUnsignedByte, BasetypeFactory,
    {:derived_class => true}],
  [::URI::Generic, ::SOAP::SOAPAnyURI,     URIFactory,
    {:derived_class => true}],
  [::String,       ::SOAP::SOAPBase64,     Base64Factory],
  [::String,       ::SOAP::SOAPHexBinary,  Base64Factory],
  [::String,       ::SOAP::SOAPDecimal,    BasetypeFactory],
  [::String,       ::SOAP::SOAPDuration,   BasetypeFactory],
  [::String,       ::SOAP::SOAPGYearMonth, BasetypeFactory],
  [::String,       ::SOAP::SOAPGYear,      BasetypeFactory],
  [::String,       ::SOAP::SOAPGMonthDay,  BasetypeFactory],
  [::String,       ::SOAP::SOAPGDay,       BasetypeFactory],
  [::String,       ::SOAP::SOAPGMonth,     BasetypeFactory],
  [::String,       ::SOAP::SOAPQName,      BasetypeFactory],

  [::Hash,         ::SOAP::SOAPArray,      HashFactory],
  [::Hash,         ::SOAP::SOAPStruct,     HashFactory],

  # Does not allow Array's subclass here.
  [::Array,        ::SOAP::SOAPArray,      ArrayFactory],

  [::SOAP::Mapping::SOAPException,
                   ::SOAP::SOAPStruct,     TypedStructFactory,
    {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RegistrySupport

#add_attributes2soap, #add_definedattributes2soap, #base2obj, #base2soap, #elename_schema_definition_from_class, #find_node_definition, #find_schema_definition, #get_xmlattr_value, #is_stubobj_elements_for_array, #register, #schema_definition_from_class, #schema_definition_from_elename, #schema_definition_from_type

Methods included from TraverseSupport

#mark_marshalled_obj, #mark_unmarshalled_obj

Constructor Details

#initialize(config = {}) ⇒ EncodedRegistry

Returns a new instance of EncodedRegistry.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/soap/mapping/encodedregistry.rb', line 271

def initialize(config = {})
  super()
  @config = config
  @map = Map.new(self)
  if @config[:allow_original_mapping]
    @allow_original_mapping = true
    @map.init(RubyOriginalMap)
  else
    @allow_original_mapping = false
    @map.init(SOAPBaseMap)
  end
  @allow_untyped_struct = @config.key?(:allow_untyped_struct) ?
    @config[:allow_untyped_struct] : true
  @rubytype_factory = RubytypeFactory.new(
    :allow_untyped_struct => @allow_untyped_struct,
    :allow_original_mapping => @allow_original_mapping
  )
  @default_factory = @rubytype_factory
  @excn_handler_obj2soap = nil
  @excn_handler_soap2obj = nil
end

Instance Attribute Details

#default_factoryObject

Returns the value of attribute default_factory.



267
268
269
# File 'lib/soap/mapping/encodedregistry.rb', line 267

def default_factory
  @default_factory
end

#excn_handler_obj2soapObject

Returns the value of attribute excn_handler_obj2soap.



268
269
270
# File 'lib/soap/mapping/encodedregistry.rb', line 268

def excn_handler_obj2soap
  @excn_handler_obj2soap
end

#excn_handler_soap2objObject

Returns the value of attribute excn_handler_soap2obj.



269
270
271
# File 'lib/soap/mapping/encodedregistry.rb', line 269

def excn_handler_soap2obj
  @excn_handler_soap2obj
end

Instance Method Details

#add(obj_class, soap_class, factory, info = nil) ⇒ Object Also known as: set

initial mapping interface new interface Registry#register is defined in RegisterSupport



295
296
297
# File 'lib/soap/mapping/encodedregistry.rb', line 295

def add(obj_class, soap_class, factory, info = nil)
  @map.add(obj_class, soap_class, factory, info)
end

#find_mapped_obj_class(soap_class) ⇒ Object



321
322
323
# File 'lib/soap/mapping/encodedregistry.rb', line 321

def find_mapped_obj_class(soap_class)
  @map.find_mapped_obj_class(soap_class)
end

#find_mapped_soap_class(obj_class) ⇒ Object



317
318
319
# File 'lib/soap/mapping/encodedregistry.rb', line 317

def find_mapped_soap_class(obj_class)
  @map.find_mapped_soap_class(obj_class)
end

#obj2soap(obj, type_qname = nil) ⇒ Object



300
301
302
303
304
305
306
# File 'lib/soap/mapping/encodedregistry.rb', line 300

def obj2soap(obj, type_qname = nil)
  soap = _obj2soap(obj, type_qname)
  if @allow_original_mapping
    addextend2soap(soap, obj)
  end
  soap
end

#soap2obj(node, klass = nil) ⇒ Object



308
309
310
311
312
313
314
315
# File 'lib/soap/mapping/encodedregistry.rb', line 308

def soap2obj(node, klass = nil)
  obj = _soap2obj(node, klass)
  if @allow_original_mapping
    addextend2obj(obj, node.extraattr[RubyExtendName])
    addiv2obj(obj, node.extraattr[RubyIVarName])
  end
  obj
end