1 17 package org.apache.servicemix.lwcontainer; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 import org.apache.servicemix.common.BaseComponent; 23 import org.apache.servicemix.common.xbean.AbstractXBeanDeployer; 24 import org.apache.servicemix.jbi.container.ActivationSpec; 25 import org.apache.servicemix.jbi.container.SpringServiceUnitContainer; 26 import org.apache.xbean.kernel.Kernel; 27 import org.apache.xbean.kernel.StringServiceName; 28 29 public class LwContainerXBeanDeployer extends AbstractXBeanDeployer { 30 31 public LwContainerXBeanDeployer(BaseComponent component) { 32 super(component); 33 } 34 35 protected String getXBeanFile() { 36 return "servicemix"; 37 } 38 39 protected List getServices(Kernel kernel) { 40 try { 41 Object jbi = kernel.getService(new StringServiceName("jbi")); 42 SpringServiceUnitContainer suContainer = (SpringServiceUnitContainer) jbi; 43 ActivationSpec[] specs = suContainer.getActivationSpecs(); 44 List services = new ArrayList (); 45 for (int i = 0; i < specs.length; i++) { 46 services.add(new LwContainerEndpoint(specs[i])); 47 } 48 return services; 49 } catch (Exception e) { 50 throw new RuntimeException ("Can not find 'jbi' bean", e); 51 } 52 } 53 54 } 55 | Popular Tags |