1 18 package org.apache.activemq.tool.spi; 19 20 import org.apache.activemq.tool.properties.ReflectionUtil; 21 22 import javax.jms.ConnectionFactory ; 23 import java.util.Properties ; 24 25 public abstract class ReflectionSPIConnectionFactory extends ClassLoaderSPIConnectionFactory { 26 27 public ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception { 28 Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(getClassName()); 29 ConnectionFactory factory = (ConnectionFactory )factoryClass.newInstance(); 30 configureConnectionFactory(factory, settings); 31 return factory; 32 } 33 34 public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception { 35 ReflectionUtil.configureClass(jmsFactory, settings); 36 } 37 38 public abstract String getClassName(); 39 } 40 | Popular Tags |