src/main/java/org/jboss/loom/migrators/_ext/ExternalMigratorsLoader.java
private static Map<String, Class<? extends IConfigFragment>> loadJaxbClasses(
            MigratorDefinition desc ) throws MigrationException
    {
        Map<String, Class<? extends IConfigFragment>> jaxbClasses = new HashMap();
        List<Exception> problems  = new LinkedList();
        
        // JAXB class...
        for( JaxbClassDef jaxbClsBean : desc.jaxbBeansClasses ) {
            try {
                // Look up in the map:  "TestJaxbBean" -> class
                String className = StringUtils.substringAfter( jaxbClsBean.file.getName(), "." );
                Class cls = jaxbClasses.get( className );
                if( cls == null ){
                    // Use the directory where the definition XML file is from.
                    log.debug("    Loading JAXB class from dir " + desc.getOrigin() );
                    //File dir = new File( desc.getLocation().getSystemId() ).getParentFile();
                    File dir = desc.getOrigin().getFile().getParentFile();
                    final File groovyFile = new File( dir, jaxbClsBean.file.getPath() );
                    cls = loadGroovyClass( groovyFile );
                    if( ! IConfigFragment.class.isAssignableFrom( cls ) ){
                        problems.add( new MigrationException("Groovy class from '"+groovyFile.getPath()+
                            "' doesn't implement " + IConfigFragment.class.getSimpleName() + ": " + cls.getName()));
                        continue;
                    }
                    jaxbClasses.put( className, cls );
                }
                //mig.addJaxbClass( cls );
            }
            catch( Exception ex ){
                problems.add(ex);
            }
        }
        MigrationExceptions.wrapExceptions( problems, "Failed loading JAXB classes. ");
        return jaxbClasses;
    }
/**
     *  Loads the Groovy classes referenced in these definitions.
     */
Loads the Groovy classes referenced in these definitions.
Loads the Groovy classes referenced in these definitions .
private static Map<String, Class<? extends IConfigFragment>> loadJaxbClasses(
            MigratorDefinition desc ) throws MigrationException
    {
        Map<String, Class<? extends IConfigFragment>> jaxbClasses = new HashMap();
        List<Exception> problems  = new LinkedList();
        for( JaxbClassDef jaxbClsBean : desc.jaxbBeansClasses ) {
            try {
                String className = StringUtils.substringAfter( jaxbClsBean.file.getName(), "." );
                Class cls = jaxbClasses.get( className );
                if( cls == null ){
                    log.debug("    Loading JAXB class from dir " + desc.getOrigin() );
                    File dir = desc.getOrigin().getFile().getParentFile();
                    final File groovyFile = new File( dir, jaxbClsBean.file.getPath() );
                    cls = loadGroovyClass( groovyFile );
                    if( ! IConfigFragment.class.isAssignableFrom( cls ) ){
                        problems.add( new MigrationException("Groovy class from '"+groovyFile.getPath()+
                            "' doesn't implement " + IConfigFragment.class.getSimpleName() + ": " + cls.getName()));
                        continue;
                    }
                    jaxbClasses.put( className, cls );
                }
            }
            catch( Exception ex ){
                problems.add(ex);
            }
        }
        MigrationExceptions.wrapExceptions( problems, "Failed loading JAXB classes. ");
        return jaxbClasses;
    }
private static Map < String , Class < ? extends IConfigFragment > > loadJaxbClasses ( MigratorDefinition desc ) throws MigrationException { Map < String , Class < ? extends IConfigFragment > > jaxbClasses = new HashMap ( ) ; List < Exception > problems = new LinkedList ( ) ; for ( JaxbClassDef jaxbClsBean : desc . jaxbBeansClasses ) { try { String className = StringUtils . substringAfter ( jaxbClsBean . file . getName ( ) , "." ) ; Class cls = jaxbClasses . get ( className ) ; if ( cls == null ) { log . debug ( "    Loading JAXB class from dir " + desc . getOrigin ( ) ) ; File dir = desc . getOrigin ( ) . getFile ( ) . getParentFile ( ) ; final File groovyFile = new File ( dir , jaxbClsBean . file . getPath ( ) ) ; cls = loadGroovyClass ( groovyFile ) ; if ( ! IConfigFragment . class . isAssignableFrom ( cls ) ) { problems . add ( new MigrationException ( "Groovy class from '" + groovyFile . getPath ( ) + "' doesn't implement " + IConfigFragment . class . getSimpleName ( ) + ": " + cls . getName ( ) ) ) ; continue ; } jaxbClasses . put ( className , cls ) ; } } catch ( Exception ex ) { problems . add ( ex ) ; } } MigrationExceptions . wrapExceptions ( problems , "Failed loading JAXB classes. " ) ; return jaxbClasses ; }
Loads the Groovy classes referenced in these definitions.
Loads the Groovy classes referenced in these definitions .
// JAXB class... // Look up in the map:  "TestJaxbBean" -> class // Use the directory where the definition XML file is from. //File dir = new File( desc.getLocation().getSystemId() ).getParentFile(); //mig.addJaxbClass( cls );