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