001    // SECTION-START[License Header]
002    // <editor-fold defaultstate="collapsed" desc=" Generated License ">
003    /*
004     *   Copyright (c) 2010 The JOMC Project
005     *   Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net>
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 BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
021     *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
022     *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
023     *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
024     *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025     *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026     *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
027     *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028     *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
029     *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
030     *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031     *
032     *   $Id: SdkModelValidator.java 2234 2010-06-29 00:03:38Z schulte2005 $
033     *
034     */
035    // </editor-fold>
036    // SECTION-END
037    package org.jomc.sdk.model.modlet;
038    
039    import java.text.MessageFormat;
040    import java.util.ResourceBundle;
041    import java.util.logging.Level;
042    import javax.xml.bind.JAXBElement;
043    import org.jomc.model.Dependency;
044    import org.jomc.model.Implementation;
045    import org.jomc.model.Module;
046    import org.jomc.model.Modules;
047    import org.jomc.model.ObjectFactory;
048    import org.jomc.model.Properties;
049    import org.jomc.model.Property;
050    import org.jomc.model.PropertyException;
051    import org.jomc.model.Specification;
052    import org.jomc.model.modlet.ModelHelper;
053    import org.jomc.modlet.Model;
054    import org.jomc.modlet.ModelContext;
055    import org.jomc.modlet.ModelException;
056    import org.jomc.modlet.ModelValidationReport;
057    import org.jomc.modlet.ModelValidator;
058    import org.jomc.sdk.model.ItemType;
059    import org.jomc.sdk.model.ListType;
060    import org.jomc.sdk.model.MapType;
061    
062    // SECTION-START[Documentation]
063    // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
064    /**
065     * SDK 'ModelValidator' implementation.
066     *
067     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
068     * @version $Id: SdkModelValidator.java 2234 2010-06-29 00:03:38Z schulte2005 $
069     */
070    // </editor-fold>
071    // SECTION-END
072    // SECTION-START[Annotations]
073    // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
074    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
075    // </editor-fold>
076    // SECTION-END
077    public final class SdkModelValidator implements ModelValidator
078    {
079        // SECTION-START[SdkModelValidator]
080    
081        public ModelValidationReport validateModel( final ModelContext context, final Model model ) throws ModelException
082        {
083            if ( context == null )
084            {
085                throw new NullPointerException( "context" );
086            }
087            if ( model == null )
088            {
089                throw new NullPointerException( "model" );
090            }
091    
092            final ModelValidationReport report = new ModelValidationReport();
093            final Modules modules = ModelHelper.getModules( model );
094    
095            if ( modules != null )
096            {
097                if ( context.isLoggable( Level.FINE ) )
098                {
099                    context.log( Level.FINE, getMessage(
100                        "validatingModel", this.getClass().getName(), model.getIdentifier() ), null );
101    
102                }
103    
104                for ( Module m : modules.getModule() )
105                {
106                    this.assertValidSdkObjects( context, m, null, null, null, report );
107    
108                    if ( m.getSpecifications() != null )
109                    {
110                        for ( Specification s : m.getSpecifications().getSpecification() )
111                        {
112                            this.assertValidSdkObjects( context, null, s, null, null, report );
113                        }
114                    }
115    
116                    if ( m.getImplementations() != null )
117                    {
118                        for ( Implementation i : m.getImplementations().getImplementation() )
119                        {
120                            this.assertValidSdkObjects( context, null, null, i, null, report );
121    
122                            if ( i.getDependencies() != null )
123                            {
124                                for ( Dependency d : i.getDependencies().getDependency() )
125                                {
126                                    this.assertValidSdkObjects( context, null, null, i, d, report );
127                                }
128                            }
129                        }
130                    }
131                }
132            }
133            else if ( context.isLoggable( Level.WARNING ) )
134            {
135                context.log( Level.WARNING, getMessage( "modulesNotFound", model.getIdentifier() ), null );
136            }
137    
138            return report;
139        }
140    
141        private void assertValidSdkObjects( final ModelContext context, final Module module,
142                                            final Specification specification, final Implementation implementation,
143                                            final Dependency dependency, final ModelValidationReport report )
144        {
145            if ( module != null && ( implementation != null || dependency != null || specification != null ) )
146            {
147                throw new IllegalArgumentException();
148            }
149            if ( implementation != null && ( module != null || specification != null ) )
150            {
151                throw new IllegalArgumentException();
152            }
153            if ( specification != null && ( module != null || implementation != null || dependency != null ) )
154            {
155                throw new IllegalArgumentException();
156            }
157    
158            Properties properties = null;
159            JAXBElement detailElement = null;
160    
161            if ( module != null )
162            {
163                properties = module.getProperties();
164                detailElement = new ObjectFactory().createModule( module );
165            }
166            if ( specification != null )
167            {
168                properties = specification.getProperties();
169                detailElement = new ObjectFactory().createSpecification( specification );
170            }
171            if ( implementation != null )
172            {
173                properties = implementation.getProperties();
174                detailElement = new ObjectFactory().createImplementation( implementation );
175            }
176            if ( dependency != null )
177            {
178                properties = dependency.getProperties();
179            }
180    
181            if ( properties != null )
182            {
183                for ( Property p : properties.getProperty() )
184                {
185                    if ( p.getAny() != null )
186                    {
187                        final Object any =
188                            p.getAny() instanceof JAXBElement ? ( (JAXBElement) p.getAny() ).getValue() : p.getAny();
189    
190                        if ( any instanceof ListType )
191                        {
192                            final ListType list = (ListType) any;
193    
194                            for ( ItemType item : list.getItem() )
195                            {
196                                if ( item.getValue() != null && item.getAny() != null )
197                                {
198                                    if ( module != null )
199                                    {
200                                        report.getDetails().add( new ModelValidationReport.Detail(
201                                            "MODULE_LIST_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
202                                            "moduleListItemValueConstraint", module.getName(), p.getName() ),
203                                            detailElement ) );
204    
205                                    }
206    
207                                    if ( specification != null )
208                                    {
209                                        report.getDetails().add( new ModelValidationReport.Detail(
210                                            "SPECIFICATION_LIST_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
211                                            "specificationListItemValueConstraint", specification.getIdentifier(),
212                                            p.getName() ), detailElement ) );
213    
214                                    }
215    
216                                    if ( implementation != null )
217                                    {
218                                        if ( dependency != null )
219                                        {
220                                            report.getDetails().add( new ModelValidationReport.Detail(
221                                                "DEPENDENCY_LIST_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
222                                                "dependencyListItemValueConstraint", implementation.getIdentifier(),
223                                                dependency.getName(), p.getName() ), detailElement ) );
224    
225                                        }
226                                        else
227                                        {
228                                            report.getDetails().add( new ModelValidationReport.Detail(
229                                                "IMPLEMENTATION_LIST_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
230                                                "implementationListItemValueConstraint", implementation.getIdentifier(),
231                                                p.getName() ), detailElement ) );
232    
233                                        }
234                                    }
235                                }
236    
237                                if ( item.getAny() != null && item.getType() == null )
238                                {
239                                    if ( module != null )
240                                    {
241                                        report.getDetails().add( new ModelValidationReport.Detail(
242                                            "MODULE_LIST_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
243                                            "moduleListItemTypeConstraint", module.getName(), p.getName() ),
244                                            detailElement ) );
245    
246                                    }
247    
248                                    if ( specification != null )
249                                    {
250                                        report.getDetails().add( new ModelValidationReport.Detail(
251                                            "SPECIFICATION_LIST_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
252                                            "specificationListItemTypeConstraint", specification.getIdentifier(),
253                                            p.getName() ), detailElement ) );
254    
255                                    }
256    
257                                    if ( implementation != null )
258                                    {
259                                        if ( dependency != null )
260                                        {
261                                            report.getDetails().add( new ModelValidationReport.Detail(
262                                                "DEPENDENCY_LIST_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
263                                                "dependencyListItemTypeConstraint", implementation.getIdentifier(),
264                                                dependency.getName(), p.getName() ), detailElement ) );
265    
266                                        }
267                                        else
268                                        {
269                                            report.getDetails().add( new ModelValidationReport.Detail(
270                                                "IMPLEMENTATION_LIST_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
271                                                "implementationListItemTypeConstraint", implementation.getIdentifier(),
272                                                p.getName() ), detailElement ) );
273    
274                                        }
275                                    }
276                                }
277    
278                                try
279                                {
280                                    item.getJavaValue( context.getClassLoader() );
281                                }
282                                catch ( final PropertyException e )
283                                {
284                                    if ( context.isLoggable( Level.FINE ) )
285                                    {
286                                        context.log( Level.FINE, e.getMessage(), e );
287                                    }
288    
289                                    if ( module != null )
290                                    {
291                                        report.getDetails().add( new ModelValidationReport.Detail(
292                                            "MODULE_LIST_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
293                                            "moduleListItemJavaValueConstraint", module.getName(), p.getName(),
294                                            e.getMessage() ), detailElement ) );
295    
296                                    }
297    
298                                    if ( specification != null )
299                                    {
300                                        report.getDetails().add( new ModelValidationReport.Detail(
301                                            "SPECIFICATION_LIST_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
302                                            "specificationListItemJavaValueConstraint", specification.getIdentifier(),
303                                            p.getName(), e.getMessage() ), detailElement ) );
304    
305                                    }
306    
307                                    if ( implementation != null )
308                                    {
309                                        if ( dependency != null )
310                                        {
311                                            report.getDetails().add( new ModelValidationReport.Detail(
312                                                "DEPENDENCY_LIST_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
313                                                "dependencyListItemJavaValueConstraint", implementation.getIdentifier(),
314                                                dependency.getName(), p.getName(), e.getMessage() ), detailElement ) );
315    
316                                        }
317                                        else
318                                        {
319                                            report.getDetails().add( new ModelValidationReport.Detail(
320                                                "IMPLEMENTATION_LIST_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
321                                                "implementationListItemJavaValueConstraint", implementation.getIdentifier(),
322                                                p.getName(), e.getMessage() ), detailElement ) );
323    
324                                        }
325                                    }
326                                }
327                            }
328    
329                            try
330                            {
331                                list.getJavaValue( context.getClassLoader() );
332                            }
333                            catch ( final PropertyException e )
334                            {
335                                if ( context.isLoggable( Level.FINE ) )
336                                {
337                                    context.log( Level.FINE, e.getMessage(), e );
338                                }
339    
340                                if ( module != null )
341                                {
342                                    report.getDetails().add( new ModelValidationReport.Detail(
343                                        "MODULE_LIST_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
344                                        "moduleListJavaValueConstraint", module.getName(), p.getName(), e.getMessage() ),
345                                        detailElement ) );
346    
347                                }
348    
349                                if ( specification != null )
350                                {
351                                    report.getDetails().add( new ModelValidationReport.Detail(
352                                        "SPECIFICATION_LIST_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
353                                        "specificationListJavaValueConstraint", specification.getIdentifier(),
354                                        p.getName(), e.getMessage() ), detailElement ) );
355    
356                                }
357    
358                                if ( implementation != null )
359                                {
360                                    if ( dependency != null )
361                                    {
362                                        report.getDetails().add( new ModelValidationReport.Detail(
363                                            "DEPENDENCY_LIST_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
364                                            "dependencyListJavaValueConstraint", implementation.getIdentifier(),
365                                            dependency.getName(), p.getName(), e.getMessage() ), detailElement ) );
366    
367                                    }
368                                    else
369                                    {
370                                        report.getDetails().add( new ModelValidationReport.Detail(
371                                            "IMPLEMENTATION_LIST_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
372                                            "implementationListJavaValueConstraint", implementation.getIdentifier(),
373                                            p.getName(), e.getMessage() ), detailElement ) );
374    
375                                    }
376                                }
377                            }
378                        }
379    
380                        if ( any instanceof MapType )
381                        {
382                            final MapType map = (MapType) any;
383    
384                            for ( MapType.Entry entry : map.getEntry() )
385                            {
386                                if ( entry.getKey().getValue() != null && entry.getKey().getAny() != null )
387                                {
388                                    if ( module != null )
389                                    {
390                                        report.getDetails().add( new ModelValidationReport.Detail(
391                                            "MODULE_MAP_KEY_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
392                                            "moduleMapKeyItemValueConstraint", module.getName(), p.getName() ),
393                                            detailElement ) );
394    
395                                    }
396    
397                                    if ( specification != null )
398                                    {
399                                        report.getDetails().add( new ModelValidationReport.Detail(
400                                            "SPECIFICATION_MAP_KEY_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
401                                            "specificationMapKeyItemValueConstraint", specification.getIdentifier(),
402                                            p.getName() ), detailElement ) );
403    
404                                    }
405    
406                                    if ( implementation != null )
407                                    {
408                                        if ( dependency != null )
409                                        {
410                                            report.getDetails().add( new ModelValidationReport.Detail(
411                                                "DEPENDENCY_MAP_KEY_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
412                                                "dependencyMapKeyItemValueConstraint", implementation.getIdentifier(),
413                                                dependency.getName(), p.getName() ), detailElement ) );
414    
415                                        }
416                                        else
417                                        {
418                                            report.getDetails().add( new ModelValidationReport.Detail(
419                                                "IMPLEMENTATION_MAP_KEY_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
420                                                "implementationMapKeyItemValueConstraint", implementation.getIdentifier(),
421                                                p.getName() ), detailElement ) );
422    
423                                        }
424                                    }
425                                }
426    
427                                if ( entry.getValue().getValue() != null && entry.getValue().getAny() != null )
428                                {
429                                    if ( module != null )
430                                    {
431                                        report.getDetails().add( new ModelValidationReport.Detail(
432                                            "MODULE_MAP_VALUE_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
433                                            "moduleMapValueItemValueConstraint", module.getName(), p.getName() ),
434                                            detailElement ) );
435    
436                                    }
437    
438                                    if ( specification != null )
439                                    {
440                                        report.getDetails().add( new ModelValidationReport.Detail(
441                                            "SPECIFICATION_MAP_VALUE_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
442                                            "specificationMapValueItemValueConstraint", specification.getIdentifier(),
443                                            p.getName() ), detailElement ) );
444    
445                                    }
446    
447                                    if ( implementation != null )
448                                    {
449                                        if ( dependency != null )
450                                        {
451                                            report.getDetails().add( new ModelValidationReport.Detail(
452                                                "DEPENDENCY_MAP_VALUE_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
453                                                "dependencyMapValueItemValueConstraint", implementation.getIdentifier(),
454                                                dependency.getName(), p.getName() ), detailElement ) );
455    
456                                        }
457                                        else
458                                        {
459                                            report.getDetails().add( new ModelValidationReport.Detail(
460                                                "IMPLEMENTATION_MAP_VALUE_ITEM_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
461                                                "implementationMapValueItemValueConstraint", implementation.getIdentifier(),
462                                                p.getName() ), detailElement ) );
463    
464                                        }
465                                    }
466                                }
467    
468                                if ( entry.getKey().getAny() != null && entry.getKey().getType() == null )
469                                {
470                                    if ( module != null )
471                                    {
472                                        report.getDetails().add( new ModelValidationReport.Detail(
473                                            "MODULE_MAP_KEY_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
474                                            "moduleMapKeyItemTypeConstraint", module.getName(), p.getName() ),
475                                            detailElement ) );
476    
477                                    }
478    
479                                    if ( specification != null )
480                                    {
481                                        report.getDetails().add( new ModelValidationReport.Detail(
482                                            "SPECIFICATION_MAP_KEY_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
483                                            "specificationMapKeyItemTypeConstraint", specification.getIdentifier(),
484                                            p.getName() ), detailElement ) );
485    
486                                    }
487    
488    
489                                    if ( implementation != null )
490                                    {
491                                        if ( dependency != null )
492                                        {
493                                            report.getDetails().add( new ModelValidationReport.Detail(
494                                                "DEPENDENCY_MAP_KEY_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
495                                                "dependencyMapKeyItemTypeConstraint", implementation.getIdentifier(),
496                                                dependency.getName(), p.getName() ), detailElement ) );
497    
498                                        }
499                                        else
500                                        {
501                                            report.getDetails().add( new ModelValidationReport.Detail(
502                                                "IMPLEMENTATION_MAP_KEY_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
503                                                "implementationMapKeyItemTypeConstraint", implementation.getIdentifier(),
504                                                p.getName() ), detailElement ) );
505    
506                                        }
507                                    }
508                                }
509    
510                                if ( entry.getValue().getAny() != null && entry.getValue().getType() == null )
511                                {
512                                    if ( module != null )
513                                    {
514                                        report.getDetails().add( new ModelValidationReport.Detail(
515                                            "MODULE_MAP_VALUE_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
516                                            "moduleMapValueItemTypeConstraint", module.getName(), p.getName() ),
517                                            detailElement ) );
518    
519                                    }
520    
521                                    if ( specification != null )
522                                    {
523                                        report.getDetails().add( new ModelValidationReport.Detail(
524                                            "SPECIFICATION_MAP_VALUE_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
525                                            "specificationMapValueItemTypeConstraint", specification.getIdentifier(),
526                                            p.getName() ), detailElement ) );
527    
528                                    }
529    
530                                    if ( implementation != null )
531                                    {
532                                        if ( dependency != null )
533                                        {
534                                            report.getDetails().add( new ModelValidationReport.Detail(
535                                                "DEPENDENCY_MAP_VALUE_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
536                                                "dependencyMapValueItemTypeConstraint", implementation.getIdentifier(),
537                                                dependency.getName(), p.getName() ), detailElement ) );
538    
539                                        }
540                                        else
541                                        {
542                                            report.getDetails().add( new ModelValidationReport.Detail(
543                                                "IMPLEMENTATION_MAP_VALUE_ITEM_TYPE_CONSTRAINT", Level.SEVERE, getMessage(
544                                                "implementationMapValueItemTypeConstraint", implementation.getIdentifier(),
545                                                p.getName() ), detailElement ) );
546    
547                                        }
548                                    }
549                                }
550    
551                                try
552                                {
553                                    entry.getKey().getJavaValue( context.getClassLoader() );
554                                }
555                                catch ( final PropertyException e )
556                                {
557                                    if ( context.isLoggable( Level.FINE ) )
558                                    {
559                                        context.log( Level.FINE, e.getMessage(), e );
560                                    }
561    
562                                    if ( module != null )
563                                    {
564                                        report.getDetails().add( new ModelValidationReport.Detail(
565                                            "MODULE_MAP_KEY_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
566                                            "moduleMapKeyItemJavaValueConstraint", module.getName(), p.getName(),
567                                            e.getMessage() ), detailElement ) );
568    
569                                    }
570    
571                                    if ( specification != null )
572                                    {
573                                        report.getDetails().add( new ModelValidationReport.Detail(
574                                            "SPECIFICATION_MAP_KEY_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
575                                            "specificationMapKeyItemJavaValueConstraint", specification.getIdentifier(),
576                                            p.getName(), e.getMessage() ), detailElement ) );
577    
578                                    }
579    
580                                    if ( implementation != null )
581                                    {
582                                        if ( dependency != null )
583                                        {
584                                            report.getDetails().add( new ModelValidationReport.Detail(
585                                                "DEPENDENCY_MAP_KEY_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
586                                                "dependencyMapKeyItemJavaValueConstraint", implementation.getIdentifier(),
587                                                dependency.getName(), p.getName(), e.getMessage() ), detailElement ) );
588    
589                                        }
590                                        else
591                                        {
592                                            report.getDetails().add( new ModelValidationReport.Detail(
593                                                "IMPLEMENTATION_MAP_KEY_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE,
594                                                getMessage( "implementationMapKeyItemJavaValueConstraint",
595                                                            implementation.getIdentifier(), p.getName(), e.getMessage() ),
596                                                detailElement ) );
597    
598                                        }
599                                    }
600                                }
601    
602                                try
603                                {
604                                    entry.getValue().getJavaValue( context.getClassLoader() );
605                                }
606                                catch ( final PropertyException e )
607                                {
608                                    if ( context.isLoggable( Level.FINE ) )
609                                    {
610                                        context.log( Level.FINE, e.getMessage(), e );
611                                    }
612    
613                                    if ( module != null )
614                                    {
615                                        report.getDetails().add( new ModelValidationReport.Detail(
616                                            "MODULE_MAP_VALUE_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
617                                            "moduleMapValueItemJavaValueConstraint", module.getName(), p.getName(),
618                                            e.getMessage() ), detailElement ) );
619    
620                                    }
621    
622                                    if ( specification != null )
623                                    {
624                                        report.getDetails().add( new ModelValidationReport.Detail(
625                                            "SPECIFICATION_MAP_VALUE_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
626                                            "specificationMapValueItemJavaValueConstraint", specification.getIdentifier(),
627                                            p.getName(), e.getMessage() ), detailElement ) );
628    
629                                    }
630    
631                                    if ( implementation != null )
632                                    {
633                                        if ( dependency != null )
634                                        {
635                                            report.getDetails().add( new ModelValidationReport.Detail(
636                                                "DEPENDENCY_MAP_VALUE_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE,
637                                                getMessage( "dependencyMapValueItemJavaValueConstraint",
638                                                            implementation.getIdentifier(), dependency.getName(),
639                                                            p.getName(), e.getMessage() ), detailElement ) );
640    
641                                        }
642                                        else
643                                        {
644                                            report.getDetails().add( new ModelValidationReport.Detail(
645                                                "IMPLEMENTATION_MAP_VALUE_ITEM_JAVA_VALUE_CONSTRAINT", Level.SEVERE,
646                                                getMessage( "implementationMapValueItemJavaValueConstraint",
647                                                            implementation.getIdentifier(), p.getName(), e.getMessage() ),
648                                                detailElement ) );
649    
650                                        }
651                                    }
652                                }
653                            }
654    
655                            try
656                            {
657                                map.getJavaValue( context.getClassLoader() );
658                            }
659                            catch ( final PropertyException e )
660                            {
661                                if ( context.isLoggable( Level.FINE ) )
662                                {
663                                    context.log( Level.FINE, e.getMessage(), e );
664                                }
665    
666                                if ( module != null )
667                                {
668                                    report.getDetails().add( new ModelValidationReport.Detail(
669                                        "MODULE_MAP_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
670                                        "moduleMapJavaValueConstraint", module.getName(), p.getName(), e.getMessage() ),
671                                        detailElement ) );
672    
673                                }
674    
675                                if ( specification != null )
676                                {
677                                    report.getDetails().add( new ModelValidationReport.Detail(
678                                        "SPECIFICATION_MAP_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
679                                        "specificationMapJavaValueConstraint", specification.getIdentifier(),
680                                        p.getName(), e.getMessage() ), detailElement ) );
681    
682                                }
683    
684                                if ( implementation != null )
685                                {
686                                    if ( dependency != null )
687                                    {
688                                        report.getDetails().add( new ModelValidationReport.Detail(
689                                            "DEPENDENCY_MAP_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
690                                            "dependencyMapJavaValueConstraint", implementation.getIdentifier(),
691                                            dependency.getName(), p.getName(), e.getMessage() ), detailElement ) );
692    
693                                    }
694                                    else
695                                    {
696                                        report.getDetails().add( new ModelValidationReport.Detail(
697                                            "IMPLEMENTATION_MAP_JAVA_VALUE_CONSTRAINT", Level.SEVERE, getMessage(
698                                            "implementationMapJavaValueConstraint", implementation.getIdentifier(),
699                                            p.getName(), e.getMessage() ), detailElement ) );
700    
701                                    }
702                                }
703                            }
704                        }
705                    }
706                }
707            }
708        }
709    
710        private static String getMessage( final String key, final Object... arguments )
711        {
712            return MessageFormat.format( ResourceBundle.getBundle( SdkModelValidator.class.getName().replace( '.', '/' ) ).
713                getString( key ), arguments );
714    
715        }
716    
717        // SECTION-END
718        // SECTION-START[Constructors]
719        // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
720    
721        /** Creates a new {@code SdkModelValidator} instance. */
722        @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
723        public SdkModelValidator()
724        {
725            // SECTION-START[Default Constructor]
726            super();
727            // SECTION-END
728        }
729        // </editor-fold>
730        // SECTION-END
731        // SECTION-START[Dependencies]
732        // SECTION-END
733        // SECTION-START[Properties]
734        // SECTION-END
735        // SECTION-START[Messages]
736        // SECTION-END
737    }