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,76 @@
1
+ module Sbuilder
2
+
3
+ # Abstract Parent class for Sbuilder for Snippet loaders.
4
+ #
5
+ # Class implements following service groups
6
+ #
7
+ # - Constructor and Object Initialize
8
+ # - Framework Services for API loader
9
+ # - configure plugin
10
+ #
11
+
12
+
13
+ class SnippetLoaderPlugin < LoaderPluginRoot
14
+
15
+
16
+ # services to hook up framework
17
+ include SnippetLoaderPluginMixer
18
+
19
+ # def_delegator Sbuilder::SnippetLoaderPlugin, :validateProperties
20
+
21
+ # ------------------------------------------------------------------
22
+ # @!group Constructor and Object Initialize
23
+
24
+ def initialize( options = {} )
25
+ super( options )
26
+ end
27
+
28
+ # @!endgroup
29
+
30
+ # ------------------------------------------------------------------
31
+ # @!group Configure Plugin
32
+
33
+ # Configure API loader - MUST be implemented by plugin class
34
+ # @param configuration [Hash] properties to configure
35
+
36
+ def self.configure( configuration )
37
+ raise PluginException.new <<-EOS unless configuration.nil?
38
+ Plugin classes should implement class method #{__method__}
39
+
40
+
41
+ This error is raised when using 'configuration' -property in 'extend.loaders' array entry.
42
+ For example:
43
+
44
+ extend:
45
+ loaders:
46
+ - className: Sbuilder::XXXX::Plugin
47
+ gem: sbuilder-xxxx
48
+ configuration: any value
49
+
50
+ and the plugin class (e.g. Sbuilder::XXXX::Plugin) does not implement class
51
+ method '.#{__method__}'
52
+
53
+ EOS
54
+ end
55
+
56
+
57
+ # @!endgroup
58
+
59
+ # ------------------------------------------------------------------
60
+ # @!group Register snippets to sbuilder
61
+
62
+ # Abstract method, which must be implemented by concrete snippet loader plugin
63
+ #
64
+ # This method should use 'handOver' method, which passes snippet,
65
+ # along with metadata, via snippet loader snippetFacade to sbuilder.
66
+ #
67
+ def doRegisterSnippets( snippetsDefs )
68
+ raise PluginException.new "Missing implementation for 'doRegisterSnippets'"
69
+ end
70
+
71
+ # @!endgroup
72
+
73
+
74
+ end # class SnippetLoaderPlugin
75
+ end
76
+
@@ -0,0 +1,56 @@
1
+ module Sbuilder
2
+
3
+ ##
4
+ # Mixer module to include to API loader plugins
5
+ #
6
+ # Implement:
7
+ # - getter & setter for Snippet loader facade
8
+
9
+ module SnippetLoaderPluginMixer
10
+
11
+ ##
12
+ # Sbuilder controller calls 'setFacade' when new API loader object
13
+ # is contstructed. Sets instance variable '@facade'.
14
+ #
15
+ # @param [Sbuilder::ApiLoaderFacade] facace to Sbuilder services
16
+
17
+ def setSnippetFacade( facade )
18
+ @snippetFacade = facade
19
+ end
20
+
21
+ # @return [Sbuilder::ApiLoaderFacade] snippetFacade to access Sbuilder servivices ( set in 'setFacade')
22
+ def snippetFacade
23
+ @snippetFacade
24
+ end
25
+
26
+ ##
27
+ # A method available for plugin sub class, allowing sub class to
28
+ # register metatype prio
29
+ def registerMetatype( metatype, desc )
30
+ snippetFacade.registerMetatype( metatype, desc )
31
+ end
32
+
33
+ ##
34
+ # @param [Hash] snippetsDefs defining snippets to
35
+ # load. +snippetsDefs+ are passed un modified to plugin
36
+ # implementation
37
+ def registerSnippets( snippetsDefs )
38
+ # call implementation in concrete class
39
+ logger.info "#{__method__}, snippetsDefs=#{snippetsDefs}"
40
+ doRegisterSnippets( snippetsDefs )
41
+ end
42
+
43
+
44
+ # def validateProperties( hash, required_props, allowed_props )
45
+ # SnippetLoaderPlugin.validateProperties( hash, required_props, allowed_props )
46
+ # end
47
+
48
+ def self.validateProperties( hash, required_props, allowed_props )
49
+ Sbuilder::Utils::Validate.validateProperties( hash, required_props, allowed_props )
50
+ end
51
+
52
+
53
+
54
+ end
55
+
56
+ end
@@ -7,7 +7,7 @@ module Sbuilder
7
7
  @@singleton=nil # initiallly no factory object
