1 23 package com.sun.enterprise.deployment.node.runtime; 24 25 import java.util.Map ; 26 import java.util.Set ; 27 import java.util.Iterator ; 28 import java.util.logging.Level ; 29 import org.w3c.dom.Node ; 30 31 import javax.xml.namespace.QName ; 32 import com.sun.enterprise.deployment.node.XMLElement; 33 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 34 import com.sun.enterprise.deployment.ServiceReferenceDescriptor; 35 import com.sun.enterprise.deployment.xml.WebServicesTagNames; 36 import com.sun.enterprise.deployment.ServiceRefPortInfo; 37 import com.sun.enterprise.deployment.NameValuePairDescriptor; 38 import com.sun.enterprise.deployment.node.NameValuePairNode; 39 import com.sun.enterprise.deployment.node.runtime.common.MessageSecurityBindingNode; 40 import com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor; 41 42 import com.sun.enterprise.deployment.util.DOLUtils; 43 44 51 public class ServiceRefPortInfoRuntimeNode extends DeploymentDescriptorNode { 52 53 private String namespaceUri; 54 55 public ServiceRefPortInfoRuntimeNode() { 56 super(); 57 registerElementHandler 58 (new XMLElement(WebServicesTagNames.STUB_PROPERTY), 59 NameValuePairNode.class, "addStubProperty"); 60 registerElementHandler 61 (new XMLElement(WebServicesTagNames.CALL_PROPERTY), 62 NameValuePairNode.class, "addCallProperty"); 63 registerElementHandler(new XMLElement(WebServicesTagNames.MESSAGE_SECURITY_BINDING), MessageSecurityBindingNode.class, "setMessageSecurityBinding"); 64 } 65 66 72 protected Map getDispatchTable() { 73 Map table = super.getDispatchTable(); 74 table.put(WebServicesTagNames.SERVICE_ENDPOINT_INTERFACE, 75 "setServiceEndpointInterface"); 76 return table; 77 } 78 79 85 86 public void setElementValue(XMLElement element, String value) { 87 String name = element.getQName(); 88 if (WebServicesTagNames.NAMESPACE_URI.equals(name)) { 89 namespaceUri = value; 90 } else if (WebServicesTagNames.LOCAL_PART.equals(name)) { 91 ServiceRefPortInfo desc = (ServiceRefPortInfo) 92 getDescriptor(); 93 QName wsdlPort = new QName (namespaceUri, value); 94 desc.setWsdlPort(wsdlPort); 95 namespaceUri = null; 96 } else super.setElementValue(element, value); 97 98 } 99 100 108 public Node writeDescriptor(Node parent, String nodeName, 109 ServiceRefPortInfo desc) { 110 Node serviceRefPortInfoRuntimeNode = 111 super.writeDescriptor(parent, nodeName, desc); 112 113 appendTextChild(serviceRefPortInfoRuntimeNode, 114 WebServicesTagNames.SERVICE_ENDPOINT_INTERFACE, 115 desc.getServiceEndpointInterface()); 116 117 QName port = desc.getWsdlPort(); 118 119 if( port != null ) { 120 Node wsdlPortNode = appendChild(serviceRefPortInfoRuntimeNode, 121 WebServicesTagNames.WSDL_PORT); 122 appendTextChild(wsdlPortNode, 123 WebServicesTagNames.NAMESPACE_URI, 124 port.getNamespaceURI()); 125 appendTextChild(wsdlPortNode, 126 WebServicesTagNames.LOCAL_PART, 127 port.getLocalPart()); 128 } 129 130 132 NameValuePairNode nameValueNode = new NameValuePairNode(); 133 134 Set stubProperties = desc.getStubProperties(); 135 for(Iterator iter = stubProperties.iterator(); iter.hasNext();) { 136 NameValuePairDescriptor next = (NameValuePairDescriptor)iter.next(); 137 nameValueNode.writeDescriptor 138 (serviceRefPortInfoRuntimeNode, 139 WebServicesTagNames.STUB_PROPERTY, next); 140 } 141 142 for(Iterator iter = desc.getCallProperties().iterator(); 144 iter.hasNext();) { 145 NameValuePairDescriptor next = (NameValuePairDescriptor)iter.next(); 146 nameValueNode.writeDescriptor 147 (serviceRefPortInfoRuntimeNode, 148 WebServicesTagNames.CALL_PROPERTY, next); 149 } 150 151 MessageSecurityBindingDescriptor messageSecBindingDesc = 153 desc.getMessageSecurityBinding(); 154 if (messageSecBindingDesc != null) { 155 MessageSecurityBindingNode messageSecBindingNode = 156 new MessageSecurityBindingNode(); 157 messageSecBindingNode.writeDescriptor(serviceRefPortInfoRuntimeNode, WebServicesTagNames.MESSAGE_SECURITY_BINDING, messageSecBindingDesc); 158 } 159 160 return serviceRefPortInfoRuntimeNode; 161 } 162 163 } 164 | Popular Tags |