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