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
@@ -14,11 +14,82 @@ module Sbuilder
14
14
  # className: <class name>
15
15
  # configuration:
16
16
  # <configuration-value>
17
+ # objects:
18
+ # <named-object>
19
+ #
20
+ # WHERE <named-object> is a hash
21
+ #
22
+ # - objectName:
23
+ # configuration:
24
+ # <configuration-value>
25
+ #
26
+ #
27
+ # COMMENTS:
28
+ # - `objects` -property is optional
29
+ # - `objectName` must be unique
30
+ # - if 'className' is used, must also give 'gem'
17
31
  #
18
- # <gem-name>: gem name to require
19
32
  # <class name>: name of interface loader in 'type' property in 'interfaces' array
33
+ # <gem-name>: gem name to require, require only if <class name> not defined
20
34
  # <configuration-value>: a (hash) value passed to 'className'::configure' -method
35
+ # or `className.new#configure` method for objects
36
+ #
37
+ #
38
+
39
+ extend:
40
+ loaders:
41
+
42
+ # - className: Sbuilder::SnippetLoaderSimple
43
+ # configuration:
44
+ # src_dir: src/pet
45
+
46
+ EOS
47
+
48
+ SBUILDER_SNIPPETS = <<-EOS.unindent
49
+
50
+ # Load snippets to sbuilder code repository
51
+ #
52
+ # SCHEMA:
53
+ #
54
+ #
55
+ # snippets:
56
+ # - <snippet-loader>
57
+ # - <snippet-loader>
58
+ # - <snippet-loader>
59
+ #
60
+ # <snippet-loader>: an array element with the following mandatory properties
61
+ #
62
+ # className: name of the snippet loader object,
63
+ # className used in 'extend.loaders'
64
+ # objectName: name of the class of snippet loader object,
65
+ # references 'objectName' in 'extend.loaders.objects',
66
+ # must give either 'className' or 'objectName'
67
+ # snippets: array of snippet load definitions,
68
+ # content of the array varies for classNames
69
+ #
70
+ #
71
+ # Special metatypes:
72
+ # - service_implementation: defines a macro to call for the service
73
+ # - service_completion: defines a macro to call when service
74
+ # finishes. Intended use is check service status, and implementation
75
+ # transaction semantics.
21
76
  #
77
+ # Example for className: Sbuilder::SnippetLoaderSimple
78
+ #
79
+ # className: Sbuilder::SnippetLoaderSimple
80
+ # configuration:
81
+ # metatypes:
82
+ # code: Example code
83
+ # snippets:
84
+ # - metatype: service_implementation
85
+ # appName: "/max2(post)"
86
+ # file: max2_post.tla
87
+ # - metatype: service_implementation
88
+ # appName: "/dummy(post)"
89
+ # file: dummy_post.tla
90
+ # - metatype: code
91
+ # appName: max2
92
+ # file: max2.tla
22
93
  EOS
23
94
 
24
95
  SBUILDER_INVARIANTS = <<-EOS.unindent
@@ -64,24 +135,47 @@ module Sbuilder
64
135
  # SCHEMA:
65
136
  #
66
137
  # interfaces:
67
- # - type: <interface loader name>
138
+ # -
139
+ # className: <class name>
140
+ # configuration: <configuration-value>
141
+ # objectName: <object name>
68
142
  #
69
143
  # file: <file name in cnf-dir>
70
144
  # infrastructureServices: <is infrastructureService>
145
+ # interfaceServices: <is interfaceService>
71
146
  # url: <path or url>
72
147
  # cache: <cache file path>
73
148
  #
