001// SECTION-START[License Header] 002// <editor-fold defaultstate="collapsed" desc=" Generated License "> 003/* 004 * jDTAUS 005 * Copyright (C) Christian Schulte, 2012-039 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU Lesser General Public License as published 009 * by the Free Software Foundation, either version 2.1 of the License, or 010 * (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public License 018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 019 * 020 * $JDTAUS: ModelModelProvider.java 8561 2012-06-04 02:44:14Z schulte2005 $ 021 * 022 */ 023// </editor-fold> 024// SECTION-END 025package org.jdtaus.core.container.ri.jomc; 026 027import java.util.HashSet; 028import java.util.Locale; 029import java.util.Set; 030import java.util.logging.Level; 031import org.jomc.model.Argument; 032import org.jomc.model.ArgumentType; 033import org.jomc.model.Arguments; 034import org.jomc.model.Dependencies; 035import org.jomc.model.Dependency; 036import org.jomc.model.Implementation; 037import org.jomc.model.ImplementationReference; 038import org.jomc.model.Implementations; 039import org.jomc.model.InheritanceModel; 040import org.jomc.model.Message; 041import org.jomc.model.MessageReference; 042import org.jomc.model.Messages; 043import org.jomc.model.Module; 044import org.jomc.model.Modules; 045import org.jomc.model.Multiplicity; 046import org.jomc.model.Properties; 047import org.jomc.model.Property; 048import org.jomc.model.Specification; 049import org.jomc.model.SpecificationReference; 050import org.jomc.model.Specifications; 051import org.jomc.model.Text; 052import org.jomc.model.Texts; 053import org.jomc.model.modlet.ModelHelper; 054import org.jomc.modlet.Model; 055import org.jomc.modlet.ModelContext; 056import org.jomc.modlet.ModelException; 057 058// SECTION-START[Documentation] 059// <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 060/** 061 * JOMC {@code ModelProvider} providing the jDTAUS {@code Model}. 062 * 063 * <dl> 064 * <dt><b>Identifier:</b></dt><dd>jDTAUS Core JOMC Container :: Model ModelProvider</dd> 065 * <dt><b>Name:</b></dt><dd>jDTAUS Core JOMC Container :: Model ModelProvider</dd> 066 * <dt><b>Specifications:</b></dt> 067 * <dd>org.jomc.modlet.ModelProvider</dd> 068 * <dt><b>Abstract:</b></dt><dd>No</dd> 069 * <dt><b>Final:</b></dt><dd>No</dd> 070 * <dt><b>Stateless:</b></dt><dd>No</dd> 071 * </dl> 072 * 073 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 074 * @version 1.12-SNAPSHOT 075 */ 076// </editor-fold> 077// SECTION-END 078// SECTION-START[Annotations] 079// <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> 080@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 081// </editor-fold> 082// SECTION-END 083public class ModelModelProvider 084 implements 085 org.jomc.modlet.ModelProvider 086{ 087 // SECTION-START[ModelProvider] 088 089 /** Name of the system property controlling the use of the context class loader. */ 090 private static final String CONTEXT_CLASSLOADER_PROPERTY_NAME = 091 "org.jdtaus.core.container.ClassLoaderFactory.enableContextClassloader"; 092 093 @Override 094 public Model findModel( final ModelContext context, final Model model ) throws NullPointerException, ModelException 095 { 096 Model provided = null; 097 final String sys = System.getProperty( CONTEXT_CLASSLOADER_PROPERTY_NAME ); 098 final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 099 100 try 101 { 102 System.setProperty( CONTEXT_CLASSLOADER_PROPERTY_NAME, Boolean.TRUE.toString() ); 103 Thread.currentThread().setContextClassLoader( context.getClassLoader() ); 104 105 final Modules modules = 106 transformModules( context, org.jdtaus.core.container.ModelFactory.getModel().getModules() ); 107 108 if ( modules != null ) 109 { 110 applyInheritanceAttributes( context, modules ); 111 provided = model.clone(); 112 ModelHelper.addModules( provided, modules ); 113 } 114 115 return provided; 116 } 117 finally 118 { 119 Thread.currentThread().setContextClassLoader( classLoader ); 120 121 if ( sys != null ) 122 { 123 System.setProperty( CONTEXT_CLASSLOADER_PROPERTY_NAME, sys ); 124 } 125 else 126 { 127 System.clearProperty( CONTEXT_CLASSLOADER_PROPERTY_NAME ); 128 } 129 } 130 } 131 132 // SECTION-END 133 // SECTION-START[ModelModelProvider] 134 private static Modules transformModules( final ModelContext context, 135 final org.jdtaus.core.container.Modules jdtausModules ) 136 { 137 Modules modules = null; 138 139 if ( jdtausModules != null ) 140 { 141 modules = new Modules(); 142 143 for ( int i = 0, s0 = jdtausModules.size(); i < s0; i++ ) 144 { 145 final org.jdtaus.core.container.Module jdtausModule = jdtausModules.getModule( i ); 146 147 if ( !org.jdtaus.core.container.Model.class.getName().equals( jdtausModule.getName() ) ) 148 { // Skip platform module. 149 modules.getModule().add( transformModule( context, jdtausModule ) ); 150 } 151 } 152 } 153 154 return modules; 155 } 156 157 private static Module transformModule( final ModelContext context, 158 final org.jdtaus.core.container.Module jdtausModule ) 159 { 160 Module module = null; 161 162 if ( jdtausModule != null ) 163 { 164 module = new Module(); 165 module.setDocumentation( transformText( context, jdtausModule.getDocumentation() ) ); 166 module.setName( jdtausModule.getName() ); 167 module.setVersion( jdtausModule.getVersion() ); 168 module.setSpecifications( transformSpecifications( context, jdtausModule.getSpecifications() ) ); 169 module.setImplementations( transformImplementations( context, jdtausModule.getImplementations() ) ); 170 171 if ( context.isLoggable( Level.FINEST ) ) 172 { 173 context.log( Level.FINEST, getModuleInfo( Locale.getDefault(), module.getName(), 174 module.getVersion() == null ? module.getVersion() : "" ), 175 null ); 176 177 } 178 } 179 180 return module; 181 } 182 183 private static Implementations transformImplementations( 184 final ModelContext context, 185 final org.jdtaus.core.container.Implementations jdtausImplementations ) 186 { 187 Implementations implementations = null; 188 189 if ( jdtausImplementations != null ) 190 { 191 implementations = new Implementations(); 192 implementations.setDocumentation( transformText( context, jdtausImplementations.getDocumentation() ) ); 193 194 for ( int i = 0, s0 = jdtausImplementations.size(); i < s0; i++ ) 195 { 196 implementations.getImplementation().add( transformImplementation( 197 context, jdtausImplementations.getImplementation( i ) ) ); 198 199 } 200 } 201 202 return implementations; 203 } 204 205 private static Implementation transformImplementation( 206 final ModelContext context, 207 final org.jdtaus.core.container.Implementation jdtausImplementation ) 208 { 209 final Implementation implementation = new Implementation(); 210 implementation.setIdentifier( jdtausImplementation.getIdentifier() ); 211 implementation.setClazz( jdtausImplementation.getIdentifier() ); 212 implementation.setClassDeclaration( Boolean.TRUE ); 213 implementation.setFinal( jdtausImplementation.isFinal() ); 214 implementation.setName( jdtausImplementation.getName() ); 215 implementation.setVendor( jdtausImplementation.getVendor() ); 216 implementation.setVersion( jdtausImplementation.getVersion() ); 217 implementation.setDocumentation( transformText( context, jdtausImplementation.getDocumentation() ) ); 218 implementation.setProperties( transformProperties( context, jdtausImplementation.getDeclaredProperties() ) ); 219 implementation.setMessages( transformMessages( context, jdtausImplementation.getDeclaredMessages() ) ); 220 implementation.setDependencies( transformDependencies( context, jdtausImplementation.getDeclaredDependencies() ) ); 221 implementation.setSpecifications( transformSpecificationReferences( 222 context, jdtausImplementation.getImplementedSpecifications() ) ); 223 224 // The jDTAUS Container has no support for synchronising object accesses. This ensures the state management of 225 // the JOMC ObjectManager is in effect. 226 implementation.setStateless( Boolean.FALSE ); 227 228 if ( jdtausImplementation.getParent() != null ) 229 { 230 final Implementations references = new Implementations(); 231 implementation.setImplementations( references ); 232 233 final ImplementationReference reference = new ImplementationReference(); 234 references.getReference().add( reference ); 235 236 reference.setIdentifier( jdtausImplementation.getParent().getIdentifier() ); 237 reference.setVersion( jdtausImplementation.getParent().getVersion() ); 238 } 239 240 return implementation; 241 } 242 243 private static Specifications transformSpecifications( 244 final ModelContext context, 245 final org.jdtaus.core.container.Specifications jdtausSpecifications ) 246 { 247 Specifications specifications = null; 248 249 if ( jdtausSpecifications != null ) 250 { 251 specifications = new Specifications(); 252 specifications.setDocumentation( transformText( context, jdtausSpecifications.getDocumentation() ) ); 253 254 for ( int i = 0, s0 = jdtausSpecifications.size(); i < s0; i++ ) 255 { 256 specifications.getSpecification().add( transformSpecification( 257 context, jdtausSpecifications.getSpecification( i ) ) ); 258 259 } 260 } 261 262 return specifications; 263 } 264 265 private static Specifications transformSpecificationReferences( 266 final ModelContext context, 267 final org.jdtaus.core.container.Specifications jdtausSpecifications ) 268 { 269 Specifications specifications = null; 270 271 if ( jdtausSpecifications != null ) 272 { 273 specifications = new Specifications(); 274 specifications.setDocumentation( transformText( context, jdtausSpecifications.getDocumentation() ) ); 275 276 for ( int i = 0, s0 = jdtausSpecifications.size(); i < s0; i++ ) 277 { 278 final SpecificationReference specificationReference = new SpecificationReference(); 279 specificationReference.setIdentifier( jdtausSpecifications.getSpecification( i ).getIdentifier() ); 280 specificationReference.setVersion( jdtausSpecifications.getSpecification( i ).getVersion() ); 281 specifications.getReference().add( specificationReference ); 282 } 283 } 284 285 return specifications; 286 } 287 288 private static Specification transformSpecification( 289 final ModelContext context, 290 final org.jdtaus.core.container.Specification jdtausSpecification ) 291 { 292 final Specification specification = new Specification(); 293 specification.setClassDeclaration( Boolean.TRUE ); 294 specification.setClazz( jdtausSpecification.getIdentifier() ); 295 specification.setIdentifier( jdtausSpecification.getIdentifier() ); 296 specification.setVendor( jdtausSpecification.getVendor() ); 297 specification.setVersion( jdtausSpecification.getVersion() ); 298 specification.setDocumentation( transformText( context, jdtausSpecification.getDocumentation() ) ); 299 300 switch ( jdtausSpecification.getMultiplicity() ) 301 { 302 case org.jdtaus.core.container.Specification.MULTIPLICITY_MANY: 303 specification.setMultiplicity( Multiplicity.MANY ); 304 break; 305 case org.jdtaus.core.container.Specification.MULTIPLICITY_ONE: 306 specification.setMultiplicity( Multiplicity.ONE ); 307 break; 308 default: 309 310 } 311 312 switch ( jdtausSpecification.getScope() ) 313 { 314 case org.jdtaus.core.container.Specification.SCOPE_CONTEXT: 315 specification.setScope( "jDTAUS Context" ); 316 break; 317 318 case org.jdtaus.core.container.Specification.SCOPE_SINGLETON: 319 specification.setScope( "Singleton" ); 320 break; 321 default: 322 323 } 324 325 specification.setProperties( transformProperties( context, jdtausSpecification.getProperties() ) ); 326 return specification; 327 } 328 329 private static Texts transformText( final ModelContext context, final org.jdtaus.core.container.Text jdtausText ) 330 { 331 Texts texts = null; 332 333 if ( jdtausText != null ) 334 { 335 texts = new Texts(); 336 337 for ( final Locale locale : jdtausText.getLocales() ) 338 { 339 final Text text = new Text(); 340 text.setLanguage( locale.getLanguage() ); 341 text.setValue( jdtausText.getValue( locale ) ); 342 texts.getText().add( text ); 343 344 if ( text.getValue().equals( jdtausText.getValue() ) ) 345 { 346 texts.setDefaultLanguage( locale.getLanguage() ); 347 } 348 } 349 350 if ( texts.getText().isEmpty() ) 351 { 352 texts = null; 353 } 354 } 355 356 return texts; 357 } 358 359 private static Properties transformProperties( final ModelContext context, 360 final org.jdtaus.core.container.Properties jdtausProperties ) 361 { 362 Properties properties = null; 363 364 if ( jdtausProperties != null ) 365 { 366 properties = new Properties(); 367 properties.setDocumentation( transformText( context, jdtausProperties.getDocumentation() ) ); 368 369 for ( int i = 0, s0 = jdtausProperties.size(); i < s0; i++ ) 370 { 371 properties.getProperty().add( transformProperty( context, jdtausProperties.getProperty( i ) ) ); 372 } 373 } 374 375 return properties; 376 } 377 378 private static Property transformProperty( final ModelContext context, 379 final org.jdtaus.core.container.Property jdtausProperty ) 380 { 381 Property property = null; 382 383 if ( jdtausProperty != null ) 384 { 385 property = new Property(); 386 property.setDocumentation( transformText( context, jdtausProperty.getDocumentation() ) ); 387 property.setName( jdtausProperty.getName() ); 388 property.setFinal( Boolean.FALSE ); 389 property.setOverride( Boolean.FALSE ); 390 property.setType( jdtausProperty.getType().getName() ); 391 392 if ( jdtausProperty.getValue() != null ) 393 { 394 property.setValue( jdtausProperty.getValue().toString() ); 395 } 396 else if ( jdtausProperty.isApi() ) 397 { 398 if ( Byte.TYPE.equals( jdtausProperty.getType() ) 399 || Short.TYPE.equals( jdtausProperty.getType() ) 400 || Integer.TYPE.equals( jdtausProperty.getType() ) 401 || Long.TYPE.equals( jdtausProperty.getType() ) 402 || Float.TYPE.equals( jdtausProperty.getType() ) 403 || Double.TYPE.equals( jdtausProperty.getType() ) ) 404 { 405 property.setValue( "0" ); 406 } 407 else 408 { 409 property.setValue( "" ); 410 } 411 } 412 } 413 414 return property; 415 } 416 417 private static Messages transformMessages( final ModelContext context, 418 final org.jdtaus.core.container.Messages jdtausMessages ) 419 { 420 Messages messages = null; 421 422 if ( jdtausMessages != null ) 423 { 424 messages = new Messages(); 425 messages.setDocumentation( transformText( context, jdtausMessages.getDocumentation() ) ); 426 427 for ( int i = 0, s0 = jdtausMessages.size(); i < s0; i++ ) 428 { 429 messages.getMessage().add( transformMessage( context, jdtausMessages.getMessage( i ) ) ); 430 } 431 } 432 433 return messages; 434 } 435 436 private static Message transformMessage( final ModelContext context, 437 final org.jdtaus.core.container.Message jdtausMessage ) 438 { 439 Message message = null; 440 441 if ( jdtausMessage != null ) 442 { 443 message = new Message(); 444 message.setDocumentation( transformText( context, jdtausMessage.getDocumentation() ) ); 445 message.setName( jdtausMessage.getName() ); 446 message.setFinal( Boolean.FALSE ); 447 message.setOverride( Boolean.FALSE ); 448 message.setTemplate( transformText( context, jdtausMessage.getTemplate() ) ); 449 message.setArguments( transformArguments( context, jdtausMessage.getArguments() ) ); 450 } 451 452 return message; 453 } 454 455 private static Arguments transformArguments( final ModelContext context, 456 final org.jdtaus.core.container.Arguments jdtausArguments ) 457 { 458 Arguments arguments = null; 459 460 if ( jdtausArguments != null ) 461 { 462 arguments = new Arguments(); 463 arguments.setDocumentation( transformText( context, jdtausArguments.getDocumentation() ) ); 464 465 for ( int i = 0, s0 = jdtausArguments.size(); i < s0; i++ ) 466 { 467 arguments.getArgument().add( transformArgument( context, jdtausArguments.getArgument( i ) ) ); 468 } 469 } 470 471 return arguments; 472 } 473 474 private static Argument transformArgument( final ModelContext context, 475 final org.jdtaus.core.container.Argument jdtausArgument ) 476 { 477 Argument argument = null; 478 479 if ( jdtausArgument != null ) 480 { 481 argument = new Argument(); 482 argument.setDocumentation( transformText( context, jdtausArgument.getDocumentation() ) ); 483 argument.setIndex( jdtausArgument.getIndex() ); 484 argument.setName( jdtausArgument.getName() ); 485 486 switch ( jdtausArgument.getType() ) 487 { 488 case org.jdtaus.core.container.Argument.TYPE_DATE: 489 argument.setType( ArgumentType.DATE ); 490 break; 491 492 case org.jdtaus.core.container.Argument.TYPE_NUMBER: 493 argument.setType( ArgumentType.NUMBER ); 494 break; 495 496 case org.jdtaus.core.container.Argument.TYPE_TEXT: 497 argument.setType( ArgumentType.TEXT ); 498 break; 499 case org.jdtaus.core.container.Argument.TYPE_TIME: 500 argument.setType( ArgumentType.TIME ); 501 break; 502 default: 503 504 } 505 } 506 507 return argument; 508 } 509 510 private static Dependencies transformDependencies( final ModelContext context, 511 final org.jdtaus.core.container.Dependencies jdtausDependencies ) 512 { 513 Dependencies dependencies = null; 514 515 if ( jdtausDependencies != null ) 516 { 517 dependencies = new Dependencies(); 518 dependencies.setDocumentation( transformText( context, jdtausDependencies.getDocumentation() ) ); 519 520 for ( int i = 0, s0 = jdtausDependencies.size(); i < s0; i++ ) 521 { 522 dependencies.getDependency().add( transformDependency( 523 context, jdtausDependencies.getDependency( i ) ) ); 524 525 } 526 } 527 528 return dependencies; 529 } 530 531 private static Dependency transformDependency( final ModelContext context, 532 final org.jdtaus.core.container.Dependency jdtausDependency ) 533 { 534 Dependency dependency = null; 535 536 if ( jdtausDependency != null ) 537 { 538 dependency = new Dependency(); 539 dependency.setDocumentation( transformText( context, jdtausDependency.getDocumentation() ) ); 540 dependency.setName( jdtausDependency.getName() ); 541 dependency.setFinal( Boolean.FALSE ); 542 dependency.setOverride( Boolean.FALSE ); 543 dependency.setBound( jdtausDependency.isBound() ); 544 dependency.setIdentifier( jdtausDependency.getSpecification().getIdentifier() ); 545 dependency.setVersion( jdtausDependency.getSpecification().getVersion() ); 546 547 if ( jdtausDependency.getImplementation() != null ) 548 { 549 dependency.setImplementationName( jdtausDependency.getImplementation().getName() ); 550 } 551 552 // Cannot set to optional since the JOMC ObjectManager returns null if no implementations are found and 553 // jDTAUS implementations expect an empty array. 554 dependency.setOptional( Boolean.FALSE ); 555 dependency.setProperties( transformProperties( context, jdtausDependency.getDeclaredProperties() ) ); 556 } 557 558 return dependency; 559 } 560 561 private static void applyInheritanceAttributes( final ModelContext context, final Modules modules ) 562 { 563 final InheritanceModel imodel = new InheritanceModel( modules ); 564 565 if ( modules.getImplementations() != null ) 566 { 567 for ( int i = 0, s0 = modules.getImplementations().getImplementation().size(); i < s0; i++ ) 568 { 569 applyInheritanceAttributes( 570 context, modules, imodel, modules.getImplementations().getImplementation().get( i ) ); 571 572 } 573 } 574 } 575 576 private static void applyInheritanceAttributes( final ModelContext context, final Modules modules, 577 final InheritanceModel imodel, final Implementation implementation ) 578 { 579 final Set<String> dependencyNames = imodel.getDependencyNames( implementation.getIdentifier() ); 580 final Set<String> messageNames = imodel.getMessageNames( implementation.getIdentifier() ); 581 final Set<String> propertyNames = imodel.getPropertyNames( implementation.getIdentifier() ); 582 583 for ( final String dependencyName : dependencyNames ) 584 { 585 final Set<InheritanceModel.Node<Dependency>> effDependency = 586 imodel.getDependencyNodes( implementation.getIdentifier(), dependencyName ); 587 588 for ( final InheritanceModel.Node<Dependency> d : effDependency ) 589 { 590 if ( d.getImplementation().getIdentifier().equals( implementation.getIdentifier() ) 591 && !d.getOverriddenNodes().isEmpty() ) 592 { 593 implementation.getDependencies().getDependency( dependencyName ).setOverride( true ); 594 } 595 } 596 } 597 598 for ( final String messageName : messageNames ) 599 { 600 final Set<InheritanceModel.Node<Message>> effMessage = 601 imodel.getMessageNodes( implementation.getIdentifier(), messageName ); 602 603 for ( final InheritanceModel.Node<Message> m : effMessage ) 604 { 605 if ( m.getImplementation().getIdentifier().equals( implementation.getIdentifier() ) 606 && !m.getOverriddenNodes().isEmpty() ) 607 { 608 final Message msg = implementation.getMessages().getMessage( messageName ); 609 final MessageReference ref = implementation.getMessages().getReference( messageName ); 610 611 if ( msg != null ) 612 { 613 msg.setOverride( true ); 614 } 615 if ( ref != null ) 616 { 617 ref.setOverride( true ); 618 } 619 } 620 } 621 } 622 623 for ( final String propertyName : propertyNames ) 624 { 625 final Set<InheritanceModel.Node<Property>> effProperty = 626 imodel.getPropertyNodes( implementation.getIdentifier(), propertyName ); 627 628 for ( final InheritanceModel.Node<Property> p : effProperty ) 629 { 630 if ( p.getImplementation().getIdentifier().equals( implementation.getIdentifier() ) 631 && !p.getOverriddenNodes().isEmpty() ) 632 { 633 implementation.getProperties().getProperty( propertyName ).setOverride( true ); 634 } 635 } 636 } 637 638 if ( implementation.getDependencies() != null ) 639 { 640 for ( int i = 0, s0 = implementation.getDependencies().getDependency().size(); i < s0; i++ ) 641 { 642 applyInheritanceAttributes( 643 context, modules, imodel, implementation.getDependencies().getDependency().get( i ) ); 644 645 } 646 } 647 } 648 649 private static void applyInheritanceAttributes( final ModelContext context, final Modules modules, 650 final InheritanceModel imodel, final Dependency dependency ) 651 { 652 final Set<Implementation> implementations = new HashSet<Implementation>(); 653 654 if ( dependency.getImplementationName() != null ) 655 { 656 final Implementation i = modules.getImplementation( dependency.getIdentifier(), 657 dependency.getImplementationName() ); 658 659 if ( i != null ) 660 { 661 implementations.add( i ); 662 } 663 } 664 else 665 { 666 final Implementations i = modules.getImplementations( dependency.getIdentifier() ); 667 if ( i != null ) 668 { 669 implementations.addAll( i.getImplementation() ); 670 } 671 } 672 673 if ( dependency.getDependencies() != null ) 674 { 675 for ( int i = 0, s0 = dependency.getDependencies().getDependency().size(); i < s0; i++ ) 676 { 677 final Dependency d = dependency.getDependencies().getDependency().get( i ); 678 679 for ( final Implementation impl : implementations ) 680 { 681 final Set<InheritanceModel.Node<Dependency>> effDependencies = 682 imodel.getDependencyNodes( impl.getIdentifier(), d.getName() ); 683 684 if ( !d.isOverride() && !effDependencies.isEmpty() ) 685 { 686 d.setOverride( true ); 687 } 688 } 689 690 applyInheritanceAttributes( context, modules, imodel, d ); 691 } 692 } 693 if ( dependency.getMessages() != null ) 694 { 695 for ( int i = 0, s0 = dependency.getMessages().getMessage().size(); i < s0; i++ ) 696 { 697 final Message m = dependency.getMessages().getMessage().get( i ); 698 699 for ( final Implementation impl : implementations ) 700 { 701 final Set<InheritanceModel.Node<Message>> effMessages = 702 imodel.getMessageNodes( impl.getIdentifier(), m.getName() ); 703 704 if ( !m.isOverride() && !effMessages.isEmpty() ) 705 { 706 m.setOverride( true ); 707 } 708 } 709 } 710 } 711 if ( dependency.getProperties() != null ) 712 { 713 for ( int i = 0, s0 = dependency.getProperties().getProperty().size(); i < s0; i++ ) 714 { 715 final Property p = dependency.getProperties().getProperty().get( i ); 716 717 for ( final Implementation impl : implementations ) 718 { 719 final Set<InheritanceModel.Node<Property>> effProperties = 720 imodel.getPropertyNodes( impl.getIdentifier(), p.getName() ); 721 722 if ( !p.isOverride() && !effProperties.isEmpty() ) 723 { 724 p.setOverride( true ); 725 } 726 } 727 } 728 } 729 } 730 731 // SECTION-END 732 // SECTION-START[Constructors] 733 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 734 /** Creates a new {@code ModelModelProvider} instance. */ 735 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 736 public ModelModelProvider() 737 { 738 // SECTION-START[Default Constructor] 739 super(); 740 // SECTION-END 741 } 742 // </editor-fold> 743 // SECTION-END 744 // SECTION-START[Dependencies] 745 // SECTION-END 746 // SECTION-START[Properties] 747 // SECTION-END 748 // SECTION-START[Messages] 749 // <editor-fold defaultstate="collapsed" desc=" Generated Messages "> 750 /** 751 * Gets the text of the {@code <moduleInfo>} message. 752 * <p><dl> 753 * <dt><b>Languages:</b></dt> 754 * <dd>English (default)</dd> 755 * <dd>Deutsch</dd> 756 * <dt><b>Final:</b></dt><dd>No</dd> 757 * </dl></p> 758 * @param locale The locale of the message to return. 759 * @param moduleName Format argument. 760 * @param moduleVersion Format argument. 761 * @return The text of the {@code <moduleInfo>} message for {@code locale}. 762 * @throws org.jomc.ObjectManagementException if getting the message instance fails. 763 */ 764 @SuppressWarnings("unused") 765 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 766 private static String getModuleInfo( final java.util.Locale locale, final java.lang.String moduleName, final java.lang.String moduleVersion ) 767 { 768 java.io.BufferedReader reader = null; 769 boolean suppressExceptionOnClose = true; 770 771 try 772 { 773 final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "org/jdtaus/core/container/ri/jomc/ModelModelProvider", locale ).getString( "moduleInfo" ), moduleName, moduleVersion, (Object) null ); 774 final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() ); 775 reader = new java.io.BufferedReader( new java.io.StringReader( message ) ); 776 final String lineSeparator = System.getProperty( "line.separator", "\n" ); 777 778 String line; 779 while ( ( line = reader.readLine() ) != null ) 780 { 781 builder.append( lineSeparator ).append( line ); 782 } 783 784 suppressExceptionOnClose = false; 785 return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : ""; 786 } 787 catch( final java.lang.ClassCastException e ) 788 { 789 throw new org.jomc.ObjectManagementException( e.getMessage(), e ); 790 } 791 catch( final java.lang.IllegalArgumentException e ) 792 { 793 throw new org.jomc.ObjectManagementException( e.getMessage(), e ); 794 } 795 catch( final java.util.MissingResourceException e ) 796 { 797 throw new org.jomc.ObjectManagementException( e.getMessage(), e ); 798 } 799 catch( final java.io.IOException e ) 800 { 801 throw new org.jomc.ObjectManagementException( e.getMessage(), e ); 802 } 803 finally 804 { 805 try 806 { 807 if( reader != null ) 808 { 809 reader.close(); 810 } 811 } 812 catch( final java.io.IOException e ) 813 { 814 if( !suppressExceptionOnClose ) 815 { 816 throw new org.jomc.ObjectManagementException( e.getMessage(), e ); 817 } 818 } 819 } 820 } 821 // </editor-fold> 822 // SECTION-END 823}