private synchronized void initialize ( ) { Iterator types = EntityTypesLocator . getEntityTypes ( ) . getAllEntityTypes ( ) ; String factoryName = null ; while ( types . hasNext ( ) ) { Class type = ( Class ) types . next ( ) ; if ( type != Object . class ) { String factoryKey = "org.apereo.portal.services.EntityNameFinderService.NameFinderFactory.implementation_" + type . getName ( ) ; try { factoryName = PropertiesManager . getProperty ( factoryKey ) ; } catch ( Exception runtime ) { String dMsg = "EntityNameFinderService.initialize(): " + "could not find property for " + type . getName ( ) + " factory." ; log . debug ( dMsg ) ; } if ( factoryName != null ) { try { IEntityNameFinderFactory factory = ( IEntityNameFinderFactory ) Class . forName ( factoryName ) . newInstance ( ) ; getNameFinders ( ) . put ( type , factory . newFinder ( ) ) ; } catch ( Exception e ) { String eMsg = "EntityNameFinderService.initialize(): " + "Could not instantiate finder for " + type . getName ( ) + ": " ; log . error ( eMsg , e ) ; } } } } setInitialized ( true ) ; }
Gets all the entity types and tries to instantiate and cache a finder for each one . There needn t be a finder for every entity type so if there s no entry in the portal . properties we just log the fact and continue .