74
- # <interface loader name>: name of interface loader,
75
- # valid values: 'swagger' and className values
76
- # given in 'extend.loaders' array
77
- # <is infrastructureService>: true or false (default false)
149
+ # WHERE
150
+ #
151
+ # <class name>: name of the snippet loader object,
152
+ # className used in 'extend.loaders'
153
+ #
154
+ # <object name>: name of the class of api loader object,
155
+ # references 'objectName' in 'extend.loaders.objects',
156
+ #
157
+ #
158
+ # <configuration-value>: a (hash) value passed to 'className'::configure' -method
159
+ # or `className.new#configure` method for objects
160
+ #
161
+ #
162
+ # <is infrastructureService>: true generates the possibility for a
163
+ # service set return response using 'InfrastructureServiceResponse' operator, and
164
+ # the caller to access response status ( operator 'InfrastructureServiceGetStatus')
165
+ # and response data ( operator #InfrastructureServiceGetResponse'), optional, defaults false
166
+ #
167
+ # <is interfaceService>: true generates interface process for the interface, which
168
+ # environment can call (see 'step-extension', optional, defaults true
169
+ #
78
170
  # <file name in cnf-dir> : file name in cnf-directory
79
171
  # <path or url> : path relative to cwd, or http url,
80
172
  # e.g https://cdn.rawgit.com/swagger-api/swagger-spec/master/examples/v2.0/yaml/petstore-expanded.yaml
81
173
  # <cache file path> : path relative to cwd, where interface file is cached
82
174
  #
83
175
  # COMMENTS:
84
- # - give 'file' xor 'url' property
176
+ # - must give either 'className' or 'objectName'
177
+ # - when 'className' given 'configuration' allowed
178
+ # - must give either 'file' or 'url'
85
179
  # - property 'cache' optional, useful when http access slow
86
180
  # - infrastructureServices are modelled as procedures, which may modify state
87
181
  # or return values used in 'normal' interfaces
@@ -170,17 +264,41 @@ module Sbuilder
170
264
  # cardinality: <cardinality>
171
265
  # values:
172
266
  # - <str-value>
267
+ # type: <type-def>
268
+ # range: <range-def>
173
269
  #
174
270
  #
175
271
  # <domain-name>: domain name resolved
176
272
  # <cardinality>: integer value for domain, default 1
177
273
  # <str-value>: fixed value for domain
274
+ # <type-def>: Int|BOOLEAN
275
+ # <rannge-def>: [low,high]
178
276
  #
179
277
  # COMMENTS:
180
- # - give 'cardinality' xor 'values' property
278
+ # - give one of 'cardinality', 'values','type', 'range'
181
279
  #
182
280
 
183
281
  EOS
282
+
283
+ EXTENSION_HEADER_PREFS = <<-EOS.unindent
284
+
285
+ # Modify setup preference
286
+ #
287
+ # SCHEMA:
288
+ # - preferences-extension:
289
+ # - preferences:
290
+ # <hash-values>
291
+ #
292
+ # <hash-values> : optional properties overriding preferences given in 'sbuilder.yaml'
293
+ #
294
+ #
295
+ # Example
296
+ # - preferences-extension:
297
+ # preferences:
298
+ # debug-output: true
299
+ #
300
+ EOS
301
+
184
302
 
185
303
  EXTENSION_HEADER_IF = <<-EOS.unindent
186
304
 
@@ -235,6 +353,7 @@ module Sbuilder
235
353
 
236
354
 
237
355
  RESOLVER_HEADER = <<-EOS.unindent
356
+
238
357
  # Example of an YAML resolver
239
358
  #
240
359
  # Contains array of hashes
@@ -8,7 +8,7 @@ module Sbuilder
8
8
 
9
9
 
10
10
  include Sbuilder::Utils::MyLogger # mix logger
11
- PROGNAME = "main" # logger progname
11
+ PROGNAME = nil # progname for logger default class name
12
12
 
13
13
  VERSION_BANNER = <<-EOS.unindent
14
14
  #{File.basename $0} - #{Sbuilder::version}
@@ -50,6 +50,11 @@ module Sbuilder
50
50
  :enum => [ "DEBUG", "INFO", "WARN", "ERROR" ],
51
51
  :desc => "Set debug level "
52
52
 
53
+ class_option :parser_debug, :type =>:string, :default => "ERROR",
54
+ :enum => [ "DEBUG", "INFO", "WARN", "ERROR" ],
55
+ :desc => "Set debug level for parser"
56
+
57
+
53
58
  class_option :logfile, :type =>:string,