8
8
  attr_reader :options # remembers options
9
9
 
10
- attr_reader :paramSetLoaders # hash[Name->Class:ParamSetLoader]
10
+ attr_reader :loaderPlugins # hash[Name->Class] with configure method
11
11
  attr_reader :mapperRules # hash[Name->Class:ResolverRule]
12
12
  attr_reader :mapperLoaders # hash[Name->Class:ResolverLoader]
13
13
  attr_reader :parameters # hash[Name->Class:Parameter]
@@ -15,9 +15,17 @@ module Sbuilder
15
15
  attr_reader :domains # hash[Name->Class:Domain]
16
16
  attr_reader :extension_loaders # hash[Name->Class:ExtensionLoader]
17
17
 
18
+ # @attr [Sbuilder::SetupLoader:Array] array of setuploader
19
+ attr_reader :setup_loaders
20
+
21
+ # @attr [Hash] namedPluginObjects
22
+ # @option namedPluginObjects [String] name of ApiLoaderPlugin, SnippetLoaderPlugin
23
+ # @option namedPluginObjects [Object] object of ApiLoaderPlugin, SnippetLoaderPlugin
24
+ attr_accessor :namedPluginObjects
25
+
18
26
  # ------------------------------------------------------------------
19
27
  # mixer
20
- PROGNAME = "Factory" # progname for logger
28
+ PROGNAME = nil # progname for logger default class name
21
29
  include Sbuilder::Utils::MyLogger # mix logger
22
30
 
23
31
 
@@ -29,34 +37,47 @@ module Sbuilder
29
37
  @logger = getLogger( PROGNAME, options )
30
38
  @logger.info( "#{__method__} initialized options=#{options}" )
31
39
  @options = options
40
+
41
+ self.namedPluginObjects={}
32
42
  initializeFactories
33
43
  end
34
44
 
45
+
35
46
  def initializeFactories
36
47
  @extension_loaders={
37
48
  Sbuilder::Constants::EXTENSION_LOADER_YAML => ExtensionLoader,
38
49
  }
50
+ @setup_loaders = {
51
+ Sbuilder::Constants::SETUP_LOADER_ENVIRONMENT => SetupLoaderEnv,
52
+ Sbuilder::Constants::SETUP_LOADER_STEP => SetupLoaderEnv,
53
+ Sbuilder::Constants::SETUP_PREFERENCES_EXTENSION => SetupLoaderPref,
54
+ }
39
55
  @parameters={
40
56
  Sbuilder::Constants::PARAMETER => Parameter_Dom,
41
57
  Sbuilder::Constants::PARAMETER_REF => Parameter_Ref,
42
58
  }
43
59
  @paramSets = {
44
60
  Sbuilder::Constants::INTERFACE_OPERATION => ParamSet_If,
45
- Sbuilder::Constants::SWAGGER_DEFINITION => ParamSetDef,
61
+ Sbuilder::Constants::DEFINITION => ParamSetDef,
62
+ Sbuilder::Constants::DEFINITION_FUNCTION => ParamSetDefFunc,
46
63
  Sbuilder::Constants::PARAM_SET_STEPS => ParamSetStep,
47
64
  }
48
65
 
49
- @paramSetLoaders = {
66
+ @loaderPlugins = {
50
67
  # Sbuilder::Constants::LOADER_SWAGGER => ParamSetLoaderSwagger
51
68
  }
52
69
 
53
- # swagger loader loaded as an extension
70
+ # add default loaders to sbuilder
54
71
  addLoaders( [
55
- { 'gem' => 'sbuilder/param_set_loader_swagger',
72
+ { 'gem' => './param_set_loader_swagger',
56
73
  'className' => 'Sbuilder::ParamSetLoaderSwagger',
57
74
  'configuration' => nil,
58
- }
59
- ], [ Sbuilder::Constants::LOADER_SWAGGER] )
75
+ },
76
+ { 'gem' => './snippet_loader_simple',
77
+ 'className' => 'Sbuilder::SnippetLoaderSimple',
78
+ 'configuration' => { 'src_dir' => options[:src_dir] },
79
+ },
80
+ ], [ Sbuilder::Constants::LOADER_SWAGGER, nil] )
60
81
  @mapperLoaders = {
61
82
  Sbuilder::Constants::MAPPER_YAML => ResolverLoader_YAML
62
83
  }
