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