1 22 package org.objectweb.petals.binding.axis2; 23 24 import java.io.File ; 25 import java.util.logging.Level ; 26 27 import javax.jbi.JBIException; 28 29 import org.apache.axis2.AxisFault; 30 import org.apache.axis2.context.ConfigurationContext; 31 import org.apache.axis2.context.ConfigurationContextFactory; 32 import org.objectweb.petals.binding.axis2.listener.jbi.JBIListener; 33 import org.objectweb.petals.binding.axis2.listener.soap.SOAPListenerManager; 34 import org.objectweb.petals.component.common.bc.AbstractBindingComponent; 35 import org.objectweb.petals.component.common.su.ServiceUnitListener; 36 import org.objectweb.petals.component.common.su.SimpleServiceUnitManager; 37 38 44 public class Axis2BC extends AbstractBindingComponent { 45 46 49 protected JBIListener listener; 50 51 54 protected SOAPListenerManager externalListenerManager; 55 56 60 @Override 61 public void start() throws JBIException { 62 super.start(); 63 try { 64 externalListenerManager.start(); 65 } catch (AxisFault e) { 66 getLogger().severe(e.getMessage()); 67 throw new JBIException(e); 68 } 69 } 70 71 @Override 72 public void stop() throws JBIException { 73 super.stop(); 74 try { 75 externalListenerManager.stop(); 76 } catch (AxisFault e) { 77 getLogger().severe(e.getMessage()); 78 throw new JBIException(e); 79 } 80 } 81 82 @Override 83 protected void init(BindingComponentInitializer initializer) { 84 85 SimpleServiceUnitManager bindingSUM = (SimpleServiceUnitManager) getServiceUnitManager(); 87 88 ConfigurationContext axisConfigurationContext = null; 90 try { 91 axisConfigurationContext = ConfigurationContextFactory 92 .createConfigurationContextFromFileSystem(getContext() 93 .getInstallRoot(), getContext().getInstallRoot() 94 + File.separator + "axis2.xml"); 95 } catch (AxisFault e) { 96 getLogger() 97 .log( 98 Level.INFO, 99 "Can not create AXIS configuration context. " 100 + "Please verify that the axis2.xml file is in your component install root path !"); 101 } 102 103 ServiceUnitListener suListener = new Axis2BCSUListener( 105 axisConfigurationContext, getContext(), getLogger()); 106 setServiceUnitListener(suListener); 107 108 listener = new JBIListener(bindingSUM, getLogger()); 111 112 externalListenerManager = new SOAPListenerManager(getContext(), 114 getChannel(), bindingSUM, axisConfigurationContext, getLogger()); 115 116 initializer.setExternalListenerManager(externalListenerManager); 117 initializer.setJbiListener(listener); 118 119 } 120 } 121 | Popular Tags |