@@ -67,23 +88,42 @@ module Sbuilder
67
88
 
68
89
  @domains = {
69
90
  Sbuilder::Constants::TYPE_DOMAIN => Domain,
70
- Sbuilder::Constants::TYPE_VALUE_DOMAIN => DomainValue ,
91
+ Sbuilder::Constants::TYPE_DOMAIN_TYPE => DomainType,
92
+ Sbuilder::Constants::TYPE_RANGE_DOMAIN => DomainRange,
93
+ Sbuilder::Constants::TYPE_VALUE_DOMAIN => DomainValue,
71
94
  Sbuilder::Constants::TYPE_CARDINALITY_DOMAIN => DomainCardinality ,
72
95
  }
73
96
 
74
97
  end
75
98
 
76
- # Configure additional loaders
99
+
100
+ # ------------------------------------------------------------------
101
+ # @!group Plugin extensions
102
+
103
+ # Configure additional plugin extensions
104
+ #
105
+ # @param arrOfLoaders [Hash:Array] with properties
106
+ # :name,:className
107
+ #
108
+ # @param name [String:Array] alias name to use (in addition to
109
+ # className)
77
110
  #
78
- # @param arrOfLoaders [Hash:Array] with properties :name,:className
79
- # @param name [String:Array] alias name to use (in addition to className)
80
111
  def addLoaders( arrOfLoaders, names=nil )
112
+
81
113
  arrOfLoaders.each_with_index do |loader,index|
82
114
 
83
- validateProperties( loader, ['className', 'gem'], ['configuration'] )
115
+ # validateProperties( loader, ['className', ], ['configuration', 'gem', 'objects'] )
116
+ Utils::Validate.validateProperties( loader, Constants::VALIDATION[:extend_loader][:required], Constants::VALIDATION[:extend_loader][:allowed] )
84
117
 
85
- # load class module to context - if className
86
- require loader['gem'] unless Class.const_defined?( loader['className'] )
118
+ # load class module to context - unless Class already defined
119
+ if ! Class.const_defined?( loader['className'] )
120
+ Utils::Validate.validateProperties( loader, Constants::VALIDATION[:extend_loader][:required_after_classname], Constants::VALIDATION[:extend_loader][:allowed] )
121
+ if loader['gem'][0] == '.'
122
+ require_relative loader['gem']
123
+ else
124
+ require loader['gem']
125
+ end
126
+ end
87
127
 
88
128
  begin
89
129
  @logger.info "#{__method__} loader['className']=#{loader['className']}"
@@ -97,16 +137,98 @@ module Sbuilder
97
137
  @logger.error( "#{__method__} #{msg}" )
98
138
  raise NameError, msg, e.backtrace
99
139
  end
100
- klass.configure( loader['configuration'] )
101
140
  # using className
102
141
  name = loader['className']
103
- paramSetLoaders[name] = klass
104
- # using optional name
105
- paramSetLoaders[names[index]] = klass if names
106
142
 