54
59
  :default => File.join(Dir.getwd, Sbuilder::Constants::LOGFILE), :desc => "Set file for log output"
55
60
 
@@ -159,6 +164,7 @@ module Sbuilder
159
164
  shared_options :templates
160
165
  shared_options :default_templates
161
166
  shared_options :verbosity
167
+ shared_options :src_dir
162
168
  shared_options :cnf_dir
163
169
  shared_options :cnf_file
164
170
  # shared_options :src_dir
@@ -169,14 +175,40 @@ module Sbuilder
169
175
  :desc => "Filter files TLA+ specification code, false-> no filter->include all snippets"
170
176
 
171
177
 
172
- option :filter_list, :aliases => "-F", :type => :string, :default => nil,
173
- :desc => "List of files to include in TLA+ specification code"
174
-
175
178
  def generate( setupDirectory=nil)
176
179
  ctrl = getController( options )
177
180
  ctrl.setup( setupDirectory )
178
181
  end
179
182
 
183
+ # ------------------------------------------------------------------
184
+ # symbols
185
+ desc "documents symbols", "Document symbols"
186
+
187
+ shared_options :verbosity
188
+ shared_options :cnf_dir
189
+ shared_options :verbosity
190
+ shared_options :default_templates
191
+ shared_options :cnf_dir
192
+ shared_options :templates
193
+ def symbols( what=nil )
194
+
195
+ controller = getCtrl
196
+ controller.load
197
+
198
+ validateWhats( what, getSetupNames(controller) ) if what
199
+
200
+ controller.processSetups( what ) do |setupName, setupConf, possibilities|
201
+ st = controller.getSymbolTable
202
+ puts <<-EOS.unindent
203
+ #{setupName}: #{setupConf['desc']}
204
+ #{st.table.keys.map { |metatype| { metatype => st.getMetaTypeDescription(metatype), :maps=>st.table[metatype] } } .to_yaml}
205
+ EOS
206
+
207
+ end # processSetups
208
+
209
+
210
+ end
211
+
180
212
  # ------------------------------------------------------------------
181
213
  # list
182
214
 
@@ -193,7 +225,9 @@ module Sbuilder
193
225
 
194
226
  desc "document [setup]", "Document configuration for all setups or for the given setup"
195
227
  shared_options :verbosity
228
+ shared_options :default_templates
196
229
  shared_options :cnf_dir
230
+ shared_options :templates
197
231
  def document( what=nil )
198
232
  controller = getCtrl
199
233
  controller.load
@@ -207,10 +241,19 @@ module Sbuilder
207
241
  - #{invariant[:name]}: #{invariant[:desc]}
208
242
  EOS
209
243
  end
210
- puts "SETUPS:"
244
+ setupsOutput=false
211
245
  controller.processSetups( what ) do |setupName, setupConf, possibilities|
212
246
  assumptions = controller.getSetupAssumptionList( setupConf )
213
- puts <<-EOS.unindent
247
+
248
+ if !setupsOutput
249
+ # Output SETUPS -header just before outputting first setup
250
+ # configuration. This prevents any initialization output
251
+ # from mixing between SETUPS header and setups data.
252
+ setupsOutput =TRUE
253
+ puts "SETUPS:"
254
+ end
255
+
256
+ puts <<-EOS.unindent
214
257
  - #{setupName}: #{setupConf['desc']}
215
258
  - possibilities: #{(setupConf['possibilities'] || [] ).join( ' ' )}
216
259
  - assumptions: #{assumptions.join( ' ' )}
@@ -2,16 +2,21 @@
2
2
  require_relative "utils/hash_inject"
3
3
  require_relative "utils/string_inject"
4
4
 
5
+ require_relative "utils/powerset"
5
6
  require_relative "utils/version"
6
7
  require_relative "utils/logger"
7
- require_relative "utils/cache_lines"
8
+ require_relative "utils/fileio"
8
9
  require_relative "utils/netio"
10
+ require_relative "utils/validate"
9
11
 
