1 15 package org.apache.hivemind.lib.impl; 16 17 import org.apache.hivemind.ServiceImplementationFactory; 18 import org.apache.hivemind.ServiceImplementationFactoryParameters; 19 import org.apache.hivemind.impl.BaseLocatable; 20 import org.springframework.beans.factory.BeanFactory; 21 22 29 public class SpringLookupFactory extends BaseLocatable implements ServiceImplementationFactory 30 { 31 32 private BeanFactory _defaultBeanFactory; 33 34 public Object createCoreServiceImplementation( 35 ServiceImplementationFactoryParameters factoryParameters) 36 { 37 SpringBeanParameter p = (SpringBeanParameter) factoryParameters.getFirstParameter(); 38 String beanName = p.getName(); 39 40 BeanFactory f = p.getBeanFactory(); 41 42 if (f == null) 43 f = _defaultBeanFactory; 44 45 return f.getBean(beanName, factoryParameters.getServiceInterface()); 46 } 47 48 49 public void setDefaultBeanFactory(BeanFactory defaultBeanFactory) 50 { 51 _defaultBeanFactory = defaultBeanFactory; 52 } 53 } | Popular Tags |