-
Notifications
You must be signed in to change notification settings - Fork 2
/
requests.st
892 lines (732 loc) · 27.2 KB
/
requests.st
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
Namespace current: Shampoo [
Object subclass: Request [
<category: 'Shampoo-Requests'>
<comment: 'I am an abstract class. My instances represent various requests
sent (usually) from a client to the server. Each request knows how to deserialize
from an XML and what action to perform on the server side. Each request usually
has an appropriate Response subclass, and returns a Response object on #execute.'>
| id |
Request class >> from: anXML [
<category: 'instance creation'>
| attrs class |
attrs := anXML attrMap.
class := Request allSubclasses detect:
[:each | (each respondsTo: #is:) and: [each is: (attrs at: 'type')]].
^(class new: (attrs at: 'id') asInteger)
init: anXML;
yourself
]
Request class >> new: anInteger [
<category: 'instance creation'>
^(self new)
id: anInteger;
yourself
]
id: anInteger [
<category: 'accessors'>
id := anInteger
]
id [
<category: 'accessors'>
^id
]
init: anXML [
<category: 'private'>
"Default implementation, do nothing"
]
execute [
<category: 'execution'>
^self subclassResponsibility
]
failSafe: aBlock [
<category: 'execution'>
aBlock
on: Error
do: [:err | ^OperationalResponse failure: id with: err].
^OperationalResponse success: id
]
]
Request subclass: LoginRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances represent a login request and transfer
authentication data from a client to the server. I am the one of the
few requests than do not understand an #execute message.'>
| creds |
LoginRequest class >> is: aString [
<category: 'identification'>
^aString = 'Login'
]
init: anXML [
<category: 'private'>
creds := LoginInfo fromXML: (anXML elementsNamed: 'creds') first.
]
creds [
<category: 'accessors'>
^creds
]
]
Request subclass: NamespacesRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query a list of available namespaces
in the image.'>
NamespacesRequest class >> is: aString [
<category: 'identification'>
^aString = 'Namespaces'
]
execute [
<category: 'execution'>
| names |
names := ((Namespace allInstances select: [:each | each environment = Smalltalk])
collect: [:each | each name asString]) asSet asSortedCollection.
^NamespacesResponse id: id names: (#('Smalltalk'), names)
]
]
Request subclass: ClassesRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query a list of classes in a
namespace.'>
| namespace |
ClassesRequest class >> is: aString [
<category: 'identification'>
^aString = 'Classes'
]
init: anXML [
<category: 'private'>
namespace := anXML attrMap at: 'namespace'
]
execute [
<category: 'execution'>
| space names |
names := SortedCollection new.
space := Smalltalk at: namespace asSymbol.
space allClassesDo: [:each | names add: each name asString].
^ClassesResponse id: id names: names
]
]
Request subclass: ClassRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query an information about a
class in a namespace'>
| className spaceName side |
ClassRequest class >> is: aString [
<category: 'identification'>
^aString = 'Class'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
side := (attrs at: 'side') asSymbol.
]
execute [
<category: 'execution'>
| class |
class := (Smalltalk at: spaceName asSymbol) at: className asSymbol.
(side = #class) ifTrue: [class := class class].
^ClassResponse
id: id
class: className
superclass: class superclass printString
instvars: class instVarNames asStringArray
classvars: class classVarNames asStringArray
poolvars: class sharedPools asStringArray
category: class category
]
]
Request subclass: CategoriesRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query a list of the method categories
in a concrete class from a concrete namespace.'>
| className spaceName side |
CategoriesRequest class >> is: aString [
<category: 'identification'>
^aString = 'Categories'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
side := (attrs at: 'side') asSymbol
]
execute [
<category: 'execution'>
| class cats |
class := (Smalltalk at: spaceName asSymbol) at: className asSymbol.
(side = #class) ifTrue: [class := class class].
cats := Set new.
class methodDictionary ifNotNil: [:d | d values do:
[:each | cats add: each descriptor category]].
^MethodCategoriesResponse
id: id
class: className
categories: cats asSortedCollection
]
]
Request subclass: MethodsRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query a list of methods in a concrete
category of a concrete class from a concrete namespace.'>
| className spaceName side cat |
MethodsRequest class >> is: aString [
<category: 'identification'>
^aString = 'Methods'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
side := (attrs at: 'side') asSymbol.
cat := attrs at: 'category'
]
execute [
<category: 'execution'>
| class methods allMethods |
class := (Smalltalk at: spaceName asSymbol) at: className asSymbol.
(side = #class) ifTrue: [class := class class].
allMethods := class methodDictionary ifNil: [#()] ifNotNil: [:x | x associations].
methods := (cat = '*'
ifTrue: [allMethods]
ifFalse: [allMethods select: [:e | e value descriptor category = cat]]).
^MethodsResponse
id: id
class: className
methods: (methods collect: [:each | each key asString]) asSortedCollection
]
]
Request subclass: MethodSourceRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to query the source of a concrete method
in a concrete class from a concrete namespace.'>
| className spaceName side name |
MethodSourceRequest class >> is: aString [
<category: 'identification'>
^aString = 'MethodSource'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
side := (attrs at: 'side') asSymbol.
name := attrs at: 'method'
]
execute [
<category: 'execution'>
| class method |
class := (Smalltalk at: spaceName asSymbol) at: className asSymbol.
(side = #class) ifTrue: [class := class class].
method := class methodDictionary at: name asSymbol.
^MethodResponse
id: id
class: className
method: name
source: method methodSourceString
]
]
Request subclass: CompileClassRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are used to compile a method in a concrete class from a concrete namespace.'>
| className superName superSpace spaceName instvars classvars poolvars side category |
CompileClassRequest class >> is: aString [
<category: 'identification'>
^aString = 'CompileClass'
]
init: anXML [
<category: 'private'>
| attrs fetchBlock |
attrs := anXML attrMap.
side := (attrs at: 'side' ifAbsent: ['instance']) asSymbol.
side == #instance ifTrue:
[category := (attrs at: 'category' ifAbsent: ['Uncategorized'])].
fetchBlock := [:type | (anXML elementsNamed: type) collect:
[:each | each text]].
"This data is common for both 'instance' and 'class' sides"
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
instvars := fetchBlock value: 'instvar'.
side = #instance
ifTrue: [superName := attrs at: 'super'.
superSpace := attrs at: 'superspace'.
classvars := fetchBlock value: 'classvar'.
poolvars := fetchBlock value: 'poolvar']
]
execute [
<category: 'execution'>
| parent class currentSpace targetSpace error |
targetSpace := Smalltalk at: spaceName asSymbol.
class := targetSpace at: className asSymbol ifAbsent: [nil].
side = #instance
ifTrue: ["Looks a bit kludgy, but currently I dont know how to make it better
TODO: refactor"
parent := (Smalltalk at: superSpace asSymbol) at: superName asSymbol.
currentSpace := Namespace current.
Namespace current: targetSpace.
[class := parent
subclass: className asSymbol
instanceVariableNames: instvars elementsString
classVariableNames: classvars elementsString
poolDictionaries: '' " poolvars elementsString "
category: category.
] on: Error do: [:err | error := err].
Namespace current: currentSpace]
ifFalse: [class := targetSpace at: className asSymbol ifAbsent: [nil].
[class class instanceVariableNames: instvars elementsString]
on: Error do: [:err | error := err]].
error isNil
ifTrue: [^OperationalResponse success: id]
ifFalse: [^OperationalResponse failure: id with: error]
]
]
Request subclass: CompileMethodRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances represent a request to (re)compile a concrete
method in the concrete class at the concrete namespace.'>
| className spaceName side source cat |
CompileMethodRequest class >> is: aString [
<category: 'identification'>
^aString = 'CompileMethod'
]
init: anXML [
<category: 'initialization'>
| attrs |
attrs := anXML attrMap.
className := attrs at: 'class'.
spaceName := attrs at: 'namespace'.
side := (attrs at: 'side') asSymbol.
cat := attrs at: 'category'.
source := anXML text
]
execute [
<category: 'execution'>
| class method |
class := (Smalltalk at: spaceName asSymbol) at: className asSymbol.
(side = #class) ifTrue: [class := class class].
method := class compile: source ifError:
[:filename :linenum :errdesc | ^self failWith: errdesc].
(cat ~= '*')
& (method descriptor category ~= cat)
& (method descriptor category = 'still unclassified')
ifTrue: [method descriptor category: cat].
^OperationalResponse success: id
]
failWith: aString [
<category: 'execution'>
| err |
err := Error new.
err messageText: aString.
^self fail: err
]
fail: anError [
<category: 'execution'>
^OperationalResponse failure: id with: anError
]
]
Request subclass: EvalRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances represent an abstract evaluation request. I hold
an expression string to evalute. Expression may be local and may have side
effects (introducing new classes, modifying the image, etc), I do not care. The
code of an expression is wrapped in a block automatically -- to make local
variables in "||" available. See my subclasses for more info.'>
| code |
init: anXML [
<category: 'initializtion'>
code := '[', anXML text, '] value'
]
execute [
<category: 'execution'>
^Behavior evaluate: code
]
]
EvalRequest subclass: DoItRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances represent DoIt requests. A DoIt request
evaluates an expession quite and returns only success/failure status to the
client.'>
DoItRequest class >> is: aString [
<category: 'identification'>
^aString = 'DoIt'
]
execute [
<category: 'execution'>
[super execute]
on: Error
do: [:err | ^OperationalResponse failure: id with: err].
^OperationalResponse success: id
]
]
EvalRequest subclass: PrintItRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances represent PrintIt requests. A PrinIt request
evaluates an expession and returns its result in a printed form to the client.'>
PrintItRequest class >> is: aString [
<category: 'identification'>
^aString = 'PrintIt'
]
execute [
<category: 'execution'>
| s |
[s := super execute]
on: Error
do: [:err | ^OperationalResponse failure: id with: err].
^PrintItResponse id: id value: s
]
]
Request subclass: RemoveClassRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances remove classes when executed. Be careful!'>
| spaceName className |
RemoveClassRequest class >> is: aString [
<category: 'identification'>
^aString = 'RemoveClass'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
spaceName := attrs at: 'namespace'.
className := attrs at: 'class'
]
execute [
<category: 'execution'>
^self failSafe:
[| namespace parent class |
namespace := Smalltalk at: spaceName asSymbol.
class := namespace classAt: className asSymbol.
class subclasses isEmpty ifFalse:
[^OperationalResponse
failure: id
text: 'failed to remove class ', className, ', it has subclasses.'].
parent := class superclass.
parent removeSubclass: class.
parent class removeSubclass: class class.
namespace removeKey: className asSymbol ifAbsent: []]
]
]
Request subclass: RemoveMethodRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances remove methods from classes when executed. Be careful!'>
| spaceName className side selector |
RemoveMethodRequest class >> is: aString [
<category: 'identification'>
^aString = 'RemoveMethod'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
spaceName := attrs at: 'namespace'.
className := attrs at: 'class'.
side := (attrs at: 'side') asSymbol.
selector := (attrs at: 'method') asSymbol.
]
execute [
<category: 'execution'>
^self failSafe:
[| namespace class |
namespace := Smalltalk at: spaceName asSymbol.
class := namespace classAt: className asSymbol.
(side = #class) ifTrue: [class := class class].
class removeSelector: selector]
]
]
Request subclass: ChangeCategoryRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances change methods categories when executed'>
| spaceName className side cat selector |
ChangeCategoryRequest class >> is: aString [
<category: 'identification'>
^aString = 'ChangeCategory'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
spaceName := attrs at: 'namespace'.
className := attrs at: 'class'.
side := (attrs at: 'side') asSymbol.
cat := (attrs at: 'category').
selector := (attrs at: 'method') asSymbol.
]
execute [
<category: 'execution'>
^self failSafe:
[| namespace class method |
namespace := Smalltalk at: spaceName asSymbol.
class := namespace classAt: className asSymbol.
(side = #class) ifTrue: [class := class class].
method := class methodDictionary at: selector.
method descriptor category:
(cat = '*' ifTrue: [nil] ifFalse: [cat])]
]
]
Request subclass: RemoveCategoryRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances remove methods categories when executed.
The methods of the removed category are marked as uncategorized.'>
| spaceName className side cat |
RemoveCategoryRequest class >> is: aString [
<category: 'identification'>
^aString = 'RemoveCategory'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
spaceName := attrs at: 'namespace'.
className := attrs at: 'class'.
side := (attrs at: 'side') asSymbol.
cat := (attrs at: 'category').
]
execute [
<category: 'execution'>
^self failSafe:
[| namespace class method |
namespace := Smalltalk at: spaceName asSymbol.
class := namespace classAt: className asSymbol.
(side = #class) ifTrue: [class := class class].
class methodDictionary values do:
[:method | method descriptor category = cat
ifTrue: [method descriptor category: nil]]]
]
]
Request subclass: RenameCategoryRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances rename method categories in the class.'>
| spaceName className side cat from to|
RenameCategoryRequest class >> is: aString [
<category: 'identification'>
^aString = 'RenameCategory'
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
spaceName := attrs at: 'namespace'.
className := attrs at: 'class'.
side := (attrs at: 'side') asSymbol.
from := attrs at: 'from'.
to := attrs at: 'to'.
]
execute [
<category: 'execution'>
^self failSafe:
[| namespace class method |
namespace := Smalltalk at: spaceName asSymbol.
class := namespace classAt: className asSymbol.
(side = #class) ifTrue: [class := class class].
class methodDictionary values do:
[:method | method descriptor category = from
ifTrue: [method descriptor category: to]]]
]
]
Request subclass: FileOutRequest [
<category: 'Shampoo-Requests'>
<comment: 'My instances are just wrappers. The actual work is
done by the FileOut implemention classes, I just select the right one
depending on the request arguments. Well, yes, I implement the Strategy
pattern.'>
| worker |
FileOutRequest class >> is: aString [
<category: 'identification'>
^aString = 'FileOut'
]
init: anXML [
<category: 'private'>
worker := self workerFor: anXML
]
workerFor: anXML [
<category: 'strategy'>
| attrs |
attrs := anXML attrMap.
(attrs includesKey: 'class')
ifTrue: [^ClassFileOutWorker on: anXML parent: self].
(attrs includesKey: 'category')
ifTrue: [^CategoryFileOutWorker on: anXML parent: self].
^NamespaceFileOutWorker on: anXML parent: self
]
execute [
<category: 'execution'>
[^worker execute] on: Error do:
[:err | ^OperationalResponse failure: id with: err]
]
]
Object subclass: FileOutWorker [
<category: 'Shampoo-Requests'>
| namespace request splitter |
FileOutWorker class >> on: anXML parent: aRequest [
<category: 'instance creation'>
^self new
parent: aRequest;
init: anXML;
yourself
]
parent: aRequest [
<category: 'private'>
request := aRequest.
]
init: anXML [
<category: 'private'>
| attrs |
attrs := anXML attrMap.
namespace := attrs at: 'namespace'.
splitter := self splitterFor: anXML.
]
parent [
<category: 'accessors'>
^request
]
namespace [
<category: 'accessors'>
^namespace
]
splitter [
<category: 'accessors'>
^splitter
]
splitterFor: anXML [
<category: 'strategy'>
| option |
option := anXML attrMap at: 'splitby' ifAbsent: ['class'].
option = 'category' ifTrue:
[^ByCategoryFileOutSplitter parent: self parent].
^ByClassFileOutSplitter parent: self parent
]
execute [
<category: 'execution'>
^Array new
]
buildResponses: aCollectionOfClasses [
| organized prettified responses |
organized := self splitter organize: aCollectionOfClasses.
prettified := organized collect:
[:classes | PrettyPrinter prettifyClasses: classes].
responses := prettified associations collect:
[:assoc | self splitter buildResponseFor: assoc value
in: assoc key].
responses isEmpty ifTrue:
[self error: 'No classes found for fileout'].
responses last isLast: true.
^responses
]
]
FileOutWorker subclass: ClassFileOutWorker [
<category: 'Shampoo-Requests'>
| className |
init: anXML [
<category: 'private'>
super init: anXML.
className := anXML attrMap at: 'class'.
]
splitterFor: anXML [
<category: 'strategy'>
^ByClassFileOutSplitter parent: self parent
]
execute [
<category: 'execution'>
| ns class |
ns := Smalltalk at: self namespace asSymbol.
class := ns at: className asSymbol.
^self buildResponses: (Array with: class)
]
]
FileOutWorker subclass: NamespaceFileOutWorker [
<category: 'Shampoo-Requests'>
accepts: aClass [
<category: 'private'>
^true
]
execute [
<category: 'execution'>
| ns cs |
ns := Smalltalk at: self namespace asSymbol.
cs := OrderedCollection new.
ns allClassesDo:
[:each | (self accepts: each) ifTrue: [cs add: each]].
^self buildResponses: cs
]
]
NamespaceFileOutWorker subclass: CategoryFileOutWorker [
<category: 'Shampoo-Requests'>
| catName |
init: anXML [
<category: 'private'>
super init: anXML.
catName := anXML attrMap at: 'category'.
]
accepts: aClass [
<category: 'private'>
^aClass category = catName
]
]
Object subclass: FileOutSplitter [
| request |
FileOutSplitter class >> parent: aRequest [
<category: 'instance creation'>
^(self new)
parent: aRequest;
yourself
]
parent: aRequest [
<category: 'private'>
request := aRequest
]
parent [
<category: 'accessors'>
^request
]
organize: aCollectionOfClasses [
<category: 'strategy'>
^self subclassResponsibility
]
buildResponseFor: aSourceCode in: aGroup [
<category: 'strategy'>
^self subclassResponsibility
]
]
FileOutSplitter subclass: ByClassFileOutSplitter [
<category: 'Shampoo-Requests'>
organize: aCollectionOfClasses [
<category: 'strategy'>
^Dictionary from:
(aCollectionOfClasses collect:
[:each | each name asString -> (Array with: each)])
]
buildResponseFor: aSourceCode in: aGroup [
<category: 'strategy'>
^FileOutResponse
id: self parent id
class: aGroup
source: aSourceCode
]
]
FileOutSplitter subclass: ByCategoryFileOutSplitter [
<category: 'Shampoo-Requests'>
organize: aCollectionOfClasses [
<category: 'strategy'>
| dict |
dict := Dictionary new.
aCollectionOfClasses do:
[:class |
(dict at: class category ifPresent: [:c | c add: class])
isNil ifTrue:
[dict at: class category put:
(OrderedCollection with: class)]].
^dict
]
buildResponseFor: aSourceCode in: aGroup [
<category: 'strategy'>
^FileOutResponse
id: self parent id
category: aGroup
source: aSourceCode
]
]
]