private WroManagerFactory initFactory ( final Properties properties ) { WroManagerFactory factory = null ; final String wroManagerClassName = properties . getProperty ( ConfigConstants . managerFactoryClassName . name ( ) ) ; if ( StringUtils . isEmpty ( wroManagerClassName ) ) { // If no context param was specified we return the default factory factory = newManagerFactory ( ) ; } else { // Try to find the specified factory class Class < ? > factoryClass = null ; try { factoryClass = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( wroManagerClassName ) ; factory = ( WroManagerFactory ) factoryClass . newInstance ( ) ; } catch ( final Exception e ) { throw new WroRuntimeException ( "Exception while loading WroManagerFactory class:" + wroManagerClassName , e ) ; } } // add properties if required if ( factory instanceof ConfigurableWroManagerFactory ) { ( ( ConfigurableWroManagerFactory ) factory ) . addConfigProperties ( properties ) ; } return factory ; }
Initialized inner factory based on provided configuration .