1 17 18 package org.apache.geronimo.cxf; 19 20 import org.apache.cxf.Bus; 21 import org.apache.cxf.bus.cxf.CXFBusFactory; 22 import org.apache.geronimo.gbean.GBeanInfo; 23 import org.apache.geronimo.gbean.GBeanInfoBuilder; 24 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 25 import org.apache.geronimo.webservices.WebServiceContainer; 26 import org.apache.geronimo.webservices.WebServiceContainerFactory; 27 28 31 public class CXFWebServiceContainerFactoryGBean implements WebServiceContainerFactory { 32 33 private final PortInfo portInfo; 34 private final Bus bus; 35 private final Object endpointInstance; 36 37 public CXFWebServiceContainerFactoryGBean(PortInfo portInfo, String endpointClassName, ClassLoader classLoader) throws ClassNotFoundException , IllegalAccessException , InstantiationException { 38 this.portInfo = portInfo; 39 this.bus = new CXFBusFactory().getDefaultBus(); 40 Class endpointClass = classLoader.loadClass(endpointClassName); 41 endpointInstance = endpointClass.newInstance(); 42 } 43 44 public WebServiceContainer getWebServiceContainer() { 45 return new CXFWebServiceContainer(portInfo, endpointInstance, bus); 46 } 47 48 public static final GBeanInfo GBEAN_INFO; 49 50 static { 51 GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CXFWebServiceContainerFactoryGBean.class, NameFactory.GERONIMO_SERVICE); 52 infoBuilder.addAttribute("portInfo", PortInfo.class, true, true); 53 infoBuilder.addAttribute("endpointClassName", String .class, true, true); 54 infoBuilder.addAttribute("classLoader", ClassLoader .class, false); 55 infoBuilder.setConstructor(new String [] {"portInfo", "endpointClassName", "classLoader"}); 56 GBEAN_INFO = infoBuilder.getBeanInfo(); 57 } 58 59 public static GBeanInfo getGBeanInfo() { 60 return GBEAN_INFO; 61 } 62 } 63 | Popular Tags |