12
+ require_relative "sbuilder/facade/facade_constants.rb"
10
13
  require_relative "sbuilder/constants.rb"
11
14
 
12
15
  require_relative "sbuilder/exception.rb"
13
16
 
14
17
  require_relative "sbuilder/domain.rb"
18
+ require_relative "sbuilder/domain_type.rb"
19
+ require_relative "sbuilder/domain_range.rb"
15
20
  require_relative "sbuilder/domain_value.rb"
16
21
  require_relative "sbuilder/domain_cardinality.rb"
17
22
 
@@ -21,9 +26,11 @@ require_relative "sbuilder/parameter_dom.rb"
21
26
  require_relative "sbuilder/parameter_ref.rb"
22
27
 
23
28
 
29
+ require_relative "sbuilder/facade/param_set_root.rb"
24
30
  require_relative "sbuilder/param_set.rb"
25
31
  require_relative "sbuilder/param_set_db.rb"
26
32
  require_relative "sbuilder/param_set_def.rb"
33
+ require_relative "sbuilder/param_set_def_func.rb"
27
34
  require_relative "sbuilder/param_set_if.rb"
28
35
  require_relative "sbuilder/param_set_step.rb"
29
36
 
@@ -37,19 +44,35 @@ require_relative "sbuilder/resolver.rb"
37
44
  require_relative "sbuilder/resolver_loader.rb"
38
45
  require_relative "sbuilder/resolver_loader_yaml.rb"
39
46
 
40
-
47
+ require_relative "sbuilder/symbol_table.rb"
41
48
  require_relative "sbuilder/model.rb"
49
+ require_relative "sbuilder/controller_utils.rb"
50
+
42
51
 
52
+ require_relative "sbuilder/setup_loader.rb"
53
+ require_relative "sbuilder/setup_loader_env.rb"
54
+ require_relative "sbuilder/setup_loader_pref.rb"
55
+ require_relative "sbuilder/extension_loader_step_generator.rb"
43
56
  require_relative "sbuilder/extension_loader.rb"
44
57
 
45
58
  require_relative "sbuilder/factory.rb"
46
59
  require_relative "sbuilder/controller.rb"
47
60
 
61
+ require_relative "sbuilder/facade/loader_plugin_root.rb"
62
+ require_relative "sbuilder/facade/snippet_loader_plugin_mixer.rb"
63
+ require_relative "sbuilder/facade/snippet_loader_plugin.rb"
64
+ require_relative "sbuilder/facade/api_loader_plugin_mixer.rb"
48
65
  require_relative "sbuilder/facade/api_loader_plugin.rb"
49
- require_relative "sbuilder/facade/api_loader.rb"
66
+ require_relative "sbuilder/facade/api_loader_facade.rb"
67
+ require_relative "sbuilder/facade/snippet_loader_facade.rb"
50
68
 
69
+ # Plugin modules are loaded dynamically - and should be commented here
70
+ # require_relative "sbuilder/snippet_loader_simple"
51
71
  require_relative "sbuilder/param_set_loader_swagger.rb"
52
72
 
73
+ require_relative "sbuilder/parser/parser_facade.rb"
53
74
  require_relative "sbuilder/mustache/template_reader"
54
75
  require_relative "sbuilder/mustache/template_reader_context"
76
+ require_relative "sbuilder/mustache/template_root"
77
+ require_relative "sbuilder/mustache/template_resolve"
55
78
  require_relative "sbuilder/mustache/template"
@@ -2,17 +2,30 @@ module Sbuilder
2
2
 
3
3
  class Constants
4
4
 
5
+ # some of the constans made avaible for api loaders
6
+ include Sbuilder::FacadeConstants
7
+
5
8
  # supported domain types
6
9
  TYPE_DOMAIN = "domain"
7
10
  TYPE_VALUE_DOMAIN = "value-domain"
8
- TYPE_CARDINALITY_DOMAIN = "cardinality-domain"
11
+ TYPE_CARDINALITY_DOMAIN = "cardinality-domain"
12
+ TYPE_RANGE_DOMAIN = "range-domain"
13
+ TYPE_DOMAIN_TYPE = "type-domain"
9
14
 
