DefaultObjectManager.java

  1. // SECTION-START[License Header]
  2. // <editor-fold defaultstate="collapsed" desc=" Generated License ">
  3. /*
  4.  * Java Object Management and Configuration
  5.  * Copyright (C) Christian Schulte <cs@schulte.it>, 2005-206
  6.  * All rights reserved.
  7.  *
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  *
  12.  *   o Redistributions of source code must retain the above copyright
  13.  *     notice, this list of conditions and the following disclaimer.
  14.  *
  15.  *   o Redistributions in binary form must reproduce the above copyright
  16.  *     notice, this list of conditions and the following disclaimer in
  17.  *     the documentation and/or other materials provided with the
  18.  *     distribution.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  21.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  22.  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  23.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30.  *
  31.  * $JOMC: DefaultObjectManager.java 5061 2015-05-31 13:20:40Z schulte $
  32.  *
  33.  */
  34. // </editor-fold>
  35. // SECTION-END
  36. package org.jomc.ri;

  37. import java.io.IOException;
  38. import java.lang.ref.Reference;
  39. import java.lang.ref.WeakReference;
  40. import java.lang.reflect.Array;
  41. import java.lang.reflect.Constructor;
  42. import java.lang.reflect.InvocationHandler;
  43. import java.lang.reflect.InvocationTargetException;
  44. import java.lang.reflect.Method;
  45. import java.math.BigInteger;
  46. import java.net.URI;
  47. import java.text.MessageFormat;
  48. import java.util.ArrayList;
  49. import java.util.Collections;
  50. import java.util.HashMap;
  51. import java.util.LinkedList;
  52. import java.util.List;
  53. import java.util.Locale;
  54. import java.util.Map;
  55. import java.util.logging.Level;
  56. import java.util.logging.LogRecord;
  57. import org.jomc.ObjectManagementException;
  58. import org.jomc.ObjectManager;
  59. import org.jomc.ObjectManagerFactory;
  60. import org.jomc.model.Dependency;
  61. import org.jomc.model.Implementation;
  62. import org.jomc.model.ImplementationReference;
  63. import org.jomc.model.Implementations;
  64. import org.jomc.model.Instance;
  65. import org.jomc.model.Message;
  66. import org.jomc.model.ModelObject;
  67. import org.jomc.model.ModelObjectException;
  68. import org.jomc.model.Module;
  69. import org.jomc.model.Modules;
  70. import org.jomc.model.Multiplicity;
  71. import org.jomc.model.Property;
  72. import org.jomc.model.Specification;
  73. import org.jomc.model.SpecificationReference;
  74. import org.jomc.model.Specifications;
  75. import org.jomc.model.modlet.ModelHelper;
  76. import org.jomc.modlet.Model;
  77. import org.jomc.modlet.ModelContext;
  78. import org.jomc.modlet.ModelContextFactory;
  79. import org.jomc.modlet.ModelException;
  80. import org.jomc.modlet.ModelValidationReport;
  81. import org.jomc.ri.model.RuntimeModelObject;
  82. import org.jomc.ri.model.RuntimeModules;
  83. import org.jomc.spi.Invocation;
  84. import org.jomc.spi.Invoker;
  85. import org.jomc.spi.Listener;
  86. import org.jomc.spi.Locator;
  87. import org.jomc.spi.Scope;
  88. import org.jomc.util.WeakIdentityHashMap;

  89. // SECTION-START[Documentation]
  90. // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
  91. /**
  92.  * Default {@code ObjectManager} implementation.
  93.  *
  94.  * <dl>
  95.  *   <dt><b>Identifier:</b></dt><dd>org.jomc.ri.DefaultObjectManager</dd>
  96.  *   <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ DefaultObjectManager</dd>
  97.  *   <dt><b>Specifications:</b></dt>
  98.  *     <dd>org.jomc.ObjectManager @ 1.0</dd>
  99.  *   <dt><b>Abstract:</b></dt><dd>No</dd>
  100.  *   <dt><b>Final:</b></dt><dd>No</dd>
  101.  *   <dt><b>Stateless:</b></dt><dd>No</dd>
  102.  * </dl>
  103.  *
  104.  * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
  105.  * @version 1.2
  106.  */
  107. // </editor-fold>
  108. // SECTION-END
  109. // SECTION-START[Annotations]
  110. // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
  111. @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  112. // </editor-fold>
  113. // SECTION-END
  114. public class DefaultObjectManager implements ObjectManager
  115. {

  116.     // SECTION-START[Constructors]
  117.     // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
  118.     /** Creates a new {@code DefaultObjectManager} instance. */
  119.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  120.     public DefaultObjectManager()
  121.     {
  122.         // SECTION-START[Default Constructor]
  123.         super();
  124.         // SECTION-END
  125.     }
  126.     // </editor-fold>
  127.     // SECTION-END
  128.     // SECTION-START[ObjectManager]

  129.     public <T> T getObject( final Class<T> specification )
  130.     {
  131.         if ( specification == null )
  132.         {
  133.             throw new NullPointerException( "specification" );
  134.         }

  135.         try
  136.         {
  137.             this.initialize();

  138.             Class<?> specificationClass = specification;
  139.             if ( specification.isArray() )
  140.             {
  141.                 specificationClass = specification.getComponentType();
  142.             }

  143.             final ClassLoader classLoader = this.getDefaultClassLoader( specificationClass );
  144.             final Modules model = this.getModules( classLoader );
  145.             final Specification s = model.getSpecification( specificationClass );

  146.             if ( s == null )
  147.             {
  148.                 if ( this.isLoggable( Level.WARNING ) )
  149.                 {
  150.                     this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  151.                               Locale.getDefault(), specificationClass.getName() ), null );

  152.                 }

  153.                 return null;
  154.             }

  155.             if ( s.getMultiplicity() == Multiplicity.ONE && specification.isArray() )
  156.             {
  157.                 if ( this.isLoggable( Level.WARNING ) )
  158.                 {
  159.                     this.log( classLoader, Level.WARNING, getIllegalArraySpecificationMessage(
  160.                               Locale.getDefault(), s.getIdentifier(), s.getMultiplicity().value() ), null );

  161.                 }

  162.                 return null;
  163.             }

  164.             if ( s.getMultiplicity() != Multiplicity.ONE && !specification.isArray() )
  165.             {
  166.                 if ( this.isLoggable( Level.WARNING ) )
  167.                 {
  168.                     this.log( classLoader, Level.WARNING, getIllegalObjectSpecificationMessage(
  169.                               Locale.getDefault(), s.getIdentifier(), s.getMultiplicity().value() ), null );

  170.                 }

  171.                 return null;
  172.             }

  173.             Scope scope = null;
  174.             if ( s.getScope() != null )
  175.             {
  176.                 scope = this.getScope( s.getScope(), classLoader );

  177.                 if ( scope == null )
  178.                 {
  179.                     if ( this.isLoggable( Level.WARNING ) )
  180.                     {
  181.                         this.log( classLoader, Level.WARNING, getMissingScopeMessage(
  182.                                   Locale.getDefault(), s.getScope() ), null );

  183.                     }

  184.                     return null;
  185.                 }
  186.             }

  187.             final Implementations available = model.getImplementations( s.getIdentifier() );
  188.             if ( available == null )
  189.             {
  190.                 if ( this.isLoggable( Level.WARNING ) )
  191.                 {
  192.                     this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
  193.                               Locale.getDefault(), s.getIdentifier() ), null );

  194.                 }

  195.                 return null;
  196.             }

  197.             int idx = 0;
  198.             final Object[] array = new Object[ available.getImplementation().size() ];

  199.             for ( int i = 0, s0 = available.getImplementation().size(); i < s0; i++ )
  200.             {
  201.                 final Implementation impl = available.getImplementation().get( i );

  202.                 if ( impl.getLocation() != null )
  203.                 {
  204.                     if ( s.getClazz() == null )
  205.                     {
  206.                         if ( this.isLoggable( Level.WARNING ) )
  207.                         {
  208.                             this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  209.                                       Locale.getDefault(), s.getIdentifier() ), null );

  210.                         }

  211.                         return null;
  212.                     }

  213.                     final Object o = this.getObject( s.getJavaTypeName().getClass( classLoader, true ),
  214.                                                      impl.getLocationUri(), classLoader );

  215.                     if ( o == null )
  216.                     {
  217.                         if ( this.isLoggable( Level.WARNING ) )
  218.                         {
  219.                             this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  220.                                       Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  221.                         }
  222.                     }
  223.                     else if ( specificationClass.isInstance( o ) )
  224.                     {
  225.                         array[idx++] = o;
  226.                     }
  227.                 }
  228.                 else if ( !impl.isAbstract() )
  229.                 {
  230.                     final Instance instance = model.getInstance( impl.getIdentifier() );
  231.                     if ( instance == null )
  232.                     {
  233.                         if ( this.isLoggable( Level.WARNING ) )
  234.                         {
  235.                             this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  236.                                       Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  237.                         }

  238.                         return null;
  239.                     }

  240.                     final Object o = this.getObject( scope, instance, classLoader );
  241.                     if ( o == null )
  242.                     {
  243.                         if ( this.isLoggable( Level.WARNING ) )
  244.                         {
  245.                             this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  246.                                       Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  247.                         }
  248.                     }
  249.                     else if ( specificationClass.isInstance( o ) )
  250.                     {
  251.                         array[idx++] = o;
  252.                     }
  253.                 }
  254.             }

  255.             if ( specification.isArray() )
  256.             {
  257.                 @SuppressWarnings( "unchecked" )
  258.                 final T copy = (T) Array.newInstance( specificationClass, idx );
  259.                 System.arraycopy( array, 0, copy, 0, idx );
  260.                 return copy;
  261.             }
  262.             else if ( idx == 1 )
  263.             {
  264.                 @SuppressWarnings( "unchecked" )
  265.                 final T object = (T) array[0];
  266.                 return object;
  267.             }

  268.             return null;
  269.         }
  270.         catch ( final Exception e )
  271.         {
  272.             throw new ObjectManagementException( getMessage( e ), e );
  273.         }
  274.     }

  275.     public <T> T getObject( final Class<T> specification, final String implementationName )
  276.     {
  277.         if ( specification == null )
  278.         {
  279.             throw new NullPointerException( "specification" );
  280.         }
  281.         if ( implementationName == null )
  282.         {
  283.             throw new NullPointerException( "implementationName" );
  284.         }

  285.         try
  286.         {
  287.             this.initialize();

  288.             final ClassLoader classLoader = this.getDefaultClassLoader( specification );
  289.             final Modules model = this.getModules( classLoader );
  290.             final Specification s = model.getSpecification( specification );

  291.             if ( s == null )
  292.             {
  293.                 if ( this.isLoggable( Level.WARNING ) )
  294.                 {
  295.                     this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  296.                               Locale.getDefault(), specification.getName() ), null );

  297.                 }

  298.                 return null;
  299.             }

  300.             Scope scope = null;
  301.             if ( s.getScope() != null )
  302.             {
  303.                 scope = this.getScope( s.getScope(), classLoader );

  304.                 if ( scope == null )
  305.                 {
  306.                     if ( this.isLoggable( Level.WARNING ) )
  307.                     {
  308.                         this.log( classLoader, Level.WARNING, getMissingScopeMessage(
  309.                                   Locale.getDefault(), s.getScope() ), null );

  310.                     }

  311.                     return null;
  312.                 }
  313.             }

  314.             final Implementations available = model.getImplementations( s.getIdentifier() );
  315.             if ( available == null )
  316.             {
  317.                 if ( this.isLoggable( Level.WARNING ) )
  318.                 {
  319.                     this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
  320.                               Locale.getDefault(), specification.getName() ), null );

  321.                 }

  322.                 return null;
  323.             }

  324.             final Implementation i = available.getImplementationByName( implementationName );
  325.             if ( i == null )
  326.             {
  327.                 if ( this.isLoggable( Level.WARNING ) )
  328.                 {
  329.                     this.log( classLoader, Level.WARNING, getMissingImplementationMessage(
  330.                               Locale.getDefault(), s.getIdentifier(), implementationName ), null );

  331.                 }

  332.                 return null;
  333.             }

  334.             if ( i.getLocation() != null )
  335.             {
  336.                 if ( s.getClazz() == null )
  337.                 {
  338.                     if ( this.isLoggable( Level.WARNING ) )
  339.                     {
  340.                         this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  341.                                   Locale.getDefault(), s.getIdentifier() ), null );

  342.                     }

  343.                     return null;
  344.                 }

  345.                 final T object = this.getObject( s.getJavaTypeName().getClass( classLoader, true ).
  346.                     asSubclass( specification ), i.getLocationUri(), classLoader );

  347.                 if ( object == null )
  348.                 {
  349.                     if ( this.isLoggable( Level.WARNING ) )
  350.                     {
  351.                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  352.                                   Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  353.                     }

  354.                     return null;
  355.                 }

  356.                 return object;
  357.             }
  358.             else if ( !i.isAbstract() )
  359.             {
  360.                 final Instance instance = model.getInstance( i.getIdentifier() );
  361.                 if ( instance == null )
  362.                 {
  363.                     if ( this.isLoggable( Level.WARNING ) )
  364.                     {
  365.                         this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  366.                                   Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  367.                     }

  368.                     return null;
  369.                 }

  370.                 final Object object = this.getObject( scope, instance, classLoader );
  371.                 if ( object == null )
  372.                 {
  373.                     if ( this.isLoggable( Level.WARNING ) )
  374.                     {
  375.                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  376.                                   Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  377.                     }

  378.                     return null;
  379.                 }
  380.                 else if ( specification.isInstance( object ) )
  381.                 {
  382.                     @SuppressWarnings( "unchecked" )
  383.                     final T o = (T) object;
  384.                     return o;
  385.                 }
  386.             }

  387.             return null;
  388.         }
  389.         catch ( final Exception e )
  390.         {
  391.             throw new ObjectManagementException( getMessage( e ), e );
  392.         }
  393.     }

  394.     public Object getDependency( final Object object, final String dependencyName )
  395.     {
  396.         if ( object == null )
  397.         {
  398.             throw new NullPointerException( "object" );
  399.         }
  400.         if ( dependencyName == null )
  401.         {
  402.             throw new NullPointerException( "dependencyName" );
  403.         }

  404.         try
  405.         {
  406.             this.initialize();

  407.             final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
  408.             final Modules model = this.getModules( classLoader );
  409.             final Instance instance = model.getInstance( object );

  410.             if ( instance == null )
  411.             {
  412.                 if ( this.isLoggable( Level.WARNING ) )
  413.                 {
  414.                     this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
  415.                               Locale.getDefault(), this.getObjectInfo( object ) ), null );

  416.                 }

  417.                 return null;
  418.             }

  419.             synchronized ( instance )
  420.             {
  421.                 final Dependency dependency = instance.getDependencies() != null
  422.                                                   ? instance.getDependencies().getDependency( dependencyName ) : null;

  423.                 if ( dependency == null )
  424.                 {
  425.                     if ( this.isLoggable( Level.WARNING ) )
  426.                     {
  427.                         this.log( classLoader, Level.WARNING, getMissingDependencyMessage(
  428.                                   Locale.getDefault(), instance.getIdentifier(), dependencyName ), null );

  429.                     }

  430.                     return null;
  431.                 }

  432.                 Object o = instance.getDependencyObjects().get( dependencyName );
  433.                 if ( o == null && !instance.getDependencyObjects().containsKey( dependencyName ) )
  434.                 {
  435.                     final Specification ds = model.getSpecification( dependency.getIdentifier() );
  436.                     if ( ds == null )
  437.                     {
  438.                         if ( this.isLoggable( Level.WARNING ) )
  439.                         {
  440.                             this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  441.                                       Locale.getDefault(), dependency.getIdentifier() ), null );

  442.                         }

  443.                         return null;
  444.                     }

  445.                     Scope scope = null;
  446.                     if ( ds.getScope() != null )
  447.                     {
  448.                         scope = this.getScope( ds.getScope(), classLoader );

  449.                         if ( scope == null )
  450.                         {
  451.                             if ( this.isLoggable( Level.WARNING ) )
  452.                             {
  453.                                 this.log( classLoader, Level.WARNING, getMissingScopeMessage(
  454.                                           Locale.getDefault(), ds.getScope() ), null );

  455.                             }

  456.                             return null;
  457.                         }
  458.                     }

  459.                     final Implementations available = model.getImplementations( ds.getIdentifier() );
  460.                     if ( available == null )
  461.                     {
  462.                         if ( !dependency.isOptional() && this.isLoggable( Level.WARNING ) )
  463.                         {
  464.                             this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
  465.                                       Locale.getDefault(), dependency.getIdentifier() ), null );

  466.                         }

  467.                         return null;
  468.                     }

  469.                     if ( dependency.getImplementationName() != null )
  470.                     {
  471.                         final Implementation i =
  472.                             available.getImplementationByName( dependency.getImplementationName() );

  473.                         if ( i == null )
  474.                         {
  475.                             if ( !dependency.isOptional() && this.isLoggable( Level.WARNING ) )
  476.                             {
  477.                                 this.log( classLoader, Level.WARNING, getMissingImplementationMessage(
  478.                                           Locale.getDefault(), dependency.getIdentifier(),
  479.                                           dependency.getImplementationName() ), null );

  480.                             }

  481.                             return null;
  482.                         }

  483.                         if ( i.getLocation() != null )
  484.                         {
  485.                             if ( ds.getClazz() == null )
  486.                             {
  487.                                 if ( this.isLoggable( Level.WARNING ) )
  488.                                 {
  489.                                     this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  490.                                               Locale.getDefault(), ds.getIdentifier() ), null );

  491.                                 }

  492.                                 return null;
  493.                             }

  494.                             o = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ), i.getLocationUri(),
  495.                                                 classLoader );

  496.                             if ( o == null )
  497.                             {
  498.                                 if ( this.isLoggable( Level.WARNING ) )
  499.                                 {
  500.                                     this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  501.                                               Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  502.                                 }

  503.                                 return null;
  504.                             }
  505.                         }
  506.                         else if ( !i.isAbstract() )
  507.                         {
  508.                             final Instance di = model.getInstance( i.getIdentifier(), dependency );
  509.                             if ( di == null )
  510.                             {
  511.                                 if ( this.isLoggable( Level.WARNING ) )
  512.                                 {
  513.                                     this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  514.                                               Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  515.                                 }

  516.                                 return null;
  517.                             }

  518.                             o = this.getObject( scope, di, classLoader );
  519.                             if ( o == null )
  520.                             {
  521.                                 if ( this.isLoggable( Level.WARNING ) )
  522.                                 {
  523.                                     this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  524.                                               Locale.getDefault(), i.getIdentifier(), i.getName() ), null );

  525.                                 }

  526.                                 return null;
  527.                             }
  528.                         }
  529.                     }
  530.                     else if ( ds.getMultiplicity() == Multiplicity.ONE )
  531.                     {
  532.                         if ( available.getImplementation().size() == 1 )
  533.                         {
  534.                             final Implementation ref = available.getImplementation().get( 0 );

  535.                             if ( ref.getLocation() != null )
  536.                             {
  537.                                 if ( ds.getClazz() == null )
  538.                                 {
  539.                                     if ( this.isLoggable( Level.WARNING ) )
  540.                                     {
  541.                                         this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  542.                                                   Locale.getDefault(), ds.getIdentifier() ), null );

  543.                                     }

  544.                                     return null;
  545.                                 }

  546.                                 o = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ),
  547.                                                     ref.getLocationUri(), classLoader );

  548.                                 if ( o == null )
  549.                                 {
  550.                                     if ( this.isLoggable( Level.WARNING ) )
  551.                                     {
  552.                                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  553.                                                   Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );

  554.                                     }

  555.                                     return null;
  556.                                 }
  557.                             }
  558.                             else if ( !ref.isAbstract() )
  559.                             {
  560.                                 final Instance di = model.getInstance( ref.getIdentifier(), dependency );
  561.                                 if ( di == null )
  562.                                 {
  563.                                     if ( this.isLoggable( Level.WARNING ) )
  564.                                     {
  565.                                         this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  566.                                                   Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );

  567.                                     }

  568.                                     return null;
  569.                                 }

  570.                                 o = this.getObject( scope, di, classLoader );
  571.                                 if ( o == null )
  572.                                 {
  573.                                     if ( this.isLoggable( Level.WARNING ) )
  574.                                     {
  575.                                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  576.                                                   Locale.getDefault(), ref.getIdentifier(), ref.getName() ), null );

  577.                                     }

  578.                                     return null;
  579.                                 }
  580.                             }
  581.                         }
  582.                         else
  583.                         {
  584.                             this.log( classLoader, Level.WARNING, getUnexpectedDependencyObjectsMessage(
  585.                                       Locale.getDefault(), instance.getIdentifier(), dependencyName, BigInteger.ONE,
  586.                                       available.getImplementation().size() ), null );

  587.                         }
  588.                     }
  589.                     else
  590.                     {
  591.                         int idx = 0;
  592.                         final Object[] array = new Object[ available.getImplementation().size() ];

  593.                         if ( !available.getImplementation().isEmpty() && ds.getClazz() == null )
  594.                         {
  595.                             if ( this.isLoggable( Level.WARNING ) )
  596.                             {
  597.                                 this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  598.                                           Locale.getDefault(), ds.getIdentifier() ), null );

  599.                             }

  600.                             return null;
  601.                         }

  602.                         for ( int i = 0, s0 = available.getImplementation().size(); i < s0; i++ )
  603.                         {
  604.                             final Implementation a = available.getImplementation().get( i );
  605.                             if ( a.getLocation() != null )
  606.                             {
  607.                                 if ( ds.getClazz() == null )
  608.                                 {
  609.                                     if ( this.isLoggable( Level.WARNING ) )
  610.                                     {
  611.                                         this.log( classLoader, Level.WARNING, getMissingSpecificationClassMessage(
  612.                                                   Locale.getDefault(), ds.getIdentifier() ), null );

  613.                                     }

  614.                                     return null;
  615.                                 }

  616.                                 final Object o2 = this.getObject( ds.getJavaTypeName().getClass( classLoader, true ),
  617.                                                                   a.getLocationUri(), classLoader );

  618.                                 if ( o2 == null )
  619.                                 {
  620.                                     if ( this.isLoggable( Level.WARNING ) )
  621.                                     {
  622.                                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  623.                                                   Locale.getDefault(), a.getIdentifier(), a.getName() ), null );

  624.                                     }
  625.                                 }
  626.                                 else
  627.                                 {
  628.                                     array[idx++] = o2;
  629.                                 }
  630.                             }
  631.                             else if ( !a.isAbstract() )
  632.                             {
  633.                                 final Instance di = model.getInstance( a.getIdentifier(), dependency );
  634.                                 if ( di == null )
  635.                                 {
  636.                                     if ( this.isLoggable( Level.WARNING ) )
  637.                                     {
  638.                                         this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  639.                                                   Locale.getDefault(), a.getIdentifier(), a.getName() ), null );

  640.                                     }

  641.                                     return null;
  642.                                 }

  643.                                 final Object o2 = this.getObject( scope, di, classLoader );
  644.                                 if ( o2 == null )
  645.                                 {
  646.                                     if ( this.isLoggable( Level.WARNING ) )
  647.                                     {
  648.                                         this.log( classLoader, Level.WARNING, getMissingObjectMessage(
  649.                                                   Locale.getDefault(), a.getIdentifier(), a.getName() ), null );

  650.                                     }
  651.                                 }
  652.                                 else
  653.                                 {
  654.                                     array[idx++] = o2;
  655.                                 }
  656.                             }
  657.                         }

  658.                         if ( idx > 0 )
  659.                         {
  660.                             o = Array.newInstance( ds.getJavaTypeName().getClass( classLoader, true ), idx );
  661.                             System.arraycopy( array, 0, o, 0, idx );
  662.                         }
  663.                         else
  664.                         {
  665.                             o = null;
  666.                         }
  667.                     }
  668.                 }

  669.                 if ( dependency.isBound() )
  670.                 {
  671.                     instance.getDependencyObjects().put( dependencyName, o );
  672.                 }

  673.                 return o;
  674.             }
  675.         }
  676.         catch ( final Exception e )
  677.         {
  678.             throw new ObjectManagementException( getMessage( e ), e );
  679.         }
  680.     }

  681.     public Object getProperty( final Object object, final String propertyName )
  682.     {
  683.         if ( object == null )
  684.         {
  685.             throw new NullPointerException( "object" );
  686.         }
  687.         if ( propertyName == null )
  688.         {
  689.             throw new NullPointerException( "propertyName" );
  690.         }

  691.         try
  692.         {
  693.             this.initialize();

  694.             final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
  695.             final Modules model = this.getModules( classLoader );
  696.             final Instance instance = model.getInstance( object );

  697.             if ( instance == null )
  698.             {
  699.                 if ( this.isLoggable( Level.WARNING ) )
  700.                 {
  701.                     this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
  702.                               Locale.getDefault(), this.getObjectInfo( object ) ), null );

  703.                 }

  704.                 return null;
  705.             }

  706.             synchronized ( instance )
  707.             {
  708.                 Object value = instance.getPropertyObjects().get( propertyName );

  709.                 if ( value == null && !instance.getPropertyObjects().containsKey( propertyName ) )
  710.                 {
  711.                     final Property property =
  712.                         instance.getProperties() != null ? instance.getProperties().getProperty( propertyName ) : null;

  713.                     if ( property == null )
  714.                     {
  715.                         if ( this.isLoggable( Level.WARNING ) )
  716.                         {
  717.                             this.log( classLoader, Level.WARNING, getMissingPropertyMessage(
  718.                                       Locale.getDefault(), instance.getIdentifier(), propertyName ), null );

  719.                         }

  720.                         return null;
  721.                     }

  722.                     value = property.getJavaValue( classLoader );
  723.                     instance.getPropertyObjects().put( propertyName, value );
  724.                 }

  725.                 return value;
  726.             }
  727.         }
  728.         catch ( final Exception e )
  729.         {
  730.             throw new ObjectManagementException( getMessage( e ), e );
  731.         }
  732.     }

  733.     public String getMessage( final Object object, final String messageName, final Locale locale,
  734.                               final Object... arguments )
  735.     {
  736.         if ( object == null )
  737.         {
  738.             throw new NullPointerException( "object" );
  739.         }
  740.         if ( messageName == null )
  741.         {
  742.             throw new NullPointerException( "messageName" );
  743.         }
  744.         if ( locale == null )
  745.         {
  746.             throw new NullPointerException( "locale" );
  747.         }

  748.         try
  749.         {
  750.             this.initialize();

  751.             final ClassLoader classLoader = this.getDefaultClassLoader( object.getClass() );
  752.             final Modules model = this.getModules( classLoader );
  753.             final Instance instance = model.getInstance( object );

  754.             if ( instance == null )
  755.             {
  756.                 if ( this.isLoggable( Level.WARNING ) )
  757.                 {
  758.                     this.log( classLoader, Level.WARNING, getMissingObjectInstanceMessage(
  759.                               Locale.getDefault(), this.getObjectInfo( object ) ), null );

  760.                 }

  761.                 return null;
  762.             }

  763.             synchronized ( instance )
  764.             {
  765.                 Map<Locale, MessageFormat> messageFormats = instance.getMessageObjects().get( messageName );

  766.                 if ( messageFormats == null )
  767.                 {
  768.                     messageFormats = new HashMap<Locale, MessageFormat>();
  769.                     instance.getMessageObjects().put( messageName, messageFormats );
  770.                 }

  771.                 MessageFormat messageFormat = messageFormats.get( locale );

  772.                 if ( messageFormat == null && !messageFormats.containsKey( locale ) )
  773.                 {
  774.                     final Message message =
  775.                         instance.getMessages() != null ? instance.getMessages().getMessage( messageName ) : null;

  776.                     if ( message == null || message.getTemplate() == null )
  777.                     {
  778.                         if ( this.isLoggable( Level.WARNING ) )
  779.                         {
  780.                             this.log( classLoader, Level.WARNING, getMissingMessageMessage(
  781.                                       Locale.getDefault(), instance.getIdentifier(), messageName ), null );

  782.                         }
  783.                     }
  784.                     else
  785.                     {
  786.                         messageFormat = message.getJavaMessage( locale );
  787.                     }

  788.                     messageFormats.put( locale, messageFormat );
  789.                 }

  790.                 if ( messageFormat != null )
  791.                 {
  792.                     synchronized ( messageFormat )
  793.                     {
  794.                         return messageFormat.format( arguments );
  795.                     }
  796.                 }
  797.             }

  798.             return null;
  799.         }
  800.         catch ( final Exception e )
  801.         {
  802.             throw new ObjectManagementException( getMessage( e ), e );
  803.         }
  804.     }

  805.     // SECTION-END
  806.     // SECTION-START[DefaultObjectManager]
  807.     /**
  808.      * Constant for the {@code Singleton} scope identifier.
  809.      */
  810.     protected static final String SINGLETON_SCOPE_IDENTIFIER = "Singleton";

  811.     /**
  812.      * Array holding a single {@code InvocationHandler} class.
  813.      *
  814.      * @since 1.2
  815.      */
  816.     private static final Class<?>[] INVOCATION_HANDLER_ARGUMENTS =
  817.     {
  818.         InvocationHandler.class
  819.     };

  820.     /**
  821.      * Log level events are logged at by default.
  822.      *
  823.      * @see #getDefaultLogLevel()
  824.      */
  825.     private static final Level DEFAULT_LOG_LEVEL = Level.WARNING;

  826.     /**
  827.      * Default log level.
  828.      */
  829.     private static volatile Level defaultLogLevel;

  830.     /**
  831.      * Name of the platform's bootstrap class loader class.
  832.      */
  833.     private static volatile String bootstrapClassLoaderClassName;

  834.     private static volatile boolean bootstrapClassLoaderClassNameInitialized;

  835.     /**
  836.      * Name of the root class loader class.
  837.      *
  838.      * @since 1.7
  839.      */
  840.     private static volatile String rootClassLoaderClassName;

  841.     private static volatile boolean rootClassLoaderClassNameInitialized;

  842.     /**
  843.      * Identifier of the model to search for modules by default.
  844.      *
  845.      * @since 1.1
  846.      */
  847.     private static volatile String defaultModelIdentifier;

  848.     /**
  849.      * Identifier of the model to search for modules.
  850.      *
  851.      * @since 1.1
  852.      */
  853.     private String modelIdentifier;

  854.     /**
  855.      * Flag indicating model object class path resolution is enabled by default.
  856.      *
  857.      * @since 1.1
  858.      */
  859.     private static volatile Boolean defaultModelObjectClasspathResolutionEnabled;

  860.     /**
  861.      * Flag indicating model object class path resolution is enabled.
  862.      *
  863.      * @since 1.1
  864.      */
  865.     private Boolean modelObjectClasspathResolutionEnabled;

  866.     /**
  867.      * Flag indicating model processing is enabled by default.
  868.      *
  869.      * @since 1.1
  870.      */
  871.     private static volatile Boolean defaultModelProcessingEnabled;

  872.     /**
  873.      * Flag indicating model processing is enabled.
  874.      *
  875.      * @since 1.1
  876.      */
  877.     private Boolean modelProcessingEnabled;

  878.     /**
  879.      * {@code ClassLoader} instance representing the bootstrap class loader.
  880.      */
  881.     private static final ClassLoader BOOTSTRAP_CLASSLOADER = new ClassLoader( null )
  882.     {

  883.         @Override
  884.         public String toString()
  885.         {
  886.             return DefaultObjectManager.class.getName() + ".BootstrapClassLoader@"
  887.                        + Integer.toHexString( this.hashCode() );

  888.         }

  889.     };

  890.     /**
  891.      * Flag indicating that initialization has been performed.
  892.      */
  893.     private boolean initialized;

  894.     /**
  895.      * Log level of the instance.
  896.      */
  897.     private Level logLevel;

  898.     /**
  899.      * Listeners of the instance.
  900.      */
  901.     private final Map<ClassLoader, List<Listener>> listeners =
  902.         new WeakIdentityHashMap<ClassLoader, List<Listener>>();

  903.     /**
  904.      * Modules of the instance.
  905.      */
  906.     private final Map<ClassLoader, Modules> modules =
  907.         new WeakIdentityHashMap<ClassLoader, Modules>();

  908.     /**
  909.      * Invokers of the instance.
  910.      */
  911.     private final Map<ClassLoader, Invoker> invokers =
  912.         new WeakIdentityHashMap<ClassLoader, Invoker>();

  913.     /**
  914.      * Scopes of the instance.
  915.      */
  916.     private final Map<ClassLoader, Map<String, Scope>> scopes =
  917.         new WeakIdentityHashMap<ClassLoader, Map<String, Scope>>();

  918.     /**
  919.      * Locators of the instance.
  920.      */
  921.     private final Map<ClassLoader, Map<String, Locator>> locators =
  922.         new WeakIdentityHashMap<ClassLoader, Map<String, Locator>>();

  923.     /**
  924.      * Objects of the instance.
  925.      */
  926.     private final Map<ClassLoader, Map<Object, Instance>> objects =
  927.         new WeakIdentityHashMap<ClassLoader, Map<Object, Instance>>();

  928.     /**
  929.      * {@code ObjectManager} singletons.
  930.      */
  931.     private static final Map<ClassLoader, ObjectManager> singletons =
  932.         new WeakIdentityHashMap<ClassLoader, ObjectManager>();

  933.     /**
  934.      * Default class loaders cache.
  935.      *
  936.      * @since 1.2
  937.      */
  938.     private static final Map<ClassLoader, Reference<ClassLoader>> defaultClassLoaders =
  939.         new WeakIdentityHashMap<ClassLoader, Reference<ClassLoader>>();

  940.     /**
  941.      * Proxy class constructors by class loader any instance cache.
  942.      *
  943.      * @since 1.2
  944.      */
  945.     private static final Map<ClassLoader, Map<String, Reference<Constructor<?>>>> proxyClassConstructors =
  946.         new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Constructor<?>>>>();

  947.     /**
  948.      * Default {@link ObjectManagerFactory#getObjectManager(ClassLoader)} implementation.
  949.      *
  950.      * @param classLoader The class loader to use for getting the singleton instance; {@code null} to use the platform's
  951.      * bootstrap class loader.
  952.      *
  953.      * @return The default {@code ObjectManager} singleton instance.
  954.      *
  955.      * @see ObjectManagerFactory#getObjectManager(ClassLoader)
  956.      */
  957.     public static ObjectManager getObjectManager( final ClassLoader classLoader )
  958.     {
  959.         ObjectManager manager;
  960.         final ClassLoader singletonsLoader = getClassLoader( classLoader );

  961.         synchronized ( singletons )
  962.         {
  963.             manager = singletons.get( singletonsLoader );

  964.             if ( manager == null )
  965.             {
  966.                 manager = ObjectManagerFactory.newObjectManager( classLoader );

  967.                 if ( singletons.put( singletonsLoader, manager ) != null )
  968.                 {
  969.                     throw new AssertionError( getScopeContentionFailure(
  970.                         Locale.getDefault(), manager.getClass().getName() ) );

  971.                 }
  972.             }
  973.         }

  974.         return manager.getObject( ObjectManager.class );
  975.     }

  976.     /**
  977.      * Gets the list of listeners registered with the class loader of the instance.
  978.      * <p>
  979.      * Calling this method is the same as calling<blockquote><pre>
  980.      * getListeners( getClassLoader( getClass() ) );</pre></blockquote>
  981.      *
  982.      * @return The list of registered listeners.
  983.      *
  984.      * @throws ObjectManagementException if getting the list of listeners fails.
  985.      *
  986.      * @see #getListeners(java.lang.ClassLoader)
  987.      */
  988.     public List<Listener> getListeners()
  989.     {
  990.         return this.getListeners( this.getDefaultClassLoader( this.getClass() ) );
  991.     }

  992.     /**
  993.      * Gets the list of listeners registered with a given class loader.
  994.      *
  995.      * @param classLoader The class loader to get registered listeners of.
  996.      *
  997.      * @return The list of listeners registered with {@code classLoader}.
  998.      *
  999.      * @throws NullPointerException if {@code classLoader} is {@code null}.
  1000.      * @throws ObjectManagementException if getting the list of listeners fails.
  1001.      *
  1002.      * @see #getDefaultListener(org.jomc.model.Modules)
  1003.      *
  1004.      * @since 1.1
  1005.      */
  1006.     public List<Listener> getListeners( final ClassLoader classLoader )
  1007.     {
  1008.         if ( classLoader == null )
  1009.         {
  1010.             throw new NullPointerException( "classLoader" );
  1011.         }

  1012.         try
  1013.         {
  1014.             final ClassLoader listenersLoader = this.getDefaultClassLoader( classLoader );

  1015.             synchronized ( this.listeners )
  1016.             {
  1017.                 List<Listener> cachedListeners = this.listeners.get( listenersLoader );

  1018.                 if ( cachedListeners == null )
  1019.                 {
  1020.                     final List<LogRecord> bootstrapRecords = new ArrayList<LogRecord>( 1024 );
  1021.                     final Listener bootstrapListener = new Listener()
  1022.                     {

  1023.                         public void onLog( final Level level, final String message, final Throwable throwable )
  1024.                         {
  1025.                             final LogRecord r = new LogRecord( level, message );
  1026.                             r.setThrown( throwable );

  1027.                             bootstrapRecords.add( r );
  1028.                         }

  1029.                     };

  1030.                     cachedListeners = new LinkedList<Listener>();
  1031.                     cachedListeners.add( bootstrapListener );
  1032.                     this.listeners.put( listenersLoader, cachedListeners );

  1033.                     final List<Listener> modelListeners = new LinkedList<Listener>();
  1034.                     final Modules model = this.getModules( classLoader );
  1035.                     final Specification listenerSpecification = model.getSpecification( Listener.class );

  1036.                     if ( listenerSpecification != null )
  1037.                     {
  1038.                         final Implementations implementations =
  1039.                             model.getImplementations( listenerSpecification.getIdentifier() );

  1040.                         if ( implementations != null && !implementations.getImplementation().isEmpty() )
  1041.                         {
  1042.                             for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
  1043.                             {
  1044.                                 final Implementation impl = implementations.getImplementation().get( i );
  1045.                                 final Instance listenerInstance = model.getInstance( impl.getIdentifier() );
  1046.                                 if ( listenerInstance != null )
  1047.                                 {
  1048.                                     try
  1049.                                     {
  1050.                                         final Listener l =
  1051.                                             (Listener) model.createObject( listenerInstance, classLoader );

  1052.                                         modelListeners.add( l );

  1053.                                         if ( this.isLoggable( Level.CONFIG ) )
  1054.                                         {
  1055.                                             this.log( classLoader, Level.CONFIG, getListenerInfoMessage(
  1056.                                                       Locale.getDefault(), l.getClass().getName(),
  1057.                                                       this.getClassLoaderInfo( classLoader, listenersLoader ) ), null );

  1058.                                         }
  1059.                                     }
  1060.                                     catch ( final InstantiationException e )
  1061.                                     {
  1062.                                         if ( this.isLoggable( Level.SEVERE ) )
  1063.                                         {
  1064.                                             this.log( classLoader, Level.SEVERE, getMessage( e ), e );
  1065.                                         }
  1066.                                     }
  1067.                                 }
  1068.                                 else if ( this.isLoggable( Level.WARNING ) )
  1069.                                 {
  1070.                                     this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  1071.                                               Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  1072.                                 }
  1073.                             }
  1074.                         }
  1075.                         else if ( this.isLoggable( Level.WARNING ) )
  1076.                         {
  1077.                             this.log( classLoader, Level.WARNING, getMissingImplementationsMessage(
  1078.                                       Locale.getDefault(), listenerSpecification.getIdentifier() ), null );

  1079.                         }
  1080.                     }
  1081.                     else if ( this.isLoggable( Level.WARNING ) )
  1082.                     {
  1083.                         this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  1084.                                   Locale.getDefault(), Listener.class.getName() ), null );

  1085.                     }

  1086.                     cachedListeners.remove( bootstrapListener );
  1087.                     cachedListeners.addAll( modelListeners );

  1088.                     if ( cachedListeners.isEmpty() )
  1089.                     {
  1090.                         if ( !classLoader.equals( this.getDefaultClassLoader( this.getClass() ) ) )
  1091.                         {
  1092.                             cachedListeners.addAll( this.getListeners() );
  1093.                         }
  1094.                         else
  1095.                         {
  1096.                             cachedListeners.add( this.getDefaultListener( model ) );

  1097.                             if ( this.isLoggable( Level.CONFIG ) )
  1098.                             {
  1099.                                 this.log( Level.CONFIG, getDefaultListenerInfo(
  1100.                                           Locale.getDefault(), this.getClassLoaderInfo( classLoader, listenersLoader ) ),
  1101.                                           null );

  1102.                             }
  1103.                         }
  1104.                     }

  1105.                     for ( final LogRecord r : bootstrapRecords )
  1106.                     {
  1107.                         this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
  1108.                     }
  1109.                 }

  1110.                 return cachedListeners;
  1111.             }
  1112.         }
  1113.         catch ( final ModelObjectException e )
  1114.         {
  1115.             throw new ObjectManagementException( getMessage( e ), e );
  1116.         }
  1117.     }

  1118.     /**
  1119.      * Gets a new default listener implementation instance.
  1120.      *
  1121.      * @return A new default listener implementation instance.
  1122.      *
  1123.      * @see #getListeners()
  1124.      * @see #getListeners(java.lang.ClassLoader)
  1125.      *
  1126.      * @since 1.1
  1127.      *
  1128.      * @deprecated As of JOMC 1.2, replaced by method {@link #getDefaultListener(org.jomc.model.Modules)}. This method
  1129.      * will be removed in version 2.0.
  1130.      */
  1131.     @Deprecated
  1132.     public Listener getDefaultListener()
  1133.     {
  1134.         return new DefaultListener();
  1135.     }

  1136.     /**
  1137.      * Gets a new default listener implementation instance.
  1138.      *
  1139.      * @param model The model to get a new default listener implementation instance of.
  1140.      *
  1141.      * @return A new default listener implementation instance.
  1142.      *
  1143.      * @throws NullPointerException if {@code model} is {@code null}.
  1144.      * @throws ObjectManagementException if getting a new default listener implementation instance fails.
  1145.      *
  1146.      * @see #getListeners()
  1147.      * @see #getListeners(java.lang.ClassLoader)
  1148.      *
  1149.      * @since 1.2
  1150.      */
  1151.     public Listener getDefaultListener( final Modules model )
  1152.     {
  1153.         if ( model == null )
  1154.         {
  1155.             throw new NullPointerException( "model" );
  1156.         }

  1157.         try
  1158.         {
  1159.             final Listener defaultListener = new DefaultListener();
  1160.             model.getInstance( defaultListener );
  1161.             return defaultListener;
  1162.         }
  1163.         catch ( final ModelObjectException e )
  1164.         {
  1165.             throw new ObjectManagementException( getMessage( e ), e );
  1166.         }
  1167.     }

  1168.     /**
  1169.      * Gets the default log level events are logged at.
  1170.      * <p>
  1171.      * The default log level is controlled by system property
  1172.      * {@code org.jomc.ri.DefaultObjectManager.defaultLogLevel} holding the log level to log events at by default.
  1173.      * If that property is not set, the {@code WARNING} default is returned.
  1174.      * </p>
  1175.      *
  1176.      * @return The log level events are logged at by default.
  1177.      *
  1178.      * @see #getLogLevel()
  1179.      * @see Level#parse(java.lang.String)
  1180.      */
  1181.     public static Level getDefaultLogLevel()
  1182.     {
  1183.         if ( defaultLogLevel == null )
  1184.         {
  1185.             defaultLogLevel = Level.parse( System.getProperty( "org.jomc.ri.DefaultObjectManager.defaultLogLevel",
  1186.                                                                DEFAULT_LOG_LEVEL.getName() ) );

  1187.         }

  1188.         return defaultLogLevel;
  1189.     }

  1190.     /**
  1191.      * Sets the default log level events are logged at.
  1192.      *
  1193.      * @param value The new default level events are logged at or {@code null}.
  1194.      *
  1195.      * @see #getDefaultLogLevel()
  1196.      */
  1197.     public static void setDefaultLogLevel( final Level value )
  1198.     {
  1199.         defaultLogLevel = value;
  1200.     }

  1201.     /**
  1202.      * Gets the log level of the instance.
  1203.      *
  1204.      * @return The log level of the instance.
  1205.      *
  1206.      * @see #getDefaultLogLevel()
  1207.      * @see #setLogLevel(java.util.logging.Level)
  1208.      * @see #isLoggable(java.util.logging.Level)
  1209.      */
  1210.     public final Level getLogLevel()
  1211.     {
  1212.         if ( this.logLevel == null )
  1213.         {
  1214.             this.logLevel = getDefaultLogLevel();

  1215.             if ( this.isLoggable( Level.CONFIG ) )
  1216.             {
  1217.                 this.log( Level.CONFIG, getDefaultLogLevelInfoMessage(
  1218.                           Locale.getDefault(), this.logLevel.getLocalizedName() ), null );

  1219.             }
  1220.         }

  1221.         return this.logLevel;
  1222.     }

  1223.     /**
  1224.      * Sets the log level of the instance.
  1225.      *
  1226.      * @param value The new log level of the instance or {@code null}.
  1227.      *
  1228.      * @see #getLogLevel()
  1229.      * @see #isLoggable(java.util.logging.Level)
  1230.      */
  1231.     public final void setLogLevel( final Level value )
  1232.     {
  1233.         this.logLevel = value;
  1234.     }

  1235.     /**
  1236.      * Checks if a message at a given level is provided to the listeners of the instance.
  1237.      *
  1238.      * @param level The level to test.
  1239.      *
  1240.      * @return {@code true}, if messages at {@code level} are provided to the listeners of the instance;
  1241.      * {@code false}, if messages at {@code level} are not provided to the listeners of the instance.
  1242.      *
  1243.      * @throws NullPointerException if {@code level} is {@code null}.
  1244.      *
  1245.      * @see #getLogLevel()
  1246.      * @see #setLogLevel(java.util.logging.Level)
  1247.      * @see #log(java.util.logging.Level, java.lang.String, java.lang.Throwable)
  1248.      * @see #log(java.lang.ClassLoader, java.util.logging.Level, java.lang.String, java.lang.Throwable)
  1249.      */
  1250.     public boolean isLoggable( final Level level )
  1251.     {
  1252.         if ( level == null )
  1253.         {
  1254.             throw new NullPointerException( "level" );
  1255.         }

  1256.         return level.intValue() >= this.getLogLevel().intValue();
  1257.     }

  1258.     /**
  1259.      * Notifies listeners registered with the class loader of the instance.
  1260.      * <p>
  1261.      * Calling this method is the same as calling<blockquote><pre>
  1262.      * log( getClassLoader( getClass() ), level, message, throwable );</pre></blockquote>
  1263.      * </p>
  1264.      *
  1265.      * @param level The level of the event.
  1266.      * @param message The message of the event or {@code null}.
  1267.      * @param throwable The throwable of the event or {@code null}.
  1268.      *
  1269.      * @throws NullPointerException if {@code level} is {@code null}.
  1270.      * @throws ObjectManagementException if notifying listeners fails.
  1271.      *
  1272.      * @see #log(java.lang.ClassLoader, java.util.logging.Level, java.lang.String, java.lang.Throwable)
  1273.      */
  1274.     public void log( final Level level, final String message, final Throwable throwable )
  1275.     {
  1276.         this.log( this.getDefaultClassLoader( this.getClass() ), level, message, throwable );
  1277.     }

  1278.     /**
  1279.      * Notifies listeners registered with a given class loader.
  1280.      *
  1281.      * @param classLoader The class loader to notify listeners of.
  1282.      * @param level The level of the event.
  1283.      * @param message The message of the event or {@code null}.
  1284.      * @param throwable The throwable of the event or {@code null}.
  1285.      *
  1286.      * @throws NullPointerException if {@code classLoader} or {@code level} is {@code null}.
  1287.      * @throws ObjectManagementException if notifying listeners fails.
  1288.      *
  1289.      * @since 1.1
  1290.      */
  1291.     public void log( final ClassLoader classLoader, final Level level, final String message, final Throwable throwable )
  1292.     {
  1293.         if ( level == null )
  1294.         {
  1295.             throw new NullPointerException( "level" );
  1296.         }
  1297.         if ( classLoader == null )
  1298.         {
  1299.             throw new NullPointerException( "classLoader" );
  1300.         }

  1301.         if ( this.isLoggable( level ) )
  1302.         {
  1303.             final List<Listener> l = this.getListeners( classLoader );

  1304.             for ( int i = 0, s0 = l.size(); i < s0; i++ )
  1305.             {
  1306.                 l.get( i ).onLog( level, message, throwable );
  1307.             }
  1308.         }
  1309.     }

  1310.     /**
  1311.      * Gets the identifier of the model to search for modules by default.
  1312.      * <p>
  1313.      * The identifier of the model to search for modules by default is controlled by system property
  1314.      * {@code org.jomc.ri.DefaultObjectManager.defaultModelIdentifier} holding the identifier of the model to search for
  1315.      * modules by default. If that property is not set, the {@code http://jomc.org/model} default is returned.
  1316.      * </p>
  1317.      *
  1318.      * @return The identifier of the model to search for modules by default.
  1319.      *
  1320.      * @see #getModelIdentifier()
  1321.      * @see #setDefaultModelIdentifier(java.lang.String)
  1322.      * @see ModelObject#MODEL_PUBLIC_ID
  1323.      *
  1324.      * @since 1.1
  1325.      */
  1326.     public static String getDefaultModelIdentifier()
  1327.     {
  1328.         if ( defaultModelIdentifier == null )
  1329.         {
  1330.             defaultModelIdentifier = System.getProperty( "org.jomc.ri.DefaultObjectManager.defaultModelIdentifier",
  1331.                                                          ModelObject.MODEL_PUBLIC_ID );

  1332.         }

  1333.         return defaultModelIdentifier;
  1334.     }

  1335.     /**
  1336.      * Sets the identifier of the model to search for modules by default.
  1337.      *
  1338.      * @param value The new identifier of the model to search for modules by default or {@code null}.
  1339.      *
  1340.      * @see #getDefaultModelIdentifier()
  1341.      *
  1342.      * @since 1.1
  1343.      */
  1344.     public static void setDefaultModelIdentifier( final String value )
  1345.     {
  1346.         defaultModelIdentifier = value;
  1347.     }

  1348.     /**
  1349.      * Gets the identifier of the model to search for modules.
  1350.      *
  1351.      * @return The identifier of the model to search for modules.
  1352.      *
  1353.      * @see #getDefaultModelIdentifier()
  1354.      * @see #setModelIdentifier(java.lang.String)
  1355.      *
  1356.      * @since 1.1
  1357.      */
  1358.     public final String getModelIdentifier()
  1359.     {
  1360.         if ( this.modelIdentifier == null )
  1361.         {
  1362.             this.modelIdentifier = getDefaultModelIdentifier();

  1363.             if ( this.isLoggable( Level.CONFIG ) )
  1364.             {
  1365.                 this.log( Level.CONFIG, getDefaultModelIdentifierInfo(
  1366.                           Locale.getDefault(), this.modelIdentifier ), null );

  1367.             }
  1368.         }

  1369.         return this.modelIdentifier;
  1370.     }

  1371.     /**
  1372.      * Sets the identifier of the model to search for modules.
  1373.      *
  1374.      * @param value The new identifier of the model to search for modules or {@code null}.
  1375.      *
  1376.      * @since 1.1
  1377.      */
  1378.     public final void setModelIdentifier( final String value )
  1379.     {
  1380.         this.modelIdentifier = value;
  1381.     }

  1382.     /**
  1383.      * Gets a flag indicating model object class path resolution is enabled by default.
  1384.      * <p>
  1385.      * The default model object class path resolution enabled flag is controlled by system property
  1386.      * {@code org.jomc.ri.DefaultObjectManager.defaultModelObjectClasspathResolutionEnabled} holding a boolean
  1387.      * indicating model object class path resolution is enabled by default. If that property is not set, the
  1388.      * {@code true} default is returned.
  1389.      * </p>
  1390.      *
  1391.      * @return {@code true}, if model object class path resolution is enabled by default; {@code false}, if model object
  1392.      * class path resolution is disabled by default.
  1393.      *
  1394.      * @see #isModelObjectClasspathResolutionEnabled()
  1395.      * @see #setDefaultModelObjectClasspathResolutionEnabled(java.lang.Boolean)
  1396.      *
  1397.      * @since 1.1
  1398.      */
  1399.     public static boolean isDefaultModelObjectClasspathResolutionEnabled()
  1400.     {
  1401.         if ( defaultModelObjectClasspathResolutionEnabled == null )
  1402.         {
  1403.             defaultModelObjectClasspathResolutionEnabled = Boolean.valueOf( System.getProperty(
  1404.                 "org.jomc.ri.DefaultObjectManager.defaultModelObjectClasspathResolutionEnabled",
  1405.                 Boolean.toString( true ) ) );

  1406.         }

  1407.         return defaultModelObjectClasspathResolutionEnabled;
  1408.     }

  1409.     /**
  1410.      * Sets the flag indicating model object class path resolution is enabled by default.
  1411.      *
  1412.      * @param value The new value of the flag indicating model object class path resolution is enabled by default or
  1413.      * {@code null}.
  1414.      *
  1415.      * @see #isDefaultModelObjectClasspathResolutionEnabled()
  1416.      *
  1417.      * @since 1.1
  1418.      */
  1419.     public static void setDefaultModelObjectClasspathResolutionEnabled( final Boolean value )
  1420.     {
  1421.         defaultModelObjectClasspathResolutionEnabled = value;
  1422.     }

  1423.     /**
  1424.      * Gets a flag indicating model object class path resolution is enabled.
  1425.      *
  1426.      * @return {@code true}, if model object class path resolution is enabled; {@code false}, if model object class path
  1427.      * resolution is disabled.
  1428.      *
  1429.      * @see #isDefaultModelObjectClasspathResolutionEnabled()
  1430.      * @see #setModelObjectClasspathResolutionEnabled(java.lang.Boolean)
  1431.      *
  1432.      * @since 1.1
  1433.      */
  1434.     public final boolean isModelObjectClasspathResolutionEnabled()
  1435.     {
  1436.         if ( this.modelObjectClasspathResolutionEnabled == null )
  1437.         {
  1438.             this.modelObjectClasspathResolutionEnabled = isDefaultModelObjectClasspathResolutionEnabled();

  1439.             if ( this.isLoggable( Level.CONFIG ) )
  1440.             {
  1441.                 this.log( Level.CONFIG, getDefaultModelObjectClasspahResolutionEnabledInfo(
  1442.                           Locale.getDefault(), Boolean.toString( this.modelObjectClasspathResolutionEnabled ) ), null );

  1443.             }
  1444.         }

  1445.         return this.modelObjectClasspathResolutionEnabled;
  1446.     }

  1447.     /**
  1448.      * Sets the flag indicating model object class path resolution is enabled.
  1449.      *
  1450.      * @param value The new value of the flag indicating model object class path resolution is enabled or {@code null}.
  1451.      *
  1452.      * @see #isModelObjectClasspathResolutionEnabled()
  1453.      *
  1454.      * @since 1.1
  1455.      */
  1456.     public final void setModelObjectClasspathResolutionEnabled( final Boolean value )
  1457.     {
  1458.         this.modelObjectClasspathResolutionEnabled = value;
  1459.     }

  1460.     /**
  1461.      * Gets a flag indicating model processing is enabled by default.
  1462.      * <p>
  1463.      * The default model processing enabled flag is controlled by system property
  1464.      * {@code org.jomc.ri.DefaultObjectManager.defaultModelProcessingEnabled} holding a boolean indicating model
  1465.      * processing is enabled by default. If that property is not set, the {@code true} default is returned.
  1466.      * </p>
  1467.      *
  1468.      * @return {@code true}, if model processing is enabled by default; {@code false}, if model processing is disabled
  1469.      * by default.
  1470.      *
  1471.      * @see #isModelProcessingEnabled()
  1472.      * @see #setDefaultModelProcessingEnabled(java.lang.Boolean)
  1473.      *
  1474.      * @since 1.1
  1475.      */
  1476.     public static boolean isDefaultModelProcessingEnabled()
  1477.     {
  1478.         if ( defaultModelProcessingEnabled == null )
  1479.         {
  1480.             defaultModelProcessingEnabled = Boolean.valueOf( System.getProperty(
  1481.                 "org.jomc.ri.DefaultObjectManager.defaultModelProcessingEnabled", Boolean.toString( true ) ) );

  1482.         }

  1483.         return defaultModelProcessingEnabled;
  1484.     }

  1485.     /**
  1486.      * Sets the flag indicating model processing is enabled by default.
  1487.      *
  1488.      * @param value The new value of the flag indicating model processing is enabled by default or {@code null}.
  1489.      *
  1490.      * @see #isDefaultModelProcessingEnabled()
  1491.      *
  1492.      * @since 1.1
  1493.      */
  1494.     public static void setDefaultModelProcessingEnabled( final Boolean value )
  1495.     {
  1496.         defaultModelProcessingEnabled = value;
  1497.     }

  1498.     /**
  1499.      * Gets a flag indicating model processing is enabled.
  1500.      *
  1501.      * @return {@code true}, if model processing is enabled; {@code false}, if model processing is disabled .
  1502.      *
  1503.      * @see #isDefaultModelProcessingEnabled()
  1504.      * @see #setModelProcessingEnabled(java.lang.Boolean)
  1505.      *
  1506.      * @since 1.1
  1507.      */
  1508.     public final boolean isModelProcessingEnabled()
  1509.     {
  1510.         if ( this.modelProcessingEnabled == null )
  1511.         {
  1512.             this.modelProcessingEnabled = isDefaultModelProcessingEnabled();

  1513.             if ( this.isLoggable( Level.CONFIG ) )
  1514.             {
  1515.                 this.log( Level.CONFIG, getDefaultModelProcessingEnabledInfo(
  1516.                           Locale.getDefault(), Boolean.toString( this.modelProcessingEnabled ) ), null );

  1517.             }
  1518.         }

  1519.         return this.modelProcessingEnabled;
  1520.     }

  1521.     /**
  1522.      * Sets the flag indicating model processing is enabled.
  1523.      *
  1524.      * @param value The new value of the flag indicating model processing is enabled or {@code null}.
  1525.      *
  1526.      * @see #isModelProcessingEnabled()
  1527.      *
  1528.      * @since 1.1
  1529.      */
  1530.     public final void setModelProcessingEnabled( final Boolean value )
  1531.     {
  1532.         this.modelProcessingEnabled = value;
  1533.     }

  1534.     /**
  1535.      * Gets the name of the platform's bootstrap class loader class.
  1536.      * <p>
  1537.      * The name of the platform's bootstrap class loader class is controlled by system property
  1538.      * {@code org.jomc.ri.DefaultObjectManager.bootstrapClassLoaderClassName} holding the name of the platform's
  1539.      * bootstrap class loader class. If that property is not set, the bootstrap class loader is assumed to be
  1540.      * represented by a {@code null} parent class loader.
  1541.      * </p>
  1542.      *
  1543.      * @return The name of the platform's bootstrap class loader class or {@code null}.
  1544.      *
  1545.      * @see #setBootstrapClassLoaderClassName(java.lang.String)
  1546.      * @see #getDefaultClassLoader(java.lang.ClassLoader)
  1547.      */
  1548.     public static String getBootstrapClassLoaderClassName()
  1549.     {
  1550.         if ( bootstrapClassLoaderClassName == null && !bootstrapClassLoaderClassNameInitialized )
  1551.         {
  1552.             bootstrapClassLoaderClassName =
  1553.                 System.getProperty( "org.jomc.ri.DefaultObjectManager.bootstrapClassLoaderClassName" );

  1554.             bootstrapClassLoaderClassNameInitialized = true;
  1555.         }

  1556.         return bootstrapClassLoaderClassName;
  1557.     }

  1558.     /**
  1559.      * Sets the name of the platform's bootstrap class loader class.
  1560.      *
  1561.      * @param value The new name of the platform's bootstrap class loader class or {@code null}.
  1562.      *
  1563.      * @see #getBootstrapClassLoaderClassName()
  1564.      */
  1565.     public static void setBootstrapClassLoaderClassName( final String value )
  1566.     {
  1567.         bootstrapClassLoaderClassName = value;
  1568.         bootstrapClassLoaderClassNameInitialized = false;
  1569.     }

  1570.     /**
  1571.      * Gets the name of the root class loader class.
  1572.      * <p>
  1573.      * The name of the root class loader class is controlled by system property
  1574.      * {@code org.jomc.ri.DefaultObjectManager.rootClassLoaderClassName} holding the name of the root class loader
  1575.      * class.
  1576.      *
  1577.      * @return The name of the root class loader class or {@code null}.
  1578.      *
  1579.      * @see #setRootClassLoaderClassName(java.lang.String)
  1580.      * @see #getDefaultClassLoader(java.lang.ClassLoader)
  1581.      * @since 1.7
  1582.      */
  1583.     public static String getRootClassLoaderClassName()
  1584.     {
  1585.         if ( rootClassLoaderClassName == null && !rootClassLoaderClassNameInitialized )
  1586.         {
  1587.             rootClassLoaderClassName =
  1588.                 System.getProperty( "org.jomc.ri.DefaultObjectManager.rootClassLoaderClassName" );

  1589.             rootClassLoaderClassNameInitialized = true;
  1590.         }

  1591.         return rootClassLoaderClassName;
  1592.     }

  1593.     /**
  1594.      * Sets the name of the root class loader class.
  1595.      *
  1596.      * @param value The new name of the root class loader class or {@code null}.
  1597.      *
  1598.      * @see #getRootClassLoaderClassName()
  1599.      * @since 1.7
  1600.      */
  1601.     public static void setRootClassLoaderClassName( final String value )
  1602.     {
  1603.         rootClassLoaderClassName = value;
  1604.         rootClassLoaderClassNameInitialized = false;
  1605.     }

  1606.     /**
  1607.      * Gets the modules registered with a given class loader.
  1608.      *
  1609.      * @param classLoader The class loader to get the modules of.
  1610.      *
  1611.      * @return The modules of the given class loader.
  1612.      *
  1613.      * @throws NullPointerException if {@code classLoader} is {@code null}.
  1614.      * @throws ObjectManagementException if getting the modules fails.
  1615.      *
  1616.      * @see #getDefaultModules()
  1617.      * @see #getModelIdentifier()
  1618.      * @see #isModelObjectClasspathResolutionEnabled()
  1619.      * @see #isModelProcessingEnabled()
  1620.      * @see #getRuntimeModules(org.jomc.model.Modules, java.util.Map)
  1621.      */
  1622.     public Modules getModules( final ClassLoader classLoader )
  1623.     {
  1624.         if ( classLoader == null )
  1625.         {
  1626.             throw new NullPointerException( "classLoader" );
  1627.         }

  1628.         synchronized ( this.modules )
  1629.         {
  1630.             Modules cachedModules = this.modules.get( classLoader );

  1631.             if ( cachedModules == null )
  1632.             {
  1633.                 final List<LogRecord> logRecords = new ArrayList<LogRecord>( 1024 );

  1634.                 try
  1635.                 {
  1636.                     final ModelContext modelContext = ModelContextFactory.newInstance().newModelContext( classLoader );

  1637.                     logRecords.add( new LogRecord( Level.FINER, getCreatingModulesInfo(
  1638.                                                    Locale.getDefault(), this.getClassLoaderInfo( classLoader, null ) ) ) );

  1639.                     modelContext.setLogLevel( this.getLogLevel() );
  1640.                     modelContext.getListeners().add( new ModelContext.Listener()
  1641.                     {

  1642.                         @Override
  1643.                         public void onLog( final Level level, final String message, final Throwable t )
  1644.                         {
  1645.                             super.onLog( level, message, t );
  1646.                             final LogRecord r = new LogRecord( level, message );
  1647.                             r.setThrown( t );

  1648.                             logRecords.add( r );
  1649.                         }

  1650.                     } );

  1651.                     Model model = modelContext.findModel( this.getModelIdentifier() );
  1652.                     cachedModules = ModelHelper.getModules( model );

  1653.                     if ( cachedModules != null )
  1654.                     {
  1655.                         if ( this.isModelObjectClasspathResolutionEnabled() )
  1656.                         {
  1657.                             final Module classpathModule = cachedModules.getClasspathModule(
  1658.                                 Modules.getDefaultClasspathModuleName(), classLoader );

  1659.                             if ( classpathModule != null )
  1660.                             {
  1661.                                 cachedModules.getModule().add( classpathModule );
  1662.                             }
  1663.                         }

  1664.                         if ( this.isModelProcessingEnabled() )
  1665.                         {
  1666.                             model = modelContext.processModel( model );
  1667.                         }

  1668.                         final ModelValidationReport validationReport = modelContext.validateModel( model );

  1669.                         for ( final ModelValidationReport.Detail d : validationReport.getDetails() )
  1670.                         {
  1671.                             final LogRecord r = new LogRecord( d.getLevel(), d.getMessage() );
  1672.                             logRecords.add( r );
  1673.                         }

  1674.                         cachedModules = validationReport.isModelValid() ? ModelHelper.getModules( model ) : null;
  1675.                     }
  1676.                 }
  1677.                 catch ( final ModelException e )
  1678.                 {
  1679.                     cachedModules = null;

  1680.                     final LogRecord r = new LogRecord( Level.SEVERE, getMessage( e ) );
  1681.                     r.setThrown( e );
  1682.                     logRecords.add( r );
  1683.                 }

  1684.                 if ( cachedModules == null )
  1685.                 {
  1686.                     cachedModules = this.getDefaultModules();

  1687.                     logRecords.add( new LogRecord( Level.WARNING, getDefaultModulesWarning(
  1688.                                                    Locale.getDefault(), this.getModelIdentifier(),
  1689.                                                    this.getClassLoaderInfo( classLoader, null ) ) ) );

  1690.                 }

  1691.                 final ClassLoader objectsLoader = this.getDefaultClassLoader( classLoader );

  1692.                 synchronized ( this.objects )
  1693.                 {
  1694.                     Map<Object, Instance> objectMap = this.objects.get( objectsLoader );
  1695.                     if ( objectMap == null )
  1696.                     {
  1697.                         objectMap = new WeakIdentityHashMap<Object, Instance>();
  1698.                         this.objects.put( objectsLoader, objectMap );
  1699.                     }

  1700.                     final long t0 = System.currentTimeMillis();
  1701.                     cachedModules = this.getRuntimeModules( cachedModules, objectMap );

  1702.                     if ( cachedModules instanceof RuntimeModelObject )
  1703.                     {
  1704.                         ( (RuntimeModelObject) cachedModules ).clear();
  1705.                     }

  1706.                     logRecords.add( new LogRecord( Level.FINE,
  1707.                                                    getRuntimeModelReport( Locale.getDefault(),
  1708.                                                                           System.currentTimeMillis() - t0 ) ) );

  1709.                 }

  1710.                 this.modules.put( classLoader, cachedModules );

  1711.                 for ( final LogRecord r : logRecords )
  1712.                 {
  1713.                     this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
  1714.                 }

  1715.                 if ( this.isLoggable( Level.FINEST ) )
  1716.                 {
  1717.                     this.logModulesReport( cachedModules, classLoader );
  1718.                 }
  1719.             }

  1720.             return cachedModules;
  1721.         }
  1722.     }

  1723.     /**
  1724.      * Gets a new default modules instance.
  1725.      *
  1726.      * @return A new default modules instance.
  1727.      *
  1728.      * @throws ObjectManagementException if getting a new default modules instance fails.
  1729.      *
  1730.      * @see #getModules(java.lang.ClassLoader)
  1731.      *
  1732.      * @since 1.1
  1733.      */
  1734.     public Modules getDefaultModules()
  1735.     {
  1736.         final Modules defaultModules = new Modules();
  1737.         final Module defaultModule = new Module();
  1738.         defaultModule.setSpecifications( new Specifications() );
  1739.         defaultModule.setImplementations( new Implementations() );
  1740.         defaultModules.getModule().add( defaultModule );
  1741.         defaultModule.setName( getDefaultModuleName( Locale.getDefault() ) );

  1742.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1743.             ObjectManager.class, Multiplicity.ONE, SINGLETON_SCOPE_IDENTIFIER ) );

  1744.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1745.             Scope.class, null, null ) );

  1746.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1747.             Listener.class, null, null ) );

  1748.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1749.             Locator.class, null, null ) );

  1750.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1751.             Invoker.class, null, null ) );

  1752.         defaultModule.getSpecifications().getSpecification().add( createDefaultSpecification(
  1753.             Invocation.class, Multiplicity.ONE, null ) );

  1754.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1755.             ObjectManagerFactory.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1756.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1757.             ObjectManagementException.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1758.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1759.             DefaultInvocation.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1760.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1761.             DefaultInvoker.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1762.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1763.             DefaultListener.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1764.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1765.             DefaultLocator.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1766.         defaultModule.getImplementations().getImplementation().add( createDefaultImplementation(
  1767.             DefaultScope.class, getDefaultImplementationName( Locale.getDefault() ) ) );

  1768.         final Implementation defaultObjectManager = createDefaultImplementation(
  1769.             DefaultObjectManager.class, getDefaultImplementationName( Locale.getDefault() ) );

  1770.         defaultObjectManager.setSpecifications( new Specifications() );

  1771.         final SpecificationReference refObjectManager = new SpecificationReference();
  1772.         refObjectManager.setIdentifier( ObjectManager.class.getName() );
  1773.         refObjectManager.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
  1774.         defaultObjectManager.getSpecifications().getReference().add( refObjectManager );

  1775.         defaultModule.getImplementations().getImplementation().add( defaultObjectManager );
  1776.         return defaultModules;
  1777.     }

  1778.     /**
  1779.      * Gets a new {@code Modules} instance to register with a class loader.
  1780.      *
  1781.      * @param modules The modules prepared for registration with a class loader.
  1782.      * @param objectMap The object map to associate with the given modules.
  1783.      *
  1784.      * @return The instance to register with a class loader.
  1785.      *
  1786.      * @throws NullPointerException if {@code modules} or {@code objectMap} is {@code null}.
  1787.      *
  1788.      * @see #getModules(java.lang.ClassLoader)
  1789.      * @see RuntimeModules
  1790.      *
  1791.      * @since 1.2
  1792.      */
  1793.     public Modules getRuntimeModules( final Modules modules, final Map<Object, Instance> objectMap )
  1794.     {
  1795.         if ( modules == null )
  1796.         {
  1797.             throw new NullPointerException( "modules" );
  1798.         }
  1799.         if ( objectMap == null )
  1800.         {
  1801.             throw new NullPointerException( "objectMap" );
  1802.         }

  1803.         return new RuntimeModules( modules, objectMap );
  1804.     }

  1805.     /**
  1806.      * Gets the class loader of a given class.
  1807.      *
  1808.      * @param clazz The class whose class loader to get.
  1809.      *
  1810.      * @return The class loader of {@code clazz}.
  1811.      *
  1812.      * @throws NullPointerException if {@code clazz} is {@code null}.
  1813.      *
  1814.      * @since 1.1
  1815.      */
  1816.     public ClassLoader getDefaultClassLoader( final Class<?> clazz )
  1817.     {
  1818.         if ( clazz == null )
  1819.         {
  1820.             throw new NullPointerException( "clazz" );
  1821.         }

  1822.         ClassLoader cl = clazz.getClassLoader();
  1823.         if ( cl == null )
  1824.         {
  1825.             cl = BOOTSTRAP_CLASSLOADER;
  1826.         }

  1827.         return cl;
  1828.     }

  1829.     /**
  1830.      * Gets the root class loader of a given class loader recursively.
  1831.      * <p>
  1832.      * This method recursively finds the root class loader of the given class loader. Recursion stops at the
  1833.      * platform's bootstrap class loader or at the class loader whose class name equals the name returned by method
  1834.      * {@code getRootClassLoaderClassName()}. The platform's bootstrap class loader is detected when either the current
  1835.      * class loader has no parent (a call to the {@code getParent()} method returns {@code null}) or when the class name
  1836.      * of the current class loader's parent class loader equals the name returned by method
  1837.      * {@code getBootstrapClassLoaderClassName()}. Configuration of the name of the platform's bootstrap class loader
  1838.      * class is needed when the platform's {@code getParent()} method of the {@code ClassLoader} class does not return
  1839.      * {@code null} to indicate the bootstrap class loader but instead returns an instance of {@code ClassLoader}.
  1840.      *
  1841.      * @param classLoader The class loader whose root class loader to return or {@code null} to return a
  1842.      * {@code ClassLoader} instance representing the platform's bootstrap class loader.
  1843.      *
  1844.      * @return The root class loader of {@code classLoader}.
  1845.      *
  1846.      * @see #getBootstrapClassLoaderClassName()
  1847.      * @see #getRootClassLoaderClassName()
  1848.      * @see ClassLoader#getParent()
  1849.      *
  1850.      * @since 1.1
  1851.      */
  1852.     public ClassLoader getDefaultClassLoader( final ClassLoader classLoader )
  1853.     {
  1854.         if ( classLoader == null )
  1855.         {
  1856.             return BOOTSTRAP_CLASSLOADER;
  1857.         }

  1858.         synchronized ( defaultClassLoaders )
  1859.         {
  1860.             ClassLoader loader = null;
  1861.             Reference<ClassLoader> reference = defaultClassLoaders.get( classLoader );

  1862.             if ( reference != null )
  1863.             {
  1864.                 loader = reference.get();
  1865.             }

  1866.             if ( loader == null )
  1867.             {
  1868.                 if ( classLoader.getParent() != null
  1869.                          && !classLoader.getParent().getClass().getName().equals( getBootstrapClassLoaderClassName() )
  1870.                          && !classLoader.getClass().getName().equals( getRootClassLoaderClassName() ) )
  1871.                 {
  1872.                     loader = this.getDefaultClassLoader( classLoader.getParent() );
  1873.                 }
  1874.                 else
  1875.                 {
  1876.                     loader = classLoader;
  1877.                 }

  1878.                 defaultClassLoaders.put( classLoader, new WeakReference<ClassLoader>( loader ) );
  1879.             }

  1880.             return loader;
  1881.         }
  1882.     }

  1883.     /**
  1884.      * Gets the class loader of a given class.
  1885.      *
  1886.      * @param clazz The class whose class loader to return.
  1887.      *
  1888.      * @return The class loader of {@code clazz}.
  1889.      *
  1890.      * @throws NullPointerException if {@code clazz} is {@code null}.
  1891.      *
  1892.      * @deprecated As of JOMC 1.1, please use method {@link #getDefaultClassLoader(java.lang.Class)}. This method will
  1893.      * be removed in version 2.0.
  1894.      */
  1895.     @Deprecated
  1896.     public static ClassLoader getClassLoader( final Class<?> clazz )
  1897.     {
  1898.         if ( clazz == null )
  1899.         {
  1900.             throw new NullPointerException( "clazz" );
  1901.         }

  1902.         ClassLoader cl = clazz.getClassLoader();
  1903.         if ( cl == null )
  1904.         {
  1905.             cl = BOOTSTRAP_CLASSLOADER;
  1906.         }

  1907.         return cl;
  1908.     }

  1909.     /**
  1910.      * Gets the root class loader of a given class loader recursively.
  1911.      * <p>
  1912.      * This method recursively finds the root class loader of the given class loader. Recursion stops at the
  1913.      * platform's bootstrap class loader or at the class loader whose class name equals the name returned by method
  1914.      * {@code getRootClassLoaderClassName()}. The platform's bootstrap class loader is detected when either the current
  1915.      * class loader has no parent (a call to the {@code getParent()} method returns {@code null}) or when the class name
  1916.      * of the current class loader's parent class loader equals the name returned by method
  1917.      * {@code getBootstrapClassLoaderClassName()}. Configuration of the name of the platform's bootstrap class loader
  1918.      * class is needed when the platform's {@code getParent()} method of the {@code ClassLoader} class does not return
  1919.      * {@code null} to indicate the bootstrap class loader but instead returns an instance of {@code ClassLoader}.
  1920.      *
  1921.      * @param classLoader The class loader whose root class loader to return or {@code null} to return a
  1922.      * {@code ClassLoader} instance representing the platform's bootstrap class loader.
  1923.      *
  1924.      * @return The root class loader of {@code classLoader}.
  1925.      *
  1926.      * @see #getBootstrapClassLoaderClassName()
  1927.      * @see #getRootClassLoaderClassName()
  1928.      * @see ClassLoader#getParent()
  1929.      *
  1930.      * @deprecated As of JOMC 1.1, please use method {@link #getDefaultClassLoader(java.lang.ClassLoader)}. This method
  1931.      * will be removed in version 2.0.
  1932.      */
  1933.     @Deprecated
  1934.     public static ClassLoader getClassLoader( final ClassLoader classLoader )
  1935.     {
  1936.         if ( classLoader == null )
  1937.         {
  1938.             return BOOTSTRAP_CLASSLOADER;
  1939.         }

  1940.         synchronized ( defaultClassLoaders )
  1941.         {
  1942.             ClassLoader loader = null;
  1943.             Reference<ClassLoader> reference = defaultClassLoaders.get( classLoader );

  1944.             if ( reference != null )
  1945.             {
  1946.                 loader = reference.get();
  1947.             }

  1948.             if ( loader == null )
  1949.             {
  1950.                 if ( classLoader.getParent() != null
  1951.                          && !classLoader.getParent().getClass().getName().equals( getBootstrapClassLoaderClassName() )
  1952.                          && !classLoader.getClass().getName().equals( getRootClassLoaderClassName() ) )
  1953.                 {
  1954.                     loader = getClassLoader( classLoader.getParent() );
  1955.                 }
  1956.                 else
  1957.                 {
  1958.                     loader = classLoader;
  1959.                 }

  1960.                 defaultClassLoaders.put( classLoader, new WeakReference<ClassLoader>( loader ) );
  1961.             }

  1962.             return loader;
  1963.         }
  1964.     }

  1965.     /**
  1966.      * Gets an object of a given instance from a given scope.
  1967.      *
  1968.      * @param scope The scope to get the object from or {@code null}.
  1969.      * @param instance The instance of the object to get.
  1970.      * @param classLoader The class loader to use for creating the object.
  1971.      *
  1972.      * @return An object of {@code instance} from {@code scope} or {@code null}, if no such object is found.
  1973.      *
  1974.      * @throws NullPointerException if {@code instance} or {@code classLoader} is {@code null}.
  1975.      * @throws ObjectManagementException if getting an object fails.
  1976.      */
  1977.     public Object getObject( final Scope scope, final Instance instance, final ClassLoader classLoader )
  1978.     {
  1979.         if ( instance == null )
  1980.         {
  1981.             throw new NullPointerException( "instance" );
  1982.         }
  1983.         if ( classLoader == null )
  1984.         {
  1985.             throw new NullPointerException( "classLoader" );
  1986.         }

  1987.         try
  1988.         {
  1989.             Object object = null;

  1990.             if ( scope != null )
  1991.             {
  1992.                 synchronized ( instance )
  1993.                 {
  1994.                     boolean created = true;

  1995.                     synchronized ( scope )
  1996.                     {
  1997.                         object = scope.getObject( instance.getIdentifier() );

  1998.                         if ( object == null )
  1999.                         {
  2000.                             scope.putObject( instance.getIdentifier(), instance );
  2001.                             created = false;
  2002.                         }
  2003.                     }

  2004.                     if ( object instanceof Instance )
  2005.                     {
  2006.                         synchronized ( object )
  2007.                         {
  2008.                             synchronized ( scope )
  2009.                             {
  2010.                                 object = scope.getObject( instance.getIdentifier() );

  2011.                                 if ( object instanceof Instance )
  2012.                                 {
  2013.                                     throw new ObjectManagementException( getDependencyCycleMessage(
  2014.                                         Locale.getDefault(), instance.getIdentifier() ) );

  2015.                                 }
  2016.                             }
  2017.                         }
  2018.                     }

  2019.                     if ( !created )
  2020.                     {
  2021.                         try
  2022.                         {
  2023.                             object = this.getModules( classLoader ).createObject( instance, classLoader );

  2024.                             if ( object != null )
  2025.                             {
  2026.                                 object = this.createProxy( instance, object, classLoader );
  2027.                             }

  2028.                             created = true;
  2029.                         }
  2030.                         finally
  2031.                         {
  2032.                             synchronized ( scope )
  2033.                             {
  2034.                                 if ( created && object != null )
  2035.                                 {
  2036.                                     final Object o = scope.putObject( instance.getIdentifier(), object );

  2037.                                     if ( o != instance )
  2038.                                     {
  2039.                                         scope.putObject( instance.getIdentifier(), o );
  2040.                                         throw new AssertionError( getScopeContentionFailure(
  2041.                                             Locale.getDefault(), instance.getIdentifier() ) );

  2042.                                     }
  2043.                                 }
  2044.                                 else
  2045.                                 {
  2046.                                     scope.removeObject( instance.getIdentifier() );
  2047.                                 }
  2048.                             }
  2049.                         }
  2050.                     }
  2051.                 }
  2052.             }
  2053.             else
  2054.             {
  2055.                 object = this.getModules( classLoader ).createObject( instance, classLoader );

  2056.                 if ( object != null )
  2057.                 {
  2058.                     object = this.createProxy( instance, object, classLoader );
  2059.                 }
  2060.             }

  2061.             return object;
  2062.         }
  2063.         catch ( final ModelObjectException e )
  2064.         {
  2065.             throw new ObjectManagementException( getMessage( e ), e );
  2066.         }
  2067.         catch ( final InstantiationException e )
  2068.         {
  2069.             throw new ObjectManagementException( getMessage( e ), e );
  2070.         }
  2071.     }

  2072.     /**
  2073.      * Gets an object for a given location URI.
  2074.      *
  2075.      * @param specification The specification class of the object to locate.
  2076.      * @param location The location URI of the object to locate.
  2077.      * @param classLoader The class loader to use for loading locator classes.
  2078.      * @param <T> The type of the object.
  2079.      *
  2080.      * @return An object located at {@code location} or {@code null}, if no such object is found.
  2081.      *
  2082.      * @throws NullPointerException if {@code specification}, {@code location} or {@code classLoader} is {@code null}.
  2083.      * @throws ObjectManagementException if getting an object fails.
  2084.      */
  2085.     public <T> T getObject( final Class<T> specification, final URI location, final ClassLoader classLoader )
  2086.     {
  2087.         if ( specification == null )
  2088.         {
  2089.             throw new NullPointerException( "specification" );
  2090.         }
  2091.         if ( location == null )
  2092.         {
  2093.             throw new NullPointerException( "location" );
  2094.         }
  2095.         if ( classLoader == null )
  2096.         {
  2097.             throw new NullPointerException( "classLoader" );
  2098.         }

  2099.         try
  2100.         {
  2101.             T object = null;
  2102.             final Locator locator = this.getLocator( location, classLoader );

  2103.             if ( locator != null )
  2104.             {
  2105.                 object = locator.getObject( specification, location );
  2106.             }
  2107.             else if ( this.isLoggable( Level.WARNING ) )
  2108.             {
  2109.                 this.log( classLoader, Level.WARNING, getMissingLocatorMessage(
  2110.                           Locale.getDefault(), location.getScheme() ), null );

  2111.             }

  2112.             return object;
  2113.         }
  2114.         catch ( final IOException e )
  2115.         {
  2116.             throw new ObjectManagementException( getMessage( e ), e );
  2117.         }
  2118.     }

  2119.     /**
  2120.      * Gets the scope implementation for a given scope identifier registered with a given class loader.
  2121.      *
  2122.      * @param identifier The identifier of the scope to get an implementation of.
  2123.      * @param classLoader The class loader to use for loading scope implementations.
  2124.      *
  2125.      * @return The implementation of the scope identified by {@code identifier} or {@code null}, if no such scope
  2126.      * implementation is found.
  2127.      *
  2128.      * @throws NullPointerException if {@code classLoader} or {@code identifier} is {@code null}.
  2129.      * @throws ObjectManagementException if getting the scope implementation fails.
  2130.      *
  2131.      * @see #getDefaultScope(org.jomc.model.Modules, java.lang.String)
  2132.      */
  2133.     public Scope getScope( final String identifier, final ClassLoader classLoader )
  2134.     {
  2135.         if ( classLoader == null )
  2136.         {
  2137.             throw new NullPointerException( "classLoader" );
  2138.         }
  2139.         if ( identifier == null )
  2140.         {
  2141.             throw new NullPointerException( "identifier" );
  2142.         }

  2143.         try
  2144.         {
  2145.             final ClassLoader scopesLoader = this.getDefaultClassLoader( classLoader );

  2146.             synchronized ( this.scopes )
  2147.             {
  2148.                 Map<String, Scope> cachedScopes = this.scopes.get( scopesLoader );
  2149.                 if ( cachedScopes == null )
  2150.                 {
  2151.                     cachedScopes = new HashMap<String, Scope>();
  2152.                     this.scopes.put( scopesLoader, cachedScopes );
  2153.                 }

  2154.                 Scope scope = cachedScopes.get( identifier );

  2155.                 if ( scope == null )
  2156.                 {
  2157.                     // Bootstrap scope loading.
  2158.                     final Modules model = this.getModules( classLoader );
  2159.                     final Specification scopeSpecification = model.getSpecification( Scope.class );

  2160.                     if ( scopeSpecification != null )
  2161.                     {
  2162.                         final Implementations implementations =
  2163.                             model.getImplementations( scopeSpecification.getIdentifier() );

  2164.                         if ( implementations != null )
  2165.                         {
  2166.                             for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
  2167.                             {
  2168.                                 final Implementation impl = implementations.getImplementation().get( i );

  2169.                                 if ( identifier.equals( impl.getName() ) )
  2170.                                 {
  2171.                                     final Instance instance = model.getInstance( impl.getIdentifier() );

  2172.                                     if ( instance != null )
  2173.                                     {
  2174.                                         scope = (Scope) model.createObject( instance, classLoader );
  2175.                                         cachedScopes.put( identifier, scope );
  2176.                                         if ( this.isLoggable( Level.CONFIG ) )
  2177.                                         {
  2178.                                             this.log( classLoader, Level.CONFIG, getScopeInfoMessage(
  2179.                                                       Locale.getDefault(), impl.getIdentifier(), identifier,
  2180.                                                       this.getClassLoaderInfo( classLoader, scopesLoader ) ), null );

  2181.                                         }
  2182.                                         break;
  2183.                                     }
  2184.                                     else if ( this.isLoggable( Level.WARNING ) )
  2185.                                     {
  2186.                                         this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  2187.                                                   Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  2188.                                     }
  2189.                                 }
  2190.                             }
  2191.                         }
  2192.                     }
  2193.                     else if ( this.isLoggable( Level.WARNING ) )
  2194.                     {
  2195.                         this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  2196.                                   Locale.getDefault(), Scope.class.getName() ), null );

  2197.                     }

  2198.                     if ( scope == null )
  2199.                     {
  2200.                         scope = this.getDefaultScope( model, identifier );
  2201.                         if ( scope != null )
  2202.                         {
  2203.                             cachedScopes.put( identifier, scope );
  2204.                             if ( this.isLoggable( Level.CONFIG ) )
  2205.                             {
  2206.                                 this.log( classLoader, Level.CONFIG, getDefaultScopeInfoMessage(
  2207.                                           Locale.getDefault(), identifier,
  2208.                                           this.getClassLoaderInfo( classLoader, scopesLoader ) ), null );

  2209.                             }
  2210.                         }
  2211.                     }
  2212.                 }

  2213.                 return scope;
  2214.             }
  2215.         }
  2216.         catch ( final ModelObjectException e )
  2217.         {
  2218.             throw new ObjectManagementException( getMessage( e ), e );
  2219.         }
  2220.         catch ( final InstantiationException e )
  2221.         {
  2222.             throw new ObjectManagementException( getMessage( e ), e );
  2223.         }
  2224.     }

  2225.     /**
  2226.      * Gets a new default scope implementation instance for a given identifier.
  2227.      *
  2228.      * @param identifier The identifier to get a new default scope implementation instance for.
  2229.      *
  2230.      * @return A new default scope implementation instance for {@code identifier} or {@code null}, if no such instance
  2231.      * is available.
  2232.      *
  2233.      * @throws NullPointerException if {@code identifier} is {@code null}.
  2234.      *
  2235.      * @see #getScope(java.lang.String, java.lang.ClassLoader)
  2236.      *
  2237.      * @deprecated As of JOMC 1.2, replaced by method {@link #getDefaultScope(org.jomc.model.Modules,java.lang.String)}.
  2238.      * This method will be removed in version 2.0.
  2239.      */
  2240.     @Deprecated
  2241.     public Scope getDefaultScope( final String identifier )
  2242.     {
  2243.         if ( identifier == null )
  2244.         {
  2245.             throw new NullPointerException( "identifier" );
  2246.         }

  2247.         DefaultScope defaultScope = null;

  2248.         if ( identifier.equals( SINGLETON_SCOPE_IDENTIFIER ) )
  2249.         {
  2250.             defaultScope = new DefaultScope( new HashMap<String, Object>() );
  2251.         }

  2252.         return defaultScope;
  2253.     }

  2254.     /**
  2255.      * Gets a new default scope implementation instance for a given identifier.
  2256.      *
  2257.      * @param model The model to get a new default scope implementation instance of.
  2258.      * @param identifier The identifier to get a new default scope implementation instance for.
  2259.      *
  2260.      * @return A new default scope implementation instance for {@code identifier} or {@code null}, if no such instance
  2261.      * is available.
  2262.      *
  2263.      * @throws NullPointerException if {@code model} or {@code identifier} is {@code null}.
  2264.      * @throws ObjectManagementException if getting a new default scope implementation instance fails.
  2265.      *
  2266.      * @see #getScope(java.lang.String, java.lang.ClassLoader)
  2267.      */
  2268.     public Scope getDefaultScope( final Modules model, final String identifier )
  2269.     {
  2270.         if ( model == null )
  2271.         {
  2272.             throw new NullPointerException( "model" );
  2273.         }
  2274.         if ( identifier == null )
  2275.         {
  2276.             throw new NullPointerException( "identifier" );
  2277.         }

  2278.         try
  2279.         {
  2280.             Scope defaultScope = null;

  2281.             if ( identifier.equals( SINGLETON_SCOPE_IDENTIFIER ) )
  2282.             {
  2283.                 defaultScope = new DefaultScope( new HashMap<String, Object>() );
  2284.                 model.getInstance( defaultScope );
  2285.             }

  2286.             return defaultScope;
  2287.         }
  2288.         catch ( final ModelObjectException e )
  2289.         {
  2290.             throw new ObjectManagementException( getMessage( e ), e );
  2291.         }
  2292.     }

  2293.     /**
  2294.      * Gets a locator to use with a given location URI registered with a given class loader.
  2295.      *
  2296.      * @param location The location URI to get a locator for.
  2297.      * @param classLoader The class loader to use for loading locator implementations.
  2298.      *
  2299.      * @return The locator to use for locating objects at {@code location} or {@code null}, if no such locator is
  2300.      * available.
  2301.      *
  2302.      * @throws NullPointerException if {@code classLoader} or {@code location} is {@code null}.
  2303.      * @throws ObjectManagementException if getting a locator fails.
  2304.      *
  2305.      * @see #getDefaultLocator(org.jomc.model.Modules, java.net.URI)
  2306.      */
  2307.     public Locator getLocator( final URI location, final ClassLoader classLoader )
  2308.     {
  2309.         if ( classLoader == null )
  2310.         {
  2311.             throw new NullPointerException( "classLoader" );
  2312.         }
  2313.         if ( location == null )
  2314.         {
  2315.             throw new NullPointerException( "location" );
  2316.         }

  2317.         try
  2318.         {
  2319.             final String scheme = location.getScheme();

  2320.             if ( scheme != null )
  2321.             {
  2322.                 final ClassLoader locatorsLoader = this.getDefaultClassLoader( classLoader );

  2323.                 synchronized ( this.locators )
  2324.                 {
  2325.                     Map<String, Locator> cachedLocators = this.locators.get( locatorsLoader );
  2326.                     if ( cachedLocators == null )
  2327.                     {
  2328.                         cachedLocators = new HashMap<String, Locator>();
  2329.                         this.locators.put( locatorsLoader, cachedLocators );
  2330.                     }

  2331.                     Locator locator = cachedLocators.get( scheme );

  2332.                     if ( locator == null )
  2333.                     {
  2334.                         // Bootstrap locator loading.
  2335.                         final Modules model = this.getModules( classLoader );
  2336.                         final Specification locatorSpecification = model.getSpecification( Locator.class );

  2337.                         if ( locatorSpecification != null )
  2338.                         {
  2339.                             final Implementations implementations =
  2340.                                 model.getImplementations( locatorSpecification.getIdentifier() );

  2341.                             if ( implementations != null )
  2342.                             {
  2343.                                 for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
  2344.                                 {
  2345.                                     final Implementation impl = implementations.getImplementation().get( i );

  2346.                                     if ( scheme.equals( impl.getName() ) )
  2347.                                     {
  2348.                                         final Instance instance = model.getInstance( impl.getIdentifier() );

  2349.                                         if ( instance != null )
  2350.                                         {
  2351.                                             locator = (Locator) model.createObject( instance, classLoader );
  2352.                                             cachedLocators.put( scheme, locator );

  2353.                                             if ( this.isLoggable( Level.CONFIG ) )
  2354.                                             {
  2355.                                                 this.log( classLoader, Level.CONFIG, getLocatorInfoMessage(
  2356.                                                           Locale.getDefault(), impl.getIdentifier(), scheme,
  2357.                                                           this.getClassLoaderInfo( classLoader, locatorsLoader ) ), null );

  2358.                                             }

  2359.                                             break;
  2360.                                         }
  2361.                                         else if ( this.isLoggable( Level.WARNING ) )
  2362.                                         {
  2363.                                             this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  2364.                                                       Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  2365.                                         }
  2366.                                     }
  2367.                                 }
  2368.                             }
  2369.                         }
  2370.                         else if ( this.isLoggable( Level.WARNING ) )
  2371.                         {
  2372.                             this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  2373.                                       Locale.getDefault(), Locator.class.getName() ), null );

  2374.                         }

  2375.                         if ( locator == null )
  2376.                         {
  2377.                             locator = this.getDefaultLocator( model, location );
  2378.                             if ( locator != null )
  2379.                             {
  2380.                                 cachedLocators.put( scheme, locator );
  2381.                                 if ( this.isLoggable( Level.CONFIG ) )
  2382.                                 {
  2383.                                     this.log( classLoader, Level.CONFIG, getDefaultLocatorInfoMessage(
  2384.                                               Locale.getDefault(), scheme,
  2385.                                               this.getClassLoaderInfo( classLoader, locatorsLoader ) ), null );

  2386.                                 }
  2387.                             }
  2388.                         }
  2389.                     }

  2390.                     return locator;
  2391.                 }
  2392.             }

  2393.             return null;
  2394.         }
  2395.         catch ( final ModelObjectException e )
  2396.         {
  2397.             throw new ObjectManagementException( getMessage( e ), e );
  2398.         }
  2399.         catch ( final InstantiationException e )
  2400.         {
  2401.             throw new ObjectManagementException( getMessage( e ), e );
  2402.         }
  2403.     }

  2404.     /**
  2405.      * Gets a new default locator implementation instance for a given location URI.
  2406.      *
  2407.      * @param location The location URI to get a new default locator implementation instance for.
  2408.      *
  2409.      * @return A new default locator implementation instance for {@code location} or {@code null}, if no such instance
  2410.      * is available.
  2411.      *
  2412.      * @throws NullPointerException if {@code location} is {@code null}.
  2413.      *
  2414.      * @see #getLocator(java.net.URI, java.lang.ClassLoader)
  2415.      *
  2416.      * @deprecated As of JOMC 1.2, replaced by method {@link #getDefaultLocator(org.jomc.model.Modules, java.net.URI)}.
  2417.      * This method will be removed in version 2.0.
  2418.      */
  2419.     @Deprecated
  2420.     public Locator getDefaultLocator( final URI location )
  2421.     {
  2422.         if ( location == null )
  2423.         {
  2424.             throw new NullPointerException( "location" );
  2425.         }

  2426.         Locator locator = null;
  2427.         final DefaultLocator defaultLocator = new DefaultLocator();

  2428.         if ( defaultLocator.isLocationSupported( location ) )
  2429.         {
  2430.             locator = defaultLocator;
  2431.         }

  2432.         return locator;
  2433.     }

  2434.     /**
  2435.      * Gets a new default locator implementation instance for a given location URI.
  2436.      *
  2437.      * @param model The model to get a new default location implementation instance of.
  2438.      * @param location The location URI to get a new default locator implementation instance for.
  2439.      *
  2440.      * @return A new default locator implementation instance for {@code location} or {@code null}, if no such instance
  2441.      * is available.
  2442.      *
  2443.      * @throws NullPointerException if {@code model} or {@code location} is {@code null}.
  2444.      * @throws ObjectManagementException if getting a new default locator implementation instance fails.
  2445.      *
  2446.      * @see #getLocator(java.net.URI, java.lang.ClassLoader)
  2447.      *
  2448.      * @since 1.2
  2449.      */
  2450.     public Locator getDefaultLocator( final Modules model, final URI location )
  2451.     {
  2452.         if ( model == null )
  2453.         {
  2454.             throw new NullPointerException( "model" );
  2455.         }
  2456.         if ( location == null )
  2457.         {
  2458.             throw new NullPointerException( "location" );
  2459.         }

  2460.         try
  2461.         {
  2462.             Locator locator = null;
  2463.             final DefaultLocator defaultLocator = new DefaultLocator();

  2464.             if ( defaultLocator.isLocationSupported( location ) )
  2465.             {
  2466.                 locator = defaultLocator;
  2467.                 model.getInstance( locator );
  2468.             }

  2469.             return locator;
  2470.         }
  2471.         catch ( final ModelObjectException e )
  2472.         {
  2473.             throw new ObjectManagementException( getMessage( e ), e );
  2474.         }
  2475.     }

  2476.     /**
  2477.      * Gets the invoker registered with a given class loader.
  2478.      *
  2479.      * @param classLoader The class loader to use for loading invoker implementations.
  2480.      *
  2481.      * @return The invoker of the given class loader.
  2482.      *
  2483.      * @throws NullPointerException if {@code classLoader} is {@code null}.
  2484.      * @throws ObjectManagementException if getting the invoker fails.
  2485.      *
  2486.      * @see #getDefaultInvoker(org.jomc.model.Modules)
  2487.      */
  2488.     public Invoker getInvoker( final ClassLoader classLoader )
  2489.     {
  2490.         if ( classLoader == null )
  2491.         {
  2492.             throw new NullPointerException( "classLoader" );
  2493.         }

  2494.         try
  2495.         {
  2496.             final ClassLoader invokersLoader = this.getDefaultClassLoader( classLoader );

  2497.             synchronized ( this.invokers )
  2498.             {
  2499.                 Invoker invoker = this.invokers.get( invokersLoader );

  2500.                 if ( invoker == null )
  2501.                 {
  2502.                     final Modules model = this.getModules( classLoader );
  2503.                     final Specification invokerSpecification = model.getSpecification( Invoker.class );

  2504.                     if ( invokerSpecification != null )
  2505.                     {
  2506.                         final Implementations implementations =
  2507.                             model.getImplementations( invokerSpecification.getIdentifier() );

  2508.                         if ( implementations != null && !implementations.getImplementation().isEmpty() )
  2509.                         {
  2510.                             for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
  2511.                             {
  2512.                                 final Implementation impl = implementations.getImplementation().get( i );

  2513.                                 if ( invoker == null )
  2514.                                 {
  2515.                                     final Instance invokerInstance = model.getInstance( impl.getIdentifier() );

  2516.                                     if ( invokerInstance != null )
  2517.                                     {
  2518.                                         invoker = (Invoker) model.createObject( invokerInstance, classLoader );
  2519.                                         this.invokers.put( invokersLoader, invoker );

  2520.                                         if ( this.isLoggable( Level.CONFIG ) )
  2521.                                         {
  2522.                                             this.log( classLoader, Level.CONFIG, getInvokerInfoMessage(
  2523.                                                       Locale.getDefault(), impl.getIdentifier(),
  2524.                                                       this.getClassLoaderInfo( classLoader, invokersLoader ) ), null );

  2525.                                         }
  2526.                                     }
  2527.                                     else if ( this.isLoggable( Level.WARNING ) )
  2528.                                     {
  2529.                                         this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  2530.                                                   Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  2531.                                     }
  2532.                                 }
  2533.                                 else if ( this.isLoggable( Level.CONFIG ) )
  2534.                                 {
  2535.                                     this.log( classLoader, Level.CONFIG, getIgnoredInvokerMessage(
  2536.                                               Locale.getDefault(), impl.getIdentifier() ), null );

  2537.                                 }
  2538.                             }
  2539.                         }
  2540.                     }
  2541.                     else if ( this.isLoggable( Level.WARNING ) )
  2542.                     {
  2543.                         this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  2544.                                   Locale.getDefault(), Invoker.class.getName() ), null );

  2545.                     }

  2546.                     if ( invoker == null )
  2547.                     {
  2548.                         invoker = this.getDefaultInvoker( model );
  2549.                         this.invokers.put( invokersLoader, invoker );
  2550.                         if ( this.isLoggable( Level.CONFIG ) )
  2551.                         {
  2552.                             this.log( classLoader, Level.CONFIG, getDefaultInvokerInfoMessage(
  2553.                                       Locale.getDefault(), this.getClassLoaderInfo( classLoader, invokersLoader ) ),
  2554.                                       null );

  2555.                         }
  2556.                     }
  2557.                 }

  2558.                 return invoker;
  2559.             }
  2560.         }
  2561.         catch ( final ModelObjectException e )
  2562.         {
  2563.             throw new ObjectManagementException( getMessage( e ), e );
  2564.         }
  2565.         catch ( final InstantiationException e )
  2566.         {
  2567.             throw new ObjectManagementException( getMessage( e ), e );
  2568.         }
  2569.     }

  2570.     /**
  2571.      * Gets a new default invoker implementation instance.
  2572.      *
  2573.      * @return A new default invoker implementation instance.
  2574.      *
  2575.      * @see #getInvoker(java.lang.ClassLoader)
  2576.      *
  2577.      * @since 1.1
  2578.      *
  2579.      * @deprecated As of JOMC 1.2, replaced by method {@link #getDefaultInvoker(org.jomc.model.Modules)}. This method
  2580.      * will be removed in version 2.0.
  2581.      */
  2582.     @Deprecated
  2583.     public Invoker getDefaultInvoker()
  2584.     {
  2585.         return new DefaultInvoker();
  2586.     }

  2587.     /**
  2588.      * Gets a new default invoker implementation instance.
  2589.      *
  2590.      * @param model The model to get a new default invoker implementation instance of.
  2591.      *
  2592.      * @return A new default invoker implementation instance.
  2593.      *
  2594.      * @throws NullPointerException if {@code model} is {@code null}.
  2595.      * @throws ObjectManagementException if getting a new default invoker implementation instance fails.
  2596.      *
  2597.      * @see #getInvoker(java.lang.ClassLoader)
  2598.      *
  2599.      * @since 1.2
  2600.      */
  2601.     public Invoker getDefaultInvoker( final Modules model )
  2602.     {
  2603.         if ( model == null )
  2604.         {
  2605.             throw new NullPointerException( "model" );
  2606.         }

  2607.         try
  2608.         {
  2609.             final Invoker defaultInvoker = new DefaultInvoker();
  2610.             model.getInstance( defaultInvoker );
  2611.             return defaultInvoker;
  2612.         }
  2613.         catch ( final ModelObjectException e )
  2614.         {
  2615.             throw new ObjectManagementException( getMessage( e ), e );
  2616.         }
  2617.     }

  2618.     /**
  2619.      * Gets an invocation for a given object, instance, method and arguments.
  2620.      *
  2621.      * @param object The object to invoke.
  2622.      * @param instance The instance of the object to invoke.
  2623.      * @param method The method to invoke on {@code object}.
  2624.      * @param arguments The arguments of the invocation or {@code null}.
  2625.      *
  2626.      * @return An invocation with {@code object}, {@code instance}, {@code method} and {@code arguments}.
  2627.      *
  2628.      * @throws NullPointerException if {@code object}, {@code instance} or {@code method} is {@code null}.
  2629.      * @throws InstantiationException if instantiating a new invocation fails.
  2630.      *
  2631.      * @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[])}.
  2632.      * This method will be removed in version 2.0.
  2633.      */
  2634.     @Deprecated
  2635.     public Invocation getInvocation( final Object object, final Instance instance, final Method method,
  2636.                                      final Object[] arguments ) throws InstantiationException
  2637.     {
  2638.         return this.getInvocation( this.getDefaultClassLoader( object.getClass() ), object, instance, method,
  2639.                                    arguments );

  2640.     }

  2641.     /**
  2642.      * Gets an invocation for a given class loader, object, instance, method and arguments.
  2643.      *
  2644.      * @param classLoader The class loader of the invocation.
  2645.      * @param object The object to invoke.
  2646.      * @param instance The instance of the object to invoke.
  2647.      * @param method The method to invoke on {@code object}.
  2648.      * @param arguments The arguments of the invocation or {@code null}.
  2649.      *
  2650.      * @return An invocation with {@code classLoader}, {@code object}, {@code instance}, {@code method} and
  2651.      * {@code arguments}.
  2652.      *
  2653.      * @throws NullPointerException if {@code classLoader} {@code object}, {@code instance} or {@code method} is
  2654.      * {@code null}.
  2655.      * @throws ObjectManagementException if getting an invocation fails.
  2656.      *
  2657.      * @see #getDefaultInvocation(org.jomc.model.Modules)
  2658.      *
  2659.      * @since 1.1
  2660.      */
  2661.     public Invocation getInvocation( final ClassLoader classLoader, final Object object, final Instance instance,
  2662.                                      final Method method, final Object[] arguments )
  2663.     {
  2664.         if ( classLoader == null )
  2665.         {
  2666.             throw new NullPointerException( "classLoader" );
  2667.         }
  2668.         if ( object == null )
  2669.         {
  2670.             throw new NullPointerException( "object" );
  2671.         }
  2672.         if ( instance == null )
  2673.         {
  2674.             throw new NullPointerException( "instance" );
  2675.         }
  2676.         if ( method == null )
  2677.         {
  2678.             throw new NullPointerException( "method" );
  2679.         }

  2680.         try
  2681.         {
  2682.             Invocation invocation = null;
  2683.             final Modules model = this.getModules( classLoader );
  2684.             final Specification invocationSpecification = model.getSpecification( Invocation.class );

  2685.             if ( invocationSpecification != null )
  2686.             {
  2687.                 final Implementations implementations =
  2688.                     model.getImplementations( invocationSpecification.getIdentifier() );

  2689.                 if ( implementations != null && !implementations.getImplementation().isEmpty() )
  2690.                 {
  2691.                     for ( int i = 0, s0 = implementations.getImplementation().size(); i < s0; i++ )
  2692.                     {
  2693.                         final Implementation impl = implementations.getImplementation().get( i );

  2694.                         if ( invocation == null )
  2695.                         {
  2696.                             final Instance invocationInstance = model.getInstance( impl.getIdentifier() );

  2697.                             if ( invocationInstance != null )
  2698.                             {
  2699.                                 invocation = (Invocation) model.createObject( invocationInstance, classLoader );
  2700.                             }
  2701.                             else if ( this.isLoggable( Level.WARNING ) )
  2702.                             {
  2703.                                 this.log( classLoader, Level.WARNING, getMissingInstanceMessage(
  2704.                                           Locale.getDefault(), impl.getIdentifier(), impl.getName() ), null );

  2705.                             }
  2706.                         }
  2707.                         else if ( this.isLoggable( Level.CONFIG ) )
  2708.                         {
  2709.                             this.log( classLoader, Level.CONFIG, getIgnoredInvocationMessage(
  2710.                                       Locale.getDefault(), impl.getIdentifier() ), null );

  2711.                         }
  2712.                     }
  2713.                 }
  2714.             }
  2715.             else if ( this.isLoggable( Level.WARNING ) )
  2716.             {
  2717.                 this.log( classLoader, Level.WARNING, getMissingSpecificationMessage(
  2718.                           Locale.getDefault(), Invocation.class.getName() ), null );

  2719.             }

  2720.             if ( invocation == null )
  2721.             {
  2722.                 invocation = this.getDefaultInvocation( model );
  2723.             }

  2724.             invocation.getContext().put( DefaultInvocation.OBJECT_KEY, object );
  2725.             invocation.getContext().put( DefaultInvocation.METHOD_KEY, method );
  2726.             invocation.getContext().put( DefaultInvocation.ARGUMENTS_KEY, arguments );
  2727.             invocation.getContext().put( DefaultInvocation.INSTANCE_KEY, instance );
  2728.             invocation.getContext().put( DefaultInvocation.MODULES_KEY, model );
  2729.             invocation.getContext().put( DefaultInvocation.CLASSLOADER_KEY, classLoader );
  2730.             return invocation;
  2731.         }
  2732.         catch ( final ModelObjectException e )
  2733.         {
  2734.             throw new ObjectManagementException( getMessage( e ), e );
  2735.         }
  2736.         catch ( final InstantiationException e )
  2737.         {
  2738.             throw new ObjectManagementException( getMessage( e ), e );
  2739.         }
  2740.     }

  2741.     /**
  2742.      * Gets a new default invocation implementation instance.
  2743.      *
  2744.      * @return A new default invocation implementation instance.
  2745.      *
  2746.      * @see #getInvocation(java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[])
  2747.      *
  2748.      * @since 1.1
  2749.      *
  2750.      * @deprecated As of JOMC 1.2, replaced by method {@link #getDefaultInvocation(org.jomc.model.Modules)}. This method
  2751.      * will be removed in version 2.0.
  2752.      */
  2753.     @Deprecated
  2754.     public Invocation getDefaultInvocation()
  2755.     {
  2756.         return new DefaultInvocation();
  2757.     }

  2758.     /**
  2759.      * Gets a new default invocation implementation instance.
  2760.      *
  2761.      * @param model The model to get a new default invocation implementation instance of.
  2762.      *
  2763.      * @return A new default invocation implementation instance.
  2764.      *
  2765.      * @throws NullPointerException if {@code model} is {@code null}.
  2766.      * @throws ObjectManagementException if getting a new default invocation implementation instance fails.
  2767.      *
  2768.      * @see #getInvocation(java.lang.ClassLoader, java.lang.Object, org.jomc.model.Instance, java.lang.reflect.Method, java.lang.Object[])
  2769.      *
  2770.      * @since 1.2
  2771.      */
  2772.     public Invocation getDefaultInvocation( final Modules model )
  2773.     {
  2774.         if ( model == null )
  2775.         {
  2776.             throw new NullPointerException( "model" );
  2777.         }

  2778.         try
  2779.         {
  2780.             final Invocation defaultInvocation = new DefaultInvocation();
  2781.             model.getInstance( defaultInvocation );
  2782.             return defaultInvocation;
  2783.         }
  2784.         catch ( final ModelObjectException e )
  2785.         {
  2786.             throw new ObjectManagementException( getMessage( e ), e );
  2787.         }
  2788.     }

  2789.     /**
  2790.      * Initializes the instance.
  2791.      * <p>
  2792.      * This method is called once on first usage of a new instance.
  2793.      * </p>
  2794.      *
  2795.      * @throws ObjectManagementException if initialization fails.
  2796.      */
  2797.     public synchronized void initialize()
  2798.     {
  2799.         try
  2800.         {
  2801.             if ( !this.initialized )
  2802.             {
  2803.                 try
  2804.                 {
  2805.                     final long t0 = System.currentTimeMillis();
  2806.                     this.initialized = true;

  2807.                     this.listeners.clear();
  2808.                     this.modules.clear();
  2809.                     this.invokers.clear();
  2810.                     this.locators.clear();
  2811.                     this.scopes.clear();

  2812.                     final ClassLoader classLoader = this.getDefaultClassLoader( this.getClass() );
  2813.                     final List<LogRecord> bootstrapLogRecords = new ArrayList<LogRecord>( 1024 );
  2814.                     final List<Listener> bootstrapListeners = new ArrayList<Listener>( 1 );
  2815.                     bootstrapListeners.add( new Listener()
  2816.                     {

  2817.                         public void onLog( final Level level, final String message, final Throwable throwable )
  2818.                         {
  2819.                             final LogRecord r = new LogRecord( level, message );
  2820.                             r.setThrown( throwable );

  2821.                             bootstrapLogRecords.add( r );
  2822.                         }

  2823.                     } );

  2824.                     this.listeners.put( this.getDefaultClassLoader( classLoader ),
  2825.                                         Collections.unmodifiableList( bootstrapListeners ) );

  2826.                     final Modules model = this.getModules( classLoader );
  2827.                     final Specification objectManager = model.getSpecification( ObjectManager.class );
  2828.                     if ( objectManager == null )
  2829.                     {
  2830.                         throw new InstantiationException( getMissingSpecificationMessage(
  2831.                             Locale.getDefault(), ObjectManager.class.getName() ) );

  2832.                     }

  2833.                     final Implementation thisImplementation = model.getImplementation( this.getClass() );
  2834.                     if ( thisImplementation == null )
  2835.                     {
  2836.                         throw new InstantiationException( getMissingImplementationMessage(
  2837.                             Locale.getDefault(), objectManager.getIdentifier(), this.getClass().getName() ) );

  2838.                     }

  2839.                     final Instance thisInstance = model.getInstance( this );
  2840.                     if ( thisInstance == null )
  2841.                     {
  2842.                         throw new InstantiationException( getMissingInstanceMessage(
  2843.                             Locale.getDefault(), objectManager.getIdentifier(), thisImplementation.getName() ) );

  2844.                     }

  2845.                     if ( objectManager.getScope() != null )
  2846.                     {
  2847.                         final Scope scope = this.getScope( objectManager.getScope(), classLoader );
  2848.                         if ( scope == null )
  2849.                         {
  2850.                             throw new InstantiationException( getMissingScopeMessage(
  2851.                                 Locale.getDefault(), objectManager.getScope() ) );

  2852.                         }

  2853.                         scope.putObject( thisInstance.getIdentifier(), this );
  2854.                     }

  2855.                     if ( this.isLoggable( Level.FINE ) )
  2856.                     {
  2857.                         this.log( Level.FINE, getImplementationInfoMessage(
  2858.                                   Locale.getDefault(), Long.valueOf( System.currentTimeMillis() - t0 ) ), null );

  2859.                     }

  2860.                     this.listeners.clear();

  2861.                     for ( final LogRecord r : bootstrapLogRecords )
  2862.                     {
  2863.                         this.log( classLoader, r.getLevel(), r.getMessage(), r.getThrown() );
  2864.                     }
  2865.                 }
  2866.                 catch ( final InstantiationException e )
  2867.                 {
  2868.                     this.listeners.clear();
  2869.                     this.modules.clear();
  2870.                     this.invokers.clear();
  2871.                     this.locators.clear();
  2872.                     this.scopes.clear();
  2873.                     this.initialized = false;

  2874.                     throw new ObjectManagementException( getMessage( e ), e );
  2875.                 }
  2876.             }
  2877.         }
  2878.         catch ( final ModelObjectException e )
  2879.         {
  2880.             throw new ObjectManagementException( getMessage( e ), e );
  2881.         }
  2882.     }

  2883.     /**
  2884.      * Creates a proxy object for a given object.
  2885.      *
  2886.      * @param instance The instance of {@code object}.
  2887.      * @param object The object to create a proxy object for.
  2888.      * @param classLoader The class loader to create the proxy object with.
  2889.      *
  2890.      * @return A new proxy object for {@code object}.
  2891.      *
  2892.      * @throws ObjectManagementException if creating a proxy object fails.
  2893.      */
  2894.     private Object createProxy( final Instance instance, final Object object, final ClassLoader classLoader )
  2895.     {
  2896.         try
  2897.         {
  2898.             Constructor<?> proxyClassConstructor = null;

  2899.             synchronized ( proxyClassConstructors )
  2900.             {
  2901.                 Map<String, Reference<Constructor<?>>> map = proxyClassConstructors.get( classLoader );

  2902.                 if ( map == null )
  2903.                 {
  2904.                     map = new HashMap<String, Reference<Constructor<?>>>();
  2905.                     proxyClassConstructors.put( classLoader, map );
  2906.                 }

  2907.                 Reference<Constructor<?>> reference = map.get( instance.getIdentifier() );

  2908.                 if ( reference != null )
  2909.                 {
  2910.                     proxyClassConstructor = reference.get();
  2911.                 }

  2912.                 if ( proxyClassConstructor == null
  2913.                          && ( reference != null || !map.containsKey( instance.getIdentifier() ) ) )
  2914.                 {
  2915.                     final Class<?> proxyClass = instance.getJavaProxyClass( classLoader );

  2916.                     if ( proxyClass != null )
  2917.                     {
  2918.                         proxyClassConstructor = proxyClass.getConstructor( INVOCATION_HANDLER_ARGUMENTS );
  2919.                     }

  2920.                     map.put( instance.getIdentifier(), new WeakReference<Constructor<?>>( proxyClassConstructor ) );
  2921.                 }
  2922.             }

  2923.             Object proxyObject = object;

  2924.             if ( proxyClassConstructor != null )
  2925.             {
  2926.                 proxyObject = proxyClassConstructor.newInstance( new Object[]
  2927.                 {
  2928.                     new InvocationHandler()
  2929.                     {

  2930.                         private final Invoker invoker = getInvoker( classLoader );

  2931.                         public Object invoke( final Object proxy, final Method method, final Object[] args )
  2932.                             throws Throwable
  2933.                         {
  2934.                             if ( args != null )
  2935.                             {
  2936.                                 Object[] clonedArgs = args;

  2937.                                 for ( int i = 0, s0 = clonedArgs.length; i < s0; i++ )
  2938.                                 {
  2939.                                     if ( clonedArgs[i] == proxy )
  2940.                                     {
  2941.                                         if ( clonedArgs == args )
  2942.                                         {
  2943.                                             clonedArgs = clonedArgs.clone();
  2944.                                         }

  2945.                                         clonedArgs[i] = object;
  2946.                                     }
  2947.                                 }

  2948.                                 return this.invoker.invoke( getInvocation(
  2949.                                     classLoader, object, instance, method, clonedArgs ) );

  2950.                             }

  2951.                             return this.invoker.invoke( getInvocation(
  2952.                                 classLoader, object, instance, method, null ) );

  2953.                         }

  2954.                     }
  2955.                 } );

  2956.             }

  2957.             return proxyObject;
  2958.         }
  2959.         catch ( final ModelObjectException e )
  2960.         {
  2961.             throw new ObjectManagementException( getMessage( e ), e );
  2962.         }
  2963.         catch ( final ClassNotFoundException e )
  2964.         {
  2965.             throw new ObjectManagementException( getMessage( e ), e );
  2966.         }
  2967.         catch ( final NoSuchMethodException e )
  2968.         {
  2969.             throw new ObjectManagementException( getMessage( e ), e );
  2970.         }
  2971.         catch ( final IllegalAccessException e )
  2972.         {
  2973.             throw new ObjectManagementException( getMessage( e ), e );
  2974.         }
  2975.         catch ( final InstantiationException e )
  2976.         {
  2977.             throw new ObjectManagementException( getMessage( e ), e );
  2978.         }
  2979.         catch ( final InvocationTargetException e )
  2980.         {
  2981.             throw new ObjectManagementException( getMessage( e ), e );
  2982.         }
  2983.     }

  2984.     private void logModulesReport( final Modules mods, final ClassLoader classLoader )
  2985.     {
  2986.         final StringBuilder modulesInfo = new StringBuilder( 8192 );

  2987.         this.log( classLoader, Level.FINEST, getModulesReportMessage( Locale.getDefault() ), null );

  2988.         modulesInfo.append( "\tClassLoader:" ).append( classLoader );

  2989.         if ( mods.getDocumentation() != null )
  2990.         {
  2991.             modulesInfo.append( "|Documentation:" ).append( mods.getDocumentation().getText(
  2992.                 Locale.getDefault().getLanguage() ).getValue() );

  2993.         }

  2994.         this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );

  2995.         for ( final Module m : mods.getModule() )
  2996.         {
  2997.             modulesInfo.setLength( 0 );
  2998.             modulesInfo.append( "\tM:" ).append( m.getName() );

  2999.             if ( m.getVersion() != null )
  3000.             {
  3001.                 modulesInfo.append( "|Version:" ).append( m.getVersion() );
  3002.             }
  3003.             if ( m.getVendor() != null )
  3004.             {
  3005.                 modulesInfo.append( "|Vendor:" ).append( m.getVendor() );
  3006.             }

  3007.             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3008.             modulesInfo.setLength( 0 );

  3009.             if ( m.getSpecifications() != null )
  3010.             {
  3011.                 for ( final Specification s : m.getSpecifications().getSpecification() )
  3012.                 {
  3013.                     modulesInfo.append( "\t\t" );
  3014.                     this.appendSpecificationInfo( s, modulesInfo );
  3015.                     this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3016.                     modulesInfo.setLength( 0 );

  3017.                     final Implementations available = mods.getImplementations( s.getIdentifier() );

  3018.                     if ( available != null )
  3019.                     {
  3020.                         for ( final Implementation i : available.getImplementation() )
  3021.                         {
  3022.                             modulesInfo.append( "\t\t\t" );
  3023.                             this.appendImplementationInfo( i, modulesInfo ).append( "|Module:" ).
  3024.                                 append( mods.getModuleOfImplementation( i.getIdentifier() ).getName() );

  3025.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3026.                             modulesInfo.setLength( 0 );
  3027.                         }
  3028.                     }
  3029.                 }
  3030.             }

  3031.             if ( m.getImplementations() != null )
  3032.             {
  3033.                 for ( final Implementation i : m.getImplementations().getImplementation() )
  3034.                 {
  3035.                     modulesInfo.append( "\t\t" );
  3036.                     this.appendImplementationInfo( i, modulesInfo );
  3037.                     this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3038.                     modulesInfo.setLength( 0 );

  3039.                     if ( i.getImplementations() != null )
  3040.                     {
  3041.                         modulesInfo.append( "\t\t\t" );
  3042.                         for ( final ImplementationReference r : i.getImplementations().getReference() )
  3043.                         {
  3044.                             this.appendImplementationInfo(
  3045.                                 mods.getImplementation( r.getIdentifier() ), modulesInfo ).append( "|Module:" ).
  3046.                                 append( mods.getModuleOfImplementation( r.getIdentifier() ).getName() );

  3047.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3048.                             modulesInfo.setLength( 0 );
  3049.                         }
  3050.                     }
  3051.                     if ( i.getSpecifications() != null )
  3052.                     {
  3053.                         for ( final SpecificationReference s : i.getSpecifications().getReference() )
  3054.                         {
  3055.                             modulesInfo.append( "\t\t\tS:" ).append( s.getIdentifier() );

  3056.                             if ( s.getVersion() != null )
  3057.                             {
  3058.                                 modulesInfo.append( "|Version:" ).append( s.getVersion() );
  3059.                             }

  3060.                             modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
  3061.                                 s.getIdentifier() ).getName() );

  3062.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3063.                             modulesInfo.setLength( 0 );
  3064.                         }
  3065.                     }

  3066.                     if ( i.getDependencies() != null )
  3067.                     {
  3068.                         for ( final Dependency d : i.getDependencies().getDependency() )
  3069.                         {
  3070.                             modulesInfo.append( "\t\t\tD:" ).append( d.getName() ).append( "|Identifier:" ).
  3071.                                 append( d.getIdentifier() );

  3072.                             if ( d.getImplementationName() != null )
  3073.                             {
  3074.                                 modulesInfo.append( "|Name:" ).append( d.getImplementationName() );
  3075.                             }

  3076.                             modulesInfo.append( "|Module:" ).append( mods.getModuleOfSpecification(
  3077.                                 d.getIdentifier() ).getName() );

  3078.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3079.                             modulesInfo.setLength( 0 );

  3080.                             final Implementations available = mods.getImplementations( d.getIdentifier() );

  3081.                             if ( available != null )
  3082.                             {
  3083.                                 for ( final Implementation di : available.getImplementation() )
  3084.                                 {
  3085.                                     modulesInfo.append( "\t\t\t\t" );
  3086.                                     this.appendImplementationInfo( di, modulesInfo ).append( "|Module:" ).
  3087.                                         append( mods.getModuleOfImplementation( di.getIdentifier() ).getName() );

  3088.                                     this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3089.                                     modulesInfo.setLength( 0 );
  3090.                                 }
  3091.                             }
  3092.                         }
  3093.                     }

  3094.                     if ( i.getMessages() != null )
  3095.                     {
  3096.                         for ( final Message msg : i.getMessages().getMessage() )
  3097.                         {
  3098.                             modulesInfo.append( "\t\t\tM:" ).append( msg.getName() ).append( "|Text:" ).
  3099.                                 append( msg.getTemplate().getText( Locale.getDefault().getLanguage() ).getValue() );

  3100.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3101.                             modulesInfo.setLength( 0 );
  3102.                         }
  3103.                     }

  3104.                     if ( i.getProperties() != null )
  3105.                     {
  3106.                         for ( final Property p : i.getProperties().getProperty() )
  3107.                         {
  3108.                             modulesInfo.append( "\t\t\tP:" ).append( p.getName() );
  3109.                             modulesInfo.append( "|Type:" ).append( p.getType() );
  3110.                             modulesInfo.append( "|Value:" ).append( p.getValue() );

  3111.                             try
  3112.                             {
  3113.                                 modulesInfo.append( "|JavaValue:" ).append( p.getJavaValue( classLoader ) );
  3114.                             }
  3115.                             catch ( final ModelObjectException e )
  3116.                             {
  3117.                                 modulesInfo.append( "|JavaValue:" ).append( e );
  3118.                             }

  3119.                             this.log( classLoader, Level.FINEST, modulesInfo.toString(), null );
  3120.                             modulesInfo.setLength( 0 );
  3121.                         }
  3122.                     }
  3123.                 }
  3124.             }
  3125.         }
  3126.     }

  3127.     private StringBuilder appendSpecificationInfo( final Specification s, final StringBuilder b )
  3128.     {
  3129.         b.append( "S:" ).append( s.getIdentifier() );
  3130.         if ( s.getVersion() != null )
  3131.         {
  3132.             b.append( "|Version:" ).append( s.getVersion() );
  3133.         }
  3134.         if ( s.getVendor() != null )
  3135.         {
  3136.             b.append( "|Vendor:" ).append( s.getVendor() );
  3137.         }

  3138.         b.append( "|Multiplicity:" ).append( s.getMultiplicity() ).append( "|Scope:" ).
  3139.             append( s.getScope() == null ? "Multiton" : s.getScope() );

  3140.         if ( s.getClazz() != null )
  3141.         {
  3142.             b.append( "|Class:" ).append( s.getClazz() );
  3143.         }

  3144.         return b;
  3145.     }

  3146.     private StringBuilder appendImplementationInfo( final Implementation i, final StringBuilder b )
  3147.     {
  3148.         b.append( "I:" ).append( i.getIdentifier() ).append( "|Name:" ).append( i.getName() ).append( "|Abstract:" ).
  3149.             append( i.isAbstract() ).append( "|Final:" ).append( i.isFinal() ).append( "|Stateless:" ).
  3150.             append( i.isStateless() );

  3151.         if ( i.getVersion() != null )
  3152.         {
  3153.             b.append( "|Version:" ).append( i.getVersion() );
  3154.         }
  3155.         if ( i.getVendor() != null )
  3156.         {
  3157.             b.append( "|Vendor:" ).append( i.getVendor() );
  3158.         }
  3159.         if ( i.getClazz() != null )
  3160.         {
  3161.             b.append( "|Class:" ).append( i.getClazz() );
  3162.         }
  3163.         if ( i.getLocation() != null )
  3164.         {
  3165.             b.append( "|Location:" ).append( i.getLocation() );
  3166.         }

  3167.         return b;
  3168.     }

  3169.     private String getClassLoaderInfo( final ClassLoader current, final ClassLoader parent )
  3170.     {
  3171.         final StringBuilder b = new StringBuilder();
  3172.         appendClassLoaderInfo( b, current );

  3173.         if ( parent != null )
  3174.         {
  3175.             b.append( " => " );
  3176.             appendClassLoaderInfo( b, parent );
  3177.         }

  3178.         return b.toString();
  3179.     }

  3180.     private String getObjectInfo( final Object object )
  3181.     {
  3182.         final StringBuilder b = new StringBuilder();
  3183.         appendObjectInfo( b, object );
  3184.         b.append( " @ " );
  3185.         appendClassLoaderInfo( b, this.getDefaultClassLoader( object.getClass() ) );
  3186.         return b.toString();
  3187.     }

  3188.     private static StringBuilder appendClassLoaderInfo( final StringBuilder b, final ClassLoader classLoader )
  3189.     {
  3190.         return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( classLoader ) ) ).append( ")" ).
  3191.             append( classLoader );

  3192.     }

  3193.     private static StringBuilder appendObjectInfo( final StringBuilder b, final Object object )
  3194.     {
  3195.         return b.append( "(" ).append( Integer.toHexString( System.identityHashCode( object ) ) ).append( ")" ).
  3196.             append( object );

  3197.     }

  3198.     private static String getMessage( final Throwable t )
  3199.     {
  3200.         return t != null
  3201.                    ? t.getMessage() != null && t.getMessage().trim().length() > 0
  3202.                          ? t.getMessage()
  3203.                          : getMessage( t.getCause() )
  3204.                    : null;

  3205.     }

  3206.     private static Specification createDefaultSpecification( final Class<?> specification,
  3207.                                                              final Multiplicity multiplicity, final String scope )
  3208.     {
  3209.         final Specification s = new Specification();
  3210.         s.setClassDeclaration( true );
  3211.         s.setClazz( specification.getName() );
  3212.         s.setIdentifier( specification.getName() );
  3213.         s.setMultiplicity( multiplicity );
  3214.         s.setScope( scope );
  3215.         s.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
  3216.         s.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
  3217.         return s;
  3218.     }

  3219.     private static Implementation createDefaultImplementation( final Class<?> implementation, final String name )
  3220.     {
  3221.         final Implementation i = new Implementation();
  3222.         i.setClassDeclaration( true );
  3223.         i.setClazz( implementation.getName() );
  3224.         i.setIdentifier( implementation.getName() );
  3225.         i.setName( name );
  3226.         i.setVendor( getDefaultModulesVendor( Locale.getDefault() ) );
  3227.         i.setVersion( getDefaultModulesVersion( Locale.getDefault() ) );
  3228.         return i;
  3229.     }

  3230.     // SECTION-END
  3231.     // SECTION-START[Dependencies]
  3232.     // SECTION-END
  3233.     // SECTION-START[Properties]
  3234.     // SECTION-END
  3235.     // SECTION-START[Messages]
  3236.     // <editor-fold defaultstate="collapsed" desc=" Generated Messages ">
  3237.     /**
  3238.      * Gets the text of the {@code <Creating Modules Info>} message.
  3239.      * <p><dl>
  3240.      *   <dt><b>Languages:</b></dt>
  3241.      *     <dd>English (default)</dd>
  3242.      *     <dd>Deutsch</dd>
  3243.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3244.      * </dl></p>
  3245.      * @param locale The locale of the message to return.
  3246.      * @param classLoaderInfo Format argument.
  3247.      * @return The text of the {@code <Creating Modules Info>} message for {@code locale}.
  3248.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3249.      */
  3250.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3251.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3252.     private static String getCreatingModulesInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
  3253.     {
  3254.         java.io.BufferedReader reader = null;
  3255.         boolean suppressExceptionOnClose = true;

  3256.         try
  3257.         {
  3258.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Creating Modules Info" ), classLoaderInfo, (Object) null );
  3259.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3260.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3261.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3262.             String line;
  3263.             while ( ( line = reader.readLine() ) != null )
  3264.             {
  3265.                 builder.append( lineSeparator ).append( line );
  3266.             }

  3267.             suppressExceptionOnClose = false;
  3268.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3269.         }
  3270.         catch( final java.lang.ClassCastException e )
  3271.         {
  3272.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3273.         }
  3274.         catch( final java.lang.IllegalArgumentException e )
  3275.         {
  3276.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3277.         }
  3278.         catch( final java.util.MissingResourceException e )
  3279.         {
  3280.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3281.         }
  3282.         catch( final java.io.IOException e )
  3283.         {
  3284.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3285.         }
  3286.         finally
  3287.         {
  3288.             try
  3289.             {
  3290.                 if( reader != null )
  3291.                 {
  3292.                     reader.close();
  3293.                 }
  3294.             }
  3295.             catch( final java.io.IOException e )
  3296.             {
  3297.                 if( !suppressExceptionOnClose )
  3298.                 {
  3299.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3300.                 }
  3301.             }
  3302.         }
  3303.     }
  3304.     /**
  3305.      * Gets the text of the {@code <Default Implementation Name>} message.
  3306.      * <p><dl>
  3307.      *   <dt><b>Languages:</b></dt>
  3308.      *     <dd>English (default)</dd>
  3309.      *     <dd>Deutsch</dd>
  3310.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3311.      * </dl></p>
  3312.      * @param locale The locale of the message to return.
  3313.      * @return The text of the {@code <Default Implementation Name>} message for {@code locale}.
  3314.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3315.      */
  3316.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3317.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3318.     private static String getDefaultImplementationName( final java.util.Locale locale )
  3319.     {
  3320.         java.io.BufferedReader reader = null;
  3321.         boolean suppressExceptionOnClose = true;

  3322.         try
  3323.         {
  3324.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Implementation Name" ), (Object) null );
  3325.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3326.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3327.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3328.             String line;
  3329.             while ( ( line = reader.readLine() ) != null )
  3330.             {
  3331.                 builder.append( lineSeparator ).append( line );
  3332.             }

  3333.             suppressExceptionOnClose = false;
  3334.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3335.         }
  3336.         catch( final java.lang.ClassCastException e )
  3337.         {
  3338.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3339.         }
  3340.         catch( final java.lang.IllegalArgumentException e )
  3341.         {
  3342.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3343.         }
  3344.         catch( final java.util.MissingResourceException e )
  3345.         {
  3346.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3347.         }
  3348.         catch( final java.io.IOException e )
  3349.         {
  3350.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3351.         }
  3352.         finally
  3353.         {
  3354.             try
  3355.             {
  3356.                 if( reader != null )
  3357.                 {
  3358.                     reader.close();
  3359.                 }
  3360.             }
  3361.             catch( final java.io.IOException e )
  3362.             {
  3363.                 if( !suppressExceptionOnClose )
  3364.                 {
  3365.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3366.                 }
  3367.             }
  3368.         }
  3369.     }
  3370.     /**
  3371.      * Gets the text of the {@code <Default Invoker Info Message>} message.
  3372.      * <p><dl>
  3373.      *   <dt><b>Languages:</b></dt>
  3374.      *     <dd>English (default)</dd>
  3375.      *     <dd>Deutsch</dd>
  3376.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3377.      * </dl></p>
  3378.      * @param locale The locale of the message to return.
  3379.      * @param classLoaderInfo Format argument.
  3380.      * @return The text of the {@code <Default Invoker Info Message>} message for {@code locale}.
  3381.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3382.      */
  3383.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3384.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3385.     private static String getDefaultInvokerInfoMessage( final java.util.Locale locale, final java.lang.String classLoaderInfo )
  3386.     {
  3387.         java.io.BufferedReader reader = null;
  3388.         boolean suppressExceptionOnClose = true;

  3389.         try
  3390.         {
  3391.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Invoker Info Message" ), classLoaderInfo, (Object) null );
  3392.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3393.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3394.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3395.             String line;
  3396.             while ( ( line = reader.readLine() ) != null )
  3397.             {
  3398.                 builder.append( lineSeparator ).append( line );
  3399.             }

  3400.             suppressExceptionOnClose = false;
  3401.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3402.         }
  3403.         catch( final java.lang.ClassCastException e )
  3404.         {
  3405.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3406.         }
  3407.         catch( final java.lang.IllegalArgumentException e )
  3408.         {
  3409.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3410.         }
  3411.         catch( final java.util.MissingResourceException e )
  3412.         {
  3413.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3414.         }
  3415.         catch( final java.io.IOException e )
  3416.         {
  3417.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3418.         }
  3419.         finally
  3420.         {
  3421.             try
  3422.             {
  3423.                 if( reader != null )
  3424.                 {
  3425.                     reader.close();
  3426.                 }
  3427.             }
  3428.             catch( final java.io.IOException e )
  3429.             {
  3430.                 if( !suppressExceptionOnClose )
  3431.                 {
  3432.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3433.                 }
  3434.             }
  3435.         }
  3436.     }
  3437.     /**
  3438.      * Gets the text of the {@code <Default Listener Info>} message.
  3439.      * <p><dl>
  3440.      *   <dt><b>Languages:</b></dt>
  3441.      *     <dd>English (default)</dd>
  3442.      *     <dd>Deutsch</dd>
  3443.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3444.      * </dl></p>
  3445.      * @param locale The locale of the message to return.
  3446.      * @param classLoaderInfo Format argument.
  3447.      * @return The text of the {@code <Default Listener Info>} message for {@code locale}.
  3448.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3449.      */
  3450.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3451.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3452.     private static String getDefaultListenerInfo( final java.util.Locale locale, final java.lang.String classLoaderInfo )
  3453.     {
  3454.         java.io.BufferedReader reader = null;
  3455.         boolean suppressExceptionOnClose = true;

  3456.         try
  3457.         {
  3458.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Listener Info" ), classLoaderInfo, (Object) null );
  3459.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3460.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3461.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3462.             String line;
  3463.             while ( ( line = reader.readLine() ) != null )
  3464.             {
  3465.                 builder.append( lineSeparator ).append( line );
  3466.             }

  3467.             suppressExceptionOnClose = false;
  3468.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3469.         }
  3470.         catch( final java.lang.ClassCastException e )
  3471.         {
  3472.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3473.         }
  3474.         catch( final java.lang.IllegalArgumentException e )
  3475.         {
  3476.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3477.         }
  3478.         catch( final java.util.MissingResourceException e )
  3479.         {
  3480.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3481.         }
  3482.         catch( final java.io.IOException e )
  3483.         {
  3484.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3485.         }
  3486.         finally
  3487.         {
  3488.             try
  3489.             {
  3490.                 if( reader != null )
  3491.                 {
  3492.                     reader.close();
  3493.                 }
  3494.             }
  3495.             catch( final java.io.IOException e )
  3496.             {
  3497.                 if( !suppressExceptionOnClose )
  3498.                 {
  3499.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3500.                 }
  3501.             }
  3502.         }
  3503.     }
  3504.     /**
  3505.      * Gets the text of the {@code <Default Locator Info Message>} message.
  3506.      * <p><dl>
  3507.      *   <dt><b>Languages:</b></dt>
  3508.      *     <dd>English (default)</dd>
  3509.      *     <dd>Deutsch</dd>
  3510.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3511.      * </dl></p>
  3512.      * @param locale The locale of the message to return.
  3513.      * @param schemeInfo Format argument.
  3514.      * @param classLoaderInfo Format argument.
  3515.      * @return The text of the {@code <Default Locator Info Message>} message for {@code locale}.
  3516.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3517.      */
  3518.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3519.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3520.     private static String getDefaultLocatorInfoMessage( final java.util.Locale locale, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
  3521.     {
  3522.         java.io.BufferedReader reader = null;
  3523.         boolean suppressExceptionOnClose = true;

  3524.         try
  3525.         {
  3526.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Locator Info Message" ), schemeInfo, classLoaderInfo, (Object) null );
  3527.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3528.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3529.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3530.             String line;
  3531.             while ( ( line = reader.readLine() ) != null )
  3532.             {
  3533.                 builder.append( lineSeparator ).append( line );
  3534.             }

  3535.             suppressExceptionOnClose = false;
  3536.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3537.         }
  3538.         catch( final java.lang.ClassCastException e )
  3539.         {
  3540.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3541.         }
  3542.         catch( final java.lang.IllegalArgumentException e )
  3543.         {
  3544.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3545.         }
  3546.         catch( final java.util.MissingResourceException e )
  3547.         {
  3548.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3549.         }
  3550.         catch( final java.io.IOException e )
  3551.         {
  3552.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3553.         }
  3554.         finally
  3555.         {
  3556.             try
  3557.             {
  3558.                 if( reader != null )
  3559.                 {
  3560.                     reader.close();
  3561.                 }
  3562.             }
  3563.             catch( final java.io.IOException e )
  3564.             {
  3565.                 if( !suppressExceptionOnClose )
  3566.                 {
  3567.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3568.                 }
  3569.             }
  3570.         }
  3571.     }
  3572.     /**
  3573.      * Gets the text of the {@code <Default Log Level Info Message>} message.
  3574.      * <p><dl>
  3575.      *   <dt><b>Languages:</b></dt>
  3576.      *     <dd>English (default)</dd>
  3577.      *     <dd>Deutsch</dd>
  3578.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3579.      * </dl></p>
  3580.      * @param locale The locale of the message to return.
  3581.      * @param logLevel Format argument.
  3582.      * @return The text of the {@code <Default Log Level Info Message>} message for {@code locale}.
  3583.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3584.      */
  3585.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3586.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3587.     private static String getDefaultLogLevelInfoMessage( final java.util.Locale locale, final java.lang.String logLevel )
  3588.     {
  3589.         java.io.BufferedReader reader = null;
  3590.         boolean suppressExceptionOnClose = true;

  3591.         try
  3592.         {
  3593.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Log Level Info Message" ), logLevel, (Object) null );
  3594.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3595.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3596.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3597.             String line;
  3598.             while ( ( line = reader.readLine() ) != null )
  3599.             {
  3600.                 builder.append( lineSeparator ).append( line );
  3601.             }

  3602.             suppressExceptionOnClose = false;
  3603.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3604.         }
  3605.         catch( final java.lang.ClassCastException e )
  3606.         {
  3607.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3608.         }
  3609.         catch( final java.lang.IllegalArgumentException e )
  3610.         {
  3611.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3612.         }
  3613.         catch( final java.util.MissingResourceException e )
  3614.         {
  3615.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3616.         }
  3617.         catch( final java.io.IOException e )
  3618.         {
  3619.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3620.         }
  3621.         finally
  3622.         {
  3623.             try
  3624.             {
  3625.                 if( reader != null )
  3626.                 {
  3627.                     reader.close();
  3628.                 }
  3629.             }
  3630.             catch( final java.io.IOException e )
  3631.             {
  3632.                 if( !suppressExceptionOnClose )
  3633.                 {
  3634.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3635.                 }
  3636.             }
  3637.         }
  3638.     }
  3639.     /**
  3640.      * Gets the text of the {@code <Default Model Identifier Info>} message.
  3641.      * <p><dl>
  3642.      *   <dt><b>Languages:</b></dt>
  3643.      *     <dd>English (default)</dd>
  3644.      *     <dd>Deutsch</dd>
  3645.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3646.      * </dl></p>
  3647.      * @param locale The locale of the message to return.
  3648.      * @param defaultValue Format argument.
  3649.      * @return The text of the {@code <Default Model Identifier Info>} message for {@code locale}.
  3650.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3651.      */
  3652.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3653.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3654.     private static String getDefaultModelIdentifierInfo( final java.util.Locale locale, final java.lang.String defaultValue )
  3655.     {
  3656.         java.io.BufferedReader reader = null;
  3657.         boolean suppressExceptionOnClose = true;

  3658.         try
  3659.         {
  3660.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Identifier Info" ), defaultValue, (Object) null );
  3661.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3662.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3663.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3664.             String line;
  3665.             while ( ( line = reader.readLine() ) != null )
  3666.             {
  3667.                 builder.append( lineSeparator ).append( line );
  3668.             }

  3669.             suppressExceptionOnClose = false;
  3670.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3671.         }
  3672.         catch( final java.lang.ClassCastException e )
  3673.         {
  3674.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3675.         }
  3676.         catch( final java.lang.IllegalArgumentException e )
  3677.         {
  3678.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3679.         }
  3680.         catch( final java.util.MissingResourceException e )
  3681.         {
  3682.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3683.         }
  3684.         catch( final java.io.IOException e )
  3685.         {
  3686.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3687.         }
  3688.         finally
  3689.         {
  3690.             try
  3691.             {
  3692.                 if( reader != null )
  3693.                 {
  3694.                     reader.close();
  3695.                 }
  3696.             }
  3697.             catch( final java.io.IOException e )
  3698.             {
  3699.                 if( !suppressExceptionOnClose )
  3700.                 {
  3701.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3702.                 }
  3703.             }
  3704.         }
  3705.     }
  3706.     /**
  3707.      * Gets the text of the {@code <Default Model Object Classpah Resolution Enabled Info>} message.
  3708.      * <p><dl>
  3709.      *   <dt><b>Languages:</b></dt>
  3710.      *     <dd>English (default)</dd>
  3711.      *     <dd>Deutsch</dd>
  3712.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3713.      * </dl></p>
  3714.      * @param locale The locale of the message to return.
  3715.      * @param defaultValue Format argument.
  3716.      * @return The text of the {@code <Default Model Object Classpah Resolution Enabled Info>} message for {@code locale}.
  3717.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3718.      */
  3719.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3720.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3721.     private static String getDefaultModelObjectClasspahResolutionEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
  3722.     {
  3723.         java.io.BufferedReader reader = null;
  3724.         boolean suppressExceptionOnClose = true;

  3725.         try
  3726.         {
  3727.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Object Classpah Resolution Enabled Info" ), defaultValue, (Object) null );
  3728.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3729.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3730.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3731.             String line;
  3732.             while ( ( line = reader.readLine() ) != null )
  3733.             {
  3734.                 builder.append( lineSeparator ).append( line );
  3735.             }

  3736.             suppressExceptionOnClose = false;
  3737.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3738.         }
  3739.         catch( final java.lang.ClassCastException e )
  3740.         {
  3741.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3742.         }
  3743.         catch( final java.lang.IllegalArgumentException e )
  3744.         {
  3745.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3746.         }
  3747.         catch( final java.util.MissingResourceException e )
  3748.         {
  3749.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3750.         }
  3751.         catch( final java.io.IOException e )
  3752.         {
  3753.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3754.         }
  3755.         finally
  3756.         {
  3757.             try
  3758.             {
  3759.                 if( reader != null )
  3760.                 {
  3761.                     reader.close();
  3762.                 }
  3763.             }
  3764.             catch( final java.io.IOException e )
  3765.             {
  3766.                 if( !suppressExceptionOnClose )
  3767.                 {
  3768.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3769.                 }
  3770.             }
  3771.         }
  3772.     }
  3773.     /**
  3774.      * Gets the text of the {@code <Default Model Processing Enabled Info>} message.
  3775.      * <p><dl>
  3776.      *   <dt><b>Languages:</b></dt>
  3777.      *     <dd>English (default)</dd>
  3778.      *     <dd>Deutsch</dd>
  3779.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3780.      * </dl></p>
  3781.      * @param locale The locale of the message to return.
  3782.      * @param defaultValue Format argument.
  3783.      * @return The text of the {@code <Default Model Processing Enabled Info>} message for {@code locale}.
  3784.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3785.      */
  3786.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3787.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3788.     private static String getDefaultModelProcessingEnabledInfo( final java.util.Locale locale, final java.lang.String defaultValue )
  3789.     {
  3790.         java.io.BufferedReader reader = null;
  3791.         boolean suppressExceptionOnClose = true;

  3792.         try
  3793.         {
  3794.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Model Processing Enabled Info" ), defaultValue, (Object) null );
  3795.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3796.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3797.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3798.             String line;
  3799.             while ( ( line = reader.readLine() ) != null )
  3800.             {
  3801.                 builder.append( lineSeparator ).append( line );
  3802.             }

  3803.             suppressExceptionOnClose = false;
  3804.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3805.         }
  3806.         catch( final java.lang.ClassCastException e )
  3807.         {
  3808.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3809.         }
  3810.         catch( final java.lang.IllegalArgumentException e )
  3811.         {
  3812.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3813.         }
  3814.         catch( final java.util.MissingResourceException e )
  3815.         {
  3816.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3817.         }
  3818.         catch( final java.io.IOException e )
  3819.         {
  3820.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3821.         }
  3822.         finally
  3823.         {
  3824.             try
  3825.             {
  3826.                 if( reader != null )
  3827.                 {
  3828.                     reader.close();
  3829.                 }
  3830.             }
  3831.             catch( final java.io.IOException e )
  3832.             {
  3833.                 if( !suppressExceptionOnClose )
  3834.                 {
  3835.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3836.                 }
  3837.             }
  3838.         }
  3839.     }
  3840.     /**
  3841.      * Gets the text of the {@code <Default Module Name>} message.
  3842.      * <p><dl>
  3843.      *   <dt><b>Languages:</b></dt>
  3844.      *     <dd>English (default)</dd>
  3845.      *     <dd>Deutsch</dd>
  3846.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3847.      * </dl></p>
  3848.      * @param locale The locale of the message to return.
  3849.      * @return The text of the {@code <Default Module Name>} message for {@code locale}.
  3850.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3851.      */
  3852.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3853.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3854.     private static String getDefaultModuleName( final java.util.Locale locale )
  3855.     {
  3856.         java.io.BufferedReader reader = null;
  3857.         boolean suppressExceptionOnClose = true;

  3858.         try
  3859.         {
  3860.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Module Name" ), (Object) null );
  3861.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3862.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3863.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3864.             String line;
  3865.             while ( ( line = reader.readLine() ) != null )
  3866.             {
  3867.                 builder.append( lineSeparator ).append( line );
  3868.             }

  3869.             suppressExceptionOnClose = false;
  3870.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3871.         }
  3872.         catch( final java.lang.ClassCastException e )
  3873.         {
  3874.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3875.         }
  3876.         catch( final java.lang.IllegalArgumentException e )
  3877.         {
  3878.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3879.         }
  3880.         catch( final java.util.MissingResourceException e )
  3881.         {
  3882.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3883.         }
  3884.         catch( final java.io.IOException e )
  3885.         {
  3886.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3887.         }
  3888.         finally
  3889.         {
  3890.             try
  3891.             {
  3892.                 if( reader != null )
  3893.                 {
  3894.                     reader.close();
  3895.                 }
  3896.             }
  3897.             catch( final java.io.IOException e )
  3898.             {
  3899.                 if( !suppressExceptionOnClose )
  3900.                 {
  3901.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3902.                 }
  3903.             }
  3904.         }
  3905.     }
  3906.     /**
  3907.      * Gets the text of the {@code <Default Modules Vendor>} message.
  3908.      * <p><dl>
  3909.      *   <dt><b>Languages:</b></dt>
  3910.      *     <dd>English (default)</dd>
  3911.      *     <dd>Deutsch</dd>
  3912.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3913.      * </dl></p>
  3914.      * @param locale The locale of the message to return.
  3915.      * @return The text of the {@code <Default Modules Vendor>} message for {@code locale}.
  3916.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3917.      */
  3918.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3919.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3920.     private static String getDefaultModulesVendor( final java.util.Locale locale )
  3921.     {
  3922.         java.io.BufferedReader reader = null;
  3923.         boolean suppressExceptionOnClose = true;

  3924.         try
  3925.         {
  3926.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Vendor" ), (Object) null );
  3927.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3928.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3929.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3930.             String line;
  3931.             while ( ( line = reader.readLine() ) != null )
  3932.             {
  3933.                 builder.append( lineSeparator ).append( line );
  3934.             }

  3935.             suppressExceptionOnClose = false;
  3936.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  3937.         }
  3938.         catch( final java.lang.ClassCastException e )
  3939.         {
  3940.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3941.         }
  3942.         catch( final java.lang.IllegalArgumentException e )
  3943.         {
  3944.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3945.         }
  3946.         catch( final java.util.MissingResourceException e )
  3947.         {
  3948.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3949.         }
  3950.         catch( final java.io.IOException e )
  3951.         {
  3952.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3953.         }
  3954.         finally
  3955.         {
  3956.             try
  3957.             {
  3958.                 if( reader != null )
  3959.                 {
  3960.                     reader.close();
  3961.                 }
  3962.             }
  3963.             catch( final java.io.IOException e )
  3964.             {
  3965.                 if( !suppressExceptionOnClose )
  3966.                 {
  3967.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  3968.                 }
  3969.             }
  3970.         }
  3971.     }
  3972.     /**
  3973.      * Gets the text of the {@code <Default Modules Version>} message.
  3974.      * <p><dl>
  3975.      *   <dt><b>Languages:</b></dt>
  3976.      *     <dd>English (default)</dd>
  3977.      *     <dd>Deutsch</dd>
  3978.      *   <dt><b>Final:</b></dt><dd>No</dd>
  3979.      * </dl></p>
  3980.      * @param locale The locale of the message to return.
  3981.      * @return The text of the {@code <Default Modules Version>} message for {@code locale}.
  3982.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  3983.      */
  3984.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  3985.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  3986.     private static String getDefaultModulesVersion( final java.util.Locale locale )
  3987.     {
  3988.         java.io.BufferedReader reader = null;
  3989.         boolean suppressExceptionOnClose = true;

  3990.         try
  3991.         {
  3992.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Version" ), (Object) null );
  3993.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  3994.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  3995.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  3996.             String line;
  3997.             while ( ( line = reader.readLine() ) != null )
  3998.             {
  3999.                 builder.append( lineSeparator ).append( line );
  4000.             }

  4001.             suppressExceptionOnClose = false;
  4002.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4003.         }
  4004.         catch( final java.lang.ClassCastException e )
  4005.         {
  4006.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4007.         }
  4008.         catch( final java.lang.IllegalArgumentException e )
  4009.         {
  4010.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4011.         }
  4012.         catch( final java.util.MissingResourceException e )
  4013.         {
  4014.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4015.         }
  4016.         catch( final java.io.IOException e )
  4017.         {
  4018.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4019.         }
  4020.         finally
  4021.         {
  4022.             try
  4023.             {
  4024.                 if( reader != null )
  4025.                 {
  4026.                     reader.close();
  4027.                 }
  4028.             }
  4029.             catch( final java.io.IOException e )
  4030.             {
  4031.                 if( !suppressExceptionOnClose )
  4032.                 {
  4033.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4034.                 }
  4035.             }
  4036.         }
  4037.     }
  4038.     /**
  4039.      * Gets the text of the {@code <Default Modules Warning>} message.
  4040.      * <p><dl>
  4041.      *   <dt><b>Languages:</b></dt>
  4042.      *     <dd>English (default)</dd>
  4043.      *     <dd>Deutsch</dd>
  4044.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4045.      * </dl></p>
  4046.      * @param locale The locale of the message to return.
  4047.      * @param modelInfo Format argument.
  4048.      * @param classLoaderInfo Format argument.
  4049.      * @return The text of the {@code <Default Modules Warning>} message for {@code locale}.
  4050.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4051.      */
  4052.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4053.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4054.     private static String getDefaultModulesWarning( final java.util.Locale locale, final java.lang.String modelInfo, final java.lang.String classLoaderInfo )
  4055.     {
  4056.         java.io.BufferedReader reader = null;
  4057.         boolean suppressExceptionOnClose = true;

  4058.         try
  4059.         {
  4060.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Modules Warning" ), modelInfo, classLoaderInfo, (Object) null );
  4061.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4062.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4063.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4064.             String line;
  4065.             while ( ( line = reader.readLine() ) != null )
  4066.             {
  4067.                 builder.append( lineSeparator ).append( line );
  4068.             }

  4069.             suppressExceptionOnClose = false;
  4070.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4071.         }
  4072.         catch( final java.lang.ClassCastException e )
  4073.         {
  4074.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4075.         }
  4076.         catch( final java.lang.IllegalArgumentException e )
  4077.         {
  4078.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4079.         }
  4080.         catch( final java.util.MissingResourceException e )
  4081.         {
  4082.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4083.         }
  4084.         catch( final java.io.IOException e )
  4085.         {
  4086.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4087.         }
  4088.         finally
  4089.         {
  4090.             try
  4091.             {
  4092.                 if( reader != null )
  4093.                 {
  4094.                     reader.close();
  4095.                 }
  4096.             }
  4097.             catch( final java.io.IOException e )
  4098.             {
  4099.                 if( !suppressExceptionOnClose )
  4100.                 {
  4101.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4102.                 }
  4103.             }
  4104.         }
  4105.     }
  4106.     /**
  4107.      * Gets the text of the {@code <Default Scope Info Message>} message.
  4108.      * <p><dl>
  4109.      *   <dt><b>Languages:</b></dt>
  4110.      *     <dd>English (default)</dd>
  4111.      *     <dd>Deutsch</dd>
  4112.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4113.      * </dl></p>
  4114.      * @param locale The locale of the message to return.
  4115.      * @param scopeIdentifier Format argument.
  4116.      * @param classLoaderInfo Format argument.
  4117.      * @return The text of the {@code <Default Scope Info Message>} message for {@code locale}.
  4118.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4119.      */
  4120.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4121.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4122.     private static String getDefaultScopeInfoMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
  4123.     {
  4124.         java.io.BufferedReader reader = null;
  4125.         boolean suppressExceptionOnClose = true;

  4126.         try
  4127.         {
  4128.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Default Scope Info Message" ), scopeIdentifier, classLoaderInfo, (Object) null );
  4129.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4130.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4131.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4132.             String line;
  4133.             while ( ( line = reader.readLine() ) != null )
  4134.             {
  4135.                 builder.append( lineSeparator ).append( line );
  4136.             }

  4137.             suppressExceptionOnClose = false;
  4138.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4139.         }
  4140.         catch( final java.lang.ClassCastException e )
  4141.         {
  4142.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4143.         }
  4144.         catch( final java.lang.IllegalArgumentException e )
  4145.         {
  4146.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4147.         }
  4148.         catch( final java.util.MissingResourceException e )
  4149.         {
  4150.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4151.         }
  4152.         catch( final java.io.IOException e )
  4153.         {
  4154.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4155.         }
  4156.         finally
  4157.         {
  4158.             try
  4159.             {
  4160.                 if( reader != null )
  4161.                 {
  4162.                     reader.close();
  4163.                 }
  4164.             }
  4165.             catch( final java.io.IOException e )
  4166.             {
  4167.                 if( !suppressExceptionOnClose )
  4168.                 {
  4169.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4170.                 }
  4171.             }
  4172.         }
  4173.     }
  4174.     /**
  4175.      * Gets the text of the {@code <Dependency Cycle Message>} message.
  4176.      * <p><dl>
  4177.      *   <dt><b>Languages:</b></dt>
  4178.      *     <dd>English (default)</dd>
  4179.      *     <dd>Deutsch</dd>
  4180.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4181.      * </dl></p>
  4182.      * @param locale The locale of the message to return.
  4183.      * @param implementationIdentifier Format argument.
  4184.      * @return The text of the {@code <Dependency Cycle Message>} message for {@code locale}.
  4185.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4186.      */
  4187.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4188.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4189.     private static String getDependencyCycleMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
  4190.     {
  4191.         java.io.BufferedReader reader = null;
  4192.         boolean suppressExceptionOnClose = true;

  4193.         try
  4194.         {
  4195.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Dependency Cycle Message" ), implementationIdentifier, (Object) null );
  4196.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4197.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4198.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4199.             String line;
  4200.             while ( ( line = reader.readLine() ) != null )
  4201.             {
  4202.                 builder.append( lineSeparator ).append( line );
  4203.             }

  4204.             suppressExceptionOnClose = false;
  4205.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4206.         }
  4207.         catch( final java.lang.ClassCastException e )
  4208.         {
  4209.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4210.         }
  4211.         catch( final java.lang.IllegalArgumentException e )
  4212.         {
  4213.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4214.         }
  4215.         catch( final java.util.MissingResourceException e )
  4216.         {
  4217.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4218.         }
  4219.         catch( final java.io.IOException e )
  4220.         {
  4221.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4222.         }
  4223.         finally
  4224.         {
  4225.             try
  4226.             {
  4227.                 if( reader != null )
  4228.                 {
  4229.                     reader.close();
  4230.                 }
  4231.             }
  4232.             catch( final java.io.IOException e )
  4233.             {
  4234.                 if( !suppressExceptionOnClose )
  4235.                 {
  4236.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4237.                 }
  4238.             }
  4239.         }
  4240.     }
  4241.     /**
  4242.      * Gets the text of the {@code <Ignored Invocation Message>} message.
  4243.      * <p><dl>
  4244.      *   <dt><b>Languages:</b></dt>
  4245.      *     <dd>English (default)</dd>
  4246.      *     <dd>Deutsch</dd>
  4247.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4248.      * </dl></p>
  4249.      * @param locale The locale of the message to return.
  4250.      * @param implementationIdentifier Format argument.
  4251.      * @return The text of the {@code <Ignored Invocation Message>} message for {@code locale}.
  4252.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4253.      */
  4254.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4255.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4256.     private static String getIgnoredInvocationMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
  4257.     {
  4258.         java.io.BufferedReader reader = null;
  4259.         boolean suppressExceptionOnClose = true;

  4260.         try
  4261.         {
  4262.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Ignored Invocation Message" ), implementationIdentifier, (Object) null );
  4263.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4264.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4265.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4266.             String line;
  4267.             while ( ( line = reader.readLine() ) != null )
  4268.             {
  4269.                 builder.append( lineSeparator ).append( line );
  4270.             }

  4271.             suppressExceptionOnClose = false;
  4272.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4273.         }
  4274.         catch( final java.lang.ClassCastException e )
  4275.         {
  4276.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4277.         }
  4278.         catch( final java.lang.IllegalArgumentException e )
  4279.         {
  4280.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4281.         }
  4282.         catch( final java.util.MissingResourceException e )
  4283.         {
  4284.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4285.         }
  4286.         catch( final java.io.IOException e )
  4287.         {
  4288.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4289.         }
  4290.         finally
  4291.         {
  4292.             try
  4293.             {
  4294.                 if( reader != null )
  4295.                 {
  4296.                     reader.close();
  4297.                 }
  4298.             }
  4299.             catch( final java.io.IOException e )
  4300.             {
  4301.                 if( !suppressExceptionOnClose )
  4302.                 {
  4303.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4304.                 }
  4305.             }
  4306.         }
  4307.     }
  4308.     /**
  4309.      * Gets the text of the {@code <Ignored Invoker Message>} message.
  4310.      * <p><dl>
  4311.      *   <dt><b>Languages:</b></dt>
  4312.      *     <dd>English (default)</dd>
  4313.      *     <dd>Deutsch</dd>
  4314.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4315.      * </dl></p>
  4316.      * @param locale The locale of the message to return.
  4317.      * @param implementationIdentifier Format argument.
  4318.      * @return The text of the {@code <Ignored Invoker Message>} message for {@code locale}.
  4319.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4320.      */
  4321.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4322.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4323.     private static String getIgnoredInvokerMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier )
  4324.     {
  4325.         java.io.BufferedReader reader = null;
  4326.         boolean suppressExceptionOnClose = true;

  4327.         try
  4328.         {
  4329.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Ignored Invoker Message" ), implementationIdentifier, (Object) null );
  4330.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4331.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4332.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4333.             String line;
  4334.             while ( ( line = reader.readLine() ) != null )
  4335.             {
  4336.                 builder.append( lineSeparator ).append( line );
  4337.             }

  4338.             suppressExceptionOnClose = false;
  4339.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4340.         }
  4341.         catch( final java.lang.ClassCastException e )
  4342.         {
  4343.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4344.         }
  4345.         catch( final java.lang.IllegalArgumentException e )
  4346.         {
  4347.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4348.         }
  4349.         catch( final java.util.MissingResourceException e )
  4350.         {
  4351.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4352.         }
  4353.         catch( final java.io.IOException e )
  4354.         {
  4355.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4356.         }
  4357.         finally
  4358.         {
  4359.             try
  4360.             {
  4361.                 if( reader != null )
  4362.                 {
  4363.                     reader.close();
  4364.                 }
  4365.             }
  4366.             catch( final java.io.IOException e )
  4367.             {
  4368.                 if( !suppressExceptionOnClose )
  4369.                 {
  4370.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4371.                 }
  4372.             }
  4373.         }
  4374.     }
  4375.     /**
  4376.      * Gets the text of the {@code <Illegal Array Specification Message>} message.
  4377.      * <p><dl>
  4378.      *   <dt><b>Languages:</b></dt>
  4379.      *     <dd>English (default)</dd>
  4380.      *     <dd>Deutsch</dd>
  4381.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4382.      * </dl></p>
  4383.      * @param locale The locale of the message to return.
  4384.      * @param specificationIdentifier Format argument.
  4385.      * @param specificationMultiplicity Format argument.
  4386.      * @return The text of the {@code <Illegal Array Specification Message>} message for {@code locale}.
  4387.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4388.      */
  4389.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4390.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4391.     private static String getIllegalArraySpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
  4392.     {
  4393.         java.io.BufferedReader reader = null;
  4394.         boolean suppressExceptionOnClose = true;

  4395.         try
  4396.         {
  4397.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Illegal Array Specification Message" ), specificationIdentifier, specificationMultiplicity, (Object) null );
  4398.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4399.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4400.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4401.             String line;
  4402.             while ( ( line = reader.readLine() ) != null )
  4403.             {
  4404.                 builder.append( lineSeparator ).append( line );
  4405.             }

  4406.             suppressExceptionOnClose = false;
  4407.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4408.         }
  4409.         catch( final java.lang.ClassCastException e )
  4410.         {
  4411.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4412.         }
  4413.         catch( final java.lang.IllegalArgumentException e )
  4414.         {
  4415.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4416.         }
  4417.         catch( final java.util.MissingResourceException e )
  4418.         {
  4419.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4420.         }
  4421.         catch( final java.io.IOException e )
  4422.         {
  4423.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4424.         }
  4425.         finally
  4426.         {
  4427.             try
  4428.             {
  4429.                 if( reader != null )
  4430.                 {
  4431.                     reader.close();
  4432.                 }
  4433.             }
  4434.             catch( final java.io.IOException e )
  4435.             {
  4436.                 if( !suppressExceptionOnClose )
  4437.                 {
  4438.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4439.                 }
  4440.             }
  4441.         }
  4442.     }
  4443.     /**
  4444.      * Gets the text of the {@code <Illegal Object Specification Message>} message.
  4445.      * <p><dl>
  4446.      *   <dt><b>Languages:</b></dt>
  4447.      *     <dd>English (default)</dd>
  4448.      *     <dd>Deutsch</dd>
  4449.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4450.      * </dl></p>
  4451.      * @param locale The locale of the message to return.
  4452.      * @param specificationIdentifier Format argument.
  4453.      * @param specificationMultiplicity Format argument.
  4454.      * @return The text of the {@code <Illegal Object Specification Message>} message for {@code locale}.
  4455.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4456.      */
  4457.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4458.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4459.     private static String getIllegalObjectSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String specificationMultiplicity )
  4460.     {
  4461.         java.io.BufferedReader reader = null;
  4462.         boolean suppressExceptionOnClose = true;

  4463.         try
  4464.         {
  4465.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Illegal Object Specification Message" ), specificationIdentifier, specificationMultiplicity, (Object) null );
  4466.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4467.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4468.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4469.             String line;
  4470.             while ( ( line = reader.readLine() ) != null )
  4471.             {
  4472.                 builder.append( lineSeparator ).append( line );
  4473.             }

  4474.             suppressExceptionOnClose = false;
  4475.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4476.         }
  4477.         catch( final java.lang.ClassCastException e )
  4478.         {
  4479.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4480.         }
  4481.         catch( final java.lang.IllegalArgumentException e )
  4482.         {
  4483.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4484.         }
  4485.         catch( final java.util.MissingResourceException e )
  4486.         {
  4487.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4488.         }
  4489.         catch( final java.io.IOException e )
  4490.         {
  4491.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4492.         }
  4493.         finally
  4494.         {
  4495.             try
  4496.             {
  4497.                 if( reader != null )
  4498.                 {
  4499.                     reader.close();
  4500.                 }
  4501.             }
  4502.             catch( final java.io.IOException e )
  4503.             {
  4504.                 if( !suppressExceptionOnClose )
  4505.                 {
  4506.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4507.                 }
  4508.             }
  4509.         }
  4510.     }
  4511.     /**
  4512.      * Gets the text of the {@code <Implementation Info Message>} message.
  4513.      * <p><dl>
  4514.      *   <dt><b>Languages:</b></dt>
  4515.      *     <dd>English (default)</dd>
  4516.      *     <dd>Deutsch</dd>
  4517.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4518.      * </dl></p>
  4519.      * @param locale The locale of the message to return.
  4520.      * @param initializationMillis Format argument.
  4521.      * @return The text of the {@code <Implementation Info Message>} message for {@code locale}.
  4522.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4523.      */
  4524.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4525.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4526.     private static String getImplementationInfoMessage( final java.util.Locale locale, final java.lang.Number initializationMillis )
  4527.     {
  4528.         java.io.BufferedReader reader = null;
  4529.         boolean suppressExceptionOnClose = true;

  4530.         try
  4531.         {
  4532.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Implementation Info Message" ), initializationMillis, (Object) null );
  4533.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4534.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4535.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4536.             String line;
  4537.             while ( ( line = reader.readLine() ) != null )
  4538.             {
  4539.                 builder.append( lineSeparator ).append( line );
  4540.             }

  4541.             suppressExceptionOnClose = false;
  4542.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4543.         }
  4544.         catch( final java.lang.ClassCastException e )
  4545.         {
  4546.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4547.         }
  4548.         catch( final java.lang.IllegalArgumentException e )
  4549.         {
  4550.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4551.         }
  4552.         catch( final java.util.MissingResourceException e )
  4553.         {
  4554.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4555.         }
  4556.         catch( final java.io.IOException e )
  4557.         {
  4558.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4559.         }
  4560.         finally
  4561.         {
  4562.             try
  4563.             {
  4564.                 if( reader != null )
  4565.                 {
  4566.                     reader.close();
  4567.                 }
  4568.             }
  4569.             catch( final java.io.IOException e )
  4570.             {
  4571.                 if( !suppressExceptionOnClose )
  4572.                 {
  4573.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4574.                 }
  4575.             }
  4576.         }
  4577.     }
  4578.     /**
  4579.      * Gets the text of the {@code <Invoker Info Message>} message.
  4580.      * <p><dl>
  4581.      *   <dt><b>Languages:</b></dt>
  4582.      *     <dd>English (default)</dd>
  4583.      *     <dd>Deutsch</dd>
  4584.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4585.      * </dl></p>
  4586.      * @param locale The locale of the message to return.
  4587.      * @param implementationIdentifier Format argument.
  4588.      * @param classLoaderInfo Format argument.
  4589.      * @return The text of the {@code <Invoker Info Message>} message for {@code locale}.
  4590.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4591.      */
  4592.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4593.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4594.     private static String getInvokerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
  4595.     {
  4596.         java.io.BufferedReader reader = null;
  4597.         boolean suppressExceptionOnClose = true;

  4598.         try
  4599.         {
  4600.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Invoker Info Message" ), implementationIdentifier, classLoaderInfo, (Object) null );
  4601.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4602.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4603.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4604.             String line;
  4605.             while ( ( line = reader.readLine() ) != null )
  4606.             {
  4607.                 builder.append( lineSeparator ).append( line );
  4608.             }

  4609.             suppressExceptionOnClose = false;
  4610.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4611.         }
  4612.         catch( final java.lang.ClassCastException e )
  4613.         {
  4614.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4615.         }
  4616.         catch( final java.lang.IllegalArgumentException e )
  4617.         {
  4618.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4619.         }
  4620.         catch( final java.util.MissingResourceException e )
  4621.         {
  4622.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4623.         }
  4624.         catch( final java.io.IOException e )
  4625.         {
  4626.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4627.         }
  4628.         finally
  4629.         {
  4630.             try
  4631.             {
  4632.                 if( reader != null )
  4633.                 {
  4634.                     reader.close();
  4635.                 }
  4636.             }
  4637.             catch( final java.io.IOException e )
  4638.             {
  4639.                 if( !suppressExceptionOnClose )
  4640.                 {
  4641.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4642.                 }
  4643.             }
  4644.         }
  4645.     }
  4646.     /**
  4647.      * Gets the text of the {@code <Listener Info Message>} message.
  4648.      * <p><dl>
  4649.      *   <dt><b>Languages:</b></dt>
  4650.      *     <dd>English (default)</dd>
  4651.      *     <dd>Deutsch</dd>
  4652.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4653.      * </dl></p>
  4654.      * @param locale The locale of the message to return.
  4655.      * @param implementationIdentifier Format argument.
  4656.      * @param classLoaderInfo Format argument.
  4657.      * @return The text of the {@code <Listener Info Message>} message for {@code locale}.
  4658.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4659.      */
  4660.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4661.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4662.     private static String getListenerInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String classLoaderInfo )
  4663.     {
  4664.         java.io.BufferedReader reader = null;
  4665.         boolean suppressExceptionOnClose = true;

  4666.         try
  4667.         {
  4668.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Listener Info Message" ), implementationIdentifier, classLoaderInfo, (Object) null );
  4669.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4670.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4671.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4672.             String line;
  4673.             while ( ( line = reader.readLine() ) != null )
  4674.             {
  4675.                 builder.append( lineSeparator ).append( line );
  4676.             }

  4677.             suppressExceptionOnClose = false;
  4678.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4679.         }
  4680.         catch( final java.lang.ClassCastException e )
  4681.         {
  4682.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4683.         }
  4684.         catch( final java.lang.IllegalArgumentException e )
  4685.         {
  4686.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4687.         }
  4688.         catch( final java.util.MissingResourceException e )
  4689.         {
  4690.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4691.         }
  4692.         catch( final java.io.IOException e )
  4693.         {
  4694.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4695.         }
  4696.         finally
  4697.         {
  4698.             try
  4699.             {
  4700.                 if( reader != null )
  4701.                 {
  4702.                     reader.close();
  4703.                 }
  4704.             }
  4705.             catch( final java.io.IOException e )
  4706.             {
  4707.                 if( !suppressExceptionOnClose )
  4708.                 {
  4709.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4710.                 }
  4711.             }
  4712.         }
  4713.     }
  4714.     /**
  4715.      * Gets the text of the {@code <Locator Info Message>} message.
  4716.      * <p><dl>
  4717.      *   <dt><b>Languages:</b></dt>
  4718.      *     <dd>English (default)</dd>
  4719.      *     <dd>Deutsch</dd>
  4720.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4721.      * </dl></p>
  4722.      * @param locale The locale of the message to return.
  4723.      * @param implementationIdentifier Format argument.
  4724.      * @param schemeInfo Format argument.
  4725.      * @param classLoaderInfo Format argument.
  4726.      * @return The text of the {@code <Locator Info Message>} message for {@code locale}.
  4727.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4728.      */
  4729.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4730.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4731.     private static String getLocatorInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String schemeInfo, final java.lang.String classLoaderInfo )
  4732.     {
  4733.         java.io.BufferedReader reader = null;
  4734.         boolean suppressExceptionOnClose = true;

  4735.         try
  4736.         {
  4737.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Locator Info Message" ), implementationIdentifier, schemeInfo, classLoaderInfo, (Object) null );
  4738.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4739.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4740.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4741.             String line;
  4742.             while ( ( line = reader.readLine() ) != null )
  4743.             {
  4744.                 builder.append( lineSeparator ).append( line );
  4745.             }

  4746.             suppressExceptionOnClose = false;
  4747.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4748.         }
  4749.         catch( final java.lang.ClassCastException e )
  4750.         {
  4751.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4752.         }
  4753.         catch( final java.lang.IllegalArgumentException e )
  4754.         {
  4755.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4756.         }
  4757.         catch( final java.util.MissingResourceException e )
  4758.         {
  4759.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4760.         }
  4761.         catch( final java.io.IOException e )
  4762.         {
  4763.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4764.         }
  4765.         finally
  4766.         {
  4767.             try
  4768.             {
  4769.                 if( reader != null )
  4770.                 {
  4771.                     reader.close();
  4772.                 }
  4773.             }
  4774.             catch( final java.io.IOException e )
  4775.             {
  4776.                 if( !suppressExceptionOnClose )
  4777.                 {
  4778.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4779.                 }
  4780.             }
  4781.         }
  4782.     }
  4783.     /**
  4784.      * Gets the text of the {@code <Missing Dependency Message>} message.
  4785.      * <p><dl>
  4786.      *   <dt><b>Languages:</b></dt>
  4787.      *     <dd>English (default)</dd>
  4788.      *     <dd>Deutsch</dd>
  4789.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4790.      * </dl></p>
  4791.      * @param locale The locale of the message to return.
  4792.      * @param implementationIdentifier Format argument.
  4793.      * @param dependencyName Format argument.
  4794.      * @return The text of the {@code <Missing Dependency Message>} message for {@code locale}.
  4795.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4796.      */
  4797.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4798.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4799.     private static String getMissingDependencyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String dependencyName )
  4800.     {
  4801.         java.io.BufferedReader reader = null;
  4802.         boolean suppressExceptionOnClose = true;

  4803.         try
  4804.         {
  4805.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Dependency Message" ), implementationIdentifier, dependencyName, (Object) null );
  4806.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4807.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4808.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4809.             String line;
  4810.             while ( ( line = reader.readLine() ) != null )
  4811.             {
  4812.                 builder.append( lineSeparator ).append( line );
  4813.             }

  4814.             suppressExceptionOnClose = false;
  4815.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4816.         }
  4817.         catch( final java.lang.ClassCastException e )
  4818.         {
  4819.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4820.         }
  4821.         catch( final java.lang.IllegalArgumentException e )
  4822.         {
  4823.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4824.         }
  4825.         catch( final java.util.MissingResourceException e )
  4826.         {
  4827.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4828.         }
  4829.         catch( final java.io.IOException e )
  4830.         {
  4831.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4832.         }
  4833.         finally
  4834.         {
  4835.             try
  4836.             {
  4837.                 if( reader != null )
  4838.                 {
  4839.                     reader.close();
  4840.                 }
  4841.             }
  4842.             catch( final java.io.IOException e )
  4843.             {
  4844.                 if( !suppressExceptionOnClose )
  4845.                 {
  4846.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4847.                 }
  4848.             }
  4849.         }
  4850.     }
  4851.     /**
  4852.      * Gets the text of the {@code <Missing Implementation Message>} message.
  4853.      * <p><dl>
  4854.      *   <dt><b>Languages:</b></dt>
  4855.      *     <dd>English (default)</dd>
  4856.      *     <dd>Deutsch</dd>
  4857.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4858.      * </dl></p>
  4859.      * @param locale The locale of the message to return.
  4860.      * @param specificationIdentifier Format argument.
  4861.      * @param implementationName Format argument.
  4862.      * @return The text of the {@code <Missing Implementation Message>} message for {@code locale}.
  4863.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4864.      */
  4865.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4866.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4867.     private static String getMissingImplementationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier, final java.lang.String implementationName )
  4868.     {
  4869.         java.io.BufferedReader reader = null;
  4870.         boolean suppressExceptionOnClose = true;

  4871.         try
  4872.         {
  4873.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Implementation Message" ), specificationIdentifier, implementationName, (Object) null );
  4874.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4875.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4876.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4877.             String line;
  4878.             while ( ( line = reader.readLine() ) != null )
  4879.             {
  4880.                 builder.append( lineSeparator ).append( line );
  4881.             }

  4882.             suppressExceptionOnClose = false;
  4883.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4884.         }
  4885.         catch( final java.lang.ClassCastException e )
  4886.         {
  4887.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4888.         }
  4889.         catch( final java.lang.IllegalArgumentException e )
  4890.         {
  4891.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4892.         }
  4893.         catch( final java.util.MissingResourceException e )
  4894.         {
  4895.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4896.         }
  4897.         catch( final java.io.IOException e )
  4898.         {
  4899.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4900.         }
  4901.         finally
  4902.         {
  4903.             try
  4904.             {
  4905.                 if( reader != null )
  4906.                 {
  4907.                     reader.close();
  4908.                 }
  4909.             }
  4910.             catch( final java.io.IOException e )
  4911.             {
  4912.                 if( !suppressExceptionOnClose )
  4913.                 {
  4914.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4915.                 }
  4916.             }
  4917.         }
  4918.     }
  4919.     /**
  4920.      * Gets the text of the {@code <Missing Implementations Message>} message.
  4921.      * <p><dl>
  4922.      *   <dt><b>Languages:</b></dt>
  4923.      *     <dd>English (default)</dd>
  4924.      *     <dd>Deutsch</dd>
  4925.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4926.      * </dl></p>
  4927.      * @param locale The locale of the message to return.
  4928.      * @param specificationIdentifier Format argument.
  4929.      * @return The text of the {@code <Missing Implementations Message>} message for {@code locale}.
  4930.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4931.      */
  4932.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  4933.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  4934.     private static String getMissingImplementationsMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
  4935.     {
  4936.         java.io.BufferedReader reader = null;
  4937.         boolean suppressExceptionOnClose = true;

  4938.         try
  4939.         {
  4940.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Implementations Message" ), specificationIdentifier, (Object) null );
  4941.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  4942.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  4943.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  4944.             String line;
  4945.             while ( ( line = reader.readLine() ) != null )
  4946.             {
  4947.                 builder.append( lineSeparator ).append( line );
  4948.             }

  4949.             suppressExceptionOnClose = false;
  4950.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  4951.         }
  4952.         catch( final java.lang.ClassCastException e )
  4953.         {
  4954.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4955.         }
  4956.         catch( final java.lang.IllegalArgumentException e )
  4957.         {
  4958.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4959.         }
  4960.         catch( final java.util.MissingResourceException e )
  4961.         {
  4962.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4963.         }
  4964.         catch( final java.io.IOException e )
  4965.         {
  4966.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4967.         }
  4968.         finally
  4969.         {
  4970.             try
  4971.             {
  4972.                 if( reader != null )
  4973.                 {
  4974.                     reader.close();
  4975.                 }
  4976.             }
  4977.             catch( final java.io.IOException e )
  4978.             {
  4979.                 if( !suppressExceptionOnClose )
  4980.                 {
  4981.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  4982.                 }
  4983.             }
  4984.         }
  4985.     }
  4986.     /**
  4987.      * Gets the text of the {@code <Missing Instance Message>} message.
  4988.      * <p><dl>
  4989.      *   <dt><b>Languages:</b></dt>
  4990.      *     <dd>English (default)</dd>
  4991.      *     <dd>Deutsch</dd>
  4992.      *   <dt><b>Final:</b></dt><dd>No</dd>
  4993.      * </dl></p>
  4994.      * @param locale The locale of the message to return.
  4995.      * @param implementationIdentifier Format argument.
  4996.      * @param implementationName Format argument.
  4997.      * @return The text of the {@code <Missing Instance Message>} message for {@code locale}.
  4998.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  4999.      */
  5000.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5001.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5002.     private static String getMissingInstanceMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
  5003.     {
  5004.         java.io.BufferedReader reader = null;
  5005.         boolean suppressExceptionOnClose = true;

  5006.         try
  5007.         {
  5008.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Instance Message" ), implementationIdentifier, implementationName, (Object) null );
  5009.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5010.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5011.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5012.             String line;
  5013.             while ( ( line = reader.readLine() ) != null )
  5014.             {
  5015.                 builder.append( lineSeparator ).append( line );
  5016.             }

  5017.             suppressExceptionOnClose = false;
  5018.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5019.         }
  5020.         catch( final java.lang.ClassCastException e )
  5021.         {
  5022.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5023.         }
  5024.         catch( final java.lang.IllegalArgumentException e )
  5025.         {
  5026.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5027.         }
  5028.         catch( final java.util.MissingResourceException e )
  5029.         {
  5030.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5031.         }
  5032.         catch( final java.io.IOException e )
  5033.         {
  5034.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5035.         }
  5036.         finally
  5037.         {
  5038.             try
  5039.             {
  5040.                 if( reader != null )
  5041.                 {
  5042.                     reader.close();
  5043.                 }
  5044.             }
  5045.             catch( final java.io.IOException e )
  5046.             {
  5047.                 if( !suppressExceptionOnClose )
  5048.                 {
  5049.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5050.                 }
  5051.             }
  5052.         }
  5053.     }
  5054.     /**
  5055.      * Gets the text of the {@code <Missing Locator Message>} message.
  5056.      * <p><dl>
  5057.      *   <dt><b>Languages:</b></dt>
  5058.      *     <dd>English (default)</dd>
  5059.      *     <dd>Deutsch</dd>
  5060.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5061.      * </dl></p>
  5062.      * @param locale The locale of the message to return.
  5063.      * @param locationInfo Format argument.
  5064.      * @return The text of the {@code <Missing Locator Message>} message for {@code locale}.
  5065.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5066.      */
  5067.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5068.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5069.     private static String getMissingLocatorMessage( final java.util.Locale locale, final java.lang.String locationInfo )
  5070.     {
  5071.         java.io.BufferedReader reader = null;
  5072.         boolean suppressExceptionOnClose = true;

  5073.         try
  5074.         {
  5075.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Locator Message" ), locationInfo, (Object) null );
  5076.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5077.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5078.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5079.             String line;
  5080.             while ( ( line = reader.readLine() ) != null )
  5081.             {
  5082.                 builder.append( lineSeparator ).append( line );
  5083.             }

  5084.             suppressExceptionOnClose = false;
  5085.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5086.         }
  5087.         catch( final java.lang.ClassCastException e )
  5088.         {
  5089.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5090.         }
  5091.         catch( final java.lang.IllegalArgumentException e )
  5092.         {
  5093.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5094.         }
  5095.         catch( final java.util.MissingResourceException e )
  5096.         {
  5097.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5098.         }
  5099.         catch( final java.io.IOException e )
  5100.         {
  5101.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5102.         }
  5103.         finally
  5104.         {
  5105.             try
  5106.             {
  5107.                 if( reader != null )
  5108.                 {
  5109.                     reader.close();
  5110.                 }
  5111.             }
  5112.             catch( final java.io.IOException e )
  5113.             {
  5114.                 if( !suppressExceptionOnClose )
  5115.                 {
  5116.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5117.                 }
  5118.             }
  5119.         }
  5120.     }
  5121.     /**
  5122.      * Gets the text of the {@code <Missing Message Message>} message.
  5123.      * <p><dl>
  5124.      *   <dt><b>Languages:</b></dt>
  5125.      *     <dd>English (default)</dd>
  5126.      *     <dd>Deutsch</dd>
  5127.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5128.      * </dl></p>
  5129.      * @param locale The locale of the message to return.
  5130.      * @param implementationIdentifier Format argument.
  5131.      * @param messageName Format argument.
  5132.      * @return The text of the {@code <Missing Message Message>} message for {@code locale}.
  5133.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5134.      */
  5135.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5136.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5137.     private static String getMissingMessageMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String messageName )
  5138.     {
  5139.         java.io.BufferedReader reader = null;
  5140.         boolean suppressExceptionOnClose = true;

  5141.         try
  5142.         {
  5143.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Message Message" ), implementationIdentifier, messageName, (Object) null );
  5144.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5145.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5146.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5147.             String line;
  5148.             while ( ( line = reader.readLine() ) != null )
  5149.             {
  5150.                 builder.append( lineSeparator ).append( line );
  5151.             }

  5152.             suppressExceptionOnClose = false;
  5153.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5154.         }
  5155.         catch( final java.lang.ClassCastException e )
  5156.         {
  5157.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5158.         }
  5159.         catch( final java.lang.IllegalArgumentException e )
  5160.         {
  5161.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5162.         }
  5163.         catch( final java.util.MissingResourceException e )
  5164.         {
  5165.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5166.         }
  5167.         catch( final java.io.IOException e )
  5168.         {
  5169.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5170.         }
  5171.         finally
  5172.         {
  5173.             try
  5174.             {
  5175.                 if( reader != null )
  5176.                 {
  5177.                     reader.close();
  5178.                 }
  5179.             }
  5180.             catch( final java.io.IOException e )
  5181.             {
  5182.                 if( !suppressExceptionOnClose )
  5183.                 {
  5184.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5185.                 }
  5186.             }
  5187.         }
  5188.     }
  5189.     /**
  5190.      * Gets the text of the {@code <Missing Object Instance Message>} message.
  5191.      * <p><dl>
  5192.      *   <dt><b>Languages:</b></dt>
  5193.      *     <dd>English (default)</dd>
  5194.      *     <dd>Deutsch</dd>
  5195.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5196.      * </dl></p>
  5197.      * @param locale The locale of the message to return.
  5198.      * @param objectInfo Format argument.
  5199.      * @return The text of the {@code <Missing Object Instance Message>} message for {@code locale}.
  5200.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5201.      */
  5202.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5203.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5204.     private static String getMissingObjectInstanceMessage( final java.util.Locale locale, final java.lang.String objectInfo )
  5205.     {
  5206.         java.io.BufferedReader reader = null;
  5207.         boolean suppressExceptionOnClose = true;

  5208.         try
  5209.         {
  5210.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Object Instance Message" ), objectInfo, (Object) null );
  5211.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5212.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5213.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5214.             String line;
  5215.             while ( ( line = reader.readLine() ) != null )
  5216.             {
  5217.                 builder.append( lineSeparator ).append( line );
  5218.             }

  5219.             suppressExceptionOnClose = false;
  5220.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5221.         }
  5222.         catch( final java.lang.ClassCastException e )
  5223.         {
  5224.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5225.         }
  5226.         catch( final java.lang.IllegalArgumentException e )
  5227.         {
  5228.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5229.         }
  5230.         catch( final java.util.MissingResourceException e )
  5231.         {
  5232.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5233.         }
  5234.         catch( final java.io.IOException e )
  5235.         {
  5236.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5237.         }
  5238.         finally
  5239.         {
  5240.             try
  5241.             {
  5242.                 if( reader != null )
  5243.                 {
  5244.                     reader.close();
  5245.                 }
  5246.             }
  5247.             catch( final java.io.IOException e )
  5248.             {
  5249.                 if( !suppressExceptionOnClose )
  5250.                 {
  5251.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5252.                 }
  5253.             }
  5254.         }
  5255.     }
  5256.     /**
  5257.      * Gets the text of the {@code <Missing Object Message>} message.
  5258.      * <p><dl>
  5259.      *   <dt><b>Languages:</b></dt>
  5260.      *     <dd>English (default)</dd>
  5261.      *     <dd>Deutsch</dd>
  5262.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5263.      * </dl></p>
  5264.      * @param locale The locale of the message to return.
  5265.      * @param implementationIdentifier Format argument.
  5266.      * @param implementationName Format argument.
  5267.      * @return The text of the {@code <Missing Object Message>} message for {@code locale}.
  5268.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5269.      */
  5270.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5271.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5272.     private static String getMissingObjectMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String implementationName )
  5273.     {
  5274.         java.io.BufferedReader reader = null;
  5275.         boolean suppressExceptionOnClose = true;

  5276.         try
  5277.         {
  5278.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Object Message" ), implementationIdentifier, implementationName, (Object) null );
  5279.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5280.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5281.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5282.             String line;
  5283.             while ( ( line = reader.readLine() ) != null )
  5284.             {
  5285.                 builder.append( lineSeparator ).append( line );
  5286.             }

  5287.             suppressExceptionOnClose = false;
  5288.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5289.         }
  5290.         catch( final java.lang.ClassCastException e )
  5291.         {
  5292.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5293.         }
  5294.         catch( final java.lang.IllegalArgumentException e )
  5295.         {
  5296.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5297.         }
  5298.         catch( final java.util.MissingResourceException e )
  5299.         {
  5300.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5301.         }
  5302.         catch( final java.io.IOException e )
  5303.         {
  5304.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5305.         }
  5306.         finally
  5307.         {
  5308.             try
  5309.             {
  5310.                 if( reader != null )
  5311.                 {
  5312.                     reader.close();
  5313.                 }
  5314.             }
  5315.             catch( final java.io.IOException e )
  5316.             {
  5317.                 if( !suppressExceptionOnClose )
  5318.                 {
  5319.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5320.                 }
  5321.             }
  5322.         }
  5323.     }
  5324.     /**
  5325.      * Gets the text of the {@code <Missing Property Message>} message.
  5326.      * <p><dl>
  5327.      *   <dt><b>Languages:</b></dt>
  5328.      *     <dd>English (default)</dd>
  5329.      *     <dd>Deutsch</dd>
  5330.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5331.      * </dl></p>
  5332.      * @param locale The locale of the message to return.
  5333.      * @param implementationIdentifier Format argument.
  5334.      * @param propertyName Format argument.
  5335.      * @return The text of the {@code <Missing Property Message>} message for {@code locale}.
  5336.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5337.      */
  5338.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5339.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5340.     private static String getMissingPropertyMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String propertyName )
  5341.     {
  5342.         java.io.BufferedReader reader = null;
  5343.         boolean suppressExceptionOnClose = true;

  5344.         try
  5345.         {
  5346.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Property Message" ), implementationIdentifier, propertyName, (Object) null );
  5347.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5348.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5349.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5350.             String line;
  5351.             while ( ( line = reader.readLine() ) != null )
  5352.             {
  5353.                 builder.append( lineSeparator ).append( line );
  5354.             }

  5355.             suppressExceptionOnClose = false;
  5356.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5357.         }
  5358.         catch( final java.lang.ClassCastException e )
  5359.         {
  5360.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5361.         }
  5362.         catch( final java.lang.IllegalArgumentException e )
  5363.         {
  5364.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5365.         }
  5366.         catch( final java.util.MissingResourceException e )
  5367.         {
  5368.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5369.         }
  5370.         catch( final java.io.IOException e )
  5371.         {
  5372.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5373.         }
  5374.         finally
  5375.         {
  5376.             try
  5377.             {
  5378.                 if( reader != null )
  5379.                 {
  5380.                     reader.close();
  5381.                 }
  5382.             }
  5383.             catch( final java.io.IOException e )
  5384.             {
  5385.                 if( !suppressExceptionOnClose )
  5386.                 {
  5387.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5388.                 }
  5389.             }
  5390.         }
  5391.     }
  5392.     /**
  5393.      * Gets the text of the {@code <Missing Scope Message>} message.
  5394.      * <p><dl>
  5395.      *   <dt><b>Languages:</b></dt>
  5396.      *     <dd>English (default)</dd>
  5397.      *     <dd>Deutsch</dd>
  5398.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5399.      * </dl></p>
  5400.      * @param locale The locale of the message to return.
  5401.      * @param scopeIdentifier Format argument.
  5402.      * @return The text of the {@code <Missing Scope Message>} message for {@code locale}.
  5403.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5404.      */
  5405.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5406.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5407.     private static String getMissingScopeMessage( final java.util.Locale locale, final java.lang.String scopeIdentifier )
  5408.     {
  5409.         java.io.BufferedReader reader = null;
  5410.         boolean suppressExceptionOnClose = true;

  5411.         try
  5412.         {
  5413.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Scope Message" ), scopeIdentifier, (Object) null );
  5414.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5415.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5416.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5417.             String line;
  5418.             while ( ( line = reader.readLine() ) != null )
  5419.             {
  5420.                 builder.append( lineSeparator ).append( line );
  5421.             }

  5422.             suppressExceptionOnClose = false;
  5423.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5424.         }
  5425.         catch( final java.lang.ClassCastException e )
  5426.         {
  5427.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5428.         }
  5429.         catch( final java.lang.IllegalArgumentException e )
  5430.         {
  5431.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5432.         }
  5433.         catch( final java.util.MissingResourceException e )
  5434.         {
  5435.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5436.         }
  5437.         catch( final java.io.IOException e )
  5438.         {
  5439.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5440.         }
  5441.         finally
  5442.         {
  5443.             try
  5444.             {
  5445.                 if( reader != null )
  5446.                 {
  5447.                     reader.close();
  5448.                 }
  5449.             }
  5450.             catch( final java.io.IOException e )
  5451.             {
  5452.                 if( !suppressExceptionOnClose )
  5453.                 {
  5454.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5455.                 }
  5456.             }
  5457.         }
  5458.     }
  5459.     /**
  5460.      * Gets the text of the {@code <Missing Specification Class Message>} message.
  5461.      * <p><dl>
  5462.      *   <dt><b>Languages:</b></dt>
  5463.      *     <dd>English (default)</dd>
  5464.      *     <dd>Deutsch</dd>
  5465.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5466.      * </dl></p>
  5467.      * @param locale The locale of the message to return.
  5468.      * @param specificationIdentifier Format argument.
  5469.      * @return The text of the {@code <Missing Specification Class Message>} message for {@code locale}.
  5470.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5471.      */
  5472.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5473.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5474.     private static String getMissingSpecificationClassMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
  5475.     {
  5476.         java.io.BufferedReader reader = null;
  5477.         boolean suppressExceptionOnClose = true;

  5478.         try
  5479.         {
  5480.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Specification Class Message" ), specificationIdentifier, (Object) null );
  5481.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5482.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5483.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5484.             String line;
  5485.             while ( ( line = reader.readLine() ) != null )
  5486.             {
  5487.                 builder.append( lineSeparator ).append( line );
  5488.             }

  5489.             suppressExceptionOnClose = false;
  5490.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5491.         }
  5492.         catch( final java.lang.ClassCastException e )
  5493.         {
  5494.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5495.         }
  5496.         catch( final java.lang.IllegalArgumentException e )
  5497.         {
  5498.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5499.         }
  5500.         catch( final java.util.MissingResourceException e )
  5501.         {
  5502.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5503.         }
  5504.         catch( final java.io.IOException e )
  5505.         {
  5506.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5507.         }
  5508.         finally
  5509.         {
  5510.             try
  5511.             {
  5512.                 if( reader != null )
  5513.                 {
  5514.                     reader.close();
  5515.                 }
  5516.             }
  5517.             catch( final java.io.IOException e )
  5518.             {
  5519.                 if( !suppressExceptionOnClose )
  5520.                 {
  5521.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5522.                 }
  5523.             }
  5524.         }
  5525.     }
  5526.     /**
  5527.      * Gets the text of the {@code <Missing Specification Message>} message.
  5528.      * <p><dl>
  5529.      *   <dt><b>Languages:</b></dt>
  5530.      *     <dd>English (default)</dd>
  5531.      *     <dd>Deutsch</dd>
  5532.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5533.      * </dl></p>
  5534.      * @param locale The locale of the message to return.
  5535.      * @param specificationIdentifier Format argument.
  5536.      * @return The text of the {@code <Missing Specification Message>} message for {@code locale}.
  5537.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5538.      */
  5539.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5540.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5541.     private static String getMissingSpecificationMessage( final java.util.Locale locale, final java.lang.String specificationIdentifier )
  5542.     {
  5543.         java.io.BufferedReader reader = null;
  5544.         boolean suppressExceptionOnClose = true;

  5545.         try
  5546.         {
  5547.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Missing Specification Message" ), specificationIdentifier, (Object) null );
  5548.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5549.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5550.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5551.             String line;
  5552.             while ( ( line = reader.readLine() ) != null )
  5553.             {
  5554.                 builder.append( lineSeparator ).append( line );
  5555.             }

  5556.             suppressExceptionOnClose = false;
  5557.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5558.         }
  5559.         catch( final java.lang.ClassCastException e )
  5560.         {
  5561.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5562.         }
  5563.         catch( final java.lang.IllegalArgumentException e )
  5564.         {
  5565.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5566.         }
  5567.         catch( final java.util.MissingResourceException e )
  5568.         {
  5569.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5570.         }
  5571.         catch( final java.io.IOException e )
  5572.         {
  5573.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5574.         }
  5575.         finally
  5576.         {
  5577.             try
  5578.             {
  5579.                 if( reader != null )
  5580.                 {
  5581.                     reader.close();
  5582.                 }
  5583.             }
  5584.             catch( final java.io.IOException e )
  5585.             {
  5586.                 if( !suppressExceptionOnClose )
  5587.                 {
  5588.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5589.                 }
  5590.             }
  5591.         }
  5592.     }
  5593.     /**
  5594.      * Gets the text of the {@code <Modules Report Message>} message.
  5595.      * <p><dl>
  5596.      *   <dt><b>Languages:</b></dt>
  5597.      *     <dd>English (default)</dd>
  5598.      *     <dd>Deutsch</dd>
  5599.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5600.      * </dl></p>
  5601.      * @param locale The locale of the message to return.
  5602.      * @return The text of the {@code <Modules Report Message>} message for {@code locale}.
  5603.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5604.      */
  5605.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5606.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5607.     private static String getModulesReportMessage( final java.util.Locale locale )
  5608.     {
  5609.         java.io.BufferedReader reader = null;
  5610.         boolean suppressExceptionOnClose = true;

  5611.         try
  5612.         {
  5613.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Modules Report Message" ), (Object) null );
  5614.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5615.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5616.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5617.             String line;
  5618.             while ( ( line = reader.readLine() ) != null )
  5619.             {
  5620.                 builder.append( lineSeparator ).append( line );
  5621.             }

  5622.             suppressExceptionOnClose = false;
  5623.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5624.         }
  5625.         catch( final java.lang.ClassCastException e )
  5626.         {
  5627.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5628.         }
  5629.         catch( final java.lang.IllegalArgumentException e )
  5630.         {
  5631.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5632.         }
  5633.         catch( final java.util.MissingResourceException e )
  5634.         {
  5635.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5636.         }
  5637.         catch( final java.io.IOException e )
  5638.         {
  5639.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5640.         }
  5641.         finally
  5642.         {
  5643.             try
  5644.             {
  5645.                 if( reader != null )
  5646.                 {
  5647.                     reader.close();
  5648.                 }
  5649.             }
  5650.             catch( final java.io.IOException e )
  5651.             {
  5652.                 if( !suppressExceptionOnClose )
  5653.                 {
  5654.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5655.                 }
  5656.             }
  5657.         }
  5658.     }
  5659.     /**
  5660.      * Gets the text of the {@code <Runtime Model Report>} message.
  5661.      * <p><dl>
  5662.      *   <dt><b>Languages:</b></dt>
  5663.      *     <dd>English (default)</dd>
  5664.      *     <dd>Deutsch</dd>
  5665.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5666.      * </dl></p>
  5667.      * @param locale The locale of the message to return.
  5668.      * @param millis Format argument.
  5669.      * @return The text of the {@code <Runtime Model Report>} message for {@code locale}.
  5670.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5671.      */
  5672.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5673.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5674.     private static String getRuntimeModelReport( final java.util.Locale locale, final java.lang.Number millis )
  5675.     {
  5676.         java.io.BufferedReader reader = null;
  5677.         boolean suppressExceptionOnClose = true;

  5678.         try
  5679.         {
  5680.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Runtime Model Report" ), millis, (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.             String line;
  5685.             while ( ( line = reader.readLine() ) != null )
  5686.             {
  5687.                 builder.append( lineSeparator ).append( line );
  5688.             }

  5689.             suppressExceptionOnClose = false;
  5690.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5691.         }
  5692.         catch( final java.lang.ClassCastException e )
  5693.         {
  5694.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5695.         }
  5696.         catch( final java.lang.IllegalArgumentException e )
  5697.         {
  5698.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5699.         }
  5700.         catch( final java.util.MissingResourceException e )
  5701.         {
  5702.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5703.         }
  5704.         catch( final java.io.IOException e )
  5705.         {
  5706.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5707.         }
  5708.         finally
  5709.         {
  5710.             try
  5711.             {
  5712.                 if( reader != null )
  5713.                 {
  5714.                     reader.close();
  5715.                 }
  5716.             }
  5717.             catch( final java.io.IOException e )
  5718.             {
  5719.                 if( !suppressExceptionOnClose )
  5720.                 {
  5721.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5722.                 }
  5723.             }
  5724.         }
  5725.     }
  5726.     /**
  5727.      * Gets the text of the {@code <Scope Contention Failure>} message.
  5728.      * <p><dl>
  5729.      *   <dt><b>Languages:</b></dt>
  5730.      *     <dd>English (default)</dd>
  5731.      *     <dd>Deutsch</dd>
  5732.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5733.      * </dl></p>
  5734.      * @param locale The locale of the message to return.
  5735.      * @param objectIdentifier Format argument.
  5736.      * @return The text of the {@code <Scope Contention Failure>} message for {@code locale}.
  5737.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5738.      */
  5739.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5740.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5741.     private static String getScopeContentionFailure( final java.util.Locale locale, final java.lang.String objectIdentifier )
  5742.     {
  5743.         java.io.BufferedReader reader = null;
  5744.         boolean suppressExceptionOnClose = true;

  5745.         try
  5746.         {
  5747.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Scope Contention Failure" ), objectIdentifier, (Object) null );
  5748.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5749.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5750.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5751.             String line;
  5752.             while ( ( line = reader.readLine() ) != null )
  5753.             {
  5754.                 builder.append( lineSeparator ).append( line );
  5755.             }

  5756.             suppressExceptionOnClose = false;
  5757.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5758.         }
  5759.         catch( final java.lang.ClassCastException e )
  5760.         {
  5761.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5762.         }
  5763.         catch( final java.lang.IllegalArgumentException e )
  5764.         {
  5765.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5766.         }
  5767.         catch( final java.util.MissingResourceException e )
  5768.         {
  5769.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5770.         }
  5771.         catch( final java.io.IOException e )
  5772.         {
  5773.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5774.         }
  5775.         finally
  5776.         {
  5777.             try
  5778.             {
  5779.                 if( reader != null )
  5780.                 {
  5781.                     reader.close();
  5782.                 }
  5783.             }
  5784.             catch( final java.io.IOException e )
  5785.             {
  5786.                 if( !suppressExceptionOnClose )
  5787.                 {
  5788.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5789.                 }
  5790.             }
  5791.         }
  5792.     }
  5793.     /**
  5794.      * Gets the text of the {@code <Scope Info Message>} message.
  5795.      * <p><dl>
  5796.      *   <dt><b>Languages:</b></dt>
  5797.      *     <dd>English (default)</dd>
  5798.      *     <dd>Deutsch</dd>
  5799.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5800.      * </dl></p>
  5801.      * @param locale The locale of the message to return.
  5802.      * @param implementationIdentifier Format argument.
  5803.      * @param scopeIdentifier Format argument.
  5804.      * @param classLoaderInfo Format argument.
  5805.      * @return The text of the {@code <Scope Info Message>} message for {@code locale}.
  5806.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5807.      */
  5808.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5809.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5810.     private static String getScopeInfoMessage( final java.util.Locale locale, final java.lang.String implementationIdentifier, final java.lang.String scopeIdentifier, final java.lang.String classLoaderInfo )
  5811.     {
  5812.         java.io.BufferedReader reader = null;
  5813.         boolean suppressExceptionOnClose = true;

  5814.         try
  5815.         {
  5816.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Scope Info Message" ), implementationIdentifier, scopeIdentifier, classLoaderInfo, (Object) null );
  5817.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5818.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5819.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5820.             String line;
  5821.             while ( ( line = reader.readLine() ) != null )
  5822.             {
  5823.                 builder.append( lineSeparator ).append( line );
  5824.             }

  5825.             suppressExceptionOnClose = false;
  5826.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5827.         }
  5828.         catch( final java.lang.ClassCastException e )
  5829.         {
  5830.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5831.         }
  5832.         catch( final java.lang.IllegalArgumentException e )
  5833.         {
  5834.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5835.         }
  5836.         catch( final java.util.MissingResourceException e )
  5837.         {
  5838.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5839.         }
  5840.         catch( final java.io.IOException e )
  5841.         {
  5842.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5843.         }
  5844.         finally
  5845.         {
  5846.             try
  5847.             {
  5848.                 if( reader != null )
  5849.                 {
  5850.                     reader.close();
  5851.                 }
  5852.             }
  5853.             catch( final java.io.IOException e )
  5854.             {
  5855.                 if( !suppressExceptionOnClose )
  5856.                 {
  5857.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5858.                 }
  5859.             }
  5860.         }
  5861.     }
  5862.     /**
  5863.      * Gets the text of the {@code <Unexpected Dependency Objects Message>} message.
  5864.      * <p><dl>
  5865.      *   <dt><b>Languages:</b></dt>
  5866.      *     <dd>English (default)</dd>
  5867.      *     <dd>Deutsch</dd>
  5868.      *   <dt><b>Final:</b></dt><dd>No</dd>
  5869.      * </dl></p>
  5870.      * @param locale The locale of the message to return.
  5871.      * @param implementationIdentifier Format argument.
  5872.      * @param dependencyName Format argument.
  5873.      * @param expectedNumber Format argument.
  5874.      * @param computedNumber Format argument.
  5875.      * @return The text of the {@code <Unexpected Dependency Objects Message>} message for {@code locale}.
  5876.      * @throws org.jomc.ObjectManagementException if getting the message instance fails.
  5877.      */
  5878.     @SuppressWarnings({"unchecked", "unused", "PMD.UnnecessaryFullyQualifiedName"})
  5879.     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
  5880.     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 )
  5881.     {
  5882.         java.io.BufferedReader reader = null;
  5883.         boolean suppressExceptionOnClose = true;

  5884.         try
  5885.         {
  5886.             final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org.jomc.ri.DefaultObjectManager", locale ).getString( "Unexpected Dependency Objects Message" ), implementationIdentifier, dependencyName, expectedNumber, computedNumber, (Object) null );
  5887.             final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() );
  5888.             reader = new java.io.BufferedReader( new java.io.StringReader( message ) );
  5889.             final String lineSeparator = System.getProperty( "line.separator", "\n" );

  5890.             String line;
  5891.             while ( ( line = reader.readLine() ) != null )
  5892.             {
  5893.                 builder.append( lineSeparator ).append( line );
  5894.             }

  5895.             suppressExceptionOnClose = false;
  5896.             return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : "";
  5897.         }
  5898.         catch( final java.lang.ClassCastException e )
  5899.         {
  5900.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5901.         }
  5902.         catch( final java.lang.IllegalArgumentException e )
  5903.         {
  5904.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5905.         }
  5906.         catch( final java.util.MissingResourceException e )
  5907.         {
  5908.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5909.         }
  5910.         catch( final java.io.IOException e )
  5911.         {
  5912.             throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5913.         }
  5914.         finally
  5915.         {
  5916.             try
  5917.             {
  5918.                 if( reader != null )
  5919.                 {
  5920.                     reader.close();
  5921.                 }
  5922.             }
  5923.             catch( final java.io.IOException e )
  5924.             {
  5925.                 if( !suppressExceptionOnClose )
  5926.                 {
  5927.                     throw new org.jomc.ObjectManagementException( e.getMessage(), e );
  5928.                 }
  5929.             }
  5930.         }
  5931.     }
  5932.     // </editor-fold>
  5933.     // SECTION-END

  5934. }