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.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
114
115
116 public class DefaultObjectManager implements ObjectManager
117 {
118
119
120
121 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
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 if ( args != null )
3160 {
3161 Object[] clonedArgs = args;
3162
3163 for ( int i = 0, s0 = clonedArgs.length; i < s0; i++ )
3164 {
3165 if ( clonedArgs[i] == proxy )
3166 {
3167 if ( clonedArgs == args )
3168 {
3169 clonedArgs = clonedArgs.clone();
3170 }
3171
3172 clonedArgs[i] = object;
3173 }
3174 }
3175
3176 return this.invoker.invoke( getInvocation(
3177 classLoader, object, instance, method, clonedArgs ) );
3178
3179 }
3180
3181 return this.invoker.invoke( getInvocation(
3182 classLoader, object, instance, method, null ) );
3183
3184 }
3185
3186 }
3187 } );
3188
3189 }
3190
3191 return proxyObject;
3192 }
3193 catch ( final ClassNotFoundException e )
3194 {
3195 throw (InstantiationException) new InstantiationException( getMessage( e ) ).initCause( e );
3196 }
3197 catch ( final NoSuchMethodException e )
3198 {
3199 throw new AssertionError( e );
3200 }
3201 catch ( final IllegalAccessException e )
3202 {
3203 throw new AssertionError( e );
3204 }
3205 catch ( final InvocationTargetException e )
3206 {
3207 throw new AssertionError( e );
3208 }
3209 }
3210
3211 private void logModulesReport( final Modules mods, final ClassLoader classLoader )
3212 {
3213 final StringBuilder modulesInfo = new StringBuilder();
3214
3215 this.log( classLoader, Level.FINEST, getModulesReportMessage( Locale.getDefault() ), null );
3216
3217 modulesInfo.append( "\tClassLoader:" ).append( classLoader );
3218
3219 if ( mods.getDocumentation() != null )
3220 {
3221 modulesInfo.append( "|Documentation:" ).append( mods.getDocumentation().getText(
3222 Locale.getDefault().getLanguage() ).getValue() );
3223
3224 }
3225
3226 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3227
3228 for ( Module m : mods.getModule() )
3229 {
3230 modulesInfo.setLength( 0 );
3231 modulesInfo.append( "\tM:" ).append( m.getName() );
3232
3233 if ( m.getVersion() != null )
3234 {
3235 modulesInfo.append( "|Version:" ).append( m.getVersion() );
3236 }
3237 if ( m.getVendor() != null )
3238 {
3239 modulesInfo.append( "|Vendor:" ).append( m.getVendor() );
3240 }
3241
3242 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3243 modulesInfo.setLength( 0 );
3244
3245 if ( m.getSpecifications() != null )
3246 {
3247 for ( Specification s : m.getSpecifications().getSpecification() )
3248 {
3249 modulesInfo.append( "\t\t" );
3250 this.appendSpecificationInfo( s, modulesInfo );
3251 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3252 modulesInfo.setLength( 0 );
3253
3254 final Implementations available = mods.getImplementations( s.getIdentifier() );
3255
3256 if ( available != null )
3257 {
3258 for ( Implementation i : available.getImplementation() )
3259 {
3260 modulesInfo.append( "\t\t\t" );
3261 this.appendImplementationInfo( i, modulesInfo ).append( "|Module:" ).
3262 append( mods.getModuleOfImplementation( i.getIdentifier() ).getName() );
3263
3264 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3265 modulesInfo.setLength( 0 );
3266 }
3267 }
3268 }
3269 }
3270
3271 if ( m.getImplementations() != null )
3272 {
3273 for ( Implementation i : m.getImplementations().getImplementation() )
3274 {
3275 modulesInfo.append( "\t\t" );
3276 this.appendImplementationInfo( i, modulesInfo );
3277 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3278 modulesInfo.setLength( 0 );
3279
3280 if ( i.getImplementations() != null )
3281 {
3282 modulesInfo.append( "\t\t\t" );
3283 for ( ImplementationReference r : i.getImplementations().getReference() )
3284 {
3285 this.appendImplementationInfo(
3286 mods.getImplementation( r.getIdentifier() ), modulesInfo ).append( "|Module:" ).
3287 append( mods.getModuleOfImplementation( r.getIdentifier() ).getName() );
3288
3289 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3290 modulesInfo.setLength( 0 );
3291 }
3292 }
3293 if ( i.getSpecifications() != null )
3294 {
3295 for ( SpecificationReference s : i.getSpecifications().getReference() )
3296 {
3297 modulesInfo.append( "\t\t\tS:" ).append( s.getIdentifier() );
3298
3299 if ( s.getVersion() != null )
3300 {
3301 modulesInfo.append( "|Version:" ).append( s.getVersion() );
3302 }
3303
3304 modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
3305 s.getIdentifier() ).getName() );
3306
3307 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3308 modulesInfo.setLength( 0 );
3309 }
3310 }
3311
3312 if ( i.getDependencies() != null )
3313 {
3314 for ( Dependency d : i.getDependencies().getDependency() )
3315 {
3316 modulesInfo.append( "\t\t\tD:" ).append( d.getName() ).append( "|Identifier:" ).
3317 append( d.getIdentifier() );
3318
3319 if ( d.getImplementationName() != null )
3320 {
3321 modulesInfo.append( "|Name:" ).append( d.getImplementationName() );
3322 }
3323
3324 modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
3325 d.getIdentifier() ).getName() );
3326
3327 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3328 modulesInfo.setLength( 0 );
3329
3330 final Implementations available = mods.getImplementations( d.getIdentifier() );
3331
3332 if ( available != null )
3333 {
3334 for ( Implementation di : available.getImplementation() )
3335 {
3336 modulesInfo.append( "\t\t\t\t" );
3337 this.appendImplementationInfo( di, modulesInfo ).append( "|Module:" ).
3338 append( mods.getModuleOfImplementation( di.getIdentifier() ).getName() );
3339
3340 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3341 modulesInfo.setLength( 0 );
3342 }
3343 }
3344 }
3345 }
3346
3347 if ( i.getMessages() != null )
3348 {
3349 for ( Message msg : i.getMessages().getMessage() )
3350 {
3351 modulesInfo.append( "\t\t\tM:" ).append( msg.getName() ).append( "|Text:" ).
3352 append( msg.getTemplate().getText( Locale.getDefault().getLanguage() ).getValue() );
3353
3354 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3355 modulesInfo.setLength( 0 );
3356 }
3357 }
3358
3359 if ( i.getProperties() != null )
3360 {
3361 for ( Property p : i.getProperties().getProperty() )
3362 {
3363 modulesInfo.append( "\t\t\tP:" ).append( p.getName() );
3364 modulesInfo.append( "|Type:" ).append( p.getType() );
3365 modulesInfo.append( "|Value:" ).append( p.getValue() );
3366
3367 try
3368 {
3369 modulesInfo.append( "|JavaValue:" ).append( p.getJavaValue( classLoader ) );
3370 }
3371 catch ( final PropertyException e )
3372 {
3373 modulesInfo.append( "|JavaValue:" ).append( e );
3374 }
3375
3376 this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
3377 modulesInfo.setLength( 0 );
3378 }
3379 }
3380 }
3381 }
3382 }
3383 }
3384
3385 private StringBuilder appendSpecificationInfo( final Specification s, final StringBuilder b )
3386 {
3387 b.append( "S:" ).append( s.getIdentifier() );
3388 if ( s.getVersion() != null )
3389 {
3390 b.append( "|Version:" ).append( s.getVersion() );
3391 }
3392 if ( s.getVendor() != null )
3393 {
3394 b.append( "|Vendor:" ).append( s.getVendor() );
3395 }
3396
3397 b.append( "|Multiplicity:" ).append( s.getMultiplicity() ).append( "|Scope:" ).
3398 append( s.getScope() == null ? "Multiton" : s.getScope() );
3399
3400 if ( s.getClazz() != null )
3401 {
3402 b.append( "|Class:" ).append( s.getClazz() );
3403 }
3404
3405 return b;
3406 }
3407
3408 private StringBuilder appendImplementationInfo( final Implementation i, final StringBuilder b )
3409 {
3410 b.append( "I:" ).append( i.getIdentifier() ).append( "|Name:" ).append( i.getName() ).append( "|Abstract:" ).
3411 append( i.isAbstract() ).append( "|Final:" ).append( i.isFinal() ).append( "|Stateless:" ).
3412 append( i.isStateless() );
3413
3414 if ( i.getVersion() != null )
3415 {
3416 b.append( "|Version:" ).append( i.getVersion() );
3417 }
3418 if ( i.getVendor() != null )
3419 {
3420 b.append( "|Vendor:" ).append( i.getVendor() );
3421 }
3422 if ( i.getClazz() != null )
3423 {
3424 b.append( "|Class:" ).append( i.getClazz() );
3425 }
3426 if ( i.getLocation() != null )
3427 {
3428 b.append( "|Location:" ).append( i.getLocation() );
3429 }
3430
3431 return b;
3432 }
3433
3434 private String getClassLoaderInfo( final ClassLoader current, final ClassLoader parent )
3435 {
3436 final StringBuilder b = new StringBuilder();
3437 appendClassLoaderInfo( b, current );
3438
3439 if ( parent != null )
3440 {
3441 b.append( " => " );
3442 appendClassLoaderInfo( b, parent );
3443 }
3444
3445 return b.toString();
3446 }
3447
3448 private String getObjectInfo( final Object object )
3449 {
3450 final StringBuilder b = new StringBuilder();
3451 appendObjectInfo( b, object );
3452 b.append( " @ " );
3453 appendClassLoaderInfo( b, this.getDefaultClassLoader( object.getClass() ) );
3454 return b.toString();
3455 }
3456
3457 private static StringBuilder appendClassLoaderInfo( final StringBuilder b, final ClassLoader classLoader )
3458 {
3459 return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( classLoader ) ) ).append( ")" ).
3460 append( classLoader );
3461
3462 }
3463
3464 private static StringBuilder appendObjectInfo( final StringBuilder b, final Object object )
3465 {
3466 return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( object ) ) ).append( ")" ).
3467 append( object );
3468
3469 }
3470
3471 private static String getMessage( final Throwable t )
3472 {
3473 return t != null ? t.getMessage() != null ? t.getMessage() : getMessage( t.getCause() ) : null;
3474 }
3475
3476 private static Specification createDefaultSpecification( final Class<?> specification,
3477 final Multiplicity multiplicity, final String scope )
3478 {
3479 final Specification s = new Specification();
3480 s.setClassDeclaration( true );
3481 s.setClazz( specification.getName() );
3482 s.setIdentifier( specification.getName() );
3483 s.setMultiplicity( multiplicity );
3484 s.setScope( scope );
3485 s.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
3486 s.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
3487 return s;
3488 }
3489
3490 private static Implementation createDefaultImplementation( final Class<?> implementation, final String name )
3491 {
3492 final Implementation i = new Implementation();
3493 i.setClassDeclaration( true );
3494 i.setClazz( implementation.getName() );
3495 i.setIdentifier( implementation.getName() );
3496 i.setName( name );
3497 i.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
3498 i.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
3499 return i;
3500 }
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3523 private static String getCreatingModulesInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
3524 {
3525 java.io.BufferedReader reader = null;
3526 boolean suppressExceptionOnClose = true;
3527
3528 try
3529 {
3530 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "creatingModulesInfo" ), classLoaderInfo, (Object) null );
3531 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3532 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3533 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3534
3535 String line;
3536 while ( ( line = reader.readLine() ) != null )
3537 {
3538 builder.append( lineSeparator ).append( line );
3539 }
3540
3541 suppressExceptionOnClose = false;
3542 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3543 }
3544 catch( final java.lang.ClassCastException e )
3545 {
3546 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3547 }
3548 catch( final java.lang.IllegalArgumentException e )
3549 {
3550 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3551 }
3552 catch( final java.util.MissingResourceException e )
3553 {
3554 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3555 }
3556 catch( final java.io.IOException e )
3557 {
3558 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3559 }
3560 finally
3561 {
3562 try
3563 {
3564 if( reader != null )
3565 {
3566 reader.close();
3567 }
3568 }
3569 catch( final java.io.IOException e )
3570 {
3571 if( !suppressExceptionOnClose )
3572 {
3573 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3574 }
3575 }
3576 }
3577 }
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3591 private static String getDefaultImplementationName( final java.util.Locale locale )
3592 {
3593 java.io.BufferedReader reader = null;
3594 boolean suppressExceptionOnClose = true;
3595
3596 try
3597 {
3598 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultImplementationName" ), (Object) null );
3599 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3600 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3601 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3602
3603 String line;
3604 while ( ( line = reader.readLine() ) != null )
3605 {
3606 builder.append( lineSeparator ).append( line );
3607 }
3608
3609 suppressExceptionOnClose = false;
3610 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3611 }
3612 catch( final java.lang.ClassCastException e )
3613 {
3614 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3615 }
3616 catch( final java.lang.IllegalArgumentException e )
3617 {
3618 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3619 }
3620 catch( final java.util.MissingResourceException e )
3621 {
3622 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3623 }
3624 catch( final java.io.IOException e )
3625 {
3626 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3627 }
3628 finally
3629 {
3630 try
3631 {
3632 if( reader != null )
3633 {
3634 reader.close();
3635 }
3636 }
3637 catch( final java.io.IOException e )
3638 {
3639 if( !suppressExceptionOnClose )
3640 {
3641 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3642 }
3643 }
3644 }
3645 }
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3660 private static String getDefaultInvokerInfoMessage( final java.util.Locale locale, final java.lang.String classLoaderInfo )
3661 {
3662 java.io.BufferedReader reader = null;
3663 boolean suppressExceptionOnClose = true;
3664
3665 try
3666 {
3667 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultInvokerInfoMessage" ), classLoaderInfo, (Object) null );
3668 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3669 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3670 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3671
3672 String line;
3673 while ( ( line = reader.readLine() ) != null )
3674 {
3675 builder.append( lineSeparator ).append( line );
3676 }
3677
3678 suppressExceptionOnClose = false;
3679 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3680 }
3681 catch( final java.lang.ClassCastException e )
3682 {
3683 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3684 }
3685 catch( final java.lang.IllegalArgumentException e )
3686 {
3687 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3688 }
3689 catch( final java.util.MissingResourceException e )
3690 {
3691 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3692 }
3693 catch( final java.io.IOException e )
3694 {
3695 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3696 }
3697 finally
3698 {
3699 try
3700 {
3701 if( reader != null )
3702 {
3703 reader.close();
3704 }
3705 }
3706 catch( final java.io.IOException e )
3707 {
3708 if( !suppressExceptionOnClose )
3709 {
3710 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3711 }
3712 }
3713 }
3714 }
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3729 private static String getDefaultListenerInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
3730 {
3731 java.io.BufferedReader reader = null;
3732 boolean suppressExceptionOnClose = true;
3733
3734 try
3735 {
3736 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultListenerInfo" ), classLoaderInfo, (Object) null );
3737 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3738 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3739 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3740
3741 String line;
3742 while ( ( line = reader.readLine() ) != null )
3743 {
3744 builder.append( lineSeparator ).append( line );
3745 }
3746
3747 suppressExceptionOnClose = false;
3748 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3749 }
3750 catch( final java.lang.ClassCastException e )
3751 {
3752 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3753 }
3754 catch( final java.lang.IllegalArgumentException e )
3755 {
3756 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3757 }
3758 catch( final java.util.MissingResourceException e )
3759 {
3760 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3761 }
3762 catch( final java.io.IOException e )
3763 {
3764 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3765 }
3766 finally
3767 {
3768 try
3769 {
3770 if( reader != null )
3771 {
3772 reader.close();
3773 }
3774 }
3775 catch( final java.io.IOException e )
3776 {
3777 if( !suppressExceptionOnClose )
3778 {
3779 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3780 }
3781 }
3782 }
3783 }
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3799 private static String getDefaultLocatorInfoMessage( final java.util.Locale locale, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
3800 {
3801 java.io.BufferedReader reader = null;
3802 boolean suppressExceptionOnClose = true;
3803
3804 try
3805 {
3806 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultLocatorInfoMessage" ), schemeInfo, classLoaderInfo, (Object) null );
3807 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3808 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3809 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3810
3811 String line;
3812 while ( ( line = reader.readLine() ) != null )
3813 {
3814 builder.append( lineSeparator ).append( line );
3815 }
3816
3817 suppressExceptionOnClose = false;
3818 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3819 }
3820 catch( final java.lang.ClassCastException e )
3821 {
3822 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3823 }
3824 catch( final java.lang.IllegalArgumentException e )
3825 {
3826 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3827 }
3828 catch( final java.util.MissingResourceException e )
3829 {
3830 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3831 }
3832 catch( final java.io.IOException e )
3833 {
3834 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3835 }
3836 finally
3837 {
3838 try
3839 {
3840 if( reader != null )
3841 {
3842 reader.close();
3843 }
3844 }
3845 catch( final java.io.IOException e )
3846 {
3847 if( !suppressExceptionOnClose )
3848 {
3849 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3850 }
3851 }
3852 }
3853 }
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3868 private static String getDefaultLogLevelInfoMessage( final java.util.Locale locale, final java.lang.String logLevel )
3869 {
3870 java.io.BufferedReader reader = null;
3871 boolean suppressExceptionOnClose = true;
3872
3873 try
3874 {
3875 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultLogLevelInfoMessage" ), logLevel, (Object) null );
3876 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3877 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3878 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3879
3880 String line;
3881 while ( ( line = reader.readLine() ) != null )
3882 {
3883 builder.append( lineSeparator ).append( line );
3884 }
3885
3886 suppressExceptionOnClose = false;
3887 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3888 }
3889 catch( final java.lang.ClassCastException e )
3890 {
3891 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3892 }
3893 catch( final java.lang.IllegalArgumentException e )
3894 {
3895 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3896 }
3897 catch( final java.util.MissingResourceException e )
3898 {
3899 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3900 }
3901 catch( final java.io.IOException e )
3902 {
3903 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3904 }
3905 finally
3906 {
3907 try
3908 {
3909 if( reader != null )
3910 {
3911 reader.close();
3912 }
3913 }
3914 catch( final java.io.IOException e )
3915 {
3916 if( !suppressExceptionOnClose )
3917 {
3918 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3919 }
3920 }
3921 }
3922 }
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
3937 private static String getDefaultModelIdentifierInfo( final java.util.Locale locale, final java.lang.String defaultValue )
3938 {
3939 java.io.BufferedReader reader = null;
3940 boolean suppressExceptionOnClose = true;
3941
3942 try
3943 {
3944 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModelIdentifierInfo" ), defaultValue, (Object) null );
3945 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
3946 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
3947 final String lineSeparator = System.getProperty( "line.separator", "\n" );
3948
3949 String line;
3950 while ( ( line = reader.readLine() ) != null )
3951 {
3952 builder.append( lineSeparator ).append( line );
3953 }
3954
3955 suppressExceptionOnClose = false;
3956 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
3957 }
3958 catch( final java.lang.ClassCastException e )
3959 {
3960 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3961 }
3962 catch( final java.lang.IllegalArgumentException e )
3963 {
3964 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3965 }
3966 catch( final java.util.MissingResourceException e )
3967 {
3968 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3969 }
3970 catch( final java.io.IOException e )
3971 {
3972 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3973 }
3974 finally
3975 {
3976 try
3977 {
3978 if( reader != null )
3979 {
3980 reader.close();
3981 }
3982 }
3983 catch( final java.io.IOException e )
3984 {
3985 if( !suppressExceptionOnClose )
3986 {
3987 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
3988 }
3989 }
3990 }
3991 }
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4006 private static String getDefaultModelObjectClasspahResolutionEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
4007 {
4008 java.io.BufferedReader reader = null;
4009 boolean suppressExceptionOnClose = true;
4010
4011 try
4012 {
4013 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModelObjectClasspahResolutionEnabledInfo" ), defaultValue, (Object) null );
4014 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4015 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4016 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4017
4018 String line;
4019 while ( ( line = reader.readLine() ) != null )
4020 {
4021 builder.append( lineSeparator ).append( line );
4022 }
4023
4024 suppressExceptionOnClose = false;
4025 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4026 }
4027 catch( final java.lang.ClassCastException e )
4028 {
4029 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4030 }
4031 catch( final java.lang.IllegalArgumentException e )
4032 {
4033 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4034 }
4035 catch( final java.util.MissingResourceException e )
4036 {
4037 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4038 }
4039 catch( final java.io.IOException e )
4040 {
4041 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4042 }
4043 finally
4044 {
4045 try
4046 {
4047 if( reader != null )
4048 {
4049 reader.close();
4050 }
4051 }
4052 catch( final java.io.IOException e )
4053 {
4054 if( !suppressExceptionOnClose )
4055 {
4056 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4057 }
4058 }
4059 }
4060 }
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4075 private static String getDefaultModelProcessingEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
4076 {
4077 java.io.BufferedReader reader = null;
4078 boolean suppressExceptionOnClose = true;
4079
4080 try
4081 {
4082 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModelProcessingEnabledInfo" ), defaultValue, (Object) null );
4083 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4084 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4085 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4086
4087 String line;
4088 while ( ( line = reader.readLine() ) != null )
4089 {
4090 builder.append( lineSeparator ).append( line );
4091 }
4092
4093 suppressExceptionOnClose = false;
4094 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4095 }
4096 catch( final java.lang.ClassCastException e )
4097 {
4098 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4099 }
4100 catch( final java.lang.IllegalArgumentException e )
4101 {
4102 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4103 }
4104 catch( final java.util.MissingResourceException e )
4105 {
4106 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4107 }
4108 catch( final java.io.IOException e )
4109 {
4110 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4111 }
4112 finally
4113 {
4114 try
4115 {
4116 if( reader != null )
4117 {
4118 reader.close();
4119 }
4120 }
4121 catch( final java.io.IOException e )
4122 {
4123 if( !suppressExceptionOnClose )
4124 {
4125 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4126 }
4127 }
4128 }
4129 }
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4143 private static String getDefaultModuleName( final java.util.Locale locale )
4144 {
4145 java.io.BufferedReader reader = null;
4146 boolean suppressExceptionOnClose = true;
4147
4148 try
4149 {
4150 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModuleName" ), (Object) null );
4151 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4152 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4153 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4154
4155 String line;
4156 while ( ( line = reader.readLine() ) != null )
4157 {
4158 builder.append( lineSeparator ).append( line );
4159 }
4160
4161 suppressExceptionOnClose = false;
4162 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4163 }
4164 catch( final java.lang.ClassCastException e )
4165 {
4166 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4167 }
4168 catch( final java.lang.IllegalArgumentException e )
4169 {
4170 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4171 }
4172 catch( final java.util.MissingResourceException e )
4173 {
4174 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4175 }
4176 catch( final java.io.IOException e )
4177 {
4178 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4179 }
4180 finally
4181 {
4182 try
4183 {
4184 if( reader != null )
4185 {
4186 reader.close();
4187 }
4188 }
4189 catch( final java.io.IOException e )
4190 {
4191 if( !suppressExceptionOnClose )
4192 {
4193 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4194 }
4195 }
4196 }
4197 }
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4211 private static String getDefaultModulesVendor( final java.util.Locale locale )
4212 {
4213 java.io.BufferedReader reader = null;
4214 boolean suppressExceptionOnClose = true;
4215
4216 try
4217 {
4218 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModulesVendor" ), (Object) null );
4219 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4220 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4221 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4222
4223 String line;
4224 while ( ( line = reader.readLine() ) != null )
4225 {
4226 builder.append( lineSeparator ).append( line );
4227 }
4228
4229 suppressExceptionOnClose = false;
4230 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4231 }
4232 catch( final java.lang.ClassCastException e )
4233 {
4234 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4235 }
4236 catch( final java.lang.IllegalArgumentException e )
4237 {
4238 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4239 }
4240 catch( final java.util.MissingResourceException e )
4241 {
4242 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4243 }
4244 catch( final java.io.IOException e )
4245 {
4246 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4247 }
4248 finally
4249 {
4250 try
4251 {
4252 if( reader != null )
4253 {
4254 reader.close();
4255 }
4256 }
4257 catch( final java.io.IOException e )
4258 {
4259 if( !suppressExceptionOnClose )
4260 {
4261 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4262 }
4263 }
4264 }
4265 }
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4279 private static String getDefaultModulesVersion( final java.util.Locale locale )
4280 {
4281 java.io.BufferedReader reader = null;
4282 boolean suppressExceptionOnClose = true;
4283
4284 try
4285 {
4286 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModulesVersion" ), (Object) null );
4287 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4288 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4289 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4290
4291 String line;
4292 while ( ( line = reader.readLine() ) != null )
4293 {
4294 builder.append( lineSeparator ).append( line );
4295 }
4296
4297 suppressExceptionOnClose = false;
4298 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4299 }
4300 catch( final java.lang.ClassCastException e )
4301 {
4302 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4303 }
4304 catch( final java.lang.IllegalArgumentException e )
4305 {
4306 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4307 }
4308 catch( final java.util.MissingResourceException e )
4309 {
4310 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4311 }
4312 catch( final java.io.IOException e )
4313 {
4314 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4315 }
4316 finally
4317 {
4318 try
4319 {
4320 if( reader != null )
4321 {
4322 reader.close();
4323 }
4324 }
4325 catch( final java.io.IOException e )
4326 {
4327 if( !suppressExceptionOnClose )
4328 {
4329 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4330 }
4331 }
4332 }
4333 }
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4349 private static String getDefaultModulesWarning( final java.util.Locale locale, final java.lang.String modelInfo, final java.lang.String classLoaderInfo )
4350 {
4351 java.io.BufferedReader reader = null;
4352 boolean suppressExceptionOnClose = true;
4353
4354 try
4355 {
4356 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultModulesWarning" ), modelInfo, classLoaderInfo, (Object) null );
4357 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4358 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4359 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4360
4361 String line;
4362 while ( ( line = reader.readLine() ) != null )
4363 {
4364 builder.append( lineSeparator ).append( line );
4365 }
4366
4367 suppressExceptionOnClose = false;
4368 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4369 }
4370 catch( final java.lang.ClassCastException e )
4371 {
4372 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4373 }
4374 catch( final java.lang.IllegalArgumentException e )
4375 {
4376 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4377 }
4378 catch( final java.util.MissingResourceException e )
4379 {
4380 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4381 }
4382 catch( final java.io.IOException e )
4383 {
4384 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4385 }
4386 finally
4387 {
4388 try
4389 {
4390 if( reader != null )
4391 {
4392 reader.close();
4393 }
4394 }
4395 catch( final java.io.IOException e )
4396 {
4397 if( !suppressExceptionOnClose )
4398 {
4399 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4400 }
4401 }
4402 }
4403 }
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4419 private static String getDefaultScopeInfoMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
4420 {
4421 java.io.BufferedReader reader = null;
4422 boolean suppressExceptionOnClose = true;
4423
4424 try
4425 {
4426 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "defaultScopeInfoMessage" ), scopeIdentifier, classLoaderInfo, (Object) null );
4427 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4428 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4429 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4430
4431 String line;
4432 while ( ( line = reader.readLine() ) != null )
4433 {
4434 builder.append( lineSeparator ).append( line );
4435 }
4436
4437 suppressExceptionOnClose = false;
4438 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4439 }
4440 catch( final java.lang.ClassCastException e )
4441 {
4442 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4443 }
4444 catch( final java.lang.IllegalArgumentException e )
4445 {
4446 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4447 }
4448 catch( final java.util.MissingResourceException e )
4449 {
4450 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4451 }
4452 catch( final java.io.IOException e )
4453 {
4454 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4455 }
4456 finally
4457 {
4458 try
4459 {
4460 if( reader != null )
4461 {
4462 reader.close();
4463 }
4464 }
4465 catch( final java.io.IOException e )
4466 {
4467 if( !suppressExceptionOnClose )
4468 {
4469 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4470 }
4471 }
4472 }
4473 }
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4488 private static String getDependencyCycleMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4489 {
4490 java.io.BufferedReader reader = null;
4491 boolean suppressExceptionOnClose = true;
4492
4493 try
4494 {
4495 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "dependencyCycleMessage" ), implementationIdentifier, (Object) null );
4496 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4497 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4498 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4499
4500 String line;
4501 while ( ( line = reader.readLine() ) != null )
4502 {
4503 builder.append( lineSeparator ).append( line );
4504 }
4505
4506 suppressExceptionOnClose = false;
4507 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4508 }
4509 catch( final java.lang.ClassCastException e )
4510 {
4511 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4512 }
4513 catch( final java.lang.IllegalArgumentException e )
4514 {
4515 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4516 }
4517 catch( final java.util.MissingResourceException e )
4518 {
4519 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4520 }
4521 catch( final java.io.IOException e )
4522 {
4523 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4524 }
4525 finally
4526 {
4527 try
4528 {
4529 if( reader != null )
4530 {
4531 reader.close();
4532 }
4533 }
4534 catch( final java.io.IOException e )
4535 {
4536 if( !suppressExceptionOnClose )
4537 {
4538 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4539 }
4540 }
4541 }
4542 }
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4557 private static String getIgnoredInvocationMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4558 {
4559 java.io.BufferedReader reader = null;
4560 boolean suppressExceptionOnClose = true;
4561
4562 try
4563 {
4564 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "ignoredInvocationMessage" ), implementationIdentifier, (Object) null );
4565 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4566 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4567 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4568
4569 String line;
4570 while ( ( line = reader.readLine() ) != null )
4571 {
4572 builder.append( lineSeparator ).append( line );
4573 }
4574
4575 suppressExceptionOnClose = false;
4576 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4577 }
4578 catch( final java.lang.ClassCastException e )
4579 {
4580 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4581 }
4582 catch( final java.lang.IllegalArgumentException e )
4583 {
4584 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4585 }
4586 catch( final java.util.MissingResourceException e )
4587 {
4588 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4589 }
4590 catch( final java.io.IOException e )
4591 {
4592 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4593 }
4594 finally
4595 {
4596 try
4597 {
4598 if( reader != null )
4599 {
4600 reader.close();
4601 }
4602 }
4603 catch( final java.io.IOException e )
4604 {
4605 if( !suppressExceptionOnClose )
4606 {
4607 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4608 }
4609 }
4610 }
4611 }
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4626 private static String getIgnoredInvokerMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
4627 {
4628 java.io.BufferedReader reader = null;
4629 boolean suppressExceptionOnClose = true;
4630
4631 try
4632 {
4633 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "ignoredInvokerMessage" ), implementationIdentifier, (Object) null );
4634 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4635 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4636 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4637
4638 String line;
4639 while ( ( line = reader.readLine() ) != null )
4640 {
4641 builder.append( lineSeparator ).append( line );
4642 }
4643
4644 suppressExceptionOnClose = false;
4645 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4646 }
4647 catch( final java.lang.ClassCastException e )
4648 {
4649 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4650 }
4651 catch( final java.lang.IllegalArgumentException e )
4652 {
4653 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4654 }
4655 catch( final java.util.MissingResourceException e )
4656 {
4657 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4658 }
4659 catch( final java.io.IOException e )
4660 {
4661 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4662 }
4663 finally
4664 {
4665 try
4666 {
4667 if( reader != null )
4668 {
4669 reader.close();
4670 }
4671 }
4672 catch( final java.io.IOException e )
4673 {
4674 if( !suppressExceptionOnClose )
4675 {
4676 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4677 }
4678 }
4679 }
4680 }
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4696 private static String getIllegalArraySpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
4697 {
4698 java.io.BufferedReader reader = null;
4699 boolean suppressExceptionOnClose = true;
4700
4701 try
4702 {
4703 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "illegalArraySpecificationMessage" ), specificationIdentifier, specificationMultiplicity, (Object) null );
4704 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4705 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4706 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4707
4708 String line;
4709 while ( ( line = reader.readLine() ) != null )
4710 {
4711 builder.append( lineSeparator ).append( line );
4712 }
4713
4714 suppressExceptionOnClose = false;
4715 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4716 }
4717 catch( final java.lang.ClassCastException e )
4718 {
4719 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4720 }
4721 catch( final java.lang.IllegalArgumentException e )
4722 {
4723 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4724 }
4725 catch( final java.util.MissingResourceException e )
4726 {
4727 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4728 }
4729 catch( final java.io.IOException e )
4730 {
4731 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4732 }
4733 finally
4734 {
4735 try
4736 {
4737 if( reader != null )
4738 {
4739 reader.close();
4740 }
4741 }
4742 catch( final java.io.IOException e )
4743 {
4744 if( !suppressExceptionOnClose )
4745 {
4746 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4747 }
4748 }
4749 }
4750 }
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4766 private static String getIllegalObjectSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
4767 {
4768 java.io.BufferedReader reader = null;
4769 boolean suppressExceptionOnClose = true;
4770
4771 try
4772 {
4773 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "illegalObjectSpecificationMessage" ), specificationIdentifier, specificationMultiplicity, (Object) null );
4774 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4775 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4776 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4777
4778 String line;
4779 while ( ( line = reader.readLine() ) != null )
4780 {
4781 builder.append( lineSeparator ).append( line );
4782 }
4783
4784 suppressExceptionOnClose = false;
4785 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4786 }
4787 catch( final java.lang.ClassCastException e )
4788 {
4789 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4790 }
4791 catch( final java.lang.IllegalArgumentException e )
4792 {
4793 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4794 }
4795 catch( final java.util.MissingResourceException e )
4796 {
4797 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4798 }
4799 catch( final java.io.IOException e )
4800 {
4801 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4802 }
4803 finally
4804 {
4805 try
4806 {
4807 if( reader != null )
4808 {
4809 reader.close();
4810 }
4811 }
4812 catch( final java.io.IOException e )
4813 {
4814 if( !suppressExceptionOnClose )
4815 {
4816 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4817 }
4818 }
4819 }
4820 }
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4835 private static String getImplementationInfoMessage( final java.util.Locale locale, final java.lang.Number initializationMillis )
4836 {
4837 java.io.BufferedReader reader = null;
4838 boolean suppressExceptionOnClose = true;
4839
4840 try
4841 {
4842 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "implementationInfoMessage" ), initializationMillis, (Object) null );
4843 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4844 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4845 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4846
4847 String line;
4848 while ( ( line = reader.readLine() ) != null )
4849 {
4850 builder.append( lineSeparator ).append( line );
4851 }
4852
4853 suppressExceptionOnClose = false;
4854 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4855 }
4856 catch( final java.lang.ClassCastException e )
4857 {
4858 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4859 }
4860 catch( final java.lang.IllegalArgumentException e )
4861 {
4862 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4863 }
4864 catch( final java.util.MissingResourceException e )
4865 {
4866 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4867 }
4868 catch( final java.io.IOException e )
4869 {
4870 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4871 }
4872 finally
4873 {
4874 try
4875 {
4876 if( reader != null )
4877 {
4878 reader.close();
4879 }
4880 }
4881 catch( final java.io.IOException e )
4882 {
4883 if( !suppressExceptionOnClose )
4884 {
4885 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4886 }
4887 }
4888 }
4889 }
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4905 private static String getInvokerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
4906 {
4907 java.io.BufferedReader reader = null;
4908 boolean suppressExceptionOnClose = true;
4909
4910 try
4911 {
4912 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "invokerInfoMessage" ), implementationIdentifier, classLoaderInfo, (Object) null );
4913 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4914 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4915 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4916
4917 String line;
4918 while ( ( line = reader.readLine() ) != null )
4919 {
4920 builder.append( lineSeparator ).append( line );
4921 }
4922
4923 suppressExceptionOnClose = false;
4924 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4925 }
4926 catch( final java.lang.ClassCastException e )
4927 {
4928 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4929 }
4930 catch( final java.lang.IllegalArgumentException e )
4931 {
4932 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4933 }
4934 catch( final java.util.MissingResourceException e )
4935 {
4936 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4937 }
4938 catch( final java.io.IOException e )
4939 {
4940 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4941 }
4942 finally
4943 {
4944 try
4945 {
4946 if( reader != null )
4947 {
4948 reader.close();
4949 }
4950 }
4951 catch( final java.io.IOException e )
4952 {
4953 if( !suppressExceptionOnClose )
4954 {
4955 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4956 }
4957 }
4958 }
4959 }
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
4975 private static String getListenerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
4976 {
4977 java.io.BufferedReader reader = null;
4978 boolean suppressExceptionOnClose = true;
4979
4980 try
4981 {
4982 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "listenerInfoMessage" ), implementationIdentifier, classLoaderInfo, (Object) null );
4983 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
4984 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
4985 final String lineSeparator = System.getProperty( "line.separator", "\n" );
4986
4987 String line;
4988 while ( ( line = reader.readLine() ) != null )
4989 {
4990 builder.append( lineSeparator ).append( line );
4991 }
4992
4993 suppressExceptionOnClose = false;
4994 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
4995 }
4996 catch( final java.lang.ClassCastException e )
4997 {
4998 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
4999 }
5000 catch( final java.lang.IllegalArgumentException e )
5001 {
5002 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5003 }
5004 catch( final java.util.MissingResourceException e )
5005 {
5006 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5007 }
5008 catch( final java.io.IOException e )
5009 {
5010 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5011 }
5012 finally
5013 {
5014 try
5015 {
5016 if( reader != null )
5017 {
5018 reader.close();
5019 }
5020 }
5021 catch( final java.io.IOException e )
5022 {
5023 if( !suppressExceptionOnClose )
5024 {
5025 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5026 }
5027 }
5028 }
5029 }
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5046 private static String getLocatorInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
5047 {
5048 java.io.BufferedReader reader = null;
5049 boolean suppressExceptionOnClose = true;
5050
5051 try
5052 {
5053 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "locatorInfoMessage" ), implementationIdentifier, schemeInfo, classLoaderInfo, (Object) null );
5054 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5055 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5056 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5057
5058 String line;
5059 while ( ( line = reader.readLine() ) != null )
5060 {
5061 builder.append( lineSeparator ).append( line );
5062 }
5063
5064 suppressExceptionOnClose = false;
5065 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5066 }
5067 catch( final java.lang.ClassCastException e )
5068 {
5069 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5070 }
5071 catch( final java.lang.IllegalArgumentException e )
5072 {
5073 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5074 }
5075 catch( final java.util.MissingResourceException e )
5076 {
5077 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5078 }
5079 catch( final java.io.IOException e )
5080 {
5081 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5082 }
5083 finally
5084 {
5085 try
5086 {
5087 if( reader != null )
5088 {
5089 reader.close();
5090 }
5091 }
5092 catch( final java.io.IOException e )
5093 {
5094 if( !suppressExceptionOnClose )
5095 {
5096 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5097 }
5098 }
5099 }
5100 }
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5116 private static String getMissingDependencyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String dependencyName )
5117 {
5118 java.io.BufferedReader reader = null;
5119 boolean suppressExceptionOnClose = true;
5120
5121 try
5122 {
5123 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingDependencyMessage" ), implementationIdentifier, dependencyName, (Object) null );
5124 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5125 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5126 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5127
5128 String line;
5129 while ( ( line = reader.readLine() ) != null )
5130 {
5131 builder.append( lineSeparator ).append( line );
5132 }
5133
5134 suppressExceptionOnClose = false;
5135 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5136 }
5137 catch( final java.lang.ClassCastException e )
5138 {
5139 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5140 }
5141 catch( final java.lang.IllegalArgumentException e )
5142 {
5143 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5144 }
5145 catch( final java.util.MissingResourceException e )
5146 {
5147 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5148 }
5149 catch( final java.io.IOException e )
5150 {
5151 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5152 }
5153 finally
5154 {
5155 try
5156 {
5157 if( reader != null )
5158 {
5159 reader.close();
5160 }
5161 }
5162 catch( final java.io.IOException e )
5163 {
5164 if( !suppressExceptionOnClose )
5165 {
5166 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5167 }
5168 }
5169 }
5170 }
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5186 private static String getMissingImplementationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String implementationName )
5187 {
5188 java.io.BufferedReader reader = null;
5189 boolean suppressExceptionOnClose = true;
5190
5191 try
5192 {
5193 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingImplementationMessage" ), specificationIdentifier, implementationName, (Object) null );
5194 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5195 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5196 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5197
5198 String line;
5199 while ( ( line = reader.readLine() ) != null )
5200 {
5201 builder.append( lineSeparator ).append( line );
5202 }
5203
5204 suppressExceptionOnClose = false;
5205 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5206 }
5207 catch( final java.lang.ClassCastException e )
5208 {
5209 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5210 }
5211 catch( final java.lang.IllegalArgumentException e )
5212 {
5213 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5214 }
5215 catch( final java.util.MissingResourceException e )
5216 {
5217 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5218 }
5219 catch( final java.io.IOException e )
5220 {
5221 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5222 }
5223 finally
5224 {
5225 try
5226 {
5227 if( reader != null )
5228 {
5229 reader.close();
5230 }
5231 }
5232 catch( final java.io.IOException e )
5233 {
5234 if( !suppressExceptionOnClose )
5235 {
5236 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5237 }
5238 }
5239 }
5240 }
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5255 private static String getMissingImplementationsMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
5256 {
5257 java.io.BufferedReader reader = null;
5258 boolean suppressExceptionOnClose = true;
5259
5260 try
5261 {
5262 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingImplementationsMessage" ), specificationIdentifier, (Object) null );
5263 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5264 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5265 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5266
5267 String line;
5268 while ( ( line = reader.readLine() ) != null )
5269 {
5270 builder.append( lineSeparator ).append( line );
5271 }
5272
5273 suppressExceptionOnClose = false;
5274 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5275 }
5276 catch( final java.lang.ClassCastException e )
5277 {
5278 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5279 }
5280 catch( final java.lang.IllegalArgumentException e )
5281 {
5282 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5283 }
5284 catch( final java.util.MissingResourceException e )
5285 {
5286 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5287 }
5288 catch( final java.io.IOException e )
5289 {
5290 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5291 }
5292 finally
5293 {
5294 try
5295 {
5296 if( reader != null )
5297 {
5298 reader.close();
5299 }
5300 }
5301 catch( final java.io.IOException e )
5302 {
5303 if( !suppressExceptionOnClose )
5304 {
5305 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5306 }
5307 }
5308 }
5309 }
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5325 private static String getMissingInstanceMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
5326 {
5327 java.io.BufferedReader reader = null;
5328 boolean suppressExceptionOnClose = true;
5329
5330 try
5331 {
5332 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingInstanceMessage" ), implementationIdentifier, implementationName, (Object) null );
5333 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5334 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5335 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5336
5337 String line;
5338 while ( ( line = reader.readLine() ) != null )
5339 {
5340 builder.append( lineSeparator ).append( line );
5341 }
5342
5343 suppressExceptionOnClose = false;
5344 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5345 }
5346 catch( final java.lang.ClassCastException e )
5347 {
5348 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5349 }
5350 catch( final java.lang.IllegalArgumentException e )
5351 {
5352 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5353 }
5354 catch( final java.util.MissingResourceException e )
5355 {
5356 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5357 }
5358 catch( final java.io.IOException e )
5359 {
5360 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5361 }
5362 finally
5363 {
5364 try
5365 {
5366 if( reader != null )
5367 {
5368 reader.close();
5369 }
5370 }
5371 catch( final java.io.IOException e )
5372 {
5373 if( !suppressExceptionOnClose )
5374 {
5375 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5376 }
5377 }
5378 }
5379 }
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5394 private static String getMissingLocatorMessage( final java.util.Locale locale, final java.lang.String locationInfo )
5395 {
5396 java.io.BufferedReader reader = null;
5397 boolean suppressExceptionOnClose = true;
5398
5399 try
5400 {
5401 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingLocatorMessage" ), locationInfo, (Object) null );
5402 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5403 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5404 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5405
5406 String line;
5407 while ( ( line = reader.readLine() ) != null )
5408 {
5409 builder.append( lineSeparator ).append( line );
5410 }
5411
5412 suppressExceptionOnClose = false;
5413 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5414 }
5415 catch( final java.lang.ClassCastException e )
5416 {
5417 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5418 }
5419 catch( final java.lang.IllegalArgumentException e )
5420 {
5421 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5422 }
5423 catch( final java.util.MissingResourceException e )
5424 {
5425 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5426 }
5427 catch( final java.io.IOException e )
5428 {
5429 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5430 }
5431 finally
5432 {
5433 try
5434 {
5435 if( reader != null )
5436 {
5437 reader.close();
5438 }
5439 }
5440 catch( final java.io.IOException e )
5441 {
5442 if( !suppressExceptionOnClose )
5443 {
5444 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5445 }
5446 }
5447 }
5448 }
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5464 private static String getMissingMessageMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String messageName )
5465 {
5466 java.io.BufferedReader reader = null;
5467 boolean suppressExceptionOnClose = true;
5468
5469 try
5470 {
5471 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingMessageMessage" ), implementationIdentifier, messageName, (Object) null );
5472 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5473 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5474 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5475
5476 String line;
5477 while ( ( line = reader.readLine() ) != null )
5478 {
5479 builder.append( lineSeparator ).append( line );
5480 }
5481
5482 suppressExceptionOnClose = false;
5483 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5484 }
5485 catch( final java.lang.ClassCastException e )
5486 {
5487 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5488 }
5489 catch( final java.lang.IllegalArgumentException e )
5490 {
5491 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5492 }
5493 catch( final java.util.MissingResourceException e )
5494 {
5495 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5496 }
5497 catch( final java.io.IOException e )
5498 {
5499 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5500 }
5501 finally
5502 {
5503 try
5504 {
5505 if( reader != null )
5506 {
5507 reader.close();
5508 }
5509 }
5510 catch( final java.io.IOException e )
5511 {
5512 if( !suppressExceptionOnClose )
5513 {
5514 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5515 }
5516 }
5517 }
5518 }
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5533 private static String getMissingObjectInstanceMessage( final java.util.Locale locale, final java.lang.String objectInfo )
5534 {
5535 java.io.BufferedReader reader = null;
5536 boolean suppressExceptionOnClose = true;
5537
5538 try
5539 {
5540 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingObjectInstanceMessage" ), objectInfo, (Object) null );
5541 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5542 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5543 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5544
5545 String line;
5546 while ( ( line = reader.readLine() ) != null )
5547 {
5548 builder.append( lineSeparator ).append( line );
5549 }
5550
5551 suppressExceptionOnClose = false;
5552 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5553 }
5554 catch( final java.lang.ClassCastException e )
5555 {
5556 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5557 }
5558 catch( final java.lang.IllegalArgumentException e )
5559 {
5560 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5561 }
5562 catch( final java.util.MissingResourceException e )
5563 {
5564 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5565 }
5566 catch( final java.io.IOException e )
5567 {
5568 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5569 }
5570 finally
5571 {
5572 try
5573 {
5574 if( reader != null )
5575 {
5576 reader.close();
5577 }
5578 }
5579 catch( final java.io.IOException e )
5580 {
5581 if( !suppressExceptionOnClose )
5582 {
5583 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5584 }
5585 }
5586 }
5587 }
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5603 private static String getMissingObjectMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
5604 {
5605 java.io.BufferedReader reader = null;
5606 boolean suppressExceptionOnClose = true;
5607
5608 try
5609 {
5610 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingObjectMessage" ), implementationIdentifier, implementationName, (Object) null );
5611 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5612 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5613 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5614
5615 String line;
5616 while ( ( line = reader.readLine() ) != null )
5617 {
5618 builder.append( lineSeparator ).append( line );
5619 }
5620
5621 suppressExceptionOnClose = false;
5622 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5623 }
5624 catch( final java.lang.ClassCastException e )
5625 {
5626 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5627 }
5628 catch( final java.lang.IllegalArgumentException e )
5629 {
5630 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5631 }
5632 catch( final java.util.MissingResourceException e )
5633 {
5634 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5635 }
5636 catch( final java.io.IOException e )
5637 {
5638 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5639 }
5640 finally
5641 {
5642 try
5643 {
5644 if( reader != null )
5645 {
5646 reader.close();
5647 }
5648 }
5649 catch( final java.io.IOException e )
5650 {
5651 if( !suppressExceptionOnClose )
5652 {
5653 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5654 }
5655 }
5656 }
5657 }
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5673 private static String getMissingPropertyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String propertyName )
5674 {
5675 java.io.BufferedReader reader = null;
5676 boolean suppressExceptionOnClose = true;
5677
5678 try
5679 {
5680 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingPropertyMessage" ), implementationIdentifier, propertyName, (Object) null );
5681 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5682 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5683 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5684
5685 String line;
5686 while ( ( line = reader.readLine() ) != null )
5687 {
5688 builder.append( lineSeparator ).append( line );
5689 }
5690
5691 suppressExceptionOnClose = false;
5692 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5693 }
5694 catch( final java.lang.ClassCastException e )
5695 {
5696 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5697 }
5698 catch( final java.lang.IllegalArgumentException e )
5699 {
5700 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5701 }
5702 catch( final java.util.MissingResourceException e )
5703 {
5704 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5705 }
5706 catch( final java.io.IOException e )
5707 {
5708 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5709 }
5710 finally
5711 {
5712 try
5713 {
5714 if( reader != null )
5715 {
5716 reader.close();
5717 }
5718 }
5719 catch( final java.io.IOException e )
5720 {
5721 if( !suppressExceptionOnClose )
5722 {
5723 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5724 }
5725 }
5726 }
5727 }
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5742 private static String getMissingScopeMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier )
5743 {
5744 java.io.BufferedReader reader = null;
5745 boolean suppressExceptionOnClose = true;
5746
5747 try
5748 {
5749 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingScopeMessage" ), scopeIdentifier, (Object) null );
5750 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5751 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5752 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5753
5754 String line;
5755 while ( ( line = reader.readLine() ) != null )
5756 {
5757 builder.append( lineSeparator ).append( line );
5758 }
5759
5760 suppressExceptionOnClose = false;
5761 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5762 }
5763 catch( final java.lang.ClassCastException e )
5764 {
5765 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5766 }
5767 catch( final java.lang.IllegalArgumentException e )
5768 {
5769 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5770 }
5771 catch( final java.util.MissingResourceException e )
5772 {
5773 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5774 }
5775 catch( final java.io.IOException e )
5776 {
5777 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5778 }
5779 finally
5780 {
5781 try
5782 {
5783 if( reader != null )
5784 {
5785 reader.close();
5786 }
5787 }
5788 catch( final java.io.IOException e )
5789 {
5790 if( !suppressExceptionOnClose )
5791 {
5792 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5793 }
5794 }
5795 }
5796 }
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5811 private static String getMissingSpecificationClassMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
5812 {
5813 java.io.BufferedReader reader = null;
5814 boolean suppressExceptionOnClose = true;
5815
5816 try
5817 {
5818 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingSpecificationClassMessage" ), specificationIdentifier, (Object) null );
5819 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5820 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5821 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5822
5823 String line;
5824 while ( ( line = reader.readLine() ) != null )
5825 {
5826 builder.append( lineSeparator ).append( line );
5827 }
5828
5829 suppressExceptionOnClose = false;
5830 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5831 }
5832 catch( final java.lang.ClassCastException e )
5833 {
5834 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5835 }
5836 catch( final java.lang.IllegalArgumentException e )
5837 {
5838 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5839 }
5840 catch( final java.util.MissingResourceException e )
5841 {
5842 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5843 }
5844 catch( final java.io.IOException e )
5845 {
5846 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5847 }
5848 finally
5849 {
5850 try
5851 {
5852 if( reader != null )
5853 {
5854 reader.close();
5855 }
5856 }
5857 catch( final java.io.IOException e )
5858 {
5859 if( !suppressExceptionOnClose )
5860 {
5861 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5862 }
5863 }
5864 }
5865 }
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5880 private static String getMissingSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
5881 {
5882 java.io.BufferedReader reader = null;
5883 boolean suppressExceptionOnClose = true;
5884
5885 try
5886 {
5887 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "missingSpecificationMessage" ), specificationIdentifier, (Object) null );
5888 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5889 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5890 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5891
5892 String line;
5893 while ( ( line = reader.readLine() ) != null )
5894 {
5895 builder.append( lineSeparator ).append( line );
5896 }
5897
5898 suppressExceptionOnClose = false;
5899 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5900 }
5901 catch( final java.lang.ClassCastException e )
5902 {
5903 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5904 }
5905 catch( final java.lang.IllegalArgumentException e )
5906 {
5907 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5908 }
5909 catch( final java.util.MissingResourceException e )
5910 {
5911 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5912 }
5913 catch( final java.io.IOException e )
5914 {
5915 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5916 }
5917 finally
5918 {
5919 try
5920 {
5921 if( reader != null )
5922 {
5923 reader.close();
5924 }
5925 }
5926 catch( final java.io.IOException e )
5927 {
5928 if( !suppressExceptionOnClose )
5929 {
5930 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5931 }
5932 }
5933 }
5934 }
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
5948 private static String getModulesReportMessage( final java.util.Locale locale )
5949 {
5950 java.io.BufferedReader reader = null;
5951 boolean suppressExceptionOnClose = true;
5952
5953 try
5954 {
5955 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "modulesReportMessage" ), (Object) null );
5956 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
5957 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
5958 final String lineSeparator = System.getProperty( "line.separator", "\n" );
5959
5960 String line;
5961 while ( ( line = reader.readLine() ) != null )
5962 {
5963 builder.append( lineSeparator ).append( line );
5964 }
5965
5966 suppressExceptionOnClose = false;
5967 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
5968 }
5969 catch( final java.lang.ClassCastException e )
5970 {
5971 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5972 }
5973 catch( final java.lang.IllegalArgumentException e )
5974 {
5975 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5976 }
5977 catch( final java.util.MissingResourceException e )
5978 {
5979 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5980 }
5981 catch( final java.io.IOException e )
5982 {
5983 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5984 }
5985 finally
5986 {
5987 try
5988 {
5989 if( reader != null )
5990 {
5991 reader.close();
5992 }
5993 }
5994 catch( final java.io.IOException e )
5995 {
5996 if( !suppressExceptionOnClose )
5997 {
5998 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
5999 }
6000 }
6001 }
6002 }
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
6017 private static String getScopeContentionFailure( final java.util.Locale locale, final java.lang.String objectIdentifier )
6018 {
6019 java.io.BufferedReader reader = null;
6020 boolean suppressExceptionOnClose = true;
6021
6022 try
6023 {
6024 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "scopeContentionFailure" ), objectIdentifier, (Object) null );
6025 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6026 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6027 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6028
6029 String line;
6030 while ( ( line = reader.readLine() ) != null )
6031 {
6032 builder.append( lineSeparator ).append( line );
6033 }
6034
6035 suppressExceptionOnClose = false;
6036 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6037 }
6038 catch( final java.lang.ClassCastException e )
6039 {
6040 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6041 }
6042 catch( final java.lang.IllegalArgumentException e )
6043 {
6044 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6045 }
6046 catch( final java.util.MissingResourceException e )
6047 {
6048 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6049 }
6050 catch( final java.io.IOException e )
6051 {
6052 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6053 }
6054 finally
6055 {
6056 try
6057 {
6058 if( reader != null )
6059 {
6060 reader.close();
6061 }
6062 }
6063 catch( final java.io.IOException e )
6064 {
6065 if( !suppressExceptionOnClose )
6066 {
6067 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6068 }
6069 }
6070 }
6071 }
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
6088 private static String getScopeInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
6089 {
6090 java.io.BufferedReader reader = null;
6091 boolean suppressExceptionOnClose = true;
6092
6093 try
6094 {
6095 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "scopeInfoMessage" ), implementationIdentifier, scopeIdentifier, classLoaderInfo, (Object) null );
6096 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6097 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6098 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6099
6100 String line;
6101 while ( ( line = reader.readLine() ) != null )
6102 {
6103 builder.append( lineSeparator ).append( line );
6104 }
6105
6106 suppressExceptionOnClose = false;
6107 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6108 }
6109 catch( final java.lang.ClassCastException e )
6110 {
6111 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6112 }
6113 catch( final java.lang.IllegalArgumentException e )
6114 {
6115 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6116 }
6117 catch( final java.util.MissingResourceException e )
6118 {
6119 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6120 }
6121 catch( final java.io.IOException e )
6122 {
6123 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6124 }
6125 finally
6126 {
6127 try
6128 {
6129 if( reader != null )
6130 {
6131 reader.close();
6132 }
6133 }
6134 catch( final java.io.IOException e )
6135 {
6136 if( !suppressExceptionOnClose )
6137 {
6138 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6139 }
6140 }
6141 }
6142 }
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
6160 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 )
6161 {
6162 java.io.BufferedReader reader = null;
6163 boolean suppressExceptionOnClose = true;
6164
6165 try
6166 {
6167 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jomc/ri/DefaultObjectManager", locale ).getString( "unexpectedDependencyObjectsMessage" ), implementationIdentifier, dependencyName, expectedNumber, computedNumber, (Object) null );
6168 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
6169 reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
6170 final String lineSeparator = System.getProperty( "line.separator", "\n" );
6171
6172 String line;
6173 while ( ( line = reader.readLine() ) != null )
6174 {
6175 builder.append( lineSeparator ).append( line );
6176 }
6177
6178 suppressExceptionOnClose = false;
6179 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
6180 }
6181 catch( final java.lang.ClassCastException e )
6182 {
6183 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6184 }
6185 catch( final java.lang.IllegalArgumentException e )
6186 {
6187 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6188 }
6189 catch( final java.util.MissingResourceException e )
6190 {
6191 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6192 }
6193 catch( final java.io.IOException e )
6194 {
6195 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6196 }
6197 finally
6198 {
6199 try
6200 {
6201 if( reader != null )
6202 {
6203 reader.close();
6204 }
6205 }
6206 catch( final java.io.IOException e )
6207 {
6208 if( !suppressExceptionOnClose )
6209 {
6210 throw new org.jomc.ObjectManagementException( e.getMessage(), e );
6211 }
6212 }
6213 }
6214 }
6215
6216
6217 }