1 7 package org.jboss.webservice; 8 9 11 import org.jboss.deployment.DeploymentException; 12 import org.jboss.deployment.DeploymentInfo; 13 import org.jboss.logging.Logger; 14 import org.jboss.mx.util.MBeanProxy; 15 import org.jboss.mx.util.MBeanProxyCreationException; 16 import org.jboss.mx.util.MBeanServerLocator; 17 import org.jboss.mx.util.ObjectNameFactory; 18 19 import javax.management.MBeanServer ; 20 import javax.management.ObjectName ; 21 import javax.naming.Context ; 22 import java.util.Iterator ; 23 24 30 public class WebServiceClientHandler 31 { 32 private static final Logger log = Logger.getLogger(WebServiceClientHandler.class); 34 35 43 public static void setupServiceRefEnvironment(Context envCtx, Iterator serviceRefs, DeploymentInfo di) throws DeploymentException 44 { 45 if (serviceRefs.hasNext() == false) 47 return; 48 49 MBeanServer server = MBeanServerLocator.locateJBoss(); 50 ObjectName ws4eeObjectName = ObjectNameFactory.create("jboss.ws4ee:service=ServiceClientDeployer"); 51 ObjectName jbosswsObjectName = ObjectNameFactory.create("jboss.ws:service=WebServiceClientDeployer"); 52 53 ObjectName objectName = null; 54 WebServiceClientDeployment wsClientDeployment; 55 try 56 { 57 if (server.isRegistered(ws4eeObjectName)) 58 { 59 objectName = ws4eeObjectName; 60 wsClientDeployment = (WebServiceClientDeployment)MBeanProxy.get(WebServiceClientDeployment.class, ws4eeObjectName, server); 61 } 62 else if (server.isRegistered(jbosswsObjectName)) 63 { 64 objectName = jbosswsObjectName; 65 wsClientDeployment = (WebServiceClientDeployment)MBeanProxy.get(WebServiceClientDeployment.class, jbosswsObjectName, server); 66 } 67 else 68 { 69 log.warn("No web service client deployer registered"); 70 return; 71 } 72 } 73 catch (MBeanProxyCreationException e) 74 { 75 throw new DeploymentException("Cannot create proxy to the web service client deployer: " + objectName); 76 } 77 78 wsClientDeployment.setupServiceRefEnvironment(envCtx, serviceRefs, di); 80 } 81 } 82 | Popular Tags |