1 23 package com.sun.enterprise.deployment.node.runtime; 24 25 import java.util.*; 26 import org.w3c.dom.Node ; 27 import java.util.logging.Level ; 28 29 import javax.xml.namespace.QName ; 30 import com.sun.enterprise.deployment.node.XMLElement; 31 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 32 import com.sun.enterprise.deployment.WebServiceEndpoint; 33 import com.sun.enterprise.deployment.WebService; 34 import com.sun.enterprise.deployment.WebServicesDescriptor; 35 import com.sun.enterprise.deployment.WebBundleDescriptor; 36 import com.sun.enterprise.deployment.BundleDescriptor; 37 import com.sun.enterprise.deployment.EjbBundleDescriptor; 38 import com.sun.enterprise.deployment.Descriptor; 39 import com.sun.enterprise.deployment.node.runtime.web.WebBundleRuntimeNode; 40 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 41 import com.sun.enterprise.deployment.xml.WebServicesTagNames; 42 43 import java.net.URL ; 44 import java.net.MalformedURLException ; 45 46 import com.sun.enterprise.deployment.util.DOLUtils; 47 48 54 public class WebServiceRuntimeNode extends DeploymentDescriptorNode { 55 56 private WebService descriptor; 57 58 public Object getDescriptor() { 59 return descriptor; 60 } 61 62 68 69 public void setElementValue(XMLElement element, String value) { 70 if (WebServicesTagNames.WEB_SERVICE_DESCRIPTION_NAME.equals 71 (element.getQName())) { 72 BundleDescriptor parent; 73 if (getParentNode() instanceof WebBundleRuntimeNode) { 74 parent = ((WebBundleRuntimeNode) getParentNode()).getWebBundleDescriptor(); 75 } else { 76 parent = (BundleDescriptor) getParentNode().getDescriptor(); 77 } 78 WebServicesDescriptor webServices = parent.getWebServices(); 79 descriptor = webServices.getWebServiceByName(value); 80 } else if( WebServicesTagNames.CLIENT_WSDL_PUBLISH_URL.equals 81 (element.getQName()) ) { 82 if( descriptor == null ) { 83 DOLUtils.getDefaultLogger().info 84 ("Warning : WebService descriptor is null for " 85 + "final wsdl url=" + value); 86 return; 87 } 88 try { 89 URL url = new URL (value); 90 descriptor.setClientPublishUrl(url); 91 } catch(MalformedURLException mue) { 92 DOLUtils.getDefaultLogger().log(Level.INFO, 93 "Warning : Invalid final wsdl url=" + value, mue); 94 } 95 } else { 96 super.setElementValue(element, value); 97 } 98 } 99 100 108 public Node writeDescriptor(Node parent, String nodeName, 109 WebService webService) { 110 Node webServiceNode = 111 super.writeDescriptor(parent, nodeName, webService); 112 113 appendTextChild(webServiceNode, 114 WebServicesTagNames.WEB_SERVICE_DESCRIPTION_NAME, 115 webService.getName()); 116 117 if( webService.hasClientPublishUrl() ) { 118 URL url = webService.getClientPublishUrl(); 119 appendTextChild(webServiceNode, 120 WebServicesTagNames.CLIENT_WSDL_PUBLISH_URL, 121 url.toExternalForm()); 122 } 123 124 return webServiceNode; 125 } 126 127 134 public void writeWebServiceRuntimeInfo(Node parent, 135 BundleDescriptor bundle) { 136 WebServicesDescriptor webServices = bundle.getWebServices(); 137 if( webServices != null ) { 138 for(Iterator iter = webServices.getWebServices().iterator(); 139 iter.hasNext();) { 140 WebService next = (WebService) iter.next(); 141 if( next.hasClientPublishUrl() ) { 142 writeDescriptor 143 (parent, WebServicesTagNames.WEB_SERVICE, next); 144 } 145 } 146 } 147 } 148 149 } 150 | Popular Tags |