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;
37
38 import java.io.IOException;
39 import java.lang.ref.Reference;
40 import java.lang.ref.WeakReference;
41 import java.lang.reflect.Array;
42 import java.lang.reflect.Constructor;
43 import java.lang.reflect.InvocationHandler;
44 import java.lang.reflect.InvocationTargetException;
45 import java.lang.reflect.Method;
46 import java.math.BigInteger;
47 import java.net.URI;
48 import java.text.MessageFormat;
49 import java.util.ArrayList;
50 import java.util.Collections;
51 import java.util.HashMap;
52 import java.util.LinkedList;
53 import java.util.List;
54 import java.util.Locale;
55 import java.util.Map;
56 import java.util.logging.Level;
57 import java.util.logging.LogRecord;
58 import org.jomc.ObjectManagementException;
59 import org.jomc.ObjectManager;
60 import org.jomc.ObjectManagerFactory;
61 import org.jomc.model.Dependency;
62 import org.jomc.model.Implementation;
63 import org.jomc.model.ImplementationReference;
64 import org.jomc.model.Implementations;
65 import org.jomc.model.Instance;
66 import org.jomc.model.Message;
67 import org.jomc.model.ModelObject;
68 import org.jomc.model.ModelObjectException;
69 import org.jomc.model.Module;
70 import org.jomc.model.Modules;
71 import org.jomc.model.Multiplicity;
72 import org.jomc.model.Property;
73 import org.jomc.model.Specification;
74 import org.jomc.model.SpecificationReference;
75 import org.jomc.model.Specifications;
76 import org.jomc.model.modlet.ModelHelper;
77 import org.jomc.modlet.Model;
78 import org.jomc.modlet.ModelContext;
79 import org.jomc.modlet.ModelContextFactory;
80 import org.jomc.modlet.ModelException;
81 import org.jomc.modlet.ModelValidationReport;
82 import org.jomc.ri.model.RuntimeModelObject;
83 import org.jomc.ri.model.RuntimeModules;
84 import org.jomc.spi.Invocation;
85 import org.jomc.spi.Invoker;
86 import org.jomc.spi.Listener;
87 import org.jomc.spi.Locator;
88 import org.jomc.spi.Scope;
89 import org.jomc.util.WeakIdentityHashMap;
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
114
115
116 public class DefaultObjectManager implements ObjectManager
117 {
118
119
120
121
122 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
123 public DefaultObjectManager()
124 {
125
126 super();
127
128 }
129
130
131
132
133 public <T> T getObject( final Class<T> specification )
134 {
135 if ( specification == null )
136 {
137 throw new NullPointerException( "specification" );
138 }
139
140 try
141 {
142 this.initialize();
143
144 Class<?> specificationClass = specification;
145 if ( specification.isArray() )
146 {
147 specificationClass = specification.getComponentType();
148 }
149
150 final ClassLoader classLoader = this.getDefaultClassLoader( specificationClass );
151 final Modules model = this.getModules( classLoader );
152 final Specification s = model.getSpecification( specificationClass );
153
154 if ( s == null )
155 {
156 if ( this.isLoggable( Level.WARNING ) )
157 {
158 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
159 Locale.getDefault(), specificationClass.getName() ), null );
160
161 }
162
163 return null;
164 }
165
166 if ( s.getMultiplicity() == Multiplicity.ONE && specification.isArray() )
167 {
168 if ( this.isLoggable( Level.WARNING ) )
169 {
170 this.log( classLoader, Level.WARNING, getIllegalArraySpecificationMessage(
171 Locale.getDefault(), s.getIdentifier(), s.getMultiplicity().value() ), null );
172
173 }
174
175 return null;
176 }
177
178 if ( s.getMultiplicity() != Multiplicity.ONE && !specification.isArray() )
179 {
180 if ( this.isLoggable( Level.WARNING ) )
181 {
182 this.log( classLoader, Level.WARNING, getIllegalObjectSpecificationMessage(
183 Locale.getDefault(), s.getIdentifier(), s.getMultiplicity().value() ), null );
184
185 }
186
187 return null;
188 }
189
190 Scope scope = null;
191 if ( s.getScope() != null )
192 {
193 scope = this.getScope( s.getScope(), classLoader );
194
195 if ( scope == null )
196 {
197 if ( this.isLoggable( Level.WARNING ) )
198 {
199 this.log( classLoader, Level.WARNING, getMissingScopeMessage(
200 Locale.getDefault(), s.getScope() ), null );
201
202 }
203
204 return null;
205 }
206 }
207
208 final Implementations available = model.getImplementations( s.getIdentifier() );
209 if ( available == null )
210 {
211 if ( this.isLoggable( Level.WARNING ) )
212 {
213 this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
214 Locale.getDefault(), s.getIdentifier() ), null );
215
216 }
217
218 return null;
219 }
220
221 int idx = 0;
222 final Object[] array = new Object[ available.getImplementation().size() ];
223
224 for ( int i = 0, s0 = available.getImplementation().size(); i < s0; i++ )
225 {
226 final Implementation impl = available.getImplementation().get( i );
227
228 if ( impl.getLocation() != null )
229 {
230 if ( s.getClazz() == null )
231 {
232 if ( this.isLoggable( Level.WARNING ) )
233 {
234 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
235 Locale.getDefault(), s.getIdentifier() ), null );
236
237 }
238
239 return null;
240 }
241
242 final Object o = this.getObject( s.getJavaTypeName().getClass( classLoader, true ),
243 impl.getLocationUri(), classLoader );
244
245 if ( o == null )
246 {
247 if ( this.isLoggable( Level.WARNING ) )
248 {
249 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
250 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
251
252 }
253 }
254 else if ( specificationClass.isInstance( o ) )
255 {
256 array[idx++] = o;
257 }
258 }
259 else if ( !impl.isAbstract() )
260 {
261 final Instance instance = model.getInstance( impl.getIdentifier() );
262 if ( instance == null )
263 {
264 if ( this.isLoggable( Level.WARNING ) )
265 {
266 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
267 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
268
269 }
270
271 return null;
272 }
273
274 final Object o = this.getObject( scope, instance, classLoader );
275 if ( o == null )
276 {
277 if ( this.isLoggable( Level.WARNING ) )
278 {
279 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
280 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
281
282 }
283 }
284 else if ( specificationClass.isInstance( o ) )
285 {
286 array[idx++] = o;
287 }
288 }
289 }
290
291 if ( specification.isArray() )
292 {
293 @SuppressWarnings( "unchecked" )
294 final T copy = (T) Array.newInstance( specificationClass, idx );
295 System.arraycopy( array, 0, copy, 0, idx );
296 return copy;
297 }
298 else if ( idx == 1 )
299 {
300 @SuppressWarnings( "unchecked" )
301 final T object = (T) array[0];
302 return object;
303 }
304
305 return null;
306 }
307 catch ( final Exception e )
308 {
309 throw new ObjectManagementException( getMessage( e ), e );
310 }
311 }
312
313 public <T> T getObject( final Class<T> specification, final String implementationName )
314 {
315 if ( specification == null )
316 {
317 throw new NullPointerException( "specification" );
318 }
319 if ( implementationName == null )
320 {
321 throw new NullPointerException( "implementationName" );
322 }
323
324 try
325 {
326 this.initialize();
327
328 final ClassLoader classLoader = this.getDefaultClassLoader( specification );
329 final Modules model = this.getModules( classLoader );
330 final Specification s = model.getSpecification( specification );
331
332 if ( s == null )
333 {
334 if ( this.isLoggable( Level.WARNING ) )
335 {
336 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
337 Locale.getDefault(), specification.getName() ), null );
338
339 }
340
341 return null;
342 }
343
344 Scope scope = null;
345 if ( s.getScope() != null )
346 {
347 scope = this.getScope( s.getScope(), classLoader );
348
349 if ( scope == null )
350 {
351 if ( this.isLoggable( Level.WARNING ) )
352 {
353 this.log( classLoader, Level.WARNING, getMissingScopeMessage(
354 Locale.getDefault(), s.getScope() ), null );
355
356 }
357
358 return null;
359 }
360 }
361
362 final Implementations available = model.getImplementations( s.getIdentifier() );
363 if ( available == null )
364 {
365 if ( this.isLoggable( Level.WARNING ) )
366 {
367 this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
368 Locale.getDefault(), specification.getName() ), null );
369
370 }
371
372 return null;
373 }
374
375 final Implementation i = available.getImplementationByName( implementationName );
376 if ( i == null )
377 {
378 if ( this.isLoggable( Level.WARNING ) )
379 {
380 this.log( classLoader, Level.WARNING, getMissingImplementationMessage(
381 Locale.getDefault(), s.getIdentifier(), implementationName ), null );
382
383 }
384
385 return null;
386 }
387
388 if ( i.getLocation() != null )
389 {
390 if ( s.getClazz() == null )
391 {
392 if ( this.isLoggable( Level.WARNING ) )
393 {
394 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
395 Locale.getDefault(), s.getIdentifier() ), null );
396
397 }
398
399 return null;
400 }
401
402 final T object = this.getObject( s.getJavaTypeName().getClass( classLoader, true ).
403 asSubclass( specification ), i.getLocationUri(), classLoader );
404
405 if ( object == null )
406 {
407 if ( this.isLoggable( Level.WARNING ) )
408 {
409 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
410 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
411
412 }
413
414 return null;
415 }
416
417 return object;
418 }
419 else if ( !i.isAbstract() )
420 {
421 final Instance instance = model.getInstance( i.getIdentifier() );
422 if ( instance == null )
423 {
424 if ( this.isLoggable( Level.WARNING ) )
425 {
426 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
427 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
428
429 }
430
431 return null;
432 }
433
434 final Object object = this.getObject( scope, instance, classLoader );
435 if ( object == null )
436 {
437 if ( this.isLoggable( Level.WARNING ) )
438 {
439 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
440 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
441
442 }
443
444 return null;
445 }
446 else if ( specification.isInstance( object ) )
447 {
448 @SuppressWarnings( "unchecked" )
449 final T o = (T) object;
450 return o;
451 }
452 }
453
454 return null;
455 }
456 catch ( final Exception e )
457 {
458 throw new ObjectManagementException( getMessage( e ), e );
459 }
460 }
461
462 public Object getDependency( final Object object, final String dependencyName )
463 {
464 if ( object == null )
465 {
466 throw new NullPointerException( "object" );
467 }
468 if ( dependencyName == null )
469 {
470 throw new NullPointerException( "dependencyName" );
471 }
472
473 try
474 {
475 this.initialize();
476
477 final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
478 final Modules model = this.getModules( classLoader );
479 final Instance instance = model.getInstance( object );
480
481 if ( instance == null )
482 {
483 if ( this.isLoggable( Level.WARNING ) )
484 {
485 this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
486 Locale.getDefault(), this.getObjectInfo( object ) ), null );
487
488 }
489
490 return null;
491 }
492
493 synchronized ( instance )
494 {
495 final Dependency dependency = instance.getDependencies() != null
496 ? instance.getDependencies().getDependency( dependencyName ) : null;
497
498 if ( dependency == null )
499 {
500 if ( this.isLoggable( Level.WARNING ) )
501 {
502 this.log( classLoader, Level.WARNING, getMissingDependencyMessage(
503 Locale.getDefault(), instance.getIdentifier(), dependencyName ), null );
504
505 }
506
507 return null;
508 }
509
510 Object o = instance.getDependencyObjects().get( dependencyName );
511 if ( o == null && !instance.getDependencyObjects().containsKey( dependencyName ) )
512 {
513 final Specification ds = model.getSpecification( dependency.getIdentifier() );
514 if ( ds == null )
515 {
516 if ( this.isLoggable( Level.WARNING ) )
517 {
518 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
519 Locale.getDefault(), dependency.getIdentifier() ), null );
520
521 }
522
523 return null;
524 }
525
526 Scope scope = null;
527 if ( ds.getScope() != null )
528 {
529 scope = this.getScope( ds.getScope(), classLoader );
530
531 if ( scope == null )
532 {
533 if ( this.isLoggable( Level.WARNING ) )
534 {
535 this.log( classLoader, Level.WARNING, getMissingScopeMessage(
536 Locale.getDefault(), ds.getScope() ), null );
537
538 }
539
540 return null;
541 }
542 }
543
544 final Implementations available = model.getImplementations( ds.getIdentifier() );
545 if ( available == null )
546 {
547 if ( !dependency.isOptional() && this.isLoggable( Level.WARNING ) )
548 {
549 this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
550 Locale.getDefault(), dependency.getIdentifier() ), null );
551
552 }
553
554 return null;
555 }
556
557 if ( dependency.getImplementationName() != null )
558 {
559 final Implementation i =
560 available.getImplementationByName( dependency.getImplementationName() );
561
562 if ( i == null )
563 {
564 if ( !dependency.isOptional() && this.isLoggable( Level.WARNING ) )
565 {
566 this.log( classLoader, Level.WARNING, getMissingImplementationMessage(
567 Locale.getDefault(), dependency.getIdentifier(),
568 dependency.getImplementationName() ), null );
569
570 }
571
572 return null;
573 }
574
575 if ( i.getLocation() != null )
576 {
577 if ( ds.getClazz() == null )
578 {
579 if ( this.isLoggable( Level.WARNING ) )
580 {
581 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
582 Locale.getDefault(), ds.getIdentifier() ), null );
583
584 }
585
586 return null;
587 }
588
589 o = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ), i.getLocationUri(),
590 classLoader );
591
592 if ( o == null )
593 {
594 if ( this.isLoggable( Level.WARNING ) )
595 {
596 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
597 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
598
599 }
600
601 return null;
602 }
603 }
604 else if ( !i.isAbstract() )
605 {
606 final Instance di = model.getInstance( i.getIdentifier(), dependency );
607 if ( di == null )
608 {
609 if ( this.isLoggable( Level.WARNING ) )
610 {
611 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
612 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
613
614 }
615
616 return null;
617 }
618
619 o = this.getObject( scope, di, classLoader );
620 if ( o == null )
621 {
622 if ( this.isLoggable( Level.WARNING ) )
623 {
624 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
625 Locale.getDefault(), i.getIdentifier(), i.getName() ), null );
626
627 }
628
629 return null;
630 }
631 }
632 }
633 else if ( ds.getMultiplicity() == Multiplicity.ONE )
634 {
635 if ( available.getImplementation().size() == 1 )
636 {
637 final Implementation ref = available.getImplementation().get( 0 );
638
639 if ( ref.getLocation() != null )
640 {
641 if ( ds.getClazz() == null )
642 {
643 if ( this.isLoggable( Level.WARNING ) )
644 {
645 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
646 Locale.getDefault(), ds.getIdentifier() ), null );
647
648 }
649
650 return null;
651 }
652
653 o = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ),
654 ref.getLocationUri(), classLoader );
655
656 if ( o == null )
657 {
658 if ( this.isLoggable( Level.WARNING ) )
659 {
660 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
661 Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );
662
663 }
664
665 return null;
666 }
667 }
668 else if ( !ref.isAbstract() )
669 {
670 final Instance di = model.getInstance( ref.getIdentifier(), dependency );
671 if ( di == null )
672 {
673 if ( this.isLoggable( Level.WARNING ) )
674 {
675 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
676 Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );
677
678 }
679
680 return null;
681 }
682
683 o = this.getObject( scope, di, classLoader );
684 if ( o == null )
685 {
686 if ( this.isLoggable( Level.WARNING ) )
687 {
688 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
689 Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );
690
691 }
692
693 return null;
694 }
695 }
696 }
697 else
698 {
699 this.log( classLoader, Level.WARNING, getUnexpectedDependencyObjectsMessage(
700 Locale.getDefault(), instance.getIdentifier(), dependencyName, BigInteger.ONE,
701 available.getImplementation().size() ), null );
702
703 }
704 }
705 else
706 {
707 int idx = 0;
708 final Object[] array = new Object[ available.getImplementation().size() ];
709
710 if ( !available.getImplementation().isEmpty() && ds.getClazz() == null )
711 {
712 if ( this.isLoggable( Level.WARNING ) )
713 {
714 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
715 Locale.getDefault(), ds.getIdentifier() ), null );
716
717 }
718
719 return null;
720 }
721
722 for ( int i = 0, s0 = available.getImplementation().size(); i < s0; i++ )
723 {
724 final Implementation a = available.getImplementation().get( i );
725 if ( a.getLocation() != null )
726 {
727 if ( ds.getClazz() == null )
728 {
729 if ( this.isLoggable( Level.WARNING ) )
730 {
731 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
732 Locale.getDefault(), ds.getIdentifier() ), null );
733
734 }
735
736 return null;
737 }
738
739 final Object o2 = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ),
740 a.getLocationUri(), classLoader );
741
742 if ( o2 == null )
743 {
744 if ( this.isLoggable( Level.WARNING ) )
745 {
746 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
747 Locale.getDefault(), a.getIdentifier(), a.getName() ), null );
748
749 }
750 }
751 else
752 {
753 array[idx++] = o2;
754 }
755 }
756 else if ( !a.isAbstract() )
757 {
758 final Instance di = model.getInstance( a.getIdentifier(), dependency );
759 if ( di == null )
760 {
761 if ( this.isLoggable( Level.WARNING ) )
762 {
763 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
764 Locale.getDefault(), a.getIdentifier(), a.getName() ), null );
765
766 }
767
768 return null;
769 }
770
771 final Object o2 = this.getObject( scope, di, classLoader );
772 if ( o2 == null )
773 {
774 if ( this.isLoggable( Level.WARNING ) )
775 {
776 this.log( classLoader, Level.WARNING, getMissingObjectMessage(
777 Locale.getDefault(), a.getIdentifier(), a.getName() ), null );
778
779 }
780 }
781 else
782 {
783 array[idx++] = o2;
784 }
785 }
786 }
787
788 if ( idx > 0 )
789 {
790 o = Array.newInstance( ds.getJavaTypeName().getClass( classLoader, true ), idx );
791 System.arraycopy( array, 0, o, 0, idx );
792 }
793 else
794 {
795 o = null;
796 }
797 }
798 }
799
800 if ( dependency.isBound() )
801 {
802 instance.getDependencyObjects().put( dependencyName, o );
803 }
804
805 return o;
806 }
807 }
808 catch ( final Exception e )
809 {
810 throw new ObjectManagementException( getMessage( e ), e );
811 }
812 }
813
814 public Object getProperty( final Object object, final String propertyName )
815 {
816 if ( object == null )
817 {
818 throw new NullPointerException( "object" );
819 }
820 if ( propertyName == null )
821 {
822 throw new NullPointerException( "propertyName" );
823 }
824
825 try
826 {
827 this.initialize();
828
829 final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
830 final Modules model = this.getModules( classLoader );
831 final Instance instance = model.getInstance( object );
832
833 if ( instance == null )
834 {
835 if ( this.isLoggable( Level.WARNING ) )
836 {
837 this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
838 Locale.getDefault(), this.getObjectInfo( object ) ), null );
839
840 }
841
842 return null;
843 }
844
845 synchronized ( instance )
846 {
847 Object value = instance.getPropertyObjects().get( propertyName );
848
849 if ( value == null && !instance.getPropertyObjects().containsKey( propertyName ) )
850 {
851 final Property property =
852 instance.getProperties() != null ? instance.getProperties().getProperty( propertyName ) : null;
853
854 if ( property == null )
855 {
856 if ( this.isLoggable( Level.WARNING ) )
857 {
858 this.log( classLoader, Level.WARNING, getMissingPropertyMessage(
859 Locale.getDefault(), instance.getIdentifier(), propertyName ), null );
860
861 }
862
863 return null;
864 }
865
866 value = property.getJavaValue( classLoader );
867 instance.getPropertyObjects().put( propertyName, value );
868 }
869
870 return value;
871 }
872 }
873 catch ( final Exception e )
874 {
875 throw new ObjectManagementException( getMessage( e ), e );
876 }
877 }
878
879 public String getMessage( final Object object, final String messageName, final Locale locale,
880 final Object... arguments )
881 {
882 if ( object == null )
883 {
884 throw new NullPointerException( "object" );
885 }
886 if ( messageName == null )
887 {
888 throw new NullPointerException( "messageName" );
889 }
890 if ( locale == null )
891 {
892 throw new NullPointerException( "locale" );
893 }
894
895 try
896 {
897 this.initialize();
898
899 final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
900 final Modules model = this.getModules( classLoader );
901 final Instance instance = model.getInstance( object );
902
903 if ( instance == null )
904 {
905 if ( this.isLoggable( Level.WARNING ) )
906 {
907 this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
908 Locale.getDefault(), this.getObjectInfo( object ) ), null );
909
910 }
911
912 return null;
913 }
914
915 synchronized ( instance )
916 {
917 Map<Locale, MessageFormat> messageFormats = instance.getMessageObjects().get( messageName );
918
919 if ( messageFormats == null )
920 {
921 messageFormats = new HashMap<Locale, MessageFormat>();
922 instance.getMessageObjects().put( messageName, messageFormats );
923 }
924
925 MessageFormat messageFormat = messageFormats.get( locale );
926
927 if ( messageFormat == null && !messageFormats.containsKey( locale ) )
928 {
929 final Message message =
930 instance.getMessages() != null ? instance.getMessages().getMessage( messageName ) : null;
931
932 if ( message == null || message.getTemplate() == null )
933 {
934 if ( this.isLoggable( Level.WARNING ) )
935 {
936 this.log( classLoader, Level.WARNING, getMissingMessageMessage(
937 Locale.getDefault(), instance.getIdentifier(), messageName ), null );
938
939 }
940 }
941 else
942 {
943 messageFormat = message.getJavaMessage( locale );
944 }
945
946 messageFormats.put( locale, messageFormat );
947 }
948
949 if ( messageFormat != null )
950 {
951 synchronized ( messageFormat )
952 {
953 return messageFormat.format( arguments );
954 }
955 }
956 }
957
958 return null;
959 }
960 catch ( final Exception e )
961 {
962 throw new ObjectManagementException( getMessage( e ), e );
963 }
964 }
965
966
967
968
969
970
971 protected static final String SINGLETON_SCOPE_IDENTIFIER = "Singleton";
972
973
974
975
976
977
978 private static final Class<?>[] INVOCATION_HANDLER_ARGUMENTS =
979 {
980 InvocationHandler.class
981 };
982
983
984
985
986
987
988 private static final Level DEFAULT_LOG_LEVEL = Level.WARNING;
989
990
991
992
993 private static volatile Level defaultLogLevel;
994
995
996
997
998 private static volatile String bootstrapClassLoaderClassName;
999
1000 private static volatile boolean bootstrapClassLoaderClassNameInitialized;
1001
1002
1003
1004
1005
1006
1007 private static volatile String rootClassLoaderClassName;
1008
1009 private static volatile boolean rootClassLoaderClassNameInitialized;
1010
1011
1012
1013
1014
1015
1016 private static volatile String defaultModelIdentifier;
1017
1018
1019
1020
1021
1022
1023 private String modelIdentifier;
1024
1025
1026
1027
1028
1029
1030 private static volatile Boolean defaultModelObjectClasspathResolutionEnabled;
1031
1032
1033
1034
1035
1036
1037 private Boolean modelObjectClasspathResolutionEnabled;
1038
1039
1040
1041
1042
1043
1044 private static volatile Boolean defaultModelProcessingEnabled;
1045
1046
1047
1048
1049
1050
1051 private Boolean modelProcessingEnabled;
1052
1053
1054
1055
1056 private static final ClassLoader BOOTSTRAP_CLASSLOADER = new ClassLoader( null )
1057 {
1058
1059 @Override
1060 public String toString()
1061 {
1062 return DefaultObjectManager.class.getName() + ".BootstrapClassLoader@"
1063 + Integer.toHexString( this.hashCode() );
1064
1065 }
1066
1067 };
1068
1069
1070
1071
1072 private boolean initialized;
1073
1074
1075
1076
1077 private Level logLevel;
1078
1079
1080
1081
1082 private final Map<ClassLoader, List<Listener>> listeners =
1083 new WeakIdentityHashMap<ClassLoader, List<Listener>>();
1084
1085
1086
1087
1088 private final Map<ClassLoader, Modules> modules =
1089 new WeakIdentityHashMap<ClassLoader, Modules>();
1090
1091
1092
1093
1094 private final Map<ClassLoader, Invoker> invokers =
1095 new WeakIdentityHashMap<ClassLoader, Invoker>();
1096
1097
1098
1099
1100 private final Map<ClassLoader, Map<String, Scope>> scopes =
1101 new WeakIdentityHashMap<ClassLoader, Map<String, Scope>>();
1102
1103
1104
1105
1106 private final Map<ClassLoader, Map<String, Locator>> locators =
1107 new WeakIdentityHashMap<ClassLoader, Map<String, Locator>>();
1108
1109
1110
1111
1112 private final Map<ClassLoader, Map<Object, Instance>> objects =
1113 new WeakIdentityHashMap<ClassLoader, Map<Object, Instance>>();
1114
1115
1116
1117
1118 private static final Map<ClassLoader, ObjectManager> singletons =
1119 new WeakIdentityHashMap<ClassLoader, ObjectManager>();
1120
1121
1122
1123
1124
1125
1126 private static final Map<ClassLoader, Reference<ClassLoader>> defaultClassLoaders =
1127 new WeakIdentityHashMap<ClassLoader, Reference<ClassLoader>>();
1128
1129
1130
1131
1132
1133
1134 private static final Map<ClassLoader, Map<String, Reference<Constructor<?>>>> proxyClassConstructors =
1135 new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Constructor<?>>>>();
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147 public static ObjectManager getObjectManager( final ClassLoader classLoader )
1148 {
1149 ObjectManager manager;
1150 final ClassLoader singletonsLoader = getClassLoader( classLoader );
1151
1152 synchronized ( singletons )
1153 {
1154 manager = singletons.get( singletonsLoader );
1155
1156 if ( manager == null )
1157 {
1158 manager = ObjectManagerFactory.newObjectManager( classLoader );
1159
1160 if ( singletons.put( singletonsLoader, manager ) != null )
1161 {
1162 throw new AssertionError( getScopeContentionFailure(
1163 Locale.getDefault(), manager.getClass().getName() ) );
1164
1165 }
1166 }
1167 }
1168
1169 return manager.getObject( ObjectManager.class );
1170 }
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184 public List<Listener> getListeners()
1185 {
1186 return this.getListeners( this.getDefaultClassLoader( this.getClass() ) );
1187 }
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203 public List<Listener> getListeners( final ClassLoader classLoader )
1204 {
1205 if ( classLoader == null )
1206 {
1207 throw new NullPointerException( "classLoader" );
1208 }
1209
1210 try
1211 {
1212 final ClassLoader listenersLoader = this.getDefaultClassLoader( classLoader );
1213
1214 synchronized ( this.listeners )
1215 {
1216 List<Listener> cachedListeners = this.listeners.get( listenersLoader );
1217
1218 if ( cachedListeners == null )
1219 {
1220 final List<LogRecord> bootstrapRecords = new ArrayList<LogRecord>( 1024 );
1221 final Listener bootstrapListener = new Listener()
1222 {
1223
1224 public void onLog( final Level level, final String message, final Throwable throwable )
1225 {
1226 final LogRecord r = new LogRecord( level, message );
1227 r.setThrown( throwable );
1228
1229 bootstrapRecords.add( r );
1230 }
1231
1232 };
1233
1234 cachedListeners = new LinkedList<Listener>();
1235 cachedListeners.add( bootstrapListener );
1236 this.listeners.put( listenersLoader, cachedListeners );
1237
1238 final List<Listener> modelListeners = new LinkedList<Listener>();
1239 final Modules model = this.getModules( classLoader );
1240 final Specification listenerSpecification = model.getSpecification( Listener.class );
1241
1242 if ( listenerSpecification != null )
1243 {
1244 final Implementations implementations =
1245 model.getImplementations( listenerSpecification.getIdentifier() );
1246
1247 if ( implementations != null && !implementations.getImplementation().isEmpty() )
1248 {
1249 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
1250 {
1251 final Implementation impl = implementations.getImplementation().get( i );
1252 final Instance listenerInstance = model.getInstance( impl.getIdentifier() );
1253 if ( listenerInstance != null )
1254 {
1255 try
1256 {
1257 final Listener l =
1258 (Listener) model.createObject( listenerInstance, classLoader );
1259
1260 modelListeners.add( l );
1261
1262 if ( this.isLoggable( Level.CONFIG ) )
1263 {
1264 this.log( classLoader, Level.CONFIG, getListenerInfoMessage(
1265 Locale.getDefault(), l.getClass().getName(),
1266 this.getClassLoaderInfo( classLoader, listenersLoader ) ), null );
1267
1268 }
1269 }
1270 catch ( final InstantiationException e )
1271 {
1272 if ( this.isLoggable( Level.SEVERE ) )
1273 {
1274 this.log( classLoader, Level.SEVERE, getMessage( e ), e );
1275 }
1276 }
1277 }
1278 else if ( this.isLoggable( Level.WARNING ) )
1279 {
1280 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
1281 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
1282
1283 }
1284 }
1285 }
1286 else if ( this.isLoggable( Level.WARNING ) )
1287 {
1288 this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
1289 Locale.getDefault(), listenerSpecification.getIdentifier() ), null );
1290
1291 }
1292 }
1293 else if ( this.isLoggable( Level.WARNING ) )
1294 {
1295 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
1296 Locale.getDefault(), Listener.class.getName() ), null );
1297
1298 }
1299
1300 cachedListeners.remove( bootstrapListener );
1301 cachedListeners.addAll( modelListeners );
1302
1303 if ( cachedListeners.isEmpty() )
1304 {
1305 if ( !classLoader.equals( this.getDefaultClassLoader( this.getClass() ) ) )
1306 {
1307 cachedListeners.addAll( this.getListeners() );
1308 }
1309 else
1310 {
1311 cachedListeners.add( this.getDefaultListener( model ) );
1312
1313 if ( this.isLoggable( Level.CONFIG ) )
1314 {
1315 this.log( Level.CONFIG, getDefaultListenerInfo(
1316 Locale.getDefault(), this.getClassLoaderInfo( classLoader, listenersLoader ) ),
1317 null );
1318
1319 }
1320 }
1321 }
1322
1323 for ( final LogRecord r : bootstrapRecords )
1324 {
1325 this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
1326 }
1327 }
1328
1329 return cachedListeners;
1330 }
1331 }
1332 catch ( final ModelObjectException e )
1333 {
1334 throw new ObjectManagementException( getMessage( e ), e );
1335 }
1336 }
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351 @Deprecated
1352 public Listener getDefaultListener()
1353 {
1354 return new DefaultListener();
1355 }
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372 public Listener getDefaultListener( final Modules model )
1373 {
1374 if ( model == null )
1375 {
1376 throw new NullPointerException( "model" );
1377 }
1378
1379 try
1380 {
1381 final Listener defaultListener = new DefaultListener();
1382 model.getInstance( defaultListener );
1383 return defaultListener;
1384 }
1385 catch ( final ModelObjectException e )
1386 {
1387 throw new ObjectManagementException( getMessage( e ), e );
1388 }
1389 }
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404 public static Level getDefaultLogLevel()
1405 {
1406 if ( defaultLogLevel == null )
1407 {
1408 defaultLogLevel = Level.parse( System.getProperty( "org.jomc.ri.DefaultObjectManager.defaultLogLevel",
1409 DEFAULT_LOG_LEVEL.getName() ) );
1410
1411 }
1412
1413 return defaultLogLevel;
1414 }
1415
1416
1417
1418
1419
1420
1421
1422
1423 public static void setDefaultLogLevel( final Level value )
1424 {
1425 defaultLogLevel = value;
1426 }
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437 public final Level getLogLevel()
1438 {
1439 if ( this.logLevel == null )
1440 {
1441 this.logLevel = getDefaultLogLevel();
1442
1443 if ( this.isLoggable( Level.CONFIG ) )
1444 {
1445 this.log( Level.CONFIG, getDefaultLogLevelInfoMessage(
1446 Locale.getDefault(), this.logLevel.getLocalizedName() ), null );
1447
1448 }
1449 }
1450
1451 return this.logLevel;
1452 }
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462 public final void setLogLevel( final Level value )
1463 {
1464 this.logLevel = value;
1465 }
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482 public boolean isLoggable( final Level level )
1483 {
1484 if ( level == null )
1485 {
1486 throw new NullPointerException( "level" );
1487 }
1488
1489 return level.intValue() >= this.getLogLevel().intValue();
1490 }
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508 public void log( final Level level, final String message, final Throwable throwable )
1509 {
1510 this.log( this.getDefaultClassLoader( this.getClass() ), level, message, throwable );
1511 }
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526 public void log( final ClassLoader classLoader, final Level level, final String message, final Throwable throwable )
1527 {
1528 if ( level == null )
1529 {
1530 throw new NullPointerException( "level" );
1531 }
1532 if ( classLoader == null )
1533 {
1534 throw new NullPointerException( "classLoader" );
1535 }
1536
1537 if ( this.isLoggable( level ) )
1538 {
1539 final List<Listener> l = this.getListeners( classLoader );
1540
1541 for ( int i = 0, s0 = l.size(); i < s0; i++ )
1542 {
1543 l.get( i ).onLog( level, message, throwable );
1544 }
1545 }
1546 }
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564 public static String getDefaultModelIdentifier()
1565 {
1566 if ( defaultModelIdentifier == null )
1567 {
1568 defaultModelIdentifier = System.getProperty( "org.jomc.ri.DefaultObjectManager.defaultModelIdentifier",
1569 ModelObject.MODEL_PUBLIC_ID );
1570
1571 }
1572
1573 return defaultModelIdentifier;
1574 }
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585 public static void setDefaultModelIdentifier( final String value )
1586 {
1587 defaultModelIdentifier = value;
1588 }
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600 public final String getModelIdentifier()
1601 {
1602 if ( this.modelIdentifier == null )
1603 {
1604 this.modelIdentifier = getDefaultModelIdentifier();
1605
1606 if ( this.isLoggable( Level.CONFIG ) )
1607 {
1608 this.log( Level.CONFIG, getDefaultModelIdentifierInfo(
1609 Locale.getDefault(), this.modelIdentifier ), null );
1610
1611 }
1612 }
1613
1614 return this.modelIdentifier;
1615 }
1616
1617
1618
1619
1620
1621
1622
1623
1624 public final void setModelIdentifier( final String value )
1625 {
1626 this.modelIdentifier = value;
1627 }
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646 public static boolean isDefaultModelObjectClasspathResolutionEnabled()
1647 {
1648 if ( defaultModelObjectClasspathResolutionEnabled == null )
1649 {
1650 defaultModelObjectClasspathResolutionEnabled = Boolean.valueOf( System.getProperty(
1651 "org.jomc.ri.DefaultObjectManager.defaultModelObjectClasspathResolutionEnabled",
1652 Boolean.toString( true ) ) );
1653
1654 }
1655
1656 return defaultModelObjectClasspathResolutionEnabled;
1657 }
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669 public static void setDefaultModelObjectClasspathResolutionEnabled( final Boolean value )
1670 {
1671 defaultModelObjectClasspathResolutionEnabled = value;
1672 }
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685 public final boolean isModelObjectClasspathResolutionEnabled()
1686 {
1687 if ( this.modelObjectClasspathResolutionEnabled == null )
1688 {
1689 this.modelObjectClasspathResolutionEnabled = isDefaultModelObjectClasspathResolutionEnabled();
1690
1691 if ( this.isLoggable( Level.CONFIG ) )
1692 {
1693 this.log( Level.CONFIG, getDefaultModelObjectClasspahResolutionEnabledInfo(
1694 Locale.getDefault(), Boolean.toString( this.modelObjectClasspathResolutionEnabled ) ), null );
1695
1696 }
1697 }
1698
1699 return this.modelObjectClasspathResolutionEnabled;
1700 }
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711 public final void setModelObjectClasspathResolutionEnabled( final Boolean value )
1712 {
1713 this.modelObjectClasspathResolutionEnabled = value;
1714 }
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732 public static boolean isDefaultModelProcessingEnabled()
1733 {
1734 if ( defaultModelProcessingEnabled == null )
1735 {
1736 defaultModelProcessingEnabled = Boolean.valueOf( System.getProperty(
1737 "org.jomc.ri.DefaultObjectManager.defaultModelProcessingEnabled", Boolean.toString( true ) ) );
1738
1739 }
1740
1741 return defaultModelProcessingEnabled;
1742 }
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753 public static void setDefaultModelProcessingEnabled( final Boolean value )
1754 {
1755 defaultModelProcessingEnabled = value;
1756 }
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768 public final boolean isModelProcessingEnabled()
1769 {
1770 if ( this.modelProcessingEnabled == null )
1771 {
1772 this.modelProcessingEnabled = isDefaultModelProcessingEnabled();
1773
1774 if ( this.isLoggable( Level.CONFIG ) )
1775 {
1776 this.log( Level.CONFIG, getDefaultModelProcessingEnabledInfo(
1777 Locale.getDefault(), Boolean.toString( this.modelProcessingEnabled ) ), null );
1778
1779 }
1780 }
1781
1782 return this.modelProcessingEnabled;
1783 }
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794 public final void setModelProcessingEnabled( final Boolean value )
1795 {
1796 this.modelProcessingEnabled = value;
1797 }
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813 public static String getBootstrapClassLoaderClassName()
1814 {
1815 if ( bootstrapClassLoaderClassName == null && !bootstrapClassLoaderClassNameInitialized )
1816 {
1817 bootstrapClassLoaderClassName =
1818 System.getProperty( "org.jomc.ri.DefaultObjectManager.bootstrapClassLoaderClassName" );
1819
1820 bootstrapClassLoaderClassNameInitialized = true;
1821 }
1822
1823 return bootstrapClassLoaderClassName;
1824 }
1825
1826
1827
1828
1829
1830
1831
1832
1833 public static void setBootstrapClassLoaderClassName( final String value )
1834 {
1835 bootstrapClassLoaderClassName = value;
1836 bootstrapClassLoaderClassNameInitialized = false;
1837 }
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852 public static String getRootClassLoaderClassName()
1853 {
1854 if ( rootClassLoaderClassName == null && !rootClassLoaderClassNameInitialized )
1855 {
1856 rootClassLoaderClassName =
1857 System.getProperty( "org.jomc.ri.DefaultObjectManager.rootClassLoaderClassName" );
1858
1859 rootClassLoaderClassNameInitialized = true;
1860 }
1861
1862 return rootClassLoaderClassName;
1863 }
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873 public static void setRootClassLoaderClassName( final String value )
1874 {
1875 rootClassLoaderClassName = value;
1876 rootClassLoaderClassNameInitialized = false;
1877 }
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895 public Modules getModules( final ClassLoader classLoader )
1896 {
1897 if ( classLoader == null )
1898 {
1899 throw new NullPointerException( "classLoader" );
1900 }
1901
1902 synchronized ( this.modules )
1903 {
1904 Modules cachedModules = this.modules.get( classLoader );
1905
1906 if ( cachedModules == null )
1907 {
1908 final List<LogRecord> logRecords = new ArrayList<LogRecord>( 1024 );
1909
1910 try
1911 {
1912 final ModelContext modelContext = ModelContextFactory.newInstance().newModelContext( classLoader );
1913
1914 logRecords.add( new LogRecord( Level.FINER, getCreatingModulesInfo(
1915 Locale.getDefault(), this.getClassLoaderInfo( classLoader, null ) ) ) );
1916
1917 modelContext.setLogLevel( this.getLogLevel() );
1918 modelContext.getListeners().add( new ModelContext.Listener()
1919 {
1920
1921 @Override
1922 public void onLog( final Level level, final String message, final Throwable t )
1923 {
1924 super.onLog( level, message, t );
1925 final LogRecord r = new LogRecord( level, message );
1926 r.setThrown( t );
1927
1928 logRecords.add( r );
1929 }
1930
1931 } );
1932
1933 Model model = modelContext.findModel( this.getModelIdentifier() );
1934 cachedModules = ModelHelper.getModules( model );
1935
1936 if ( cachedModules != null )
1937 {
1938 if ( this.isModelObjectClasspathResolutionEnabled() )
1939 {
1940 final Module classpathModule = cachedModules.getClasspathModule(
1941 Modules.getDefaultClasspathModuleName(), classLoader );
1942
1943 if ( classpathModule != null )
1944 {
1945 cachedModules.getModule().add( classpathModule );
1946 }
1947 }
1948
1949 if ( this.isModelProcessingEnabled() )
1950 {
1951 model = modelContext.processModel( model );
1952 }
1953
1954 final ModelValidationReport validationReport = modelContext.validateModel( model );
1955
1956 for ( final ModelValidationReport.Detail d : validationReport.getDetails() )
1957 {
1958 final LogRecord r = new LogRecord( d.getLevel(), d.getMessage() );
1959 logRecords.add( r );
1960 }
1961
1962 cachedModules = validationReport.isModelValid() ? ModelHelper.getModules( model ) : null;
1963 }
1964 }
1965 catch ( final ModelException e )
1966 {
1967 cachedModules = null;
1968
1969 final LogRecord r = new LogRecord( Level.SEVERE, getMessage( e ) );
1970 r.setThrown( e );
1971 logRecords.add( r );
1972 }
1973
1974 if ( cachedModules == null )
1975 {
1976 cachedModules = this.getDefaultModules();
1977
1978 logRecords.add( new LogRecord( Level.WARNING, getDefaultModulesWarning(
1979 Locale.getDefault(), this.getModelIdentifier(),
1980 this.getClassLoaderInfo( classLoader, null ) ) ) );
1981
1982 }
1983
1984 final ClassLoader objectsLoader = this.getDefaultClassLoader( classLoader );
1985
1986 synchronized ( this.objects )
1987 {
1988 Map<Object, Instance> objectMap = this.objects.get( objectsLoader );
1989 if ( objectMap == null )
1990 {
1991 objectMap = new WeakIdentityHashMap<Object, Instance>();
1992 this.objects.put( objectsLoader, objectMap );
1993 }
1994
1995 final long t0 = System.currentTimeMillis();
1996 cachedModules = this.getRuntimeModules( cachedModules, objectMap );
1997
1998 if ( cachedModules instanceof RuntimeModelObject )
1999 {
2000 ( (RuntimeModelObject) cachedModules ).clear();
2001 }
2002
2003 logRecords.add( new LogRecord( Level.FINE,
2004 getRuntimeModelReport( Locale.getDefault(),
2005 System.currentTimeMillis() - t0 ) ) );
2006
2007 }
2008
2009 this.modules.put( classLoader, cachedModules );
2010
2011 for ( final LogRecord r : logRecords )
2012 {
2013 this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
2014 }
2015
2016 if ( this.isLoggable( Level.FINEST ) )
2017 {
2018 this.logModulesReport( cachedModules, classLoader );
2019 }
2020 }
2021
2022 return cachedModules;
2023 }
2024 }
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037 public Modules getDefaultModules()
2038 {
2039 final Modules defaultModules = new Modules();
2040 final Module defaultModule = new Module();
2041 defaultModule.setSpecifications( new Specifications() );
2042 defaultModule.setImplementations( new Implementations() );
2043 defaultModules.getModule().add( defaultModule );
2044 defaultModule.setName( getDefaultModuleName( Locale.getDefault() ) );
2045
2046 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2047 ObjectManager.class, Multiplicity.ONE, SINGLETON_SCOPE_IDENTIFIER ) );
2048
2049 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2050 Scope.class, null, null ) );
2051
2052 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2053 Listener.class, null, null ) );
2054
2055 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2056 Locator.class, null, null ) );
2057
2058 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2059 Invoker.class, null, null ) );
2060
2061 defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
2062 Invocation.class, Multiplicity.ONE, null ) );
2063
2064 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2065 ObjectManagerFactory.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2066
2067 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2068 ObjectManagementException.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2069
2070 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2071 DefaultInvocation.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2072
2073 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2074 DefaultInvoker.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2075
2076 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2077 DefaultListener.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2078
2079 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2080 DefaultLocator.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2081
2082 defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
2083 DefaultScope.class, getDefaultImplementationName( Locale.getDefault() ) ) );
2084
2085 final Implementation defaultObjectManager = createDefaultImplementation(
2086 DefaultObjectManager.class, getDefaultImplementationName( Locale.getDefault() ) );
2087
2088 defaultObjectManager.setSpecifications( new Specifications() );
2089
2090 final SpecificationReference refObjectManager = new SpecificationReference();
2091 refObjectManager.setIdentifier( ObjectManager.class.getName() );
2092 refObjectManager.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
2093 defaultObjectManager.getSpecifications().getReference().add( refObjectManager );
2094
2095 defaultModule.getImplementations().getImplementation().add( defaultObjectManager );
2096 return defaultModules;
2097 }
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114 public Modules getRuntimeModules( final Modules modules, final Map<Object, Instance> objectMap )
2115 {
2116 if ( modules == null )
2117 {
2118 throw new NullPointerException( "modules" );
2119 }
2120 if ( objectMap == null )
2121 {
2122 throw new NullPointerException( "objectMap" );
2123 }
2124
2125 return new RuntimeModules( modules, objectMap );
2126 }
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139 public ClassLoader getDefaultClassLoader( final Class<?> clazz )
2140 {
2141 if ( clazz == null )
2142 {
2143 throw new NullPointerException( "clazz" );
2144 }
2145
2146 ClassLoader cl = clazz.getClassLoader();
2147 if ( cl == null )
2148 {
2149 cl = BOOTSTRAP_CLASSLOADER;
2150 }
2151
2152 return cl;
2153 }
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178 public ClassLoader getDefaultClassLoader( final ClassLoader classLoader )
2179 {
2180 if ( classLoader == null )
2181 {
2182 return BOOTSTRAP_CLASSLOADER;
2183 }
2184
2185 synchronized ( defaultClassLoaders )
2186 {
2187 ClassLoader loader = null;
2188 Reference<ClassLoader> reference = defaultClassLoaders.get( classLoader );
2189
2190 if ( reference != null )
2191 {
2192 loader = reference.get();
2193 }
2194
2195 if ( loader == null )
2196 {
2197 if ( classLoader.getParent() != null
2198 && !classLoader.getParent().getClass().getName().equals( getBootstrapClassLoaderClassName() )
2199 && !classLoader.getClass().getName().equals( getRootClassLoaderClassName() ) )
2200 {
2201 loader = this.getDefaultClassLoader( classLoader.getParent() );
2202 }
2203 else
2204 {
2205 loader = classLoader;
2206 }
2207
2208 defaultClassLoaders.put( classLoader, new WeakReference<ClassLoader>( loader ) );
2209 }
2210
2211 return loader;
2212 }
2213 }
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227 @Deprecated
2228 public static ClassLoader getClassLoader( final Class<?> clazz )
2229 {
2230 if ( clazz == null )
2231 {
2232 throw new NullPointerException( "clazz" );
2233 }
2234
2235 ClassLoader cl = clazz.getClassLoader();
2236 if ( cl == null )
2237 {
2238 cl = BOOTSTRAP_CLASSLOADER;
2239 }
2240
2241 return cl;
2242 }
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268 @Deprecated
2269 public static ClassLoader getClassLoader( final ClassLoader classLoader )
2270 {
2271 if ( classLoader == null )
2272 {
2273 return BOOTSTRAP_CLASSLOADER;
2274 }
2275
2276 synchronized ( defaultClassLoaders )
2277 {
2278 ClassLoader loader = null;
2279 Reference<ClassLoader> reference = defaultClassLoaders.get( classLoader );
2280
2281 if ( reference != null )
2282 {
2283 loader = reference.get();
2284 }
2285
2286 if ( loader == null )
2287 {
2288 if ( classLoader.getParent() != null
2289 && !classLoader.getParent().getClass().getName().equals( getBootstrapClassLoaderClassName() )
2290 && !classLoader.getClass().getName().equals( getRootClassLoaderClassName() ) )
2291 {
2292 loader = getClassLoader( classLoader.getParent() );
2293 }
2294 else
2295 {
2296 loader = classLoader;
2297 }
2298
2299 defaultClassLoaders.put( classLoader, new WeakReference<ClassLoader>( loader ) );
2300 }
2301
2302 return loader;
2303 }
2304 }
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318 public Object getObject( final Scope scope, final Instance instance, final ClassLoader classLoader )
2319 {
2320 if ( instance == null )
2321 {
2322 throw new NullPointerException( "instance" );
2323 }
2324 if ( classLoader == null )
2325 {
2326 throw new NullPointerException( "classLoader" );
2327 }
2328
2329 try
2330 {
2331 Object object = null;
2332
2333 if ( scope != null )
2334 {
2335 synchronized ( instance )
2336 {
2337 boolean created = true;
2338
2339 synchronized ( scope )
2340 {
2341 object = scope.getObject( instance.getIdentifier() );
2342
2343 if ( object == null )
2344 {
2345 scope.putObject( instance.getIdentifier(), instance );
2346 created = false;
2347 }
2348 }
2349
2350 if ( object instanceof Instance )
2351 {
2352 synchronized ( object )
2353 {
2354 synchronized ( scope )
2355 {
2356 object = scope.getObject( instance.getIdentifier() );
2357
2358 if ( object instanceof Instance )
2359 {
2360 throw new ObjectManagementException( getDependencyCycleMessage(
2361 Locale.getDefault(), instance.getIdentifier() ) );
2362
2363 }
2364 }
2365 }
2366 }
2367
2368 if ( !created )
2369 {
2370 try
2371 {
2372 object = this.getModules( classLoader ).createObject( instance, classLoader );
2373
2374 if ( object != null )
2375 {
2376 object = this.createProxy( instance, object, classLoader );
2377 }
2378
2379 created = true;
2380 }
2381 finally
2382 {
2383 synchronized ( scope )
2384 {
2385 if ( created && object != null )
2386 {
2387 final Object o = scope.putObject( instance.getIdentifier(), object );
2388
2389 if ( o != instance )
2390 {
2391 scope.putObject( instance.getIdentifier(), o );
2392 throw new AssertionError( getScopeContentionFailure(
2393 Locale.getDefault(), instance.getIdentifier() ) );
2394
2395 }
2396 }
2397 else
2398 {
2399 scope.removeObject( instance.getIdentifier() );
2400 }
2401 }
2402 }
2403 }
2404 }
2405 }
2406 else
2407 {
2408 object = this.getModules( classLoader ).createObject( instance, classLoader );
2409
2410 if ( object != null )
2411 {
2412 object = this.createProxy( instance, object, classLoader );
2413 }
2414 }
2415
2416 return object;
2417 }
2418 catch ( final ModelObjectException e )
2419 {
2420 throw new ObjectManagementException( getMessage( e ), e );
2421 }
2422 catch ( final InstantiationException e )
2423 {
2424 throw new ObjectManagementException( getMessage( e ), e );
2425 }
2426 }
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441 public <T> T getObject( final Class<T> specification, final URI location, final ClassLoader classLoader )
2442 {
2443 if ( specification == null )
2444 {
2445 throw new NullPointerException( "specification" );
2446 }
2447 if ( location == null )
2448 {
2449 throw new NullPointerException( "location" );
2450 }
2451 if ( classLoader == null )
2452 {
2453 throw new NullPointerException( "classLoader" );
2454 }
2455
2456 try
2457 {
2458 T object = null;
2459 final Locator locator = this.getLocator( location, classLoader );
2460
2461 if ( locator != null )
2462 {
2463 object = locator.getObject( specification, location );
2464 }
2465 else if ( this.isLoggable( Level.WARNING ) )
2466 {
2467 this.log( classLoader, Level.WARNING, getMissingLocatorMessage(
2468 Locale.getDefault(), location.getScheme() ), null );
2469
2470 }
2471
2472 return object;
2473 }
2474 catch ( final IOException e )
2475 {
2476 throw new ObjectManagementException( getMessage( e ), e );
2477 }
2478 }
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494 public Scope getScope( final String identifier, final ClassLoader classLoader )
2495 {
2496 if ( classLoader == null )
2497 {
2498 throw new NullPointerException( "classLoader" );
2499 }
2500 if ( identifier == null )
2501 {
2502 throw new NullPointerException( "identifier" );
2503 }
2504
2505 try
2506 {
2507 final ClassLoader scopesLoader = this.getDefaultClassLoader( classLoader );
2508
2509 synchronized ( this.scopes )
2510 {
2511 Map<String, Scope> cachedScopes = this.scopes.get( scopesLoader );
2512 if ( cachedScopes == null )
2513 {
2514 cachedScopes = new HashMap<String, Scope>();
2515 this.scopes.put( scopesLoader, cachedScopes );
2516 }
2517
2518 Scope scope = cachedScopes.get( identifier );
2519
2520 if ( scope == null )
2521 {
2522
2523 final Modules model = this.getModules( classLoader );
2524 final Specification scopeSpecification = model.getSpecification( Scope.class );
2525
2526 if ( scopeSpecification != null )
2527 {
2528 final Implementations implementations =
2529 model.getImplementations( scopeSpecification.getIdentifier() );
2530
2531 if ( implementations != null )
2532 {
2533 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
2534 {
2535 final Implementation impl = implementations.getImplementation().get( i );
2536
2537 if ( identifier.equals( impl.getName() ) )
2538 {
2539 final Instance instance = model.getInstance( impl.getIdentifier() );
2540
2541 if ( instance != null )
2542 {
2543 scope = (Scope) model.createObject( instance, classLoader );
2544 cachedScopes.put( identifier, scope );
2545 if ( this.isLoggable( Level.CONFIG ) )
2546 {
2547 this.log( classLoader, Level.CONFIG, getScopeInfoMessage(
2548 Locale.getDefault(), impl.getIdentifier(), identifier,
2549 this.getClassLoaderInfo( classLoader, scopesLoader ) ), null );
2550
2551 }
2552 break;
2553 }
2554 else if ( this.isLoggable( Level.WARNING ) )
2555 {
2556 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
2557 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
2558
2559 }
2560 }
2561 }
2562 }
2563 }
2564 else if ( this.isLoggable( Level.WARNING ) )
2565 {
2566 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
2567 Locale.getDefault(), Scope.class.getName() ), null );
2568
2569 }
2570
2571 if ( scope == null )
2572 {
2573 scope = this.getDefaultScope( model, identifier );
2574 if ( scope != null )
2575 {
2576 cachedScopes.put( identifier, scope );
2577 if ( this.isLoggable( Level.CONFIG ) )
2578 {
2579 this.log( classLoader, Level.CONFIG, getDefaultScopeInfoMessage(
2580 Locale.getDefault(), identifier,
2581 this.getClassLoaderInfo( classLoader, scopesLoader ) ), null );
2582
2583 }
2584 }
2585 }
2586 }
2587
2588 return scope;
2589 }
2590 }
2591 catch ( final ModelObjectException e )
2592 {
2593 throw new ObjectManagementException( getMessage( e ), e );
2594 }
2595 catch ( final InstantiationException e )
2596 {
2597 throw new ObjectManagementException( getMessage( e ), e );
2598 }
2599 }
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616 @Deprecated
2617 public Scope getDefaultScope( final String identifier )
2618 {
2619 if ( identifier == null )
2620 {
2621 throw new NullPointerException( "identifier" );
2622 }
2623
2624 DefaultScope defaultScope = null;
2625
2626 if ( identifier.equals( SINGLETON_SCOPE_IDENTIFIER ) )
2627 {
2628 defaultScope = new DefaultScope( new HashMap<String, Object>() );
2629 }
2630
2631 return defaultScope;
2632 }
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648 public Scope getDefaultScope( final Modules model, final String identifier )
2649 {
2650 if ( model == null )
2651 {
2652 throw new NullPointerException( "model" );
2653 }
2654 if ( identifier == null )
2655 {
2656 throw new NullPointerException( "identifier" );
2657 }
2658
2659 try
2660 {
2661 Scope defaultScope = null;
2662
2663 if ( identifier.equals( SINGLETON_SCOPE_IDENTIFIER ) )
2664 {
2665 defaultScope = new DefaultScope( new HashMap<String, Object>() );
2666 model.getInstance( defaultScope );
2667 }
2668
2669 return defaultScope;
2670 }
2671 catch ( final ModelObjectException e )
2672 {
2673 throw new ObjectManagementException( getMessage( e ), e );
2674 }
2675 }
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691 public Locator getLocator( final URI location, final ClassLoader classLoader )
2692 {
2693 if ( classLoader == null )
2694 {
2695 throw new NullPointerException( "classLoader" );
2696 }
2697 if ( location == null )
2698 {
2699 throw new NullPointerException( "location" );
2700 }
2701
2702 try
2703 {
2704 final String scheme = location.getScheme();
2705
2706 if ( scheme != null )
2707 {
2708 final ClassLoader locatorsLoader = this.getDefaultClassLoader( classLoader );
2709
2710 synchronized ( this.locators )
2711 {
2712 Map<String, Locator> cachedLocators = this.locators.get( locatorsLoader );
2713 if ( cachedLocators == null )
2714 {
2715 cachedLocators = new HashMap<String, Locator>();
2716 this.locators.put( locatorsLoader, cachedLocators );
2717 }
2718
2719 Locator locator = cachedLocators.get( scheme );
2720
2721 if ( locator == null )
2722 {
2723
2724 final Modules model = this.getModules( classLoader );
2725 final Specification locatorSpecification = model.getSpecification( Locator.class );
2726
2727 if ( locatorSpecification != null )
2728 {
2729 final Implementations implementations =
2730 model.getImplementations( locatorSpecification.getIdentifier() );
2731
2732 if ( implementations != null )
2733 {
2734 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
2735 {
2736 final Implementation impl = implementations.getImplementation().get( i );
2737
2738 if ( scheme.equals( impl.getName() ) )
2739 {
2740 final Instance instance = model.getInstance( impl.getIdentifier() );
2741
2742 if ( instance != null )
2743 {
2744 locator = (Locator) model.createObject( instance, classLoader );
2745 cachedLocators.put( scheme, locator );
2746
2747 if ( this.isLoggable( Level.CONFIG ) )
2748 {
2749 this.log( classLoader, Level.CONFIG, getLocatorInfoMessage(
2750 Locale.getDefault(), impl.getIdentifier(), scheme,
2751 this.getClassLoaderInfo( classLoader, locatorsLoader ) ), null );
2752
2753 }
2754
2755 break;
2756 }
2757 else if ( this.isLoggable( Level.WARNING ) )
2758 {
2759 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
2760 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
2761
2762 }
2763 }
2764 }
2765 }
2766 }
2767 else if ( this.isLoggable( Level.WARNING ) )
2768 {
2769 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
2770 Locale.getDefault(), Locator.class.getName() ), null );
2771
2772 }
2773
2774 if ( locator == null )
2775 {
2776 locator = this.getDefaultLocator( model, location );
2777 if ( locator != null )
2778 {
2779 cachedLocators.put( scheme, locator );
2780 if ( this.isLoggable( Level.CONFIG ) )
2781 {
2782 this.log( classLoader, Level.CONFIG, getDefaultLocatorInfoMessage(
2783 Locale.getDefault(), scheme,
2784 this.getClassLoaderInfo( classLoader, locatorsLoader ) ), null );
2785
2786 }
2787 }
2788 }
2789 }
2790
2791 return locator;
2792 }
2793 }
2794
2795 return null;
2796 }
2797 catch ( final ModelObjectException e )
2798 {
2799 throw new ObjectManagementException( getMessage( e ), e );
2800 }
2801 catch ( final InstantiationException e )
2802 {
2803 throw new ObjectManagementException( getMessage( e ), e );
2804 }
2805 }
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822 @Deprecated
2823 public Locator getDefaultLocator( final URI location )
2824 {
2825 if ( location == null )
2826 {
2827 throw new NullPointerException( "location" );
2828 }
2829
2830 Locator locator = null;
2831 final DefaultLocator defaultLocator = new DefaultLocator();
2832
2833 if ( defaultLocator.isLocationSupported( location ) )
2834 {
2835 locator = defaultLocator;
2836 }
2837
2838 return locator;
2839 }
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857 public Locator getDefaultLocator( final Modules model, final URI location )
2858 {
2859 if ( model == null )
2860 {
2861 throw new NullPointerException( "model" );
2862 }
2863 if ( location == null )
2864 {
2865 throw new NullPointerException( "location" );
2866 }
2867
2868 try
2869 {
2870 Locator locator = null;
2871 final DefaultLocator defaultLocator = new DefaultLocator();
2872
2873 if ( defaultLocator.isLocationSupported( location ) )
2874 {
2875 locator = defaultLocator;
2876 model.getInstance( locator );
2877 }
2878
2879 return locator;
2880 }
2881 catch ( final ModelObjectException e )
2882 {
2883 throw new ObjectManagementException( getMessage( e ), e );
2884 }
2885 }
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899 public Invoker getInvoker( final ClassLoader classLoader )
2900 {
2901 if ( classLoader == null )
2902 {
2903 throw new NullPointerException( "classLoader" );
2904 }
2905
2906 try
2907 {
2908 final ClassLoader invokersLoader = this.getDefaultClassLoader( classLoader );
2909
2910 synchronized ( this.invokers )
2911 {
2912 Invoker invoker = this.invokers.get( invokersLoader );
2913
2914 if ( invoker == null )
2915 {
2916 final Modules model = this.getModules( classLoader );
2917 final Specification invokerSpecification = model.getSpecification( Invoker.class );
2918
2919 if ( invokerSpecification != null )
2920 {
2921 final Implementations implementations =
2922 model.getImplementations( invokerSpecification.getIdentifier() );
2923
2924 if ( implementations != null && !implementations.getImplementation().isEmpty() )
2925 {
2926 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
2927 {
2928 final Implementation impl = implementations.getImplementation().get( i );
2929
2930 if ( invoker == null )
2931 {
2932 final Instance invokerInstance = model.getInstance( impl.getIdentifier() );
2933
2934 if ( invokerInstance != null )
2935 {
2936 invoker = (Invoker) model.createObject( invokerInstance, classLoader );
2937 this.invokers.put( invokersLoader, invoker );
2938
2939 if ( this.isLoggable( Level.CONFIG ) )
2940 {
2941 this.log( classLoader, Level.CONFIG, getInvokerInfoMessage(
2942 Locale.getDefault(), impl.getIdentifier(),
2943 this.getClassLoaderInfo( classLoader, invokersLoader ) ), null );
2944
2945 }
2946 }
2947 else if ( this.isLoggable( Level.WARNING ) )
2948 {
2949 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
2950 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
2951
2952 }
2953 }
2954 else if ( this.isLoggable( Level.CONFIG ) )
2955 {
2956 this.log( classLoader, Level.CONFIG, getIgnoredInvokerMessage(
2957 Locale.getDefault(), impl.getIdentifier() ), null );
2958
2959 }
2960 }
2961 }
2962 }
2963 else if ( this.isLoggable( Level.WARNING ) )
2964 {
2965 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
2966 Locale.getDefault(), Invoker.class.getName() ), null );
2967
2968 }
2969
2970 if ( invoker == null )
2971 {
2972 invoker = this.getDefaultInvoker( model );
2973 this.invokers.put( invokersLoader, invoker );
2974 if ( this.isLoggable( Level.CONFIG ) )
2975 {
2976 this.log( classLoader, Level.CONFIG, getDefaultInvokerInfoMessage(
2977 Locale.getDefault(), this.getClassLoaderInfo( classLoader, invokersLoader ) ),
2978 null );
2979
2980 }
2981 }
2982 }
2983
2984 return invoker;
2985 }
2986 }
2987 catch ( final ModelObjectException e )
2988 {
2989 throw new ObjectManagementException( getMessage( e ), e );
2990 }
2991 catch ( final InstantiationException e )
2992 {
2993 throw new ObjectManagementException( getMessage( e ), e );
2994 }
2995 }
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009 @Deprecated
3010 public Invoker getDefaultInvoker()
3011 {
3012 return new DefaultInvoker();
3013 }
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029 public Invoker getDefaultInvoker( final Modules model )
3030 {
3031 if ( model == null )
3032 {
3033 throw new NullPointerException( "model" );
3034 }
3035
3036 try
3037 {
3038 final Invoker defaultInvoker = new DefaultInvoker();
3039 model.getInstance( defaultInvoker );
3040 return defaultInvoker;
3041 }
3042 catch ( final ModelObjectException e )
3043 {
3044 throw new ObjectManagementException( getMessage( e ), e );
3045 }
3046 }
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064 @Deprecated
3065 public Invocation getInvocation( final Object object, final Instance instance, final Method method,
3066 final Object[] arguments ) throws InstantiationException
3067 {
3068 return this.getInvocation( this.getDefaultClassLoader( object.getClass() ), object, instance, method,
3069 arguments );
3070
3071 }
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093 public Invocation getInvocation( final ClassLoader classLoader, final Object object, final Instance instance,
3094 final Method method, final Object[] arguments )
3095 {
3096 if ( classLoader == null )
3097 {
3098 throw new NullPointerException( "classLoader" );
3099 }
3100 if ( object == null )
3101 {
3102 throw new NullPointerException( "object" );
3103 }
3104 if ( instance == null )
3105 {
3106 throw new NullPointerException( "instance" );
3107 }
3108 if ( method == null )
3109 {
3110 throw new NullPointerException( "method" );
3111 }
3112
3113 try
3114 {
3115 Invocation invocation = null;
3116 final Modules model = this.getModules( classLoader );
3117 final Specification invocationSpecification = model.getSpecification( Invocation.class );
3118
3119 if ( invocationSpecification != null )
3120 {
3121 final Implementations implementations =
3122 model.getImplementations( invocationSpecification.getIdentifier() );
3123
3124 if ( implementations != null && !implementations.getImplementation().isEmpty() )
3125 {
3126 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
3127 {
3128 final Implementation impl = implementations.getImplementation().get( i );
3129
3130 if ( invocation == null )
3131 {
3132 final Instance invocationInstance = model.getInstance( impl.getIdentifier() );
3133
3134 if ( invocationInstance != null )
3135 {
3136 invocation = (Invocation) model.createObject( invocationInstance, classLoader );
3137 }
3138 else if ( this.isLoggable( Level.WARNING ) )
3139 {
3140 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
3141 Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );
3142
3143 }
3144 }
3145 else if ( this.isLoggable( Level.CONFIG ) )
3146 {
3147 this.log( classLoader, Level.CONFIG, getIgnoredInvocationMessage(
3148 Locale.getDefault(), impl.getIdentifier() ), null );
3149
3150 }
3151 }
3152 }
3153 }
3154 else if ( this.isLoggable( Level.WARNING ) )
3155 {
3156 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
3157 Locale.getDefault(), Invocation.class.getName() ), null );
3158
3159 }
3160
3161 if ( invocation == null )
3162 {
3163 invocation = this.getDefaultInvocation( model );
3164 }
3165
3166 invocation.getContext().put( DefaultInvocation.OBJECT_KEY, object );
3167 invocation.getContext().put( DefaultInvocation.METHOD_KEY, method );
3168 invocation.getContext().put( DefaultInvocation.ARGUMENTS_KEY, arguments );
3169 invocation.getContext().put( DefaultInvocation.INSTANCE_KEY, instance );
3170 invocation.getContext().put( DefaultInvocation.MODULES_KEY, model );
3171 invocation.getContext().put( DefaultInvocation.CLASSLOADER_KEY, classLoader );
3172 return invocation;
3173 }
3174 catch ( final ModelObjectException e )
3175 {
3176 throw new ObjectManagementException( getMessage( e ), e );
3177 }
3178 catch ( final InstantiationException e )
3179 {
3180 throw new ObjectManagementException( getMessage( e ), e );
3181 }
3182 }
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196 @Deprecated
3197 public Invocation getDefaultInvocation()
3198 {
3199 return new DefaultInvocation();
3200 }
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216 public Invocation getDefaultInvocation( final Modules model )
3217 {
3218 if ( model == null )
3219 {
3220 throw new NullPointerException( "model" );
3221 }
3222
3223 try
3224 {
3225 final Invocation defaultInvocation = new DefaultInvocation();
3226 model.getInstance( defaultInvocation );
3227 return defaultInvocation;
3228 }
3229 catch ( final ModelObjectException e )
3230 {
3231 throw new ObjectManagementException( getMessage( e ), e );
3232 }
3233 }
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243 public synchronized void initialize()
3244 {
3245 try
3246 {
3247 if ( !this.initialized )
3248 {
3249 try
3250 {
3251 final long t0 = System.currentTimeMillis();
3252 this.initialized = true;
3253
3254 this.listeners.clear();
3255 this.modules.clear();
3256 this.invokers.clear();
3257 this.locators.clear();
3258 this.scopes.clear();
3259
3260 final ClassLoader classLoader = this.getDefaultClassLoader( this.getClass() );
3261 final List<LogRecord> bootstrapLogRecords = new ArrayList<LogRecord>( 1024 );
3262 final List<Listener> bootstrapListeners = new ArrayList<Listener>( 1 );
3263 bootstrapListeners.add( new Listener()
3264 {
3265
3266 public void onLog( final Level level, final String message, final Throwable throwable )
3267 {
3268 final LogRecord r = new LogRecord( level, message );
3269 r.setThrown( throwable );
3270
3271 bootstrapLogRecords.add( r );
3272 }
3273
3274 } );
3275
3276 this.listeners.put( this.getDefaultClassLoader( classLoader ),
3277 Collections.unmodifiableList( bootstrapListeners ) );
3278
3279 final Modules model = this.getModules( classLoader );
3280 final Specification objectManager = model.getSpecification( ObjectManager.class );
3281 if ( objectManager == null )
3282 {
3283 throw new InstantiationException( getMissingSpecificationMessage(
3284 Locale.getDefault(), ObjectManager.class.getName() ) );
3285
3286 }
3287
3288 final Implementation thisImplementation = model.getImplementation( this.getClass() );
3289 if ( thisImplementation == null )
3290 {
3291 throw new InstantiationException( getMissingImplementationMessage(
3292 Locale.getDefault(), objectManager.getIdentifier(), this.getClass().getName() ) );
3293
3294 }
3295
3296 final Instance thisInstance = model.getInstance( this );
3297 if ( thisInstance == null )
3298 {
3299 throw new InstantiationException( getMissingInstanceMessage(
3300 Locale.getDefault(), objectManager.getIdentifier(), thisImplementation.getName() ) );
3301
3302 }
3303
3304 if ( objectManager.getScope() != null )
3305 {
3306 final Scope scope = this.getScope( objectManager.getScope(), classLoader );
3307 if ( scope == null )
3308 {
3309 throw new InstantiationException( getMissingScopeMessage(
3310 Locale.getDefault(), objectManager.getScope() ) );
3311
3312 }
3313
3314 scope.putObject( thisInstance.getIdentifier(), this );
3315 }
3316
3317 if ( this.isLoggable( Level.FINE ) )
3318 {
3319 this.log( Level.FINE, getImplementationInfoMessage(
3320 Locale.getDefault(), Long.valueOf( System.currentTimeMillis() - t0 ) ), null );
3321
3322 }
3323
3324 this.listeners.clear();
3325
3326 for ( final LogRecord r : bootstrapLogRecords )
3327 {
3328 this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
3329 }
3330 }
3331 catch ( final InstantiationException e )
3332 {
3333 this.listeners.clear();
3334 this.modules.clear();
3335 this.invokers.clear();
3336 this.locators.clear();
3337 this.scopes.clear();
3338 this.initialized = false;
3339
3340 throw new ObjectManagementException( getMessage( e ), e );
3341 }
3342 }
3343 }
3344 catch ( final ModelObjectException e )
3345 {
3346 throw new ObjectManagementException( getMessage( e ), e );
3347 }
3348 }
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361 private Object createProxy( final Instance instance, final Object object, final ClassLoader classLoader )
3362 {
3363 try
3364 {
3365 Constructor<?> proxyClassConstructor = null;
3366
3367 synchronized ( proxyClassConstructors )
3368 {
3369 Map<String, Reference<Constructor<?>>> map = proxyClassConstructors.get( classLoader );
3370
3371 if ( map == null )
3372 {
3373 map = new HashMap<String, Reference<Constructor<?>>>();
3374 proxyClassConstructors.put( classLoader, map );
3375 }
3376
3377 Reference<Constructor<?>> reference = map.get( instance.getIdentifier() );
3378
3379 if ( reference != null )
3380 {
3381 proxyClassConstructor = reference.get();
3382 }
3383
3384 if ( proxyClassConstructor == null
3385 && ( reference != null || !map.containsKey( instance.getIdentifier() ) ) )
3386 {
3387 final Class<?> proxyClass = instance.getJavaProxyClass( classLoader );
3388
3389 if ( proxyClass != null )
3390 {
3391 proxyClassConstructor = proxyClass.getConstructor( INVOCATION_HANDLER_ARGUMENTS );
3392 }
3393
3394 map.put( instance.getIdentifier(), new WeakReference<Constructor<?>>( proxyClassConstructor ) );
3395 }
3396 }
3397
3398 Object proxyObject = object;
3399
3400 if ( proxyClassConstructor != null )
3401 {
3402 proxyObject = proxyClassConstructor.newInstance( new Object[]
3403 {
3404 new InvocationHandler()
3405 {
3406
3407 private final Invoker invoker = getInvoker( classLoader );
3408
3409 public Object invoke( final Object proxy, final Method method, final Object[] args )
3410 throws Throwable
3411 {
3412 if ( args != null )
3413 {
3414 Object[] clonedArgs = args;
3415
3416 for ( int i = 0, s0 = clonedArgs.length; i < s0; i++ )
3417 {
3418 if ( clonedArgs[i] == proxy )
3419 {
3420 if ( clonedArgs == args )
3421 {
3422 clonedArgs = clonedArgs.clone();
3423 }
3424
3425 clonedArgs[i] = object;
3426 }
3427 }
3428
3429 return this.invoker.invoke( getInvocation(
3430 classLoader, object, instance, method, clonedArgs ) );
3431
3432 }
3433
3434 return this.invoker.invoke( getInvocation(
3435 classLoader, object, instance, method, null ) );
3436
3437 }
3438
3439 }
3440 } );
3441
3442 }
3443
3444 return proxyObject;
3445 }
3446 catch ( final ModelObjectException e )
3447 {
3448 throw new ObjectManagementException( getMessage( e ), e );
3449 }
3450 catch ( final ClassNotFoundException e )
3451 {
3452 throw new ObjectManagementException( getMessage( e ), e );
3453 }
3454 catch ( final NoSuchMethodException e )
3455 {
3456 throw new ObjectManagementException( getMessage( e ), e );
3457 }
3458 catch ( final IllegalAccessException e )
3459 {
3460 throw new ObjectManagementException( getMessage( e ), e );
3461 }
3462 catch ( final InstantiationException e )
3463 {
3464 throw new ObjectManagementException( getMessage( e ), e );
3465 }
3466 catch ( final InvocationTargetException e )
3467 {
3468 throw new ObjectManagementException( getMessage( e ), e );
3469 }
3470 }
3471
3472 private void logModulesReport( final Modules mods, final ClassLoader classLoader )
3473 {
3474 final StringBuilder modulesInfo = new StringBuilder( 8192 );
3475
3476 this.log( classLoader, Level.FINEST, getModulesReportMessage( Locale.getDefault() ), null );
3477
3478 modulesInfo.append( "\tClassLoader:" ).append( classLoader );
3479
3480 if ( mods.getDocumentation() != null )
3481 {
3482 modulesInfo.append( "|Documentation:" ).append( mods.getDocumentation().getText(
3483 Locale.getDefault().getLanguage() ).getValue() );
3484
3485 }
3486
3487 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3488
3489 for ( final Module m : mods.getModule() )
3490 {
3491 modulesInfo.setLength( 0 );
3492 modulesInfo.append( "\tM:" ).append( m.getName() );
3493
3494 if ( m.getVersion() != null )
3495 {
3496 modulesInfo.append( "|Version:" ).append( m.getVersion() );
3497 }
3498 if ( m.getVendor() != null )
3499 {
3500 modulesInfo.append( "|Vendor:" ).append( m.getVendor() );
3501 }
3502
3503 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3504 modulesInfo.setLength( 0 );
3505
3506 if ( m.getSpecifications() != null )
3507 {
3508 for ( final Specification s : m.getSpecifications().getSpecification() )
3509 {
3510 modulesInfo.append( "\t\t" );
3511 this.appendSpecificationInfo( s, modulesInfo );
3512 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3513 modulesInfo.setLength( 0 );
3514
3515 final Implementations available = mods.getImplementations( s.getIdentifier() );
3516
3517 if ( available != null )
3518 {
3519 for ( final Implementation i : available.getImplementation() )
3520 {
3521 modulesInfo.append( "\t\t\t" );
3522 this.appendImplementationInfo( i, modulesInfo ).append( "|Module:" ).
3523 append( mods.getModuleOfImplementation( i.getIdentifier() ).getName() );
3524
3525 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3526 modulesInfo.setLength( 0 );
3527 }
3528 }
3529 }
3530 }
3531
3532 if ( m.getImplementations() != null )
3533 {
3534 for ( final Implementation i : m.getImplementations().getImplementation() )
3535 {
3536 modulesInfo.append( "\t\t" );
3537 this.appendImplementationInfo( i, modulesInfo );
3538 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3539 modulesInfo.setLength( 0 );
3540
3541 if ( i.getImplementations() != null )
3542 {
3543 modulesInfo.append( "\t\t\t" );
3544 for ( final ImplementationReference r : i.getImplementations().getReference() )
3545 {
3546 this.appendImplementationInfo(
3547 mods.getImplementation( r.getIdentifier() ), modulesInfo ).append( "|Module:" ).
3548 append( mods.getModuleOfImplementation( r.getIdentifier() ).getName() );
3549
3550 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3551 modulesInfo.setLength( 0 );
3552 }
3553 }
3554 if ( i.getSpecifications() != null )
3555 {
3556 for ( final SpecificationReference s : i.getSpecifications().getReference() )
3557 {
3558 modulesInfo.append( "\t\t\tS:" ).append( s.getIdentifier() );
3559
3560 if ( s.getVersion() != null )
3561 {
3562 modulesInfo.append( "|Version:" ).append( s.getVersion() );
3563 }
3564
3565 modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
3566 s.getIdentifier() ).getName() );
3567
3568 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3569 modulesInfo.setLength( 0 );
3570 }
3571 }
3572
3573 if ( i.getDependencies() != null )
3574 {
3575 for ( final Dependency d : i.getDependencies().getDependency() )
3576 {
3577 modulesInfo.append( "\t\t\tD:" ).append( d.getName() ).append( "|Identifier:" ).
3578 append( d.getIdentifier() );
3579
3580 if ( d.getImplementationName() != null )
3581 {
3582 modulesInfo.append( "|Name:" ).append( d.getImplementationName() );
3583 }
3584
3585 modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
3586 d.getIdentifier() ).getName() );
3587
3588 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3589 modulesInfo.setLength( 0 );
3590
3591 final Implementations available = mods.getImplementations( d.getIdentifier() );
3592
3593 if ( available != null )
3594 {
3595 for ( final Implementation di : available.getImplementation() )
3596 {
3597 modulesInfo.append( "\t\t\t\t" );
3598 this.appendImplementationInfo( di, modulesInfo ).append( "|Module:" ).
3599 append( mods.getModuleOfImplementation( di.getIdentifier() ).getName() );
3600
3601 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3602 modulesInfo.setLength( 0 );
3603 }
3604 }
3605 }
3606 }
3607
3608 if ( i.getMessages() != null )
3609 {
3610 for ( final Message msg : i.getMessages().getMessage() )
3611 {
3612 modulesInfo.append( "\t\t\tM:" ).append( msg.getName() ).append( "|Text:" ).
3613 append( msg.getTemplate().getText( Locale.getDefault().getLanguage() ).getValue() );
3614
3615 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3616 modulesInfo.setLength( 0 );
3617 }
3618 }
3619
3620 if ( i.getProperties() != null )
3621 {
3622 for ( final Property p : i.getProperties().getProperty() )
3623 {
3624 modulesInfo.append( "\t\t\tP:" ).append( p.getName() );
3625 modulesInfo.append( "|Type:" ).append( p.getType() );
3626 modulesInfo.append( "|Value:" ).append( p.getValue() );
3627
3628 try
3629 {
3630 modulesInfo.append( "|JavaValue:" ).append( p.getJavaValue( classLoader ) );
3631 }
3632 catch ( final ModelObjectException e )
3633 {
3634 modulesInfo.append( "|JavaValue:" ).append( e );
3635 }
3636
3637 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3638 modulesInfo.setLength( 0 );
3639 }
3640 }
3641 }
3642 }
3643 }
3644 }
3645
3646 private StringBuilder appendSpecificationInfo( final Specification s, final StringBuilder b )
3647 {
3648 b.append( "S:" ).append( s.getIdentifier() );
3649 if ( s.getVersion() != null )
3650 {
3651 b.append( "|Version:" ).append( s.getVersion() );
3652 }
3653 if ( s.getVendor() != null )
3654 {
3655 b.append( "|Vendor:" ).append( s.getVendor() );
3656 }
3657
3658 b.append( "|Multiplicity:" ).append( s.getMultiplicity() ).append( "|Scope:" ).
3659 append( s.getScope() == null ? "Multiton" : s.getScope() );
3660
3661 if ( s.getClazz() != null )
3662 {
3663 b.append( "|Class:" ).append( s.getClazz() );
3664 }
3665
3666 return b;
3667 }
3668
3669 private StringBuilder appendImplementationInfo( final Implementation i, final StringBuilder b )
3670 {
3671 b.append( "I:" ).append( i.getIdentifier() ).append( "|Name:" ).append( i.getName() ).append( "|Abstract:" ).
3672 append( i.isAbstract() ).append( "|Final:" ).append( i.isFinal() ).append( "|Stateless:" ).
3673 append( i.isStateless() );
3674
3675 if ( i.getVersion() != null )
3676 {
3677 b.append( "|Version:" ).append( i.getVersion() );
3678 }
3679 if ( i.getVendor() != null )
3680 {
3681 b.append( "|Vendor:" ).append( i.getVendor() );
3682 }
3683 if ( i.getClazz() != null )
3684 {
3685 b.append( "|Class:" ).append( i.getClazz() );
3686 }
3687 if ( i.getLocation() != null )
3688 {
3689 b.append( "|Location:" ).append( i.getLocation() );
3690 }
3691
3692 return b;
3693 }
3694
3695 private String getClassLoaderInfo( final ClassLoader current, final ClassLoader parent )
3696 {
3697 final StringBuilder b = new StringBuilder();
3698 appendClassLoaderInfo( b, current );
3699
3700 if ( parent != null )
3701 {
3702 b.append( " => " );
3703 appendClassLoaderInfo( b, parent );
3704 }
3705
3706 return b.toString();
3707 }
3708
3709 private String getObjectInfo( final Object object )
3710 {
3711 final StringBuilder b = new StringBuilder();
3712 appendObjectInfo( b, object );
3713 b.append( " @ " );
3714 appendClassLoaderInfo( b, this.getDefaultClassLoader( object.getClass() ) );
3715 return b.toString();
3716 }
3717
3718 private static StringBuilder appendClassLoaderInfo( final StringBuilder b, final ClassLoader classLoader )
3719 {
3720 return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( classLoader ) ) ).append( ")" ).
3721 append( classLoader );
3722
3723 }
3724
3725 private static StringBuilder appendObjectInfo( final StringBuilder b, final Object object )
3726 {
3727 return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( object ) ) ).append( ")" ).
3728 append( object );
3729
3730 }
3731
3732 private static String getMessage( final Throwable t )
3733 {
3734 return t != null
3735 ? t.getMessage() != null && t.getMessage().trim().length() > 0
3736 ? t.getMessage()
3737 : getMessage( t.getCause() )
3738 : null;
3739
3740 }
3741
3742 private static Specification createDefaultSpecification( final Class<?> specification,
3743 final Multiplicity multiplicity, final String scope )
3744 {
3745 final Specification s = new Specification();
3746 s.setClassDeclaration( true );
3747 s.setClazz( specification.getName() );
3748 s.setIdentifier( specification.getName() );
3749 s.setMultiplicity( multiplicity );
3750 s.setScope( scope );
3751 s.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
3752 s.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
3753 return s;
3754 }
3755
3756 private static Implementation createDefaultImplementation( final Class<?> implementation, final String name )
3757 {
3758 final Implementation i = new Implementation();
3759 i.setClassDeclaration( true );
3760 i.setClazz( implementation.getName() );
3761 i.setIdentifier( implementation.getName() );
3762 i.setName( name );
3763 i.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
3764 i.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
3765 return i;
3766 }
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
3789 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
3790 private static String getCreatingModulesInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
3791 {
3792 java.io.BufferedReader reader = null;
3793 boolean suppressExceptionOnClose = true;
3794
3795 try
3796 {
3797 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Creating Modules Info" ), classLoaderInfo, (Object) null );
3798 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3799 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3800 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3801
3802 String line;
3803 while ( ( line = reader.readLine() ) != null )
3804 {
3805 builder.append( lineSeparator ).append( line );
3806 }
3807
3808 suppressExceptionOnClose = false;
3809 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3810 }
3811 catch( final java.lang.ClassCastException e )
3812 {
3813 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3814 }
3815 catch( final java.lang.IllegalArgumentException e )
3816 {
3817 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3818 }
3819 catch( final java.util.MissingResourceException e )
3820 {
3821 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3822 }
3823 catch( final java.io.IOException e )
3824 {
3825 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3826 }
3827 finally
3828 {
3829 try
3830 {
3831 if( reader != null )
3832 {
3833 reader.close();
3834 }
3835 }
3836 catch( final java.io.IOException e )
3837 {
3838 if( !suppressExceptionOnClose )
3839 {
3840 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3841 }
3842 }
3843 }
3844 }
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
3858 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
3859 private static String getDefaultImplementationName( final java.util.Locale locale )
3860 {
3861 java.io.BufferedReader reader = null;
3862 boolean suppressExceptionOnClose = true;
3863
3864 try
3865 {
3866 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Implementation Name" ), (Object) null );
3867 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3868 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3869 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3870
3871 String line;
3872 while ( ( line = reader.readLine() ) != null )
3873 {
3874 builder.append( lineSeparator ).append( line );
3875 }
3876
3877 suppressExceptionOnClose = false;
3878 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3879 }
3880 catch( final java.lang.ClassCastException e )
3881 {
3882 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3883 }
3884 catch( final java.lang.IllegalArgumentException e )
3885 {
3886 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3887 }
3888 catch( final java.util.MissingResourceException e )
3889 {
3890 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3891 }
3892 catch( final java.io.IOException e )
3893 {
3894 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3895 }
3896 finally
3897 {
3898 try
3899 {
3900 if( reader != null )
3901 {
3902 reader.close();
3903 }
3904 }
3905 catch( final java.io.IOException e )
3906 {
3907 if( !suppressExceptionOnClose )
3908 {
3909 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3910 }
3911 }
3912 }
3913 }
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
3928 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
3929 private static String getDefaultInvokerInfoMessage( final java.util.Locale locale, final java.lang.String classLoaderInfo )
3930 {
3931 java.io.BufferedReader reader = null;
3932 boolean suppressExceptionOnClose = true;
3933
3934 try
3935 {
3936 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Invoker Info Message" ), classLoaderInfo, (Object) null );
3937 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3938 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3939 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3940
3941 String line;
3942 while ( ( line = reader.readLine() ) != null )
3943 {
3944 builder.append( lineSeparator ).append( line );
3945 }
3946
3947 suppressExceptionOnClose = false;
3948 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3949 }
3950 catch( final java.lang.ClassCastException e )
3951 {
3952 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3953 }
3954 catch( final java.lang.IllegalArgumentException e )
3955 {
3956 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3957 }
3958 catch( final java.util.MissingResourceException e )
3959 {
3960 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3961 }
3962 catch( final java.io.IOException e )
3963 {
3964 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3965 }
3966 finally
3967 {
3968 try
3969 {
3970 if( reader != null )
3971 {
3972 reader.close();
3973 }
3974 }
3975 catch( final java.io.IOException e )
3976 {
3977 if( !suppressExceptionOnClose )
3978 {
3979 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3980 }
3981 }
3982 }
3983 }
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
3998 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
3999 private static String getDefaultListenerInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
4000 {
4001 java.io.BufferedReader reader = null;
4002 boolean suppressExceptionOnClose = true;
4003
4004 try
4005 {
4006 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Listener Info" ), classLoaderInfo, (Object) null );
4007 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4008 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4009 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4010
4011 String line;
4012 while ( ( line = reader.readLine() ) != null )
4013 {
4014 builder.append( lineSeparator ).append( line );
4015 }
4016
4017 suppressExceptionOnClose = false;
4018 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4019 }
4020 catch( final java.lang.ClassCastException e )
4021 {
4022 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4023 }
4024 catch( final java.lang.IllegalArgumentException e )
4025 {
4026 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4027 }
4028 catch( final java.util.MissingResourceException e )
4029 {
4030 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4031 }
4032 catch( final java.io.IOException e )
4033 {
4034 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4035 }
4036 finally
4037 {
4038 try
4039 {
4040 if( reader != null )
4041 {
4042 reader.close();
4043 }
4044 }
4045 catch( final java.io.IOException e )
4046 {
4047 if( !suppressExceptionOnClose )
4048 {
4049 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4050 }
4051 }
4052 }
4053 }
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4069 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4070 private static String getDefaultLocatorInfoMessage( final java.util.Locale locale, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
4071 {
4072 java.io.BufferedReader reader = null;
4073 boolean suppressExceptionOnClose = true;
4074
4075 try
4076 {
4077 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Locator Info Message" ), schemeInfo, classLoaderInfo, (Object) null );
4078 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4079 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4080 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4081
4082 String line;
4083 while ( ( line = reader.readLine() ) != null )
4084 {
4085 builder.append( lineSeparator ).append( line );
4086 }
4087
4088 suppressExceptionOnClose = false;
4089 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4090 }
4091 catch( final java.lang.ClassCastException e )
4092 {
4093 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4094 }
4095 catch( final java.lang.IllegalArgumentException e )
4096 {
4097 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4098 }
4099 catch( final java.util.MissingResourceException e )
4100 {
4101 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4102 }
4103 catch( final java.io.IOException e )
4104 {
4105 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4106 }
4107 finally
4108 {
4109 try
4110 {
4111 if( reader != null )
4112 {
4113 reader.close();
4114 }
4115 }
4116 catch( final java.io.IOException e )
4117 {
4118 if( !suppressExceptionOnClose )
4119 {
4120 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4121 }
4122 }
4123 }
4124 }
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4139 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4140 private static String getDefaultLogLevelInfoMessage( final java.util.Locale locale, final java.lang.String logLevel )
4141 {
4142 java.io.BufferedReader reader = null;
4143 boolean suppressExceptionOnClose = true;
4144
4145 try
4146 {
4147 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Log Level Info Message" ), logLevel, (Object) null );
4148 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4149 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4150 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4151
4152 String line;
4153 while ( ( line = reader.readLine() ) != null )
4154 {
4155 builder.append( lineSeparator ).append( line );
4156 }
4157
4158 suppressExceptionOnClose = false;
4159 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4160 }
4161 catch( final java.lang.ClassCastException e )
4162 {
4163 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4164 }
4165 catch( final java.lang.IllegalArgumentException e )
4166 {
4167 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4168 }
4169 catch( final java.util.MissingResourceException e )
4170 {
4171 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4172 }
4173 catch( final java.io.IOException e )
4174 {
4175 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4176 }
4177 finally
4178 {
4179 try
4180 {
4181 if( reader != null )
4182 {
4183 reader.close();
4184 }
4185 }
4186 catch( final java.io.IOException e )
4187 {
4188 if( !suppressExceptionOnClose )
4189 {
4190 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4191 }
4192 }
4193 }
4194 }
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4209 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4210 private static String getDefaultModelIdentifierInfo( final java.util.Locale locale, final java.lang.String defaultValue )
4211 {
4212 java.io.BufferedReader reader = null;
4213 boolean suppressExceptionOnClose = true;
4214
4215 try
4216 {
4217 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Identifier Info" ), defaultValue, (Object) null );
4218 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4219 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4220 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4221
4222 String line;
4223 while ( ( line = reader.readLine() ) != null )
4224 {
4225 builder.append( lineSeparator ).append( line );
4226 }
4227
4228 suppressExceptionOnClose = false;
4229 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4230 }
4231 catch( final java.lang.ClassCastException e )
4232 {
4233 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4234 }
4235 catch( final java.lang.IllegalArgumentException e )
4236 {
4237 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4238 }
4239 catch( final java.util.MissingResourceException e )
4240 {
4241 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4242 }
4243 catch( final java.io.IOException e )
4244 {
4245 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4246 }
4247 finally
4248 {
4249 try
4250 {
4251 if( reader != null )
4252 {
4253 reader.close();
4254 }
4255 }
4256 catch( final java.io.IOException e )
4257 {
4258 if( !suppressExceptionOnClose )
4259 {
4260 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4261 }
4262 }
4263 }
4264 }
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4279 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4280 private static String getDefaultModelObjectClasspahResolutionEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
4281 {
4282 java.io.BufferedReader reader = null;
4283 boolean suppressExceptionOnClose = true;
4284
4285 try
4286 {
4287 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Object Classpah Resolution Enabled Info" ), defaultValue, (Object) null );
4288 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4289 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4290 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4291
4292 String line;
4293 while ( ( line = reader.readLine() ) != null )
4294 {
4295 builder.append( lineSeparator ).append( line );
4296 }
4297
4298 suppressExceptionOnClose = false;
4299 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4300 }
4301 catch( final java.lang.ClassCastException e )
4302 {
4303 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4304 }
4305 catch( final java.lang.IllegalArgumentException e )
4306 {
4307 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4308 }
4309 catch( final java.util.MissingResourceException e )
4310 {
4311 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4312 }
4313 catch( final java.io.IOException e )
4314 {
4315 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4316 }
4317 finally
4318 {
4319 try
4320 {
4321 if( reader != null )
4322 {
4323 reader.close();
4324 }
4325 }
4326 catch( final java.io.IOException e )
4327 {
4328 if( !suppressExceptionOnClose )
4329 {
4330 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4331 }
4332 }
4333 }
4334 }
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4349 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4350 private static String getDefaultModelProcessingEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
4351 {
4352 java.io.BufferedReader reader = null;
4353 boolean suppressExceptionOnClose = true;
4354
4355 try
4356 {
4357 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Processing Enabled Info" ), defaultValue, (Object) null );
4358 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4359 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4360 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4361
4362 String line;
4363 while ( ( line = reader.readLine() ) != null )
4364 {
4365 builder.append( lineSeparator ).append( line );
4366 }
4367
4368 suppressExceptionOnClose = false;
4369 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4370 }
4371 catch( final java.lang.ClassCastException e )
4372 {
4373 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4374 }
4375 catch( final java.lang.IllegalArgumentException e )
4376 {
4377 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4378 }
4379 catch( final java.util.MissingResourceException e )
4380 {
4381 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4382 }
4383 catch( final java.io.IOException e )
4384 {
4385 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4386 }
4387 finally
4388 {
4389 try
4390 {
4391 if( reader != null )
4392 {
4393 reader.close();
4394 }
4395 }
4396 catch( final java.io.IOException e )
4397 {
4398 if( !suppressExceptionOnClose )
4399 {
4400 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4401 }
4402 }
4403 }
4404 }
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4418 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4419 private static String getDefaultModuleName( final java.util.Locale locale )
4420 {
4421 java.io.BufferedReader reader = null;
4422 boolean suppressExceptionOnClose = true;
4423
4424 try
4425 {
4426 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Module Name" ), (Object) null );
4427 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4428 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4429 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4430
4431 String line;
4432 while ( ( line = reader.readLine() ) != null )
4433 {
4434 builder.append( lineSeparator ).append( line );
4435 }
4436
4437 suppressExceptionOnClose = false;
4438 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4439 }
4440 catch( final java.lang.ClassCastException e )
4441 {
4442 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4443 }
4444 catch( final java.lang.IllegalArgumentException e )
4445 {
4446 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4447 }
4448 catch( final java.util.MissingResourceException e )
4449 {
4450 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4451 }
4452 catch( final java.io.IOException e )
4453 {
4454 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4455 }
4456 finally
4457 {
4458 try
4459 {
4460 if( reader != null )
4461 {
4462 reader.close();
4463 }
4464 }
4465 catch( final java.io.IOException e )
4466 {
4467 if( !suppressExceptionOnClose )
4468 {
4469 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4470 }
4471 }
4472 }
4473 }
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4487 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4488 private static String getDefaultModulesVendor( final java.util.Locale locale )
4489 {
4490 java.io.BufferedReader reader = null;
4491 boolean suppressExceptionOnClose = true;
4492
4493 try
4494 {
4495 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Vendor" ), (Object) null );
4496 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4497 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4498 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4499
4500 String line;
4501 while ( ( line = reader.readLine() ) != null )
4502 {
4503 builder.append( lineSeparator ).append( line );
4504 }
4505
4506 suppressExceptionOnClose = false;
4507 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4508 }
4509 catch( final java.lang.ClassCastException e )
4510 {
4511 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4512 }
4513 catch( final java.lang.IllegalArgumentException e )
4514 {
4515 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4516 }
4517 catch( final java.util.MissingResourceException e )
4518 {
4519 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4520 }
4521 catch( final java.io.IOException e )
4522 {
4523 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4524 }
4525 finally
4526 {
4527 try
4528 {
4529 if( reader != null )
4530 {
4531 reader.close();
4532 }
4533 }
4534 catch( final java.io.IOException e )
4535 {
4536 if( !suppressExceptionOnClose )
4537 {
4538 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4539 }
4540 }
4541 }
4542 }
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4556 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4557 private static String getDefaultModulesVersion( final java.util.Locale locale )
4558 {
4559 java.io.BufferedReader reader = null;
4560 boolean suppressExceptionOnClose = true;
4561
4562 try
4563 {
4564 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Version" ), (Object) null );
4565 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4566 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4567 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4568
4569 String line;
4570 while ( ( line = reader.readLine() ) != null )
4571 {
4572 builder.append( lineSeparator ).append( line );
4573 }
4574
4575 suppressExceptionOnClose = false;
4576 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4577 }
4578 catch( final java.lang.ClassCastException e )
4579 {
4580 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4581 }
4582 catch( final java.lang.IllegalArgumentException e )
4583 {
4584 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4585 }
4586 catch( final java.util.MissingResourceException e )
4587 {
4588 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4589 }
4590 catch( final java.io.IOException e )
4591 {
4592 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4593 }
4594 finally
4595 {
4596 try
4597 {
4598 if( reader != null )
4599 {
4600 reader.close();
4601 }
4602 }
4603 catch( final java.io.IOException e )
4604 {
4605 if( !suppressExceptionOnClose )
4606 {
4607 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4608 }
4609 }
4610 }
4611 }
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4627 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4628 private static String getDefaultModulesWarning( final java.util.Locale locale, final java.lang.String modelInfo, final java.lang.String classLoaderInfo )
4629 {
4630 java.io.BufferedReader reader = null;
4631 boolean suppressExceptionOnClose = true;
4632
4633 try
4634 {
4635 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Warning" ), modelInfo, classLoaderInfo, (Object) null );
4636 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4637 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4638 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4639
4640 String line;
4641 while ( ( line = reader.readLine() ) != null )
4642 {
4643 builder.append( lineSeparator ).append( line );
4644 }
4645
4646 suppressExceptionOnClose = false;
4647 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4648 }
4649 catch( final java.lang.ClassCastException e )
4650 {
4651 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4652 }
4653 catch( final java.lang.IllegalArgumentException e )
4654 {
4655 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4656 }
4657 catch( final java.util.MissingResourceException e )
4658 {
4659 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4660 }
4661 catch( final java.io.IOException e )
4662 {
4663 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4664 }
4665 finally
4666 {
4667 try
4668 {
4669 if( reader != null )
4670 {
4671 reader.close();
4672 }
4673 }
4674 catch( final java.io.IOException e )
4675 {
4676 if( !suppressExceptionOnClose )
4677 {
4678 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4679 }
4680 }
4681 }
4682 }
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4698 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4699 private static String getDefaultScopeInfoMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
4700 {
4701 java.io.BufferedReader reader = null;
4702 boolean suppressExceptionOnClose = true;
4703
4704 try
4705 {
4706 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Scope Info Message" ), scopeIdentifier, classLoaderInfo, (Object) null );
4707 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4708 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4709 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4710
4711 String line;
4712 while ( ( line = reader.readLine() ) != null )
4713 {
4714 builder.append( lineSeparator ).append( line );
4715 }
4716
4717 suppressExceptionOnClose = false;
4718 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4719 }
4720 catch( final java.lang.ClassCastException e )
4721 {
4722 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4723 }
4724 catch( final java.lang.IllegalArgumentException e )
4725 {
4726 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4727 }
4728 catch( final java.util.MissingResourceException e )
4729 {
4730 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4731 }
4732 catch( final java.io.IOException e )
4733 {
4734 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4735 }
4736 finally
4737 {
4738 try
4739 {
4740 if( reader != null )
4741 {
4742 reader.close();
4743 }
4744 }
4745 catch( final java.io.IOException e )
4746 {
4747 if( !suppressExceptionOnClose )
4748 {
4749 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4750 }
4751 }
4752 }
4753 }
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4768 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4769 private static String getDependencyCycleMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4770 {
4771 java.io.BufferedReader reader = null;
4772 boolean suppressExceptionOnClose = true;
4773
4774 try
4775 {
4776 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Dependency Cycle Message" ), implementationIdentifier, (Object) null );
4777 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4778 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4779 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4780
4781 String line;
4782 while ( ( line = reader.readLine() ) != null )
4783 {
4784 builder.append( lineSeparator ).append( line );
4785 }
4786
4787 suppressExceptionOnClose = false;
4788 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4789 }
4790 catch( final java.lang.ClassCastException e )
4791 {
4792 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4793 }
4794 catch( final java.lang.IllegalArgumentException e )
4795 {
4796 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4797 }
4798 catch( final java.util.MissingResourceException e )
4799 {
4800 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4801 }
4802 catch( final java.io.IOException e )
4803 {
4804 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4805 }
4806 finally
4807 {
4808 try
4809 {
4810 if( reader != null )
4811 {
4812 reader.close();
4813 }
4814 }
4815 catch( final java.io.IOException e )
4816 {
4817 if( !suppressExceptionOnClose )
4818 {
4819 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4820 }
4821 }
4822 }
4823 }
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4838 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4839 private static String getIgnoredInvocationMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4840 {
4841 java.io.BufferedReader reader = null;
4842 boolean suppressExceptionOnClose = true;
4843
4844 try
4845 {
4846 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Ignored Invocation Message" ), implementationIdentifier, (Object) null );
4847 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4848 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4849 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4850
4851 String line;
4852 while ( ( line = reader.readLine() ) != null )
4853 {
4854 builder.append( lineSeparator ).append( line );
4855 }
4856
4857 suppressExceptionOnClose = false;
4858 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4859 }
4860 catch( final java.lang.ClassCastException e )
4861 {
4862 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4863 }
4864 catch( final java.lang.IllegalArgumentException e )
4865 {
4866 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4867 }
4868 catch( final java.util.MissingResourceException e )
4869 {
4870 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4871 }
4872 catch( final java.io.IOException e )
4873 {
4874 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4875 }
4876 finally
4877 {
4878 try
4879 {
4880 if( reader != null )
4881 {
4882 reader.close();
4883 }
4884 }
4885 catch( final java.io.IOException e )
4886 {
4887 if( !suppressExceptionOnClose )
4888 {
4889 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4890 }
4891 }
4892 }
4893 }
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4908 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4909 private static String getIgnoredInvokerMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4910 {
4911 java.io.BufferedReader reader = null;
4912 boolean suppressExceptionOnClose = true;
4913
4914 try
4915 {
4916 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Ignored Invoker Message" ), implementationIdentifier, (Object) null );
4917 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4918 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4919 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4920
4921 String line;
4922 while ( ( line = reader.readLine() ) != null )
4923 {
4924 builder.append( lineSeparator ).append( line );
4925 }
4926
4927 suppressExceptionOnClose = false;
4928 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4929 }
4930 catch( final java.lang.ClassCastException e )
4931 {
4932 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4933 }
4934 catch( final java.lang.IllegalArgumentException e )
4935 {
4936 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4937 }
4938 catch( final java.util.MissingResourceException e )
4939 {
4940 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4941 }
4942 catch( final java.io.IOException e )
4943 {
4944 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4945 }
4946 finally
4947 {
4948 try
4949 {
4950 if( reader != null )
4951 {
4952 reader.close();
4953 }
4954 }
4955 catch( final java.io.IOException e )
4956 {
4957 if( !suppressExceptionOnClose )
4958 {
4959 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4960 }
4961 }
4962 }
4963 }
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
4979 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
4980 private static String getIllegalArraySpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
4981 {
4982 java.io.BufferedReader reader = null;
4983 boolean suppressExceptionOnClose = true;
4984
4985 try
4986 {
4987 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Illegal Array Specification Message" ), specificationIdentifier, specificationMultiplicity, (Object) null );
4988 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4989 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4990 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4991
4992 String line;
4993 while ( ( line = reader.readLine() ) != null )
4994 {
4995 builder.append( lineSeparator ).append( line );
4996 }
4997
4998 suppressExceptionOnClose = false;
4999 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5000 }
5001 catch( final java.lang.ClassCastException e )
5002 {
5003 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5004 }
5005 catch( final java.lang.IllegalArgumentException e )
5006 {
5007 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5008 }
5009 catch( final java.util.MissingResourceException e )
5010 {
5011 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5012 }
5013 catch( final java.io.IOException e )
5014 {
5015 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5016 }
5017 finally
5018 {
5019 try
5020 {
5021 if( reader != null )
5022 {
5023 reader.close();
5024 }
5025 }
5026 catch( final java.io.IOException e )
5027 {
5028 if( !suppressExceptionOnClose )
5029 {
5030 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5031 }
5032 }
5033 }
5034 }
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5050 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5051 private static String getIllegalObjectSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
5052 {
5053 java.io.BufferedReader reader = null;
5054 boolean suppressExceptionOnClose = true;
5055
5056 try
5057 {
5058 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Illegal Object Specification Message" ), specificationIdentifier, specificationMultiplicity, (Object) null );
5059 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5060 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5061 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5062
5063 String line;
5064 while ( ( line = reader.readLine() ) != null )
5065 {
5066 builder.append( lineSeparator ).append( line );
5067 }
5068
5069 suppressExceptionOnClose = false;
5070 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5071 }
5072 catch( final java.lang.ClassCastException e )
5073 {
5074 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5075 }
5076 catch( final java.lang.IllegalArgumentException e )
5077 {
5078 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5079 }
5080 catch( final java.util.MissingResourceException e )
5081 {
5082 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5083 }
5084 catch( final java.io.IOException e )
5085 {
5086 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5087 }
5088 finally
5089 {
5090 try
5091 {
5092 if( reader != null )
5093 {
5094 reader.close();
5095 }
5096 }
5097 catch( final java.io.IOException e )
5098 {
5099 if( !suppressExceptionOnClose )
5100 {
5101 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5102 }
5103 }
5104 }
5105 }
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5120 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5121 private static String getImplementationInfoMessage( final java.util.Locale locale, final java.lang.Number initializationMillis )
5122 {
5123 java.io.BufferedReader reader = null;
5124 boolean suppressExceptionOnClose = true;
5125
5126 try
5127 {
5128 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Implementation Info Message" ), initializationMillis, (Object) null );
5129 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5130 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5131 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5132
5133 String line;
5134 while ( ( line = reader.readLine() ) != null )
5135 {
5136 builder.append( lineSeparator ).append( line );
5137 }
5138
5139 suppressExceptionOnClose = false;
5140 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5141 }
5142 catch( final java.lang.ClassCastException e )
5143 {
5144 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5145 }
5146 catch( final java.lang.IllegalArgumentException e )
5147 {
5148 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5149 }
5150 catch( final java.util.MissingResourceException e )
5151 {
5152 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5153 }
5154 catch( final java.io.IOException e )
5155 {
5156 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5157 }
5158 finally
5159 {
5160 try
5161 {
5162 if( reader != null )
5163 {
5164 reader.close();
5165 }
5166 }
5167 catch( final java.io.IOException e )
5168 {
5169 if( !suppressExceptionOnClose )
5170 {
5171 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5172 }
5173 }
5174 }
5175 }
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5191 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5192 private static String getInvokerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
5193 {
5194 java.io.BufferedReader reader = null;
5195 boolean suppressExceptionOnClose = true;
5196
5197 try
5198 {
5199 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Invoker Info Message" ), implementationIdentifier, classLoaderInfo, (Object) null );
5200 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5201 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5202 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5203
5204 String line;
5205 while ( ( line = reader.readLine() ) != null )
5206 {
5207 builder.append( lineSeparator ).append( line );
5208 }
5209
5210 suppressExceptionOnClose = false;
5211 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5212 }
5213 catch( final java.lang.ClassCastException e )
5214 {
5215 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5216 }
5217 catch( final java.lang.IllegalArgumentException e )
5218 {
5219 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5220 }
5221 catch( final java.util.MissingResourceException e )
5222 {
5223 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5224 }
5225 catch( final java.io.IOException e )
5226 {
5227 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5228 }
5229 finally
5230 {
5231 try
5232 {
5233 if( reader != null )
5234 {
5235 reader.close();
5236 }
5237 }
5238 catch( final java.io.IOException e )
5239 {
5240 if( !suppressExceptionOnClose )
5241 {
5242 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5243 }
5244 }
5245 }
5246 }
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5262 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5263 private static String getListenerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
5264 {
5265 java.io.BufferedReader reader = null;
5266 boolean suppressExceptionOnClose = true;
5267
5268 try
5269 {
5270 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Listener Info Message" ), implementationIdentifier, classLoaderInfo, (Object) null );
5271 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5272 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5273 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5274
5275 String line;
5276 while ( ( line = reader.readLine() ) != null )
5277 {
5278 builder.append( lineSeparator ).append( line );
5279 }
5280
5281 suppressExceptionOnClose = false;
5282 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5283 }
5284 catch( final java.lang.ClassCastException e )
5285 {
5286 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5287 }
5288 catch( final java.lang.IllegalArgumentException e )
5289 {
5290 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5291 }
5292 catch( final java.util.MissingResourceException e )
5293 {
5294 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5295 }
5296 catch( final java.io.IOException e )
5297 {
5298 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5299 }
5300 finally
5301 {
5302 try
5303 {
5304 if( reader != null )
5305 {
5306 reader.close();
5307 }
5308 }
5309 catch( final java.io.IOException e )
5310 {
5311 if( !suppressExceptionOnClose )
5312 {
5313 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5314 }
5315 }
5316 }
5317 }
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5334 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5335 private static String getLocatorInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
5336 {
5337 java.io.BufferedReader reader = null;
5338 boolean suppressExceptionOnClose = true;
5339
5340 try
5341 {
5342 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Locator Info Message" ), implementationIdentifier, schemeInfo, classLoaderInfo, (Object) null );
5343 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5344 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5345 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5346
5347 String line;
5348 while ( ( line = reader.readLine() ) != null )
5349 {
5350 builder.append( lineSeparator ).append( line );
5351 }
5352
5353 suppressExceptionOnClose = false;
5354 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5355 }
5356 catch( final java.lang.ClassCastException e )
5357 {
5358 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5359 }
5360 catch( final java.lang.IllegalArgumentException e )
5361 {
5362 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5363 }
5364 catch( final java.util.MissingResourceException e )
5365 {
5366 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5367 }
5368 catch( final java.io.IOException e )
5369 {
5370 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5371 }
5372 finally
5373 {
5374 try
5375 {
5376 if( reader != null )
5377 {
5378 reader.close();
5379 }
5380 }
5381 catch( final java.io.IOException e )
5382 {
5383 if( !suppressExceptionOnClose )
5384 {
5385 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5386 }
5387 }
5388 }
5389 }
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5405 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5406 private static String getMissingDependencyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String dependencyName )
5407 {
5408 java.io.BufferedReader reader = null;
5409 boolean suppressExceptionOnClose = true;
5410
5411 try
5412 {
5413 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Dependency Message" ), implementationIdentifier, dependencyName, (Object) null );
5414 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5415 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5416 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5417
5418 String line;
5419 while ( ( line = reader.readLine() ) != null )
5420 {
5421 builder.append( lineSeparator ).append( line );
5422 }
5423
5424 suppressExceptionOnClose = false;
5425 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5426 }
5427 catch( final java.lang.ClassCastException e )
5428 {
5429 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5430 }
5431 catch( final java.lang.IllegalArgumentException e )
5432 {
5433 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5434 }
5435 catch( final java.util.MissingResourceException e )
5436 {
5437 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5438 }
5439 catch( final java.io.IOException e )
5440 {
5441 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5442 }
5443 finally
5444 {
5445 try
5446 {
5447 if( reader != null )
5448 {
5449 reader.close();
5450 }
5451 }
5452 catch( final java.io.IOException e )
5453 {
5454 if( !suppressExceptionOnClose )
5455 {
5456 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5457 }
5458 }
5459 }
5460 }
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5476 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5477 private static String getMissingImplementationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String implementationName )
5478 {
5479 java.io.BufferedReader reader = null;
5480 boolean suppressExceptionOnClose = true;
5481
5482 try
5483 {
5484 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Implementation Message" ), specificationIdentifier, implementationName, (Object) null );
5485 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5486 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5487 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5488
5489 String line;
5490 while ( ( line = reader.readLine() ) != null )
5491 {
5492 builder.append( lineSeparator ).append( line );
5493 }
5494
5495 suppressExceptionOnClose = false;
5496 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5497 }
5498 catch( final java.lang.ClassCastException e )
5499 {
5500 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5501 }
5502 catch( final java.lang.IllegalArgumentException e )
5503 {
5504 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5505 }
5506 catch( final java.util.MissingResourceException e )
5507 {
5508 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5509 }
5510 catch( final java.io.IOException e )
5511 {
5512 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5513 }
5514 finally
5515 {
5516 try
5517 {
5518 if( reader != null )
5519 {
5520 reader.close();
5521 }
5522 }
5523 catch( final java.io.IOException e )
5524 {
5525 if( !suppressExceptionOnClose )
5526 {
5527 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5528 }
5529 }
5530 }
5531 }
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5546 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5547 private static String getMissingImplementationsMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
5548 {
5549 java.io.BufferedReader reader = null;
5550 boolean suppressExceptionOnClose = true;
5551
5552 try
5553 {
5554 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Implementations Message" ), specificationIdentifier, (Object) null );
5555 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5556 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5557 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5558
5559 String line;
5560 while ( ( line = reader.readLine() ) != null )
5561 {
5562 builder.append( lineSeparator ).append( line );
5563 }
5564
5565 suppressExceptionOnClose = false;
5566 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5567 }
5568 catch( final java.lang.ClassCastException e )
5569 {
5570 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5571 }
5572 catch( final java.lang.IllegalArgumentException e )
5573 {
5574 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5575 }
5576 catch( final java.util.MissingResourceException e )
5577 {
5578 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5579 }
5580 catch( final java.io.IOException e )
5581 {
5582 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5583 }
5584 finally
5585 {
5586 try
5587 {
5588 if( reader != null )
5589 {
5590 reader.close();
5591 }
5592 }
5593 catch( final java.io.IOException e )
5594 {
5595 if( !suppressExceptionOnClose )
5596 {
5597 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5598 }
5599 }
5600 }
5601 }
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5617 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5618 private static String getMissingInstanceMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
5619 {
5620 java.io.BufferedReader reader = null;
5621 boolean suppressExceptionOnClose = true;
5622
5623 try
5624 {
5625 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Instance Message" ), implementationIdentifier, implementationName, (Object) null );
5626 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5627 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5628 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5629
5630 String line;
5631 while ( ( line = reader.readLine() ) != null )
5632 {
5633 builder.append( lineSeparator ).append( line );
5634 }
5635
5636 suppressExceptionOnClose = false;
5637 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5638 }
5639 catch( final java.lang.ClassCastException e )
5640 {
5641 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5642 }
5643 catch( final java.lang.IllegalArgumentException e )
5644 {
5645 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5646 }
5647 catch( final java.util.MissingResourceException e )
5648 {
5649 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5650 }
5651 catch( final java.io.IOException e )
5652 {
5653 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5654 }
5655 finally
5656 {
5657 try
5658 {
5659 if( reader != null )
5660 {
5661 reader.close();
5662 }
5663 }
5664 catch( final java.io.IOException e )
5665 {
5666 if( !suppressExceptionOnClose )
5667 {
5668 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5669 }
5670 }
5671 }
5672 }
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5687 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5688 private static String getMissingLocatorMessage( final java.util.Locale locale, final java.lang.String locationInfo )
5689 {
5690 java.io.BufferedReader reader = null;
5691 boolean suppressExceptionOnClose = true;
5692
5693 try
5694 {
5695 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Locator Message" ), locationInfo, (Object) null );
5696 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5697 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5698 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5699
5700 String line;
5701 while ( ( line = reader.readLine() ) != null )
5702 {
5703 builder.append( lineSeparator ).append( line );
5704 }
5705
5706 suppressExceptionOnClose = false;
5707 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5708 }
5709 catch( final java.lang.ClassCastException e )
5710 {
5711 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5712 }
5713 catch( final java.lang.IllegalArgumentException e )
5714 {
5715 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5716 }
5717 catch( final java.util.MissingResourceException e )
5718 {
5719 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5720 }
5721 catch( final java.io.IOException e )
5722 {
5723 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5724 }
5725 finally
5726 {
5727 try
5728 {
5729 if( reader != null )
5730 {
5731 reader.close();
5732 }
5733 }
5734 catch( final java.io.IOException e )
5735 {
5736 if( !suppressExceptionOnClose )
5737 {
5738 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5739 }
5740 }
5741 }
5742 }
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5758 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5759 private static String getMissingMessageMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String messageName )
5760 {
5761 java.io.BufferedReader reader = null;
5762 boolean suppressExceptionOnClose = true;
5763
5764 try
5765 {
5766 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Message Message" ), implementationIdentifier, messageName, (Object) null );
5767 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5768 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5769 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5770
5771 String line;
5772 while ( ( line = reader.readLine() ) != null )
5773 {
5774 builder.append( lineSeparator ).append( line );
5775 }
5776
5777 suppressExceptionOnClose = false;
5778 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5779 }
5780 catch( final java.lang.ClassCastException e )
5781 {
5782 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5783 }
5784 catch( final java.lang.IllegalArgumentException e )
5785 {
5786 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5787 }
5788 catch( final java.util.MissingResourceException e )
5789 {
5790 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5791 }
5792 catch( final java.io.IOException e )
5793 {
5794 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5795 }
5796 finally
5797 {
5798 try
5799 {
5800 if( reader != null )
5801 {
5802 reader.close();
5803 }
5804 }
5805 catch( final java.io.IOException e )
5806 {
5807 if( !suppressExceptionOnClose )
5808 {
5809 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5810 }
5811 }
5812 }
5813 }
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5828 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5829 private static String getMissingObjectInstanceMessage( final java.util.Locale locale, final java.lang.String objectInfo )
5830 {
5831 java.io.BufferedReader reader = null;
5832 boolean suppressExceptionOnClose = true;
5833
5834 try
5835 {
5836 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Object Instance Message" ), objectInfo, (Object) null );
5837 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5838 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5839 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5840
5841 String line;
5842 while ( ( line = reader.readLine() ) != null )
5843 {
5844 builder.append( lineSeparator ).append( line );
5845 }
5846
5847 suppressExceptionOnClose = false;
5848 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5849 }
5850 catch( final java.lang.ClassCastException e )
5851 {
5852 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5853 }
5854 catch( final java.lang.IllegalArgumentException e )
5855 {
5856 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5857 }
5858 catch( final java.util.MissingResourceException e )
5859 {
5860 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5861 }
5862 catch( final java.io.IOException e )
5863 {
5864 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5865 }
5866 finally
5867 {
5868 try
5869 {
5870 if( reader != null )
5871 {
5872 reader.close();
5873 }
5874 }
5875 catch( final java.io.IOException e )
5876 {
5877 if( !suppressExceptionOnClose )
5878 {
5879 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5880 }
5881 }
5882 }
5883 }
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5899 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5900 private static String getMissingObjectMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
5901 {
5902 java.io.BufferedReader reader = null;
5903 boolean suppressExceptionOnClose = true;
5904
5905 try
5906 {
5907 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Object Message" ), implementationIdentifier, implementationName, (Object) null );
5908 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5909 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5910 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5911
5912 String line;
5913 while ( ( line = reader.readLine() ) != null )
5914 {
5915 builder.append( lineSeparator ).append( line );
5916 }
5917
5918 suppressExceptionOnClose = false;
5919 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5920 }
5921 catch( final java.lang.ClassCastException e )
5922 {
5923 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5924 }
5925 catch( final java.lang.IllegalArgumentException e )
5926 {
5927 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5928 }
5929 catch( final java.util.MissingResourceException e )
5930 {
5931 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5932 }
5933 catch( final java.io.IOException e )
5934 {
5935 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5936 }
5937 finally
5938 {
5939 try
5940 {
5941 if( reader != null )
5942 {
5943 reader.close();
5944 }
5945 }
5946 catch( final java.io.IOException e )
5947 {
5948 if( !suppressExceptionOnClose )
5949 {
5950 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5951 }
5952 }
5953 }
5954 }
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
5970 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
5971 private static String getMissingPropertyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String propertyName )
5972 {
5973 java.io.BufferedReader reader = null;
5974 boolean suppressExceptionOnClose = true;
5975
5976 try
5977 {
5978 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Property Message" ), implementationIdentifier, propertyName, (Object) null );
5979 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5980 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5981 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5982
5983 String line;
5984 while ( ( line = reader.readLine() ) != null )
5985 {
5986 builder.append( lineSeparator ).append( line );
5987 }
5988
5989 suppressExceptionOnClose = false;
5990 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5991 }
5992 catch( final java.lang.ClassCastException e )
5993 {
5994 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5995 }
5996 catch( final java.lang.IllegalArgumentException e )
5997 {
5998 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5999 }
6000 catch( final java.util.MissingResourceException e )
6001 {
6002 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6003 }
6004 catch( final java.io.IOException e )
6005 {
6006 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6007 }
6008 finally
6009 {
6010 try
6011 {
6012 if( reader != null )
6013 {
6014 reader.close();
6015 }
6016 }
6017 catch( final java.io.IOException e )
6018 {
6019 if( !suppressExceptionOnClose )
6020 {
6021 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6022 }
6023 }
6024 }
6025 }
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6040 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6041 private static String getMissingScopeMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier )
6042 {
6043 java.io.BufferedReader reader = null;
6044 boolean suppressExceptionOnClose = true;
6045
6046 try
6047 {
6048 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Scope Message" ), scopeIdentifier, (Object) null );
6049 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6050 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6051 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6052
6053 String line;
6054 while ( ( line = reader.readLine() ) != null )
6055 {
6056 builder.append( lineSeparator ).append( line );
6057 }
6058
6059 suppressExceptionOnClose = false;
6060 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6061 }
6062 catch( final java.lang.ClassCastException e )
6063 {
6064 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6065 }
6066 catch( final java.lang.IllegalArgumentException e )
6067 {
6068 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6069 }
6070 catch( final java.util.MissingResourceException e )
6071 {
6072 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6073 }
6074 catch( final java.io.IOException e )
6075 {
6076 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6077 }
6078 finally
6079 {
6080 try
6081 {
6082 if( reader != null )
6083 {
6084 reader.close();
6085 }
6086 }
6087 catch( final java.io.IOException e )
6088 {
6089 if( !suppressExceptionOnClose )
6090 {
6091 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6092 }
6093 }
6094 }
6095 }
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6110 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6111 private static String getMissingSpecificationClassMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
6112 {
6113 java.io.BufferedReader reader = null;
6114 boolean suppressExceptionOnClose = true;
6115
6116 try
6117 {
6118 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Specification Class Message" ), specificationIdentifier, (Object) null );
6119 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6120 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6121 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6122
6123 String line;
6124 while ( ( line = reader.readLine() ) != null )
6125 {
6126 builder.append( lineSeparator ).append( line );
6127 }
6128
6129 suppressExceptionOnClose = false;
6130 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6131 }
6132 catch( final java.lang.ClassCastException e )
6133 {
6134 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6135 }
6136 catch( final java.lang.IllegalArgumentException e )
6137 {
6138 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6139 }
6140 catch( final java.util.MissingResourceException e )
6141 {
6142 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6143 }
6144 catch( final java.io.IOException e )
6145 {
6146 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6147 }
6148 finally
6149 {
6150 try
6151 {
6152 if( reader != null )
6153 {
6154 reader.close();
6155 }
6156 }
6157 catch( final java.io.IOException e )
6158 {
6159 if( !suppressExceptionOnClose )
6160 {
6161 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6162 }
6163 }
6164 }
6165 }
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6180 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6181 private static String getMissingSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
6182 {
6183 java.io.BufferedReader reader = null;
6184 boolean suppressExceptionOnClose = true;
6185
6186 try
6187 {
6188 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Specification Message" ), specificationIdentifier, (Object) null );
6189 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6190 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6191 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6192
6193 String line;
6194 while ( ( line = reader.readLine() ) != null )
6195 {
6196 builder.append( lineSeparator ).append( line );
6197 }
6198
6199 suppressExceptionOnClose = false;
6200 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6201 }
6202 catch( final java.lang.ClassCastException e )
6203 {
6204 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6205 }
6206 catch( final java.lang.IllegalArgumentException e )
6207 {
6208 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6209 }
6210 catch( final java.util.MissingResourceException e )
6211 {
6212 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6213 }
6214 catch( final java.io.IOException e )
6215 {
6216 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6217 }
6218 finally
6219 {
6220 try
6221 {
6222 if( reader != null )
6223 {
6224 reader.close();
6225 }
6226 }
6227 catch( final java.io.IOException e )
6228 {
6229 if( !suppressExceptionOnClose )
6230 {
6231 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6232 }
6233 }
6234 }
6235 }
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6249 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6250 private static String getModulesReportMessage( final java.util.Locale locale )
6251 {
6252 java.io.BufferedReader reader = null;
6253 boolean suppressExceptionOnClose = true;
6254
6255 try
6256 {
6257 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Modules Report Message" ), (Object) null );
6258 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6259 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6260 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6261
6262 String line;
6263 while ( ( line = reader.readLine() ) != null )
6264 {
6265 builder.append( lineSeparator ).append( line );
6266 }
6267
6268 suppressExceptionOnClose = false;
6269 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6270 }
6271 catch( final java.lang.ClassCastException e )
6272 {
6273 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6274 }
6275 catch( final java.lang.IllegalArgumentException e )
6276 {
6277 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6278 }
6279 catch( final java.util.MissingResourceException e )
6280 {
6281 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6282 }
6283 catch( final java.io.IOException e )
6284 {
6285 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6286 }
6287 finally
6288 {
6289 try
6290 {
6291 if( reader != null )
6292 {
6293 reader.close();
6294 }
6295 }
6296 catch( final java.io.IOException e )
6297 {
6298 if( !suppressExceptionOnClose )
6299 {
6300 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6301 }
6302 }
6303 }
6304 }
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6319 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6320 private static String getRuntimeModelReport( final java.util.Locale locale, final java.lang.Number millis )
6321 {
6322 java.io.BufferedReader reader = null;
6323 boolean suppressExceptionOnClose = true;
6324
6325 try
6326 {
6327 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Runtime Model Report" ), millis, (Object) null );
6328 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6329 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6330 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6331
6332 String line;
6333 while ( ( line = reader.readLine() ) != null )
6334 {
6335 builder.append( lineSeparator ).append( line );
6336 }
6337
6338 suppressExceptionOnClose = false;
6339 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6340 }
6341 catch( final java.lang.ClassCastException e )
6342 {
6343 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6344 }
6345 catch( final java.lang.IllegalArgumentException e )
6346 {
6347 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6348 }
6349 catch( final java.util.MissingResourceException e )
6350 {
6351 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6352 }
6353 catch( final java.io.IOException e )
6354 {
6355 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6356 }
6357 finally
6358 {
6359 try
6360 {
6361 if( reader != null )
6362 {
6363 reader.close();
6364 }
6365 }
6366 catch( final java.io.IOException e )
6367 {
6368 if( !suppressExceptionOnClose )
6369 {
6370 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6371 }
6372 }
6373 }
6374 }
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6389 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6390 private static String getScopeContentionFailure( final java.util.Locale locale, final java.lang.String objectIdentifier )
6391 {
6392 java.io.BufferedReader reader = null;
6393 boolean suppressExceptionOnClose = true;
6394
6395 try
6396 {
6397 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Scope Contention Failure" ), objectIdentifier, (Object) null );
6398 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6399 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6400 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6401
6402 String line;
6403 while ( ( line = reader.readLine() ) != null )
6404 {
6405 builder.append( lineSeparator ).append( line );
6406 }
6407
6408 suppressExceptionOnClose = false;
6409 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6410 }
6411 catch( final java.lang.ClassCastException e )
6412 {
6413 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6414 }
6415 catch( final java.lang.IllegalArgumentException e )
6416 {
6417 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6418 }
6419 catch( final java.util.MissingResourceException e )
6420 {
6421 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6422 }
6423 catch( final java.io.IOException e )
6424 {
6425 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6426 }
6427 finally
6428 {
6429 try
6430 {
6431 if( reader != null )
6432 {
6433 reader.close();
6434 }
6435 }
6436 catch( final java.io.IOException e )
6437 {
6438 if( !suppressExceptionOnClose )
6439 {
6440 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6441 }
6442 }
6443 }
6444 }
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6461 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6462 private static String getScopeInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
6463 {
6464 java.io.BufferedReader reader = null;
6465 boolean suppressExceptionOnClose = true;
6466
6467 try
6468 {
6469 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Scope Info Message" ), implementationIdentifier, scopeIdentifier, classLoaderInfo, (Object) null );
6470 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6471 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6472 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6473
6474 String line;
6475 while ( ( line = reader.readLine() ) != null )
6476 {
6477 builder.append( lineSeparator ).append( line );
6478 }
6479
6480 suppressExceptionOnClose = false;
6481 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6482 }
6483 catch( final java.lang.ClassCastException e )
6484 {
6485 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6486 }
6487 catch( final java.lang.IllegalArgumentException e )
6488 {
6489 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6490 }
6491 catch( final java.util.MissingResourceException e )
6492 {
6493 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6494 }
6495 catch( final java.io.IOException e )
6496 {
6497 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6498 }
6499 finally
6500 {
6501 try
6502 {
6503 if( reader != null )
6504 {
6505 reader.close();
6506 }
6507 }
6508 catch( final java.io.IOException e )
6509 {
6510 if( !suppressExceptionOnClose )
6511 {
6512 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6513 }
6514 }
6515 }
6516 }
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533 @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
6534 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
6535 private static String getUnexpectedDependencyObjectsMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String dependencyName, final java.lang.Number expectedNumber, final java.lang.Number computedNumber )
6536 {
6537 java.io.BufferedReader reader = null;
6538 boolean suppressExceptionOnClose = true;
6539
6540 try
6541 {
6542 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Unexpected Dependency Objects Message" ), implementationIdentifier, dependencyName, expectedNumber, computedNumber, (Object) null );
6543 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6544 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6545 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6546
6547 String line;
6548 while ( ( line = reader.readLine() ) != null )
6549 {
6550 builder.append( lineSeparator ).append( line );
6551 }
6552
6553 suppressExceptionOnClose = false;
6554 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6555 }
6556 catch( final java.lang.ClassCastException e )
6557 {
6558 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6559 }
6560 catch( final java.lang.IllegalArgumentException e )
6561 {
6562 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6563 }
6564 catch( final java.util.MissingResourceException e )
6565 {
6566 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6567 }
6568 catch( final java.io.IOException e )
6569 {
6570 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6571 }
6572 finally
6573 {
6574 try
6575 {
6576 if( reader != null )
6577 {
6578 reader.close();
6579 }
6580 }
6581 catch( final java.io.IOException e )
6582 {
6583 if( !suppressExceptionOnClose )
6584 {
6585 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6586 }
6587 }
6588 }
6589 }
6590
6591
6592
6593 }