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