1 17 package org.apache.servicemix.jsr181; 18 19 import javax.jbi.component.ComponentContext; 20 21 import org.apache.servicemix.common.BaseComponent; 22 import org.apache.servicemix.common.BaseLifeCycle; 23 import org.apache.servicemix.jsr181.xfire.JbiTransport; 24 import org.codehaus.xfire.DefaultXFire; 25 import org.codehaus.xfire.XFire; 26 import org.codehaus.xfire.transport.Transport; 27 28 public class Jsr181LifeCycle extends BaseLifeCycle { 29 30 protected XFire xfire; 31 protected Jsr181Configuration configuration; 32 33 public Jsr181LifeCycle(BaseComponent component) { 34 super(component); 35 configuration = new Jsr181Configuration(); 36 } 37 38 41 public Jsr181Configuration getConfiguration() { 42 return configuration; 43 } 44 45 48 protected Object getExtensionMBean() throws Exception { 49 return configuration; 50 } 51 52 55 public XFire getXFire() { 56 return xfire; 57 } 58 59 62 protected void doInit() throws Exception { 63 super.doInit(); 64 configuration.setRootDir(context.getWorkspaceRoot()); 65 configuration.load(); 66 xfire = createXFire(this.context); 67 } 68 69 public static XFire createXFire(ComponentContext context) { 70 XFire xfire = new DefaultXFire(); 71 Object [] transports = xfire.getTransportManager().getTransports().toArray(); 72 for (int i = 0; i < transports.length; i++) { 73 xfire.getTransportManager().unregister((Transport) transports[i]); 74 } 75 xfire.getTransportManager().register(new JbiTransport(context)); 76 return xfire; 77 } 78 79 } 80 | Popular Tags |