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 package org.jomc.ri.model;
37
38 import java.util.List;
39 import java.util.Map;
40 import javax.xml.bind.annotation.XmlTransient;
41 import org.jomc.model.Dependencies;
42 import org.jomc.model.Dependency;
43 import org.jomc.model.Implementation;
44 import org.jomc.model.Implementations;
45 import org.jomc.model.Instance;
46 import org.jomc.model.Message;
47 import org.jomc.model.Messages;
48 import org.jomc.model.Module;
49 import org.jomc.model.Modules;
50 import org.jomc.model.Properties;
51 import org.jomc.model.Property;
52 import org.jomc.model.Specification;
53 import org.jomc.model.Specifications;
54 import static org.jomc.ri.model.RuntimeModelObjects.createMap;
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.2", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2" )
79
80
81 public class RuntimeModules extends Modules implements RuntimeModelObject
82 {
83
84
85
86 @XmlTransient
87 private transient final Map<String, Module> modulesByNameCache = createMap();
88
89
90 @XmlTransient
91 private transient final Map<String, Specifications> specificationsCache = createMap();
92
93
94 @XmlTransient
95 private transient final Map<String, Implementations> implementationsCache = createMap();
96
97
98 @XmlTransient
99 private transient final Map<String, Module> moduleBySpecificationIdentifierCache = createMap();
100
101
102 @XmlTransient
103 private transient final Map<String, Module> moduleByImplementationIdentifierCache = createMap();
104
105
106 @XmlTransient
107 private transient final Map<String, Specification> specificationByIdentifierCache = createMap();
108
109
110 @XmlTransient
111 private transient final Map<String, Specification> specificationByClassNameCache = createMap();
112
113
114 @XmlTransient
115 private transient final Map<String, Specifications> specificationsByImplemenationIdentifierCache = createMap();
116
117
118 @XmlTransient
119 private transient final Map<String, Implementation> implementationByIdentifierCache = createMap();
120
121
122 @XmlTransient
123 private transient final Map<String, Implementation> implementationByClassNameCache = createMap();
124
125
126 @XmlTransient
127 private transient final Map<String, Implementation> implementationByObjectClassNameCache = createMap();
128
129
130 @XmlTransient
131 private transient final Map<String, Implementation> implementationBySpecificationAndNameCache = createMap();
132
133
134 @XmlTransient
135 private transient final Map<String, Dependencies> dependenciesByImplementationIdentifierCache = createMap();
136
137
138 @XmlTransient
139 private transient final Map<String, Properties> propertiesByImplementationIdentifierCache = createMap();
140
141
142 @XmlTransient
143 private transient final Map<String, Properties> specifiedPropertiesByImplementationIdentifierCache = createMap();
144
145
146 @XmlTransient
147 private transient final Map<String, Messages> messagesByImplementationIdentifierCache = createMap();
148
149
150 @XmlTransient
151 private transient final Map<String, Implementations> implementationsBySpecificationIdentifierCache = createMap();
152
153
154 @XmlTransient
155 private transient final Map<String, List<Object>> anyObjectsByImplemenationIdentifierCache = createMap();
156
157
158
159
160
161
162
163
164 public RuntimeModules( final Modules modules )
165 {
166 super( modules );
167
168 if ( this.getAuthors() != null )
169 {
170 this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) );
171 }
172 if ( this.getDocumentation() != null )
173 {
174 this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) );
175 }
176
177 this.copyModules();
178 }
179
180
181
182
183
184
185
186
187
188
189 public RuntimeModules( final Modules modules, final Map<Object, Instance> objects )
190 {
191 super( modules, objects );
192
193 if ( this.getAuthors() != null )
194 {
195 this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) );
196 }
197 if ( this.getDocumentation() != null )
198 {
199 this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) );
200 }
201
202 this.copyModules();
203 }
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223 @Override
224 public Module getModule( final String name )
225 {
226 if ( name == null )
227 {
228 throw new NullPointerException( "name" );
229 }
230
231 synchronized ( this.modulesByNameCache )
232 {
233 Module m = this.modulesByNameCache.get( name );
234
235 if ( m == null && !this.modulesByNameCache.containsKey( name ) )
236 {
237 m = super.getModule( name );
238 this.modulesByNameCache.put( name, m );
239 }
240
241 return m;
242 }
243 }
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258 @Override
259 public Specifications getSpecifications()
260 {
261 synchronized ( this.specificationsCache )
262 {
263 Specifications s = this.specificationsCache.get( RuntimeModules.class.getName() );
264
265 if ( s == null && !this.specificationsCache.containsKey( RuntimeModules.class.getName() ) )
266 {
267 s = super.getSpecifications();
268
269 if ( s != null )
270 {
271 s = RuntimeModelObjects.getInstance().copyOf( s );
272 }
273
274 this.specificationsCache.put( RuntimeModules.class.getName(), s );
275 }
276
277 return s;
278 }
279 }
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294 @Override
295 public Implementations getImplementations()
296 {
297 synchronized ( this.implementationsCache )
298 {
299 Implementations i = this.implementationsCache.get( RuntimeModules.class.getName() );
300
301 if ( i == null && !this.implementationsCache.containsKey( RuntimeModules.class.getName() ) )
302 {
303 i = super.getImplementations();
304
305 if ( i != null )
306 {
307 i = RuntimeModelObjects.getInstance().copyOf( i );
308 }
309
310 this.implementationsCache.put( RuntimeModules.class.getName(), i );
311 }
312
313 return i;
314 }
315 }
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336 @Override
337 public Module getModuleOfSpecification( final String specification )
338 {
339 if ( specification == null )
340 {
341 throw new NullPointerException( "specification" );
342 }
343
344 synchronized ( this.moduleBySpecificationIdentifierCache )
345 {
346 Module m = this.moduleBySpecificationIdentifierCache.get( specification );
347
348 if ( m == null && !this.moduleBySpecificationIdentifierCache.containsKey( specification ) )
349 {
350 m = super.getModuleOfSpecification( specification );
351 this.moduleBySpecificationIdentifierCache.put( specification, m );
352 }
353
354 return m;
355 }
356 }
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377 @Override
378 public Module getModuleOfImplementation( final String implementation )
379 {
380 if ( implementation == null )
381 {
382 throw new NullPointerException( "implementation" );
383 }
384
385 synchronized ( this.moduleByImplementationIdentifierCache )
386 {
387 Module m = this.moduleByImplementationIdentifierCache.get( implementation );
388
389 if ( m == null && !this.moduleByImplementationIdentifierCache.containsKey( implementation ) )
390 {
391 m = super.getModuleOfImplementation( implementation );
392 this.moduleByImplementationIdentifierCache.put( implementation, m );
393 }
394
395 return m;
396 }
397 }
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418 @Override
419 public Specification getSpecification( final String specification )
420 {
421 if ( specification == null )
422 {
423 throw new NullPointerException( "specification" );
424 }
425
426 synchronized ( this.specificationByIdentifierCache )
427 {
428 Specification s = this.specificationByIdentifierCache.get( specification );
429
430 if ( s == null && !this.specificationByIdentifierCache.containsKey( specification ) )
431 {
432 s = super.getSpecification( specification );
433 this.specificationByIdentifierCache.put( specification, s );
434 }
435
436 return s;
437 }
438 }
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459 @Override
460 public Specification getSpecification( final Class<?> specification )
461 {
462 if ( specification == null )
463 {
464 throw new NullPointerException( "specification" );
465 }
466
467 synchronized ( this.specificationByClassNameCache )
468 {
469 Specification s = this.specificationByClassNameCache.get( specification.getName() );
470
471 if ( s == null && !this.specificationByClassNameCache.containsKey( specification.getName() ) )
472 {
473 s = super.getSpecification( specification );
474 this.specificationByClassNameCache.put( specification.getName(), s );
475 }
476
477 return s;
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 @Override
503 public Specifications getSpecifications( final String implementation )
504 {
505 if ( implementation == null )
506 {
507 throw new NullPointerException( "implementation" );
508 }
509
510 synchronized ( this.specificationsByImplemenationIdentifierCache )
511 {
512 Specifications s = this.specificationsByImplemenationIdentifierCache.get( implementation );
513
514 if ( s == null && !this.specificationsByImplemenationIdentifierCache.containsKey( implementation ) )
515 {
516 s = super.getSpecifications( implementation );
517
518 if ( s != null )
519 {
520 s = RuntimeModelObjects.getInstance().copyOf( s );
521 }
522
523 this.specificationsByImplemenationIdentifierCache.put( implementation, s );
524 }
525
526 return s;
527 }
528 }
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549 @Override
550 public Implementation getImplementation( final String implementation )
551 {
552 if ( implementation == null )
553 {
554 throw new NullPointerException( "implementation" );
555 }
556
557 synchronized ( this.implementationByIdentifierCache )
558 {
559 Implementation i = this.implementationByIdentifierCache.get( implementation );
560
561 if ( i == null && !this.implementationByIdentifierCache.containsKey( implementation ) )
562 {
563 i = super.getImplementation( implementation );
564 this.implementationByIdentifierCache.put( implementation, i );
565 }
566
567 return i;
568 }
569 }
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590 @Override
591 public Implementation getImplementation( final Class<?> implementation )
592 {
593 if ( implementation == null )
594 {
595 throw new NullPointerException( "implementation" );
596 }
597
598 synchronized ( this.implementationByClassNameCache )
599 {
600 Implementation i = this.implementationByClassNameCache.get( implementation.getName() );
601
602 if ( i == null && !this.implementationByClassNameCache.containsKey( implementation.getName() ) )
603 {
604 i = super.getImplementation( implementation );
605 this.implementationByClassNameCache.put( implementation.getName(), i );
606 }
607
608 return i;
609 }
610 }
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630 @Override
631 public Implementation getImplementation( final Object object )
632 {
633 if ( object == null )
634 {
635 throw new NullPointerException( "object" );
636 }
637
638 synchronized ( this.implementationByObjectClassNameCache )
639 {
640 Implementation i = this.implementationByObjectClassNameCache.get( object.getClass().getName() );
641
642 if ( i == null && !this.implementationByObjectClassNameCache.containsKey( object.getClass().getName() ) )
643 {
644 i = super.getImplementation( object );
645 this.implementationByObjectClassNameCache.put( object.getClass().getName(), i );
646 }
647
648 return i;
649 }
650 }
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672 @Override
673 public Implementation getImplementation( final String specification, final String name )
674 {
675 if ( specification == null )
676 {
677 throw new NullPointerException( "specification" );
678 }
679 if ( name == null )
680 {
681 throw new NullPointerException( "name" );
682 }
683
684 synchronized ( this.implementationBySpecificationAndNameCache )
685 {
686 final String key = specification + "|" + name;
687 Implementation i = this.implementationBySpecificationAndNameCache.get( key );
688
689 if ( i == null && !this.implementationBySpecificationAndNameCache.containsKey( key ) )
690 {
691 i = super.getImplementation( specification, name );
692 this.implementationBySpecificationAndNameCache.put( key, i );
693 }
694
695 return i;
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 @Override
721 public Dependencies getDependencies( final String implementation )
722 {
723 if ( implementation == null )
724 {
725 throw new NullPointerException( "implementation" );
726 }
727
728 synchronized ( this.dependenciesByImplementationIdentifierCache )
729 {
730 Dependencies d = this.dependenciesByImplementationIdentifierCache.get( implementation );
731
732 if ( d == null && !this.dependenciesByImplementationIdentifierCache.containsKey( implementation ) )
733 {
734 d = super.getDependencies( implementation );
735
736 if ( d != null )
737 {
738 d = RuntimeModelObjects.getInstance().copyOf( d );
739 }
740
741 this.dependenciesByImplementationIdentifierCache.put( implementation, d );
742 }
743
744 return d;
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 @Override
770 public Properties getProperties( final String implementation )
771 {
772 if ( implementation == null )
773 {
774 throw new NullPointerException( "implementation" );
775 }
776
777 synchronized ( this.propertiesByImplementationIdentifierCache )
778 {
779 Properties p = this.propertiesByImplementationIdentifierCache.get( implementation );
780
781 if ( p == null && !this.propertiesByImplementationIdentifierCache.containsKey( implementation ) )
782 {
783 p = super.getProperties( implementation );
784
785 if ( p != null )
786 {
787 p = RuntimeModelObjects.getInstance().copyOf( p );
788 }
789
790 this.propertiesByImplementationIdentifierCache.put( implementation, p );
791 }
792
793 return p;
794 }
795 }
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817 @Override
818 public Properties getSpecifiedProperties( final String implementation )
819 {
820 if ( implementation == null )
821 {
822 throw new NullPointerException( "implementation" );
823 }
824
825 synchronized ( this.specifiedPropertiesByImplementationIdentifierCache )
826 {
827 Properties p = this.specifiedPropertiesByImplementationIdentifierCache.get( implementation );
828
829 if ( p == null && !this.specifiedPropertiesByImplementationIdentifierCache.containsKey( implementation ) )
830 {
831 p = super.getSpecifiedProperties( implementation );
832
833 if ( p != null )
834 {
835 p = RuntimeModelObjects.getInstance().copyOf( p );
836 }
837
838 this.specifiedPropertiesByImplementationIdentifierCache.put( implementation, p );
839 }
840
841 return p;
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 @Override
867 public Messages getMessages( final String implementation )
868 {
869 if ( implementation == null )
870 {
871 throw new NullPointerException( "implementation" );
872 }
873
874 synchronized ( this.messagesByImplementationIdentifierCache )
875 {
876 Messages m = this.messagesByImplementationIdentifierCache.get( implementation );
877
878 if ( m == null && !this.messagesByImplementationIdentifierCache.containsKey( implementation ) )
879 {
880 m = super.getMessages( implementation );
881
882 if ( m != null )
883 {
884 m = RuntimeModelObjects.getInstance().copyOf( m );
885 }
886
887 this.messagesByImplementationIdentifierCache.put( implementation, m );
888 }
889
890 return m;
891 }
892 }
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913 @Override
914 public Implementations getImplementations( final String specification )
915 {
916 if ( specification == null )
917 {
918 throw new NullPointerException( "specification" );
919 }
920
921 synchronized ( this.implementationsBySpecificationIdentifierCache )
922 {
923 Implementations i = this.implementationsBySpecificationIdentifierCache.get( specification );
924
925 if ( i == null && !this.implementationsBySpecificationIdentifierCache.containsKey( specification ) )
926 {
927 i = super.getImplementations( specification );
928
929 if ( i != null )
930 {
931 i = RuntimeModelObjects.getInstance().copyOf( i );
932 }
933
934 this.implementationsBySpecificationIdentifierCache.put( specification, i );
935 }
936
937 return i;
938 }
939 }
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961 @Override
962 public List<Object> getAnyObjects( final String implementation )
963 {
964 if ( implementation == null )
965 {
966 throw new NullPointerException( "implementation" );
967 }
968
969 synchronized ( this.anyObjectsByImplemenationIdentifierCache )
970 {
971 List<Object> any = this.anyObjectsByImplemenationIdentifierCache.get( implementation );
972
973 if ( any == null && !this.anyObjectsByImplemenationIdentifierCache.containsKey( implementation ) )
974 {
975 any = super.getAnyObjects( implementation );
976 this.anyObjectsByImplemenationIdentifierCache.put( implementation, any );
977 }
978
979 return any;
980 }
981 }
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000 @Override
1001 public Instance getInstance( final String implementation )
1002 {
1003 if ( implementation == null )
1004 {
1005 throw new NullPointerException( "implementation" );
1006 }
1007
1008 final Implementation i = this.getImplementation( implementation );
1009
1010 if ( i != null && i.getClazz() != null )
1011 {
1012 final Instance instance = new RuntimeInstance();
1013 instance.setIdentifier( i.getIdentifier() );
1014 instance.setName( i.getName() );
1015 instance.setClazz( i.getClazz() );
1016 instance.setStateless( i.isStateless() );
1017 instance.setDependencies( this.getDependencies( implementation ) );
1018 instance.setProperties( this.getProperties( implementation ) );
1019 instance.setMessages( this.getMessages( implementation ) );
1020 instance.setSpecifications( this.getSpecifications( implementation ) );
1021 instance.getAny().addAll( this.getAnyObjects( implementation ) );
1022 return instance;
1023 }
1024
1025 return null;
1026 }
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042 @Override
1043 public Instance getInstance( final String implementation, final Dependency dependency )
1044 {
1045 if ( implementation == null )
1046 {
1047 throw new NullPointerException( "implementation" );
1048 }
1049 if ( dependency == null )
1050 {
1051 throw new NullPointerException( "dependency" );
1052 }
1053
1054 Instance instance = this.getInstance( implementation );
1055
1056 if ( instance != null )
1057 {
1058 final Specification dependencySpecification = this.getSpecification( dependency.getIdentifier() );
1059
1060 if ( dependencySpecification != null && dependencySpecification.getScope() == null )
1061 {
1062 if ( dependency.getDependencies() != null && !dependency.getDependencies().getDependency().isEmpty() )
1063 {
1064 final Dependencies dependencies =
1065 RuntimeModelObjects.getInstance().copyOf( dependency.getDependencies() );
1066
1067 if ( instance.getDependencies() != null )
1068 {
1069 for ( int i = 0, s0 = instance.getDependencies().getDependency().size(); i < s0; i++ )
1070 {
1071 final Dependency d = instance.getDependencies().getDependency().get( i );
1072 final Dependency td = dependencies.getDependency( d.getName() );
1073
1074 if ( td == null )
1075 {
1076 dependencies.getDependency().add( d );
1077
1078 if ( dependencies instanceof RuntimeModelObject )
1079 {
1080 ( (RuntimeModelObject) dependencies ).clear();
1081 }
1082 }
1083 else
1084 {
1085 this.collectDependencies( d, td );
1086 }
1087 }
1088 }
1089
1090 instance.setDependencies( dependencies );
1091 }
1092
1093 if ( dependency.getMessages() != null && !dependency.getMessages().getMessage().isEmpty() )
1094 {
1095 final Messages messages =
1096 RuntimeModelObjects.getInstance().copyOf( dependency.getMessages() );
1097
1098 if ( instance.getMessages() != null )
1099 {
1100 for ( int i = 0, s0 = instance.getMessages().getMessage().size(); i < s0; i++ )
1101 {
1102 final Message m = instance.getMessages().getMessage().get( i );
1103
1104 if ( messages.getMessage( m.getName() ) == null )
1105 {
1106 messages.getMessage().add( m );
1107
1108 if ( messages instanceof RuntimeModelObject )
1109 {
1110 ( (RuntimeModelObject) messages ).clear();
1111 }
1112 }
1113 }
1114 }
1115
1116 instance.setMessages( messages );
1117 }
1118
1119 if ( dependency.getProperties() != null && !dependency.getProperties().getProperty().isEmpty() )
1120 {
1121 final Properties properties =
1122 RuntimeModelObjects.getInstance().copyOf( dependency.getProperties() );
1123
1124 if ( instance.getProperties() != null )
1125 {
1126 for ( int i = 0, s0 = instance.getProperties().getProperty().size(); i < s0; i++ )
1127 {
1128 final Property p = instance.getProperties().getProperty().get( i );
1129
1130 if ( properties.getProperty( p.getName() ) == null )
1131 {
1132 properties.getProperty().add( p );
1133
1134 if ( properties instanceof RuntimeModelObject )
1135 {
1136 ( (RuntimeModelObject) properties ).clear();
1137 }
1138 }
1139 }
1140 }
1141
1142 instance.setProperties( properties );
1143 }
1144 }
1145 }
1146
1147 return instance;
1148 }
1149
1150 private void collectDependencies( final Dependency source, final Dependency target )
1151 {
1152 if ( source.getMessages() != null )
1153 {
1154 if ( target.getMessages() == null )
1155 {
1156 target.setMessages( new RuntimeMessages() );
1157 }
1158
1159 for ( int i = 0, s0 = source.getMessages().getMessage().size(); i < s0; i++ )
1160 {
1161 final Message m = source.getMessages().getMessage().get( i );
1162
1163 if ( target.getMessages().getMessage( m.getName() ) == null )
1164 {
1165 target.getMessages().getMessage().add( m );
1166
1167 if ( target.getMessages() instanceof RuntimeModelObject )
1168 {
1169 ( (RuntimeModelObject) target.getMessages() ).clear();
1170 }
1171 }
1172 }
1173 }
1174
1175 if ( source.getProperties() != null )
1176 {
1177 if ( target.getProperties() == null )
1178 {
1179 target.setProperties( new RuntimeProperties() );
1180 }
1181
1182 for ( int i = 0, s0 = source.getProperties().getProperty().size(); i < s0; i++ )
1183 {
1184 final Property p = source.getProperties().getProperty().get( i );
1185
1186 if ( target.getProperties().getProperty( p.getName() ) == null )
1187 {
1188 target.getProperties().getProperty().add( p );
1189
1190 if ( target.getProperties() instanceof RuntimeModelObject )
1191 {
1192 ( (RuntimeModelObject) target.getProperties() ).clear();
1193 }
1194 }
1195 }
1196 }
1197
1198 if ( source.getDependencies() != null )
1199 {
1200 if ( target.getDependencies() == null )
1201 {
1202 target.setDependencies( new RuntimeDependencies() );
1203 }
1204
1205 for ( int i = 0, s0 = source.getDependencies().getDependency().size(); i < s0; i++ )
1206 {
1207 final Dependency sd = source.getDependencies().getDependency().get( i );
1208 final Dependency td = target.getDependencies().getDependency( sd.getName() );
1209
1210 if ( td == null )
1211 {
1212 target.getDependencies().getDependency().add( sd );
1213
1214 if ( target.getDependencies() instanceof RuntimeModelObject )
1215 {
1216 ( (RuntimeModelObject) target.getDependencies() ).clear();
1217 }
1218 }
1219 else
1220 {
1221 this.collectDependencies( sd, td );
1222 }
1223 }
1224 }
1225 }
1226
1227 private void copyModules()
1228 {
1229 for ( int i = 0, s0 = this.getModule().size(); i < s0; i++ )
1230 {
1231 final Module m = this.getModule().get( i );
1232 this.getModule().set( i, RuntimeModelObjects.getInstance().copyOf( m ) );
1233 }
1234 }
1235
1236
1237
1238 public void gc()
1239 {
1240 gcMap( this.specificationsCache );
1241 gcMap( this.implementationsCache );
1242 gcMap( this.specificationsByImplemenationIdentifierCache );
1243 gcMap( this.dependenciesByImplementationIdentifierCache );
1244 gcMap( this.propertiesByImplementationIdentifierCache );
1245 gcMap( this.specifiedPropertiesByImplementationIdentifierCache );
1246 gcMap( this.messagesByImplementationIdentifierCache );
1247 gcMap( this.implementationsBySpecificationIdentifierCache );
1248 this.gcOrClear( true, false );
1249 }
1250
1251 public void clear()
1252 {
1253 synchronized ( this.anyObjectsByImplemenationIdentifierCache )
1254 {
1255 this.anyObjectsByImplemenationIdentifierCache.clear();
1256 }
1257 synchronized ( this.dependenciesByImplementationIdentifierCache )
1258 {
1259 this.dependenciesByImplementationIdentifierCache.clear();
1260 }
1261 synchronized ( this.implementationByClassNameCache )
1262 {
1263 this.implementationByClassNameCache.clear();
1264 }
1265 synchronized ( this.implementationByIdentifierCache )
1266 {
1267 this.implementationByIdentifierCache.clear();
1268 }
1269 synchronized ( this.implementationByObjectClassNameCache )
1270 {
1271 this.implementationByObjectClassNameCache.clear();
1272 }
1273 synchronized ( this.implementationBySpecificationAndNameCache )
1274 {
1275 this.implementationBySpecificationAndNameCache.clear();
1276 }
1277 synchronized ( this.implementationsBySpecificationIdentifierCache )
1278 {
1279 this.implementationsBySpecificationIdentifierCache.clear();
1280 }
1281 synchronized ( this.implementationsCache )
1282 {
1283 this.implementationsCache.clear();
1284 }
1285 synchronized ( this.messagesByImplementationIdentifierCache )
1286 {
1287 this.messagesByImplementationIdentifierCache.clear();
1288 }
1289 synchronized ( this.moduleByImplementationIdentifierCache )
1290 {
1291 this.moduleByImplementationIdentifierCache.clear();
1292 }
1293 synchronized ( this.moduleBySpecificationIdentifierCache )
1294 {
1295 this.moduleBySpecificationIdentifierCache.clear();
1296 }
1297 synchronized ( this.modulesByNameCache )
1298 {
1299 this.modulesByNameCache.clear();
1300 }
1301 synchronized ( this.propertiesByImplementationIdentifierCache )
1302 {
1303 this.propertiesByImplementationIdentifierCache.clear();
1304 }
1305 synchronized ( this.specificationByClassNameCache )
1306 {
1307 this.specificationByClassNameCache.clear();
1308 }
1309 synchronized ( this.specificationByIdentifierCache )
1310 {
1311 this.specificationByIdentifierCache.clear();
1312 }
1313 synchronized ( this.specificationsByImplemenationIdentifierCache )
1314 {
1315 this.specificationsByImplemenationIdentifierCache.clear();
1316 }
1317 synchronized ( this.specificationsCache )
1318 {
1319 this.specificationsCache.clear();
1320 }
1321 synchronized ( this.specifiedPropertiesByImplementationIdentifierCache )
1322 {
1323 this.specifiedPropertiesByImplementationIdentifierCache.clear();
1324 }
1325
1326 this.gcOrClear( false, true );
1327 }
1328
1329 private void gcOrClear( final boolean gc, final boolean clear )
1330 {
1331 if ( this.getAuthors() instanceof RuntimeModelObject )
1332 {
1333 if ( gc )
1334 {
1335 ( (RuntimeModelObject) this.getAuthors() ).gc();
1336 }
1337 if ( clear )
1338 {
1339 ( (RuntimeModelObject) this.getAuthors() ).clear();
1340 }
1341 }
1342 if ( this.getDocumentation() instanceof RuntimeModelObject )
1343 {
1344 if ( gc )
1345 {
1346 ( (RuntimeModelObject) this.getDocumentation() ).gc();
1347 }
1348 if ( clear )
1349 {
1350 ( (RuntimeModelObject) this.getDocumentation() ).clear();
1351 }
1352 }
1353
1354 this.gcOrClearModules( gc, clear );
1355 }
1356
1357 private void gcOrClearModules( final boolean gc, final boolean clear )
1358 {
1359
1360 for ( int i = 0, s0 = this.getModule().size(); i < s0; i++ )
1361 {
1362 final Module m = this.getModule().get( i );
1363 if ( m instanceof RuntimeModelObject )
1364 {
1365 if ( gc )
1366 {
1367 ( (RuntimeModelObject) m ).gc();
1368 }
1369 if ( clear )
1370 {
1371 ( (RuntimeModelObject) m ).clear();
1372 }
1373 }
1374 }
1375 }
1376
1377 private static void gcMap( final Map<?, ?> map )
1378 {
1379 synchronized ( map )
1380 {
1381 for ( Map.Entry<?, ?> e : map.entrySet() )
1382 {
1383 if ( e.getValue() instanceof RuntimeModelObject )
1384 {
1385 ( (RuntimeModelObject) e.getValue() ).gc();
1386 }
1387 }
1388 }
1389 }
1390
1391
1392
1393
1394
1395 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.2", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2" )
1396 public RuntimeModules()
1397 {
1398
1399 super();
1400
1401 }
1402
1403
1404
1405
1406
1407
1408
1409
1410 }