1 23 24 package com.sun.enterprise.deployment.node; 25 26 import java.util.Iterator ; 27 import java.util.Map ; 28 import java.util.logging.Level ; 29 30 import java.util.List ; 31 import org.w3c.dom.Node ; 32 import org.xml.sax.Attributes ; 33 34 import javax.xml.namespace.QName ; 35 36 import com.sun.enterprise.deployment.util.DOLUtils; 37 import com.sun.enterprise.deployment.WebServiceHandlerChain; 38 import com.sun.enterprise.deployment.xml.TagNames; 39 import com.sun.enterprise.deployment.xml.WebServicesTagNames; 40 41 public class WebServiceHandlerChainNode extends DisplayableComponentNode { 42 43 private final static XMLElement tag = 44 new XMLElement(WebServicesTagNames.HANDLER_CHAIN); 45 46 public WebServiceHandlerChainNode() { 47 super(); 48 registerElementHandler 49 (new XMLElement(WebServicesTagNames.HANDLER), 50 WebServiceHandlerNode.class, "addHandler"); 51 } 52 53 56 protected XMLElement getXMLRootTag() { 57 return tag; 58 } 59 60 66 protected Map getDispatchTable() { 67 Map table = super.getDispatchTable(); 68 table.put(WebServicesTagNames.SERVICE_NAME_PATTERN, "setServiceNamePattern"); 69 table.put(WebServicesTagNames.PORT_NAME_PATTERN, "setPortNamePattern"); 70 table.put(WebServicesTagNames.PROTOCOL_BINDINGS, "setProtocolBindings"); 71 return table; 72 } 73 74 80 public void setElementValue(XMLElement element, String value) { 81 super.setElementValue(element, value); 82 } 83 84 93 public Node writeDescriptor(Node parent, String nodeName, 94 WebServiceHandlerChain handler) { 95 Node wshNode = super.writeDescriptor(parent, nodeName, handler); 96 97 if(handler.getServiceNamePattern() != null) { 98 appendTextChild(wshNode, 99 WebServicesTagNames.SERVICE_NAME_PATTERN, 100 handler.getServiceNamePattern()); 101 } 102 if(handler.getPortNamePattern() != null) { 103 appendTextChild(wshNode, 104 WebServicesTagNames.PORT_NAME_PATTERN, 105 handler.getPortNamePattern()); 106 } 107 if(handler.getProtocolBindings() != null) { 108 appendTextChild(wshNode, 109 WebServicesTagNames.PROTOCOL_BINDINGS, 110 handler.getProtocolBindings()); 111 } 112 WebServiceHandlerNode handlerNode = new WebServiceHandlerNode(); 113 handlerNode.writeWebServiceHandlers(wshNode, handler.getHandlers()); 114 return wshNode; 115 } 116 117 public void writeWebServiceHandlerChains(Node parent, List handlerChain) { 118 if(handlerChain.size() != 0) { 121 parent = super.writeDescriptor(parent, WebServicesTagNames.HANDLER_CHAINS, null); 122 } 123 for(Iterator iter = handlerChain.iterator(); iter.hasNext();) { 124 WebServiceHandlerChain next = (WebServiceHandlerChain) iter.next(); 125 writeDescriptor(parent, WebServicesTagNames.HANDLER_CHAIN, next); 126 } 127 } 128 129 } 130 | Popular Tags |