10
15
  # supported extension loader types
11
16
  EXTENSION_LOADER_YAML = "default-yaml"
17
+
18
+ # types in setup
19
+ SETUP_LOADER_STEP = "step-extension"
20
+ SETUP_PREFERENCES_EXTENSION = "preferences-extension"
21
+
22
+ # supported extension loader types
23
+ SETUP_LOADER_ENVIRONMENT = "extend-environment"
12
24
 
13
25
  # supported paramter set types
14
26
  INTERFACE_OPERATION = "operation"
15
- SWAGGER_DEFINITION="definition"
27
+ DEFINITION="definition"
28
+ DEFINITION_FUNCTION="definition-func"
16
29
  PARAM_SET_STEPS = "steps"
17
30
 
18
31
  # supported interfa loader
@@ -25,7 +38,7 @@ module Sbuilder
25
38
  MAPPER_RULE_MATCH = "match"
26
39
  MAPPER_RULE_REF = "ref"
27
40
 
28
- # supported paremters
41
+ # supported paramters
29
42
  PARAMETER = "param"
30
43
  PARAMETER_REF = "param-ref"
31
44
 
@@ -40,6 +53,16 @@ module Sbuilder
40
53
 
41
54
  SRC_PATH="#{SRC_DIR}/" # i.e. src_dir with ending '/', see option --templates
42
55
 
56
+ # known extension points (see src/extend/extend_*.mustache)
57
+ EXTENSION_POINT_ASSUMPTIONS = "assumptions"
58
+ EXTENSION_POINT_IMPLEMENTATION = "implementation"
59
+ EXTENSION_POINT_INVARIANT = "invariant"
60
+ EXTENSION_POINT_CONST="const"
61
+ EXTENSION_POINT_MACRO="macros"
62
+ EXTENSION_POINT_OPERATIONS="operations"
63
+ EXTENSION_POINT_STATE="state"
64
+
65
+
43
66
  # default log-file
44
67
  LOGFILE="sbuilder.log"
45
68
 
@@ -52,15 +75,18 @@ module Sbuilder
52
75
  # directory to cache loaded files
53
76
  CACHE_DIR = "cache"
54
77
 
78
+ # snippet loader sub-directory
79
+ SNIPPET_LOADER_DIR="snippet-loader"
80
+
55
81
  # direcotory where to output rendered templates
56
82
  GEN_DIR = "gen"
57
83
 
58
84
  # direcotory where to output build results
59
85
  BUILD_DIR = "build"
60
86
 
61
- # namespace
62
- TYPE_NAMESPACE_DOM = "d_"
63
- TYPE_NAMESPACE_REF = "t_"
87
+ # # namespace
88
+ # TYPE_NAMESPACE_DOM = "d_"
89
+ # TYPE_NAMESPACE_REF = "t_"
64
90
 
65
91
  # Location of resources
66
92
  RESOURCES_DIR = File.expand_path '../../../resources/', __FILE__
@@ -70,6 +96,139 @@ module Sbuilder
70
96
  # Default options
71
97
  OPT_VERBOSITY = 1 # output leve
72
98
 
