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