1 22 package org.jboss.injection; 23 24 26 import javax.naming.Context ; 27 import javax.xml.ws.WebServiceException; 28 import javax.xml.ws.WebServiceRef; 29 30 import org.jboss.logging.Logger; 31 import org.jboss.metamodel.descriptor.ServiceRef; 32 import org.jboss.ws.jaxws.injection.WebServiceRefDeployer; 33 34 40 public class WebServiceRefInjector implements EncInjector 41 { 42 private static final Logger log = Logger.getLogger(WebServiceRefInjector.class); 43 44 private Context ctx; 45 private String name; 46 private Class refType; 47 private String refTypeName; 48 private WebServiceRef wsref; 49 private ServiceRef sref; 50 51 public WebServiceRefInjector(Context ctx, String name, Class refType, WebServiceRef wsref, ServiceRef sref) 52 { 53 this.ctx = ctx; 54 this.name = name; 55 this.refType = refType; 56 this.wsref = wsref; 57 this.sref = sref; 58 this.refTypeName = (refType != null ? refType.getName() : null); 59 } 60 61 public void inject(InjectionContainer container) 62 { 63 try 64 { 65 WebServiceRefDeployer.setupWebServiceRef(ctx, name, refType, wsref, getAdaptedServiceRef()); 66 log.debug("@WebServiceRef bound [env=" + name + ",ref=" + refTypeName + "]"); 67 } 68 catch (Exception e) 69 { 70 throw new WebServiceException("Unable to bind @WebServiceRef [enc=" + name + ",type=" + refTypeName + "]", e); 71 } 72 } 73 74 private org.jboss.ws.jaxws.injection.ServiceRef getAdaptedServiceRef() 75 { 76 org.jboss.ws.jaxws.injection.ServiceRef newRef = new org.jboss.ws.jaxws.injection.ServiceRef(); 77 newRef.setEncName(sref.getEncName()); 78 newRef.setWsdlLocation(sref.getWsdlLocation()); 79 newRef.setConfigName(sref.getConfigName()); 80 newRef.setConfigFile(sref.getConfigFile()); 81 return newRef; 82 } 83 84 public String toString() 85 { 86 return super.toString() + "{enc=" + name + ",type=" + refTypeName + "}"; 87 } 88 } 89 | Popular Tags |