99
+ # Internal
100
+
101
+ # name of model template file
102
+ MODEL_TEMPLATE_OUTPUT="tla/model.tla"
103
+
104
+
105
+ # @!group Meta mode
106
+
107
+ # Meta model keys
108
+
109
+ # @see SymbolTable#defineMetaType for documentation
110
+ META_MODEL = [
111
+ {
112
+ :name => META_MODEL_DOMAINS,
113
+ :prefix => "d_",
114
+ :desc => "Name of a domain",
115
+ },
116
+ {
117
+ :name => META_MODEL_DEFINITIONS,
118
+ :desc => "Name of data type definition",
119
+ :prefix => "t_",
120
+ },
121
+ {
122
+ :name => META_MODEL_INTERFACE_TYPES,
123
+ :desc => "Input data types for public interfaces",
124
+ :prefix => "t_req_",
125
+ },
126
+ {
127
+ :name => META_MODEL_INTERFACE_RESPONSE_TYPES,
128
+ :desc => "Response data types for public interfaces",
129
+ :prefix => "t_resp_",
130
+ },
131
+ {
132
+ :name => META_MODEL_PROCESSES,
133
+ :desc => "Process name for a public interface service",
134
+ :prefix => "p_",
135
+ },
136
+ {
137
+ :name => META_MODEL_INFRA_SERVICES,
138
+ :desc => "Name of infrastructure service procedure",
139
+ :prefix => "s_",
140
+ },
141
+ {
142
+ :name => META_MODEL_SERVICE_IMPLEMENTATION,
143
+ :desc => "Name of a macro implementing public interface service",
144
+ :prefix => "i_",
145
+ },
146
+ {
147
+ :name => META_MODEL_SERVICE_COMPLETION,
148
+ :desc => "Name macro completing servie execution",
149
+ :prefix => "ic_",
150
+ },
151
+ {
152
+ :name => META_MODEL_FRAMEWORK_SVC,
153
+ :desc => "Services provided by framework",
154
+ :prefix => "", # use names as provided in snippet
155
+ },
156
+ {
157
+ :name => META_MODEL_INVARIANT,
158
+ :desc => "Invariant operators",
159
+ :prefix => "invariant_",
160
+ },
161
+
162
+ ]
163
+
164
+ # @!endgroup
165
+ # @!group Infrastructure domains
166
+
167
+ BASE_EXTENSIONS_DOMAIN = [
168
+ {
169
+ 'domain' => "BOOLEAN",
170
+ 'type' => 'BOOLEAN',
171
+ }
172
+ ]
173
+
174
+ # @!endgroup
175
+ # @!group Property validataion
176
+
177
+ VALIDATION = {
178
+ :extend_loader => {
179
+ :required => %w( className ),
180
+ :allowed => %w( configuration gem objects ),
181
+ :required_after_classname => %w( className gem ),
182
+ },
183
+ :SetupLoaderPref => {
184
+ :required => %w( preferences ),
185
+ :allowed => nil,
186
+ },
187
+ :extend_loader_object => {
188
+ :required => %w( objectName ),
189
+ :allowed => %w( configuration ),
190
+ },
191
+ :domain_extension => {
192
+ :required => %w( domain ),
193
+ :allowed => %w( cardinality values range type ),
194
+ :one_of => %w( cardinality values range type ),
195
+ :type_required => %w( domain type ),
196
+ :type_allowed => %w( ),
197
+ :cardinality_required => %w( domain cardinality ),
198
+ :cardinality_allowed => %w( ),
199
+ :value_required => %w( domain values ),
200
+ :value_allowed => %w( ),
201
+ },
202
+ :snippet_loader_plugin => {
203
+ :required => %w( metatype appName ),
204
+ :allowed => %w( name file url),
205
+ :class_config_required => %w( ),
206
+ :class_config_allowed => %w( src_dir ),
207
+ :object_config_required => %w( ),
208
+ :object_config_allowed => %w( metatypes ),
209
+ :one_of_file_or_url => %w( url file ),
210
+ },
211
+ :interface_extension_def => {
212
+ :required => %w( matcher ),
213
+ :allowed => %w( implementation completion ),
214
+ },
215
+ :snippet_loader_instantiate => {
216
+ :required => %w( snippets ),
217
+ :allowed => %w( className objectName configuration ),
218
+ :one_of => %w( className objectName ),
219
+ },
220
+ :api_loader_instantiate => {
221
+ :required => %w( ),
222
+ :allowed => %w( url file cache infrastructureServices interfaceServices namespace className objectName configuration type),
223
+ :one_of_class_or_object => %w( className objectName type ),
224
+ :one_of_file_or_url => %w( url file ),
225
+ }
226
+
227
+ }
228
+
229
+ # @!endgroup
230
+
231
+
73
232
  end
74
233
 
75
234
  end