Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d66fd942979db9255467a8b66bce00bc7ddb1717 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
/*******************************************************************************
 * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * CONTRIBUTORS:
 * 		Juergen Haug (initial contribution)
 * 
 *******************************************************************************/

package org.eclipse.etrice.core.postprocessing

import org.eclipse.xtext.GeneratedMetamodel

import static extension org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers.*

class DocuPostprocessor {
		
	def process(GeneratedMetamodel metamodel) {
		val pckg = metamodel.EPackage
		
		//------------------------------------------------------------------
		var cls = pckg.getClass("ConfigModel")
		cls.setDocumentation(
			'''
				The root object for the ROOM Config model. It gives access to
				the {@link SubSystemConfig sub system class},
				{@link ActorClassConfig actor class}, {@link ProtocolClassConfig protocol class} and
				{@link ActorInstanceConfig actor instance} configurations and the room model {@link Import imports}.
			''')
		
		cls.getAttribute("name").setDocumentation(
			'''
				The model name is a dot separated fully qualified name and is
				used to provide a name space.
			''')
		
		cls.getReference("imports").setDocumentation(
			'''
				This is a list of all imported room models. The config elements reference these imports.
			''')
		
		cls.getReference("configElements").setDocumentation(
			'''
				This is a list of all top level config elements
			''')
		
		//------------------------------------------------------------------
		
		cls = pckg.getClass("ConfigElement")
		cls.setDocumentation(
			'''
				This is the super class of the top level config elements
				<ul>
					<li>{@link SubSystemConfig}</li>
					<li>{@link ActorClassConfig}</li>
					<li>{@link ActorInstanceConfig}</li>
					<li>{@link ProtocolClassConfig}</li>
				</ul>
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("SubSystemConfig")
		cls.setDocumentation(
			'''
				This class defines settings with a sub system scope.
			'''
		)
		
		cls.getReference("root").setDocumentation(
			'''
				This is the logical system that contains the {@link org.eclipse.etrice.core.room.SubSystemRef sub system reference}.
			''')
			
		cls.getReference("subSystem").setDocumentation(
			'''
				This is the sub system reference.
			''')
		
		cls.getReference("dynConfig").setDocumentation(
			'''
				This is the dynamic configuration. It is available within the {@link #getSubSystem sub system}.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("DynamicConfig")
		cls.setDocumentation(
			'''
				The dynamic configuration provides a configuration at runtime.
				The source of the configuration is abstracted by an interface.
				<br>
				This feature is experimental and implemented for target language java only.
			'''
		)
		
		cls.getAttribute("filePath").setDocumentation(
			'''
				This is the file path of the configuration. In this case the source of the configuration is a simple file.
			'''
		)
		
		cls.getAttribute("userCode1").setDocumentation(
			'''
				Defines the import statement for the implemenation of the configuration source.
			''')
			
		cls.getAttribute("userCode2").setDocumentation(
			'''
				This is the constructor statement for the implemenation of the configuration source.
			'''
		)
		
		cls.getAttribute("polling").setDocumentation(
			'''
				Defines the time interval in milliseconds to query changes from the configuration source.
			'''
		)
		
		//------------------------------------------------------------------
		
		cls = pckg.getClass("ActorClassConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorClass actor class}.
				The configuration defines the default values for all instances of the {@link #getActor actor}.
				The values are applied at generation time.
				The config sub elements are:
				<ul>
					<li>{@link AttrClassConfig attribute class config}</li>
				</ul>				
			''')
		
		cls.getReference("actor").setDocumentation(
			'''
				This is the actor class.
			''')
		
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of all attribute configurations.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("ProtocolClassConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.ProtocolClass protocol class}.
				The config sub elements are:
				<ul>
					<li>a {@link PortClassConfig port class config} for the regular port class</li>
					<li>a {@link PortClassConfig port class config} for the conjugate port class</li>
				</ul>
			''')
		
		cls.getReference("protocol").setDocumentation(
			'''
				This is the protocol class.
			''')
		
		cls.getReference("regular").setDocumentation(
			'''
				This is the configuration for the regular part of the protocol.
			''')
		
		cls.getReference("conjugated").setDocumentation(
			'''
				This is the configuration for the conjugated part of the protocol.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("PortClassConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.PortClass port class}.
				The configuration defines the default values for all instances of the port.
				The values are applied at generation time.
				The config sub elements are:
				<ul>
					<li>{@link AttrClassConfig attribute class config}</li>
				</ul>
			''')
		
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of all attribute configurations.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("ActorInstanceConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorRef actor instance}.
				The configuration defines values for this actor instance and overrides the default values from the corresponding class config.
				The values are applied at generation time.
				The config sub elements are:
				<ul>
					<li>{@link AttrInstanceConfig attribute instance config}</li>
				</ul>				
			''')
		
		cls.getReference("root").setDocumentation(
			'''
				This is the logical system that contains the {@link #getSubSystem sub system}.
			''')
			
		cls.getReference("subSystem").setDocumentation(
			'''
				This is the sub system that contains the {@link #getPath actor instance}.
			''')
			
		cls.getReference("path").setDocumentation(
			'''
				This is the path of the actor instance relative to the {@link #getSubSystem sub system}.
			''')
		
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of all attribute configurations.
			''')
			
		cls.getReference("ports").setDocumentation(
			'''
				This is a list of all port configurations.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("PortInstanceConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.InterfaceItem interface item} (e.g. port instance).
				The configuration defines values for this interface item and overrides the default values from the corresponding class config.
				The values are applied at generation time.
				The config sub elements are:
				<ul>
					<li>{@link AttrInstanceConfig attribute instance config}</li>
				</ul>				
			''')
			
		cls.getReference("item").setDocumentation(
			'''
				This is the interface item.
			''')
			
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of all attribute configurations.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("AttrConfig")
		cls.setDocumentation(
			'''
				It is the super class of
				<ul>
					<li>{@link AttrClassConfig}</li>
					<li>{@link AttrInstanceConfig}</li>
				</ul>				
			''')
			
		cls.getReference("attribute").setDocumentation(
			'''
				This is the attribute.
			''')
			
		cls.getReference("value").setDocumentation(
			'''
				This is the value of {@link #getAttribute attribute}.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("AttrClassConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
				The configuration defines a default value for all instances of the attribute.
				The values are applied at generation time.
				<br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
				<ul>
					<li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
					<li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
				</ul>				
			''')
			
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
			''')
		
		cls.getReference("min").setDocumentation(
			'''
				This is the lower bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
			''')
		
		cls.getReference("max").setDocumentation(
			'''
				This is the upper bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("AttrInstanceConfig")
		cls.setDocumentation(
			'''
				This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
				The configuration defines values for this attribute instance and overrides the default values from the corresponding class config.
				The values are applied at generation time.
				<br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
				<ul>
					<li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
					<li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
				</ul>				
			''')
			
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
			''')
			
		cls.getAttribute("dynConfig").setDocumentation(
			'''
				If the dynamic configuration options is activated for this attribute, then the values are set at runtime by the means of the {@link DynamicConfig dynamic config}.
			''')
			
		cls.getAttribute("readOnly").setDocumentation(
			'''
				Controls the behavior of the dynamic configuration. If set to false, then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is updated (overwritten) if changes occur in the external configuration, 
				otherwise set to true, then changes in {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} (that occur from within the system) are recorded to the external configuration.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("RefPath")
		cls.setDocumentation(
			'''
				A path of strings that are interpreted as {@link org.eclipse.etrice.core.room.ActorRef}s starting at a {@link org.eclipse.etrice.core.room.SubSystemClass}.
			''')
		
		cls.getReference("refs").setDocumentation(
			'''
				This is a path in the instance tree where each segment corresponds to the name of the
				corresponding {@link {@link org.eclipse.etrice.core.room.ActorContainerRef}}.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("RefSegment")
		cls.setDocumentation(
			'''
				A segment of a {@link RefPath}. It consists of a name and an optional index.
				If the index is not set it will be {@code -1}.
			''')
		
		cls.getAttribute("ref").setDocumentation(
			'''
				The segment name corresponding to an actor reference.
			''')
		
		cls.getAttribute("idx").setDocumentation(
			'''
				The optional index of the reference (for replicated actors).
				If not set the index is {@code -1}.
			''')
		
	}
	
}

Back to the top