private void loadPlugins ( ) { final List < T > finalPluginsList = new ArrayList < T > ( ) ; pluginsList = new ArrayList < T > ( ) ; pluginsMap = new HashMap < String , T > ( ) ; String className = null ; try { final Class < T > [ ] classes = getClasses ( ) ; for ( final Class < T > clazz : classes ) { className = clazz . getName ( ) ; final T plugin = clazz . newInstance ( ) ; if ( plugin instanceof DelegatingModuleParser ) { ( ( DelegatingModuleParser ) plugin ) . setFeedParser ( parentParser ) ; } if ( plugin instanceof DelegatingModuleGenerator ) { ( ( DelegatingModuleGenerator ) plugin ) . setFeedGenerator ( parentGenerator ) ; } pluginsMap . put ( getKey ( plugin ) , plugin ) ; // to preserve the order of definition in the rome.properties files pluginsList . add ( plugin ) ; } final Collection < T > plugins = pluginsMap . values ( ) ; for ( final T plugin : plugins ) { // to remove overridden plugin impls finalPluginsList . add ( plugin ) ; } final Iterator < T > iterator = pluginsList . iterator ( ) ; while ( iterator . hasNext ( ) ) { final T plugin = iterator . next ( ) ; if ( ! finalPluginsList . contains ( plugin ) ) { iterator . remove ( ) ; } } } catch ( final Exception ex ) { throw new RuntimeException ( "could not instantiate plugin " + className , ex ) ; } catch ( final ExceptionInInitializerError er ) { throw new RuntimeException ( "could not instantiate plugin " + className , er ) ; } }
PRIVATE - LOADER PART