tla-sbuilder 0.2.2 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +150 -116
  3. data/VERSION +1 -1
  4. data/lib/cli/cli-customer.rb +23 -3
  5. data/lib/cli/cli-pet.rb +66 -12
  6. data/lib/cli/cli-text.rb +127 -8
  7. data/lib/cli/cli.rb +49 -6
  8. data/lib/sbuilder.rb +26 -3
  9. data/lib/sbuilder/constants.rb +165 -6
  10. data/lib/sbuilder/controller.rb +943 -169
  11. data/lib/sbuilder/controller_utils.rb +122 -0
  12. data/lib/sbuilder/default-sbuilder.yaml +38 -44
  13. data/lib/sbuilder/domain.rb +160 -36
  14. data/lib/sbuilder/domain_cardinality.rb +1 -1
  15. data/lib/sbuilder/domain_range.rb +102 -0
  16. data/lib/sbuilder/domain_type.rb +150 -0
  17. data/lib/sbuilder/domain_value.rb +21 -13
  18. data/lib/sbuilder/exception.rb +16 -0
  19. data/lib/sbuilder/extension_loader.rb +67 -686
  20. data/lib/sbuilder/extension_loader_deprecated_step_extensions.rb +711 -0
  21. data/lib/sbuilder/extension_loader_step_generator.rb +876 -0
  22. data/lib/sbuilder/facade/{api_loader.rb → api_loader_facade.rb} +176 -45
  23. data/lib/sbuilder/facade/api_loader_plugin.rb +6 -32
  24. data/lib/sbuilder/facade/api_loader_plugin_mixer.rb +35 -0
  25. data/lib/sbuilder/facade/facade_constants.rb +23 -0
  26. data/lib/sbuilder/facade/loader_plugin_root.rb +56 -0
  27. data/lib/sbuilder/facade/param_set_root.rb +55 -0
  28. data/lib/sbuilder/facade/snippet_loader_facade.rb +600 -0
  29. data/lib/sbuilder/facade/snippet_loader_plugin.rb +76 -0
  30. data/lib/sbuilder/facade/snippet_loader_plugin_mixer.rb +56 -0
  31. data/lib/sbuilder/factory.rb +224 -45
  32. data/lib/sbuilder/model.rb +125 -45
  33. data/lib/sbuilder/mustache/template.rb +107 -58
  34. data/lib/sbuilder/mustache/template_reader.rb +56 -46
  35. data/lib/sbuilder/mustache/template_reader_context.rb +64 -234
  36. data/lib/sbuilder/mustache/template_resolve.rb +103 -0
  37. data/lib/sbuilder/mustache/template_root.rb +71 -0
  38. data/lib/sbuilder/param_set.rb +30 -15
  39. data/lib/sbuilder/param_set_db.rb +1 -1
  40. data/lib/sbuilder/param_set_def.rb +6 -1
  41. data/lib/sbuilder/param_set_def_func.rb +39 -0
  42. data/lib/sbuilder/param_set_if.rb +45 -10
  43. data/lib/sbuilder/param_set_loader_swagger.rb +56 -26
  44. data/lib/sbuilder/param_set_step.rb +1 -1
  45. data/lib/sbuilder/param_sets.rb +2 -1
  46. data/lib/sbuilder/parameter.rb +9 -3
  47. data/lib/sbuilder/parameter_container.rb +1 -1
  48. data/lib/sbuilder/parameter_dom.rb +17 -5
  49. data/lib/sbuilder/parameter_ref.rb +39 -10
  50. data/lib/sbuilder/parser/parser_facade.rb +310 -0
  51. data/lib/sbuilder/resolver.rb +11 -6
  52. data/lib/sbuilder/resolver_loader.rb +1 -1
  53. data/lib/sbuilder/resolver_loader_yaml.rb +1 -1
  54. data/lib/sbuilder/resolver_rule.rb +1 -1
  55. data/lib/sbuilder/resolver_rule_match.rb +10 -4
  56. data/lib/sbuilder/resolver_rule_ref.rb +1 -1
  57. data/lib/sbuilder/setup_loader.rb +49 -0
  58. data/lib/sbuilder/setup_loader_env.rb +478 -0
  59. data/lib/sbuilder/setup_loader_pref.rb +56 -0
  60. data/lib/sbuilder/snippet_loader_simple.rb +125 -0
  61. data/lib/sbuilder/spec/api_loader.rb +34 -0
  62. data/lib/sbuilder/spec/api_loader_facade.rb +169 -32
  63. data/lib/sbuilder/spec/loader_plugin.rb +98 -0
  64. data/lib/sbuilder/spec/snippet_loader.rb +228 -0
  65. data/lib/sbuilder/symbol_table.rb +279 -0
  66. data/lib/utils/{cache_lines.rb → fileio.rb} +8 -1
  67. data/lib/utils/logger.rb +2 -1
  68. data/lib/utils/powerset.rb +13 -0
  69. data/lib/utils/validate.rb +38 -0
  70. data/mustache/cfg/const_def.mustache +2 -0
  71. data/mustache/cfg/macro_run.mustache +1 -4
  72. data/mustache/data-model-header.mustache +1 -0
  73. data/mustache/definition_types.mustache +34 -4
  74. data/mustache/domains.mustache +1 -1
  75. data/mustache/domains_assign.mustache +1 -1
  76. data/mustache/infrastructure-service-init.mustache +1 -1
  77. data/mustache/interface_processes.mustache +16 -10
  78. data/mustache/interface_types.mustache +37 -11
  79. data/mustache/operator-infrastructure-service.mustache +1 -1
  80. data/mustache/resources/schedule_operator_new_step.tla +8 -0
  81. data/mustache/resources/schedule_process_macro.tla +37 -0
  82. data/mustache/resources/schedule_process_procedure.tla +22 -0
  83. data/mustache/resources/schedule_throw.tla +16 -0
  84. data/mustache/setup/domains_run.mustache +8 -2
  85. data/mustache/setup/operator_run.mustache +0 -4
  86. data/mustache/setup/steps_run.mustache +4 -3
  87. data/mustache/setup/steps_run_parameterBind.mustache +14 -6
  88. data/mustache/setup/steps_run_parameterExact.mustache +7 -3
  89. data/mustache/state_type_invariant-infrastructure-service.mustache +9 -4
  90. data/mustache/tla/const_def.mustache +1 -1
  91. data/mustache/tla/macro_run.mustache +7 -1
  92. data/mustache/tla/module_header.mustache +1 -1
  93. data/mustache/tla/operator_run.mustache +8 -5
  94. data/mustache/tla/plc_define_run.mustache +45 -36
  95. data/mustache/tla/plc_run_state.mustache +12 -5
  96. data/src-extend/extend/extend_assumptions.mustache +3 -0
  97. data/src-extend/extend/extend_const.mustache +3 -0
  98. data/src-extend/extend/extend_implementation.mustache +3 -0
  99. data/src-extend/extend/extend_invariant.mustache +3 -0
  100. data/src-extend/extend/extend_macros.mustache +3 -0
  101. data/src-extend/extend/extend_operations.mustache +3 -0
  102. data/src-extend/extend/extend_state.mustache +3 -0
  103. data/src/pet/extend/extend_assumptions.mustache +4 -0
  104. data/src/pet/extend/extend_implementation.mustache +3 -0
  105. data/src/pet/extend/extend_invariant.mustache +3 -0
  106. data/src/pet/extend/extend_macros.mustache +3 -0
  107. data/src/pet/extend/extend_operations.mustache +4 -0
  108. data/src/pet/extend/extend_state.mustache +3 -0
  109. data/src/pet/interface +5 -5
  110. data/src/pet/interface_delete_pet.tla +1 -1
  111. data/src/pet/interface_get_pet.tla +1 -1
  112. data/src/pet/interface_post_pet.tla +4 -2
  113. data/src/pet/interface_post_tag.tla +1 -1
  114. data/src/pet/interface_put_tag.tla +1 -1
  115. data/tla-sbuilder.gemspec +3 -3
  116. metadata +44 -19
  117. data/mustache/name_definition_type.mustache +0 -5
  118. data/mustache/name_domain.mustache +0 -5
  119. data/mustache/name_domain_value.mustache +0 -5
  120. data/mustache/name_domain_value_prefix.mustache +0 -5
  121. data/mustache/name_interface_response_type.mustache +0 -6
  122. data/mustache/name_interface_type.mustache +0 -6
  123. data/mustache/name_parameter_type.mustache +0 -6
  124. data/mustache/name_process.mustache +0 -6
  125. data/mustache/state_type_invariant.mustache +0 -17
  126. data/mustache/state_variables.mustache +0 -20
  127. data/src-extend/extend/extend_invariant_cfg.mustache +0 -7
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+ require 'sbuilder'
3
+
4
+ RSpec.shared_examples_for "loader_plugin: signature" do
5
+
6
+ describe "interfaces" do
7
+
8
+ describe "confguration support" do
9
+
10
+ it "#configure " do
11
+ expect( loader ).to respond_to( :configure )
12
+ end
13
+
14
+ it "#doConfigure " do
15
+ expect( loader ).to respond_to( :doConfigure )
16
+ end
17
+
18
+ end
19
+
20
+ describe "parent class implementetation" do
21
+
22
+ it "#logger" do
23
+ expect( loader ).to respond_to( :logger )
24
+ end
25
+
26
+ it "#validateProperties" do
27
+ expect( loader ).to respond_to( :validateProperties )
28
+ end
29
+
30
+ it ".validateProperties (class method)" do
31
+ # configure -method defined on loader class?
32
+ expect( loader.class.instance_methods ).to include( :validateProperties )
33
+ end
34
+
35
+
36
+ it "#oneOf" do
37
+ expect( loader ).to respond_to( :oneOf )
38
+ end
39
+
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+
48
+ RSpec.shared_examples_for "loader_plugin: configure" do
49
+
50
+ describe "#configure" do
51
+
52
+ let ( :configuration ) { double("configuration") }
53
+
54
+ it "call :doConfigure " do
55
+ expect( loader ).to receive( :doConfigure ).with( configuration )
56
+ loader.configure( configuration )
57
+ end
58
+
59
+ it "LoaderPluginRoot#configure only implementation" do
60
+ isLoaderPluginRoot = loader.class == Sbuilder::LoaderPluginRoot
61
+ # configure -method defined on loader class?
62
+ expect( loader.class.instance_methods(false).include?( :configure ) ).to eql( isLoaderPluginRoot )
63
+ end
64
+
65
+ it "#return == self" do
66
+ expect( loader.configure( configuration ) ).to eql( loader )
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+
73
+ RSpec.shared_examples_for "loader_plugin: logger" do
74
+
75
+ describe "#logger" do
76
+
77
+ let ( :logObject ) { loader.logger }
78
+
79
+ it "!= nil" do
80
+ expect( logObject ).not_to eql( nil )
81
+ end
82
+
83
+ it "#debug" do
84
+ expect( logObject ).to respond_to( :debug )
85
+ end
86
+
87
+ it "#debug?" do
88
+ expect( logObject ).to respond_to( :debug? )
89
+ end
90
+
91
+ it "#info" do
92
+ expect( logObject ).to respond_to( :info )
93
+ end
94
+
95
+ end
96
+
97
+ end
98
+
@@ -0,0 +1,228 @@
1
+ require 'sbuilder'
2
+
3
+ RSpec.shared_examples_for "snippet_loader_plugin: signature" do
4
+
5
+ describe "Interface of Snippet Loader Plugin" do
6
+
7
+ describe "should be configurable" do
8
+
9
+ it ".configure class method responded to in class" do
10
+ expect( plugin.class ).to respond_to( :configure )
11
+ end
12
+
13
+ it "must implement '.configure' singleton method" do
14
+ expect( plugin.class.singleton_methods(false).include?(:configure) ).to eql( true )
15
+ end
16
+
17
+ end
18
+
19
+
20
+ describe "API provided by 'SnippetLoaderPlugin' parent class" do
21
+
22
+ it "#logger" do
23
+ expect( plugin ).to respond_to( :logger )
24
+ end
25
+
26
+ it "#snippetFacade" do
27
+ expect( plugin ).to respond_to( :snippetFacade )
28
+ end
29
+
30
+
31
+ it "#registerMetatype" do
32
+ expect( plugin ).to respond_to( :registerMetatype )
33
+ end
34
+
35
+
36
+ it "#validateProperties" do
37
+ expect( plugin ).to respond_to( :validateProperties )
38
+ end
39
+
40
+ it ".validateProperties (class method)" do
41
+ # configure -method defined on loader class?
42
+ expect( plugin.class.instance_methods ).to include( :validateProperties )
43
+ end
44
+
45
+
46
+ it "#oneOf" do
47
+ expect( plugin ).to respond_to( :oneOf )
48
+ end
49
+
50
+
51
+ end
52
+
53
+ describe "implement API loading snippets" do
54
+
55
+
56
+ it "#doRegisterSnippets" do
57
+ expect( plugin.class.instance_methods(false).include?( :doRegisterSnippets )).to eql( true )
58
+ end
59
+
60
+ end
61
+
62
+
63
+ end # interfaces
64
+
65
+ end
66
+
67
+ # ------------------------------------------------------------------
68
+
69
+ RSpec.shared_examples_for "snippet_loader_plugin: registers metatypes" do
70
+
71
+ # input let ( :plugin )
72
+
73
+ describe "in registerMetatype" do
74
+
75
+ let ( :facade ) { notifier = instance_double( Sbuilder::SnippetLoaderFacade) }
76
+ let ( :metatype ) { double("metatype")}
77
+ let ( :desc ) { double("metatype description")}
78
+
79
+ it "#calls facade" do
80
+ expect( facade ).to receive( :registerMetatype ).with( metatype, desc )
81
+ plugin.registerMetatype( metatype, desc )
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+
88
+ RSpec.shared_examples_for "snippet_loader_plugin: registers snippets" do
89
+
90
+ describe "in method doRegisterSnippets" do
91
+
92
+ let ( :facade ) { notifier = instance_double( Sbuilder::SnippetLoaderFacade) }
93
+
94
+ # subroutine to prepare plugin for tests
95
+ def preprarePlugin( plugin, snippetDefitions )
96
+ allow( plugin ).to receive( :snippetFacade ).and_return( facade )
97
+ expect( facade ).to receive( :handOver ).exactly( snippetDefitions.nil? ? 0 : snippetDefitions.length ).times
98
+ end
99
+
100
+ it "#handOver called for each entry in 'snippetDefitions'" do
101
+ preprarePlugin( plugin, snippetDefitions )
102
+ # call method using an array
103
+ plugin.doRegisterSnippets( snippetDefitions )
104
+ end
105
+
106
+ it "#registerSnippets passes 'snippetsDefs' to #doregisterSnippets" do
107
+ snippetDefitions = double( "snippetDefitions" )
108
+ expect( plugin ).to receive( :doRegisterSnippets ).with( snippetDefitions )
109
+ plugin.registerSnippets( snippetDefitions )
110
+ end
111
+
112
+ end
113
+
114
+ end
115
+
116
+
117
+ RSpec.shared_examples_for "snippet_loader_facade: signature" do
118
+
119
+ describe "Interface of 'SnippetLoaderFacade'" do
120
+
121
+ describe "Provides api to register metatypes" do
122
+
123
+ it "#registerMetatype" do
124
+ expect( facade ).to respond_to( :registerMetatype )
125
+ end
126
+
127
+ it "#baseMetatypes" do
128
+ expect( facade ).to respond_to( :baseMetatypes )
129
+ end
130
+
131
+
132
+
133
+ end
134
+
135
+
136
+ describe "Provides api for snippet loader to hand over snippets" do
137
+
138
+ it "#handOver" do
139
+ expect( facade ).to respond_to( :handOver )
140
+ end
141
+
142
+ end
143
+
144
+ describe "Provides api for controller to accept snippets hander over" do
145
+
146
+ it "#setSnippetHeader" do
147
+ expect( facade ).to respond_to( :setSnippetHeader )
148
+ end
149
+
150
+ it "#setSnippetFooter" do
151
+ expect( facade ).to respond_to( :setSnippetFooter )
152
+ end
153
+
154
+ it "#acceptSnippets" do
155
+ expect( facade ).to respond_to( :acceptSnippets )
156
+ end
157
+
158
+ end
159
+
160
+ describe "Miscellaneous services" do
161
+
162
+ it "#getCacheDir" do
163
+ expect( facade ).to respond_to( :getCacheDir )
164
+ end
165
+
166
+ it "#createLogger" do
167
+ expect( facade ).to respond_to( :createLogger )
168
+ end
169
+
170
+ it "#version" do
171
+ expect( facade ).to respond_to( :version )
172
+ end
173
+
174
+ end
175
+
176
+ end # interfaces
177
+
178
+ end
179
+
180
+ RSpec.shared_examples_for "snippet_loader_facade: services" do
181
+
182
+ describe "Miscellaneous services" do
183
+
184
+ describe "version'" do
185
+
186
+ # ------------------------------------------------------------------
187
+ # version
188
+
189
+ it "#return Sbuilder version" do
190
+ expect( facade.version ).to eql( Sbuilder::version )
191
+ end
192
+
193
+ end # version
194
+
195
+ # ------------------------------------------------------------------
196
+ # createLogger
197
+ describe "createLogger" do
198
+
199
+ describe "returns object'" do
200
+
201
+ let ( :logger ) { facade.createLogger(nil) }
202
+
203
+ it "#responds to :error" do
204
+ expect( logger ).to respond_to( :error )
205
+ end
206
+
207
+ it "#responds to :debug" do
208
+ expect( logger ).to respond_to( :debug )
209
+ end
210
+
211
+ it "#responds to :info" do
212
+ expect( logger ).to respond_to( :info )
213
+ end
214
+
215
+ it "#responds to :info" do
216
+ expect( logger ).to respond_to( :debug? )
217
+ end
218
+
219
+ end
220
+
221
+ end # version
222
+
223
+ end # Miscellaneous services
224
+
225
+
226
+
227
+ end
228
+
@@ -0,0 +1,279 @@
1
+ module Sbuilder
2
+
3
+ class SymbolTable
4
+
5
+ # ------------------------------------------------------------------
6
+ # Attributes
7
+
8
+ # @attr [Hash] types of :name -> :desc mappingssymbol names to add
9
+ # @option types [String] :name of symbol to define
10
+ # @option types [String] :desc description of symbol to define
11
+ attr_reader :types
12
+
13
+ alias_method :metatypes, :types
14
+
15
+ # @attr [Hash] table of symbols
16
+ # @option table [String] key is type name
17
+ # @option table [Hash] spec-namesvalue spec names of 'type'
18
+ # @option spec-names [String] key spec name of symbol entry
19
+ # @option spec-names [String] value app name of symbol entry
20
+ attr_reader :table
21
+
22
+ # ------------------------------------------------------------------
23
+ # Logger
24
+
25
+ PROGNAME = nil # progname for logger default class name
26
+ include Sbuilder::Utils::MyLogger # mix logger
27
+
28
+
29
+ # ------------------------------------------------------------------
30
+ # @!group Construct & configure
31
+
32
+ def initialize( options = {} )
33
+ @logger = getLogger( PROGNAME, options )
34
+ @logger.info( "#{__method__} initialized" )
35
+
36
+ @types = {}
37
+ @table = {}
38
+ end
39
+
40
+ # @!endgroup
41
+
42
+ # ------------------------------------------------------------------
43
+ # @!group Build symbol table
44
+
45
+ # Add type names to symbol table so that we can issue a warning if
46
+ # unknon symbol types are entered
47
+ #
48
+ # @param [Hash] symbol name to add
49
+ # @option symbol [String] :name of symbol to define
50
+ # @option symbol [String] :desc description of symbol to define
51
+ #
52
+ #
53
+ def defineMetaType( symbol )
54
+ @logger.info "#{__method__}: #{symbol}"
55
+
56
+ # symbol[:name ] = symbol[:name ]
57
+ symbol[:prefix] = symbol[:prefix] || generatePrefix()
58
+
59
+ types[symbol[:name]] = symbol
60
+
61
+ # Initialize empty hash to store appName->specName mappings
62
+ table[symbol[:name]] = table[symbol[:name]] || {}
63
+ end
64
+
65
+ # Create unique prefix entry.
66
+ #
67
+ # Implementation iteraterates '@types' in symbol table, for
68
+ # entries with :prefix symbol starting with fixed characted 'x'.
69
+ #
70
+ # Take max of
71
+ #
72
+ #
73
+ private def generatePrefix
74
+ current_prefix=0
75
+ @types.each do |k,v|
76
+ if !v[:prefix].nil? && v[:prefix].start_with?( 'x' ) then
77
+ result,tmp_prefix = /x(\d+)/.match( v[:prefix]).to_a.flatten
78
+ current_prefix = tmp_prefix.to_i > current_prefix ? tmp_prefix.to_i : current_prefix
79
+ end
80
+ end
81
+ "x#{current_prefix+1}"
82
+ end
83
+
84
+
85
+ # Add 'spec' symbol of 'type' for 'app'. Issue a warning if 'type'
86
+ # is undefined, or if 'type', 'spec' is redefined.
87
+ #
88
+ # @param [String] metatype of previsously defined metatype
89
+ #
90
+ #
91
+ # @param [String] spec name in specifcation domain
92
+ #
93
+ # @param [String] app name in application domain where 'spec' name
94
+ # is associated
95
+
96
+ def addSymbol( metatype, app, spec )
97
+
98
+ # ------------------------------------------------------------------
99
+ # Unknown metatype
100
+
101
+ if types[metatype].nil? then
102
+ typeDesc = "Unknown metatype '#{metatype}' encountered when mapping #{app} -> #{spec}"
103
+
104
+ msg= <<-EOS
105
+ #{typeDesc}
106
+
107
+ use #{self.class.name}#defineMetaType(symbol) -method to define metatypes before adding
108
+ symbols using #{self.class.name}#addSymbol -method.
109
+
110
+ EOS
111
+ # warn msg
112
+ @logger.error "#{__method__}: #{msg}"
113
+ raise SymbolTableException.new msg
114
+ end
115
+
116
+ # Init hash to map appName -> specName
117
+ table[metatype] = table[metatype] || {}
118
+
119
+ # ------------------------------------------------------------------
120
+ # Check for alias definition for specName
121
+
122
+ # turn table outsize in: specName -> [metatype,appName]
123
+ specName2metatype_appName = table.inject( {} ) {|memo,(m,ah)|
124
+ ah.each { |a,s|
125
+ memo[s] = [m,a]
126
+ }
127
+ memo
128
+ }
129
+
130
+ # ------------------------------------------------------------------
131
+ # error on aliased definition
132
+ # if specName2metatype_appName[spec] && specName2metatype_appName[spec] != [metatype,app]
133
+ # msg = specNameAliasedMessage( metatype, app, *specName2metatype_appName[spec], spec )
134
+ # @logger.error "#{__method__} #{msg}"
135
+ # raise SymbolTableException.new msg
136
+ # end
137
+
138
+ # ------------------------------------------------------------------
139
+ # Warn on duplicate definition
140
+ if table[metatype][app] && table[metatype][app] != spec
141
+ msg = specNameRerefined( metatype, app, table[metatype][app], spec )
142
+ @logger.error "#{__method__}: #{msg}"
143
+ raise SymbolTableException.new msg
144
+ end
145
+
146
+
147
+ # ------------------------------------------------------------------
148
+ # Warn on duplicate definition
149
+ if ! table[metatype][app].nil?
150
+ msg = "Duplicate symbol definition #{metatype}:#{spec}"
151
+ warn msg
152
+ @logger.warn "#{__method__}: #{msg}"
153
+ end
154
+
155
+ # ------------------------------------------------------------------
156
+ # Here normal add
157
+ @logger.info "#{__method__} added metatype '#{metatype}', name in spec-domain: '#{spec}', name in app domain: '#{app}'"
158
+
159
+ table[metatype][app] = spec
160
+ end
161
+
162
+ # @!endgroup
163
+
164
+ # ------------------------------------------------------------------
165
+ # @!group Use symbol table
166
+
167
+ # @return [String] definition of metatype
168
+ def getMetaTypeDescription( metatype )
169
+ getMetaTypeDefinition( metatype )[:desc]
170
+ end
171
+
172
+ # @return [String] definition of metatype, nil if not found
173
+ def getMetaTypeDefinition( metatype )
174
+ ret = types[metatype]
175
+
176
+ if ret.nil?
177
+ msg= <<-EOS
178
+ Metatype definition for metatype '#{metatype}' not found.
179
+
180
+ Known metatypes are: #{types.keys.join( ', ')}
181
+
182
+ EOS
183
+ # warn msg
184
+ @logger.error "#{__method__}: #{msg}"
185
+ raise SymbolTableException.new msg
186
+
187
+ end
188
+ ret
189
+
190
+ end
191
+
192
+ # # @return [Hash] application-names for 'type'
193
+ # def []( type )
194
+ # table[type]
195
+ # end
196
+
197
+ # Return 'spec' -name identified by 'app'/'type' combination
198
+ #
199
+ # @param [String] app name in application domain where 'spec' name
200
+ # is associated
201
+ #
202
+ # @param [String] type of previsously defined type
203
+ #
204
+ def lookupSymbol( appName, metatype )
205
+
206
+ # Find specname (raise exceptio if metatype not found )
207
+ specName = getMetaTypeHash( metatype, appName )[appName]
208
+
209
+ # Valid spec-name found
210
+ if specName.nil? then
211
+ msg=<<-EOS
212
+ Unknown name '#{appName}' in metatype '#{metatype}'
213
+
214
+ Valid app-names in meta-type '#{metatype}' are: #{table[metatype].keys.join(', ')}
215
+ EOS
216
+ @logger.error msg
217
+ raise SymbolTableException.new msg
218
+
219
+ end
220
+ specName
221
+
222
+ end
223
+
224
+ # @!endgroup
225
+
226
+ # @return [Hash] symbol map for 'metatype'
227
+ private def getMetaTypeHash( metatype, appName )
228
+
229
+ # Valid 'metatype'
230
+ if table[metatype].nil? then
231
+ msg=<<-EOS
232
+ Unknown meta-type '#{metatype}', when looking up for specification name for appName #{appName}
233
+
234
+ Valid meta-types are: #{table.keys.join(', ')}
235
+ EOS
236
+ @logger.error msg
237
+ raise SymbolTableException.new msg
238
+ end
239
+
240
+ # return hash for metape
241
+ table[metatype]
242
+
243
+ end
244
+
245
+ # # @return [Hash] unknown metatype hash
246
+ # private def unknownMetatype( metatype )
247
+ # {
248
+ # :name => metatype,
249
+ # :desc => "Unknown metatype '#{metatype}'",
250
+ # }
251
+ # end
252
+
253
+
254
+ # @return [String] error message for aliasins specName
255
+ private def specNameAliasedMessage( metatype1, appName1, metatype2, appName2, specName )
256
+ <<-EOS
257
+ Name '#{specName}' in specification code domain is defined twice
258
+
259
+ Application name '#{appName1}' in metatype '#{metatype1}' is defined as '#{specName}'
260
+ Application name '#{appName2}' in metatype '#{metatype2}' is defined as '#{specName}'
261
+ EOS
262
+ end
263
+
264
+ # @return [String] error message for redfining metatype/appName
265
+ private def specNameRerefined( metatype, appName, specName1, specName2 )
266
+ <<-EOS
267
+ Application name '#{appName}' in metatype '#{metatype}' refined
268
+
269
+ specName1 = #{specName1}
270
+ specName2 = #{specName1}
271
+ EOS
272
+ end
273
+
274
+
275
+
276
+ end # class SymboTable
277
+
278
+ end # module
279
+