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