FileDocCategorySizeDatePackage
WebServiceEndpointNode.javaAPI DocGlassfish v2 API9236Fri May 04 22:31:38 BST 2007com.sun.enterprise.deployment.node

WebServiceEndpointNode

public class WebServiceEndpointNode extends DisplayableComponentNode
This node handles the web service endpoint definition
author
Jerome Dochez

Fields Summary
private static final XMLElement
tag
Constructors Summary
public WebServiceEndpointNode()
Creates a new instance of WebServiceEndpointNode


           
      
        super();
        registerElementHandler
            (new XMLElement(WebServicesTagNames.HANDLER),
             WebServiceHandlerNode.class, "addHandler");
        registerElementHandler
            (new XMLElement(WebServicesTagNames.HANDLER_CHAIN),
             WebServiceHandlerChainNode.class, "addHandlerChain");
    
Methods Summary
protected java.util.MapgetDispatchTable()
all sub-implementation of this class can use a dispatch table to map xml element to method name on the descriptor class for setting the element value.

return
the map with the element name as a key, the setter method as a value

        Map table = super.getDispatchTable();
        table.put(WebServicesTagNames.PORT_COMPONENT_NAME, "setEndpointName");
        table.put(WebServicesTagNames.SERVICE_ENDPOINT_INTERFACE, 
                  "setServiceEndpointInterface");
        table.put(WebServicesTagNames.PROTOCOL_BINDING, "setProtocolBinding");
        table.put(WebServicesTagNames.ENABLE_MTOM, "setMtomEnabled");
        return table;
    
protected XMLElementgetXMLRootTag()

return
the XML tag associated with this XMLNode

        return tag;
    
public voidsetElementValue(XMLElement element, java.lang.String value)
receives notification of the value for a particular tag

param
element the xml element
param
value it's associated value

        String elementName = element.getQName();
        WebServiceEndpoint endpoint = (WebServiceEndpoint) getDescriptor();
        if (WebServicesTagNames.EJB_LINK.equals(elementName)) {
            endpoint.setEjbLink(value);
        } else if (WebServicesTagNames.SERVLET_LINK.equals(elementName)) {
            endpoint.setWebComponentLink(value);
        } else if (WebServicesTagNames.WSDL_PORT.equals(elementName)) {
            String prefix = getPrefixFromQName(value);
            String localPart = getLocalPartFromQName(value);
            String namespaceUri = resolvePrefix(element, prefix);
            if( namespaceUri == null) {
                DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.invalidDescriptorMappingFailure",
                    new Object[] {prefix , value });
            } else {
                QName wsdlPort = new QName(namespaceUri, localPart);
                endpoint.setWsdlPort(wsdlPort, prefix);
            }
        } else if(WebServicesTagNames.WSDL_SERVICE.equals(elementName)) {
            String prefix = getPrefixFromQName(value);
            String localPart = getLocalPartFromQName(value);
            String namespaceUri = resolvePrefix(element, prefix);
            if( namespaceUri == null) {
                DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.invalidDescriptorMappingFailure",
                    new Object[] {prefix , value });
            } else {
                QName wsdlSvc = new QName(namespaceUri, localPart);
                endpoint.setWsdlService(wsdlSvc, prefix);
            }
        } else super.setElementValue(element, value);
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.WebServiceEndpoint descriptor)
write the method descriptor class to a query-method DOM tree and return it

param
parent node in the DOM tree
param
node name for the root element of this xml fragment
param
the descriptor to write
return
the DOM tree top node

        
        Node wseNode = super.writeDescriptor(parent, nodeName, descriptor);

        writeDisplayableComponentInfo(wseNode, descriptor);

        appendTextChild(wseNode, 
                        WebServicesTagNames.PORT_COMPONENT_NAME,
                        descriptor.getEndpointName());
        
        QName wsdlService = descriptor.getWsdlService();
        if((wsdlService!=null) &&
            (wsdlService.getLocalPart().length() != 0)) {
            appendQNameChild(WebServicesTagNames.WSDL_SERVICE, wseNode, 
                         wsdlService.getNamespaceURI(), wsdlService.getLocalPart(),
                         descriptor.getWsdlServiceNamespacePrefix());
        }
        
        QName wsdlPort = descriptor.getWsdlPort();
        if((wsdlPort!=null) &&
            (wsdlPort.getLocalPart().length() != 0)) {
            appendQNameChild(WebServicesTagNames.WSDL_PORT, wseNode, 
                         wsdlPort.getNamespaceURI(), wsdlPort.getLocalPart(),
                         descriptor.getWsdlPortNamespacePrefix());
        }

        appendTextChild(wseNode, 
                        WebServicesTagNames.ENABLE_MTOM,
                        descriptor.getMtomEnabled());
        if(descriptor.hasUserSpecifiedProtocolBinding()) {
            appendTextChild(wseNode, 
                        WebServicesTagNames.PROTOCOL_BINDING,
                        descriptor.getProtocolBinding());            
        }
        
        appendTextChild(wseNode, 
                        WebServicesTagNames.SERVICE_ENDPOINT_INTERFACE, 
                        descriptor.getServiceEndpointInterface());
        
        if( descriptor.implementedByWebComponent() ) {
            Node linkNode = 
                appendChild(wseNode, WebServicesTagNames.SERVICE_IMPL_BEAN);
            appendTextChild(linkNode, WebServicesTagNames.SERVLET_LINK,
                            descriptor.getWebComponentLink());
        } else if( descriptor.implementedByEjbComponent() ) {
            Node linkNode = 
                appendChild(wseNode, WebServicesTagNames.SERVICE_IMPL_BEAN);
            appendTextChild(linkNode, WebServicesTagNames.EJB_LINK,
                            descriptor.getEjbLink());
        } else {
            DOLUtils.getDefaultLogger().log
                (Level.INFO, "Warning : Web service endpoint " +
                 descriptor.getEndpointName() + " is not tied to a component");
        }

        WebServiceHandlerNode handlerNode = new WebServiceHandlerNode();
        handlerNode.writeWebServiceHandlers(wseNode, 
                                            descriptor.getHandlers());

        WebServiceHandlerChainNode handlerChainNode = new WebServiceHandlerChainNode();
        handlerChainNode.writeWebServiceHandlerChains(wseNode, descriptor.getHandlerChain());
        return wseNode;