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