143
+ loaderPlugins[name] = klass
144
+ # @logger.info "#{__method__}, name=#{name}, configuration: #{loader['configuration']} "
145
+ klass.configure( loader['configuration'] )
146
+ # optional alias name
147
+ loaderPlugins[names[index]] = klass if names && names[index]
148
+
149
+ # if 'objects property defined'
150
+ loader['objects'] && loader['objects'].each do |objectConfiguration|
151
+
152
+ @logger.info "#{__method__}, objectConfiguration=#{objectConfiguration}"
153
+
154
+ Utils::Validate.validateProperties( objectConfiguration, Constants::VALIDATION[:extend_loader_object][:required], Constants::VALIDATION[:extend_loader_object][:allowed] )
155
+
156
+ # # create & configure object for 'className'
157
+ # o = klass.new( options ).configure( objectConfiguration['configuration'] )
158
+ o = getLoaderPlugin( loader['className'], objectConfiguration['configuration'] )
159
+
160
+ # add it to dictionary
161
+ @logger.info "#{__method__}, add=#{objectConfiguration['objectName']}, #{o}"
162
+ namedPluginObjects[ objectConfiguration['objectName'] ] = o
163
+
164
+ end # each object
165
+
166
+ end # each
167
+ end
168
+
169
+ # return 'objectName' plugin instance, or create new plugin object
170
+ # with 'className.new'.configure( configuration )
171
+ #
172
+ # @param [String] className name of the plugin, if nil objectName
173
+ # must be nil
174
+ #
175
+ # @param [Object] configuration to pass to className.new
176
+ #
177
+ # @param [String] objectName name of the plugin object, if nil
178
+ # className must be non nil.
179
+ #
180
+ #
181
+ # @return [ApiLoaderPlugin] plugin object instance
182
+ #
183
+ def getLoaderPlugin( className, configuration=nil, objectName=nil )
184
+
185
+ @logger.info "#{__method__}, className=#{className}, configuration=#{configuration}, objectName=#{objectName}"
186
+
187
+ raise FactoryException, "Must give either 'className' or 'objectName'" if
188
+ className.nil? && objectName.nil? || !className.nil? && !objectName.nil?
189
+
190
+ if objectName then
191
+
192
+ # get usign objectName
193
+ o = namedPluginObjects[objectName]
194
+
195
+ if o.nil? then
196
+ msg = <<-EOS
197
+ Unknown loader plugin object #{objectName}
198
+
199
+ Check array 'extend.loaders.objects' for 'objectName'
200
+
201
+ Known loader plugin object names: #{namedPluginObjects.keys.join(',')}
202
+ EOS
203
+ @logger.error( "#{__method__} #{msg}" )
204
+ raise NameError.new( msg )
205
+
206
+ end
207
+ @logger.info "#{__method__}, found #{objectName} --> #{o.class}"
208
+ return o
209
+ else
210
+
211
+ # create new 'unnamed object'
212
+
213
+ if loaderPlugins[className].nil? then
214
+ msg = <<-EOS
215
+ Unknown parameter className #{className}"
216
+
217
+ Validate classNames #{loaderPlugins.keys}
218
+ EOS
219
+
220
+ @logger.error( "#{__method__} #{msg}" )
221
+ raise NameError.new( msg )
222
+ end
223
+ newObject = loaderPlugins[className].new( options )
224
+ newObject.configure( configuration ) if configuration
225
+ return newObject
107
226
  end
108
227
  end
109
228
 
229
+ # @!endgroup
230
+
231
+
110
232
  # ------------------------------------------------------------------
111
233
  # singleton
112
234
  class << self
@@ -140,29 +262,22 @@ module Sbuilder
140
262
  return mapperLoaders[type].new( Factory.getFactory(options), options )
141
263
  end
142
264
 
143
- # @return [Sbuilder::ApiLoader] facade to Sbuilder
144
- def getFacade( controller )
145
- facade = Sbuilder::ApiLoader.new( Factory.getFactory(options), options )
265
+ # @return [Sbuilder::ApiLoaderFacade] api loader facade to Sbuilder
266
+ def getApiFacade( controller )
267
+ facade = Sbuilder::ApiLoaderFacade.new( Factory.getFactory(options), options )
268
+ facade.setController( controller )
269
+ return facade
270
+ end
271
+
272
+ # @return [Sbuilder::SnippetLoaderFacade] api loader facade to Sbuilder
273
+ def getSnippetFacade( controller )
274
+ facade = Sbuilder::SnippetLoaderFacade.new( Factory.getFactory(options), options )
146
275
  facade.setController( controller )
147
276
  return facade
148
277
  end
149
278
 
150
279
 
151
- # return object to load parameter sets
152
- def getParamSetLoader( type )
153
- if paramSetLoaders[type].nil? then
154
- msg = <<-EOS
155
- Unknown parameter type #{type}"
156
280
 
157
- Validate types #{paramSetLoaders.keys}
158
- EOS
159
-
160
- @logger.error( "#{__method__} #{msg}" )
161
- raise NameError.new( msg )
162
- end
163
- return paramSetLoaders[type].new( options )
164
- end
165
-
166
281
  # ------------------------------------------------------------------
167
282
  # template reader
168
283
 
@@ -176,15 +291,21 @@ module Sbuilder
176
291
  if options[:filter_src]
177
292
  Sbuilder::TemplateContextReader.new( controller, @options )
178
293
  else
179
- Sbuilder::TemplateReader.new( controller, @options )
294
+ getDefaultTemplateReader( controller )
295
+ # Sbuilder::TemplateReader.new( controller, @options )
180
296
  end
