| 1 |
# WSDL4R - Creating EncodedMappingRegistry code from WSDL. |
|---|
| 2 |
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. |
|---|
| 3 |
|
|---|
| 4 |
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can |
|---|
| 5 |
# redistribute it and/or modify it under the same terms of Ruby's license; |
|---|
| 6 |
# either the dual license version in 2003, or any later version. |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
require 'wsdl/info' |
|---|
| 10 |
require 'wsdl/soap/mappingRegistryCreatorSupport' |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
module WSDL |
|---|
| 14 |
module SOAP |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
class EncodedMappingRegistryCreator |
|---|
| 18 |
include MappingRegistryCreatorSupport |
|---|
| 19 |
|
|---|
| 20 |
attr_reader :definitions |
|---|
| 21 |
|
|---|
| 22 |
def initialize(definitions, name_creator, modulepath, defined_const) |
|---|
| 23 |
@definitions = definitions |
|---|
| 24 |
@name_creator = name_creator |
|---|
| 25 |
@modulepath = modulepath |
|---|
| 26 |
@simpletypes = definitions.collect_simpletypes |
|---|
| 27 |
@simpletypes.uniq! |
|---|
| 28 |
@complextypes = definitions.collect_complextypes |
|---|
| 29 |
@complextypes.uniq! |
|---|
| 30 |
@varname = nil |
|---|
| 31 |
@defined_const = defined_const |
|---|
| 32 |
end |
|---|
| 33 |
|
|---|
| 34 |
def dump(varname) |
|---|
| 35 |
@varname = varname |
|---|
| 36 |
result = '' |
|---|
| 37 |
str = dump_complextype |
|---|
| 38 |
unless str.empty? |
|---|
| 39 |
result << "\n" unless result.empty? |
|---|
| 40 |
result << str |
|---|
| 41 |
end |
|---|
| 42 |
str = dump_simpletype |
|---|
| 43 |
unless str.empty? |
|---|
| 44 |
result << "\n" unless result.empty? |
|---|
| 45 |
result << str |
|---|
| 46 |
end |
|---|
| 47 |
result |
|---|
| 48 |
end |
|---|
| 49 |
|
|---|
| 50 |
private |
|---|
| 51 |
|
|---|
| 52 |
def dump_complextype |
|---|
| 53 |
@complextypes.collect { |type| |
|---|
| 54 |
unless type.abstract |
|---|
| 55 |
dump_with_inner { |
|---|
| 56 |
dump_complextypedef(@modulepath, type.name, type, nil, :encoded => true) |
|---|
| 57 |
} |
|---|
| 58 |
end |
|---|
| 59 |
}.compact.join("\n") |
|---|
| 60 |
end |
|---|
| 61 |
|
|---|
| 62 |
def dump_simpletype |
|---|
| 63 |
@simpletypes.collect { |type| |
|---|
| 64 |
dump_with_inner { |
|---|
| 65 |
dump_simpletypedef(@modulepath, type.name, type, nil, :encoded => true) |
|---|
| 66 |
} |
|---|
| 67 |
}.compact.join("\n") |
|---|
| 68 |
end |
|---|
| 69 |
end |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
end |
|---|
| 73 |
end |
|---|