181
297
  # return @template_reader if @template_reader
182
298
  # @template_reader = Sbuilder::TemplateReader.new( @options )
183
299
  # @template_reader
184
300
  end
185
301
 
302
+ # @return [TemplateReader] default reader
303
+ private def getDefaultTemplateReader( controller )
304
+ Sbuilder::TemplateReader.new( controller, @options )
305
+ end
306
+
186
307
  # ------------------------------------------------------------------
187
- # generate
308
+ # template
188
309
  #
189
310
  # @return [Template] mustache template generator
190
311
  def getTemplate( reader )
@@ -193,31 +314,81 @@ module Sbuilder
193
314
  # @template = Template.new( getTemplateReader, @options )
194
315
  # @template
195
316
  end
317
+
318
+ # @return [mustache] template to accept
319
+ def getSnippetFacadeMustache
320
+ return Mustache.new
321
+ end
322
+
323
+
324
+ # @return [Sbuilder::TemplateResolve] mustache template generator to resolver partials
325
+ def getTemplateResolver( controller )
326
+ reader = getDefaultTemplateReader( controller )
327
+ Sbuilder::TemplateResolve.new( reader, @options )
328
+ end
196
329
 
197
330
  # ------------------------------------------------------------------
198
- # model
331
+
332
+
333
+ # @return [Sbuilder::Model] model created
199
334
  def createModel
200
335
  Sbuilder::Model.new( self, options )
201
336
  end
337
+
338
+ # @return [Sbuilder::SymbolTable] symbol table created
339
+ def createSymbolTable
340
+ Sbuilder::SymbolTable.new( options )
341
+ end
342
+
202
343
 
203
344
  # ------------------------------------------------------------------
204
- # domainLoader
205
-
206
- def getExtensionLoader( type )
345
+ # extesion loaders
346
+
347
+ # @param [String] setupName
348
+ def getExtensionLoader( type, setupName )
207
349
  if extension_loaders[type].nil? then
208
350
 
209
351
  msg = <<-EOS
210
- Unknown extension loader type #{type}"
352
+ Unknown extension type #{type}"
211
353
 
212
- Valid extension loader types #{extension_loaders.keys}
354
+ Valid extension types #{extension_loaders.keys}
213
355
  EOS
214
356
  @logger.error( "#{__method__} #{msg}" )
215
357
  raise NameError.new( msg )
216
358
  end
217
- extension_loaders[type].new( options )
359
+ ldr = extension_loaders[type].new( options )
360
+ ldr.setupName = setupName
361
+ ldr
218
362
  # Sbuilder::ExtensionLoader.new( options )
219
363
  end
220
364
 
365
+ # @param [String] type of controller to create
366
+ #
367
+ # @param [Sbuilder::Controller] controllre to associate with setup loader
368
+ #
369
+ # @param [String] setupName name of setup to extended
370
+ def getSetupLoader( type, controller, setupName )
371
+ if setup_loaders[type].nil? then
372
+
373
+ msg = <<-EOS
374
+ Unknown setup extension type #{type}"
375
+
376
+ Valid setup extesion types: #{setup_loaders.keys}
377
+ EOS
378
+ @logger.error( "#{__method__} #{msg}" )
379
+ raise NameError.new( msg )
380
+ end
381
+ ldr = setup_loaders[type].new( options, )
382
+ ldr.controller = controller
383
+ ldr.setupName = setupName
384
+ # Sbuilder::ExtensionLoader.new( options )
385
+ ldr
386
+ end
387
+
388
+ def getStepGenerator
389
+ Sbuilder::StepGenerator.new( options )
390
+ end
391
+
221
392
  # ------------------------------------------------------------------
222
393
  # mapper
223
394
 
@@ -277,6 +448,14 @@ module Sbuilder
277
448
  parameters[type].new( options )
278
449
  end
279
450
 
451
+ # ------------------------------------------------------------------
452
+ # parser
453
+
454
+ # @return [Sbuilder::ParserFacade] facade to parser
455
+ def createParserFacade
456
+ Sbuilder::ParserFacade.new( options )
457
+ end
458
+
280
459
  # ------------------------------------------------------------------
281
460
  # validate 'defintionHash' all 'required'/only 'allowed' props set
282
461
  private def validateProperties( defintionHash, required, allowed=[] )