FileDocCategorySizeDatePackage
WebServiceEndpointRuntimeNode.javaAPI DocGlassfish v2 API11753Fri May 04 22:31:42 BST 2007com.sun.enterprise.deployment.node.runtime

WebServiceEndpointRuntimeNode

public class WebServiceEndpointRuntimeNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
This node is responsible for handling runtime info for web service endpoints.
author
Kenneth Saks
version

Fields Summary
private com.sun.enterprise.deployment.Descriptor
descriptor
Constructors Summary
public WebServiceEndpointRuntimeNode()

        registerElementHandler(
            new XMLElement(WebServicesTagNames.MESSAGE_SECURITY_BINDING),
            MessageSecurityBindingNode.class, "setMessageSecurityBinding");

        registerElementHandler(new XMLElement(RuntimeTagNames.PROPERTY), 
                               RuntimeNameValuePairNode.class, "addProperty");
    
Methods Summary
public java.lang.ObjectgetDescriptor()

        return descriptor;
    
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.ENDPOINT_ADDRESS_URI, 
                  "setEndpointAddressUri");
        table.put(WebServicesTagNames.TIE_CLASS, "setTieClassName");
        table.put(WebServicesTagNames.SERVLET_IMPL_CLASS,
                  "setServletImplClass");
        table.put(WebServicesTagNames.DEBUGGING_ENABLED, "setDebugging");
        table.put(WebServicesTagNames.NAMESPACE_URI, "setServiceNamespaceUri");
        table.put(WebServicesTagNames.LOCAL_PART, "setServiceLocalPart");
        table.put(RuntimeTagNames.AUTH_METHOD, "setAuthMethod");
        table.put(RuntimeTagNames.REALM, "setRealm");
        table.put(WebServicesTagNames.TRANSPORT_GUARANTEE, 
                  "setTransportGuarantee");

        return table;
    
public voidsetElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)
receives notiification of the value for a particular tag

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

        if (WebServicesTagNames.PORT_COMPONENT_NAME.equals
            (element.getQName())) {
            Object parentDesc = getParentNode().getDescriptor();
            if (parentDesc instanceof EjbDescriptor) {
                EjbBundleDescriptor bundle = 
                    ((EjbDescriptor) parentDesc).getEjbBundleDescriptor();
                WebServicesDescriptor webServices = bundle.getWebServices();
                descriptor = webServices.getEndpointByName(value);
            } else if( parentDesc instanceof WebComponentDescriptor) {
                WebBundleDescriptor bundle = ((WebComponentDescriptor) parentDesc).getWebBundleDescriptor();
                WebServicesDescriptor webServices = bundle.getWebServices();
                descriptor = webServices.getEndpointByName(value);
            }
            if (descriptor==null) {
                DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.port_component_name_unknown",                
                    new Object[] { value });                        
            }
        } else super.setElementValue(element, value);
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.WebServiceEndpoint endpoint)
write the descriptor class to a DOM tree and return it

param
parent node for the DOM tree
param
node name for the descriptor
param
the descriptor to write
return
the DOM tree top node

        Node endpointNode = 
            super.writeDescriptor(parent, nodeName, endpoint);

        appendTextChild(endpointNode, WebServicesTagNames.PORT_COMPONENT_NAME,
                        endpoint.getEndpointName());
        appendTextChild(endpointNode, WebServicesTagNames.ENDPOINT_ADDRESS_URI,
                        endpoint.getEndpointAddressUri());
        
        // login config only makes sense for ejbs.  For web components,
        // this info is described in web application itself.
        if( endpoint.implementedByEjbComponent() &&
            endpoint.hasAuthMethod() ) {
            Node loginConfigNode = appendChild(endpointNode, 
                                               RuntimeTagNames.LOGIN_CONFIG);
            
            appendTextChild(loginConfigNode, RuntimeTagNames.AUTH_METHOD,
                            endpoint.getAuthMethod());
            appendTextChild(loginConfigNode, RuntimeTagNames.REALM,
                            endpoint.getRealm());
        }

        // message-security-binding
        MessageSecurityBindingDescriptor messageSecBindingDesc = 
            endpoint.getMessageSecurityBinding();
        if (messageSecBindingDesc != null) {
            MessageSecurityBindingNode messageSecBindingNode = 
                new MessageSecurityBindingNode();
            messageSecBindingNode.writeDescriptor(endpointNode, WebServicesTagNames.MESSAGE_SECURITY_BINDING, messageSecBindingDesc);
        }

        appendTextChild(endpointNode, WebServicesTagNames.TRANSPORT_GUARANTEE,
                        endpoint.getTransportGuarantee());

        QName serviceName = endpoint.getServiceName();
        if( serviceName != null ) {
            Node serviceQnameNode = appendChild
                (endpointNode, WebServicesTagNames.SERVICE_QNAME);
                                                
            appendTextChild(serviceQnameNode, WebServicesTagNames.NAMESPACE_URI,
                            serviceName.getNamespaceURI());
            appendTextChild(serviceQnameNode, WebServicesTagNames.LOCAL_PART,
                            serviceName.getLocalPart());
        }

        appendTextChild(endpointNode, WebServicesTagNames.TIE_CLASS,
                        endpoint.getTieClassName());
        
        if( endpoint.implementedByWebComponent() &&
            (endpoint.getServletImplClass() != null) ) {
            appendTextChild(endpointNode, 
                            WebServicesTagNames.SERVLET_IMPL_CLASS,
                            endpoint.getServletImplClass());
        }
        
        //debugging-enabled?
        appendTextChild(endpointNode, WebServicesTagNames.DEBUGGING_ENABLED,
                        endpoint.getDebugging());

        //property*
        Iterator properties = endpoint.getProperties();
        if (properties!=null) {
            RuntimeNameValuePairNode propNode = new RuntimeNameValuePairNode();        
            while (properties.hasNext()) {
                NameValuePairDescriptor aProp = (NameValuePairDescriptor) properties.next();
                propNode.writeDescriptor(endpointNode, RuntimeTagNames.PROPERTY, aProp);
            }
	    }
                            
        return endpointNode;
    
public voidwriteWebServiceEndpointInfo(org.w3c.dom.Node parent, com.sun.enterprise.deployment.EjbDescriptor ejb)
writes all the runtime information for web service endpoints for a given ejb

param
parent node to add the runtime xml info
param
the ejb endpoint

                                            
        EjbBundleDescriptor bundle = ejb.getEjbBundleDescriptor();
        WebServicesDescriptor webServices = bundle.getWebServices();
        Collection endpoints = webServices.getEndpointsImplementedBy(ejb);
        for(Iterator iter = endpoints.iterator(); iter.hasNext();) {
            WebServiceEndpoint next = (WebServiceEndpoint) iter.next();
            writeDescriptor(parent, WebServicesTagNames.WEB_SERVICE_ENDPOINT, 
                            next);
        }
    
public voidwriteWebServiceEndpointInfo(org.w3c.dom.Node parent, com.sun.enterprise.deployment.WebComponentDescriptor webComp)
writes all the runtime information for web service endpoints for a given web component

param
parent node to add the runtime xml info
param
the web component

        
        WebBundleDescriptor bundle = webComp.getWebBundleDescriptor();
        WebServicesDescriptor webServices = bundle.getWebServices();
        Collection endpoints = webServices.getEndpointsImplementedBy(webComp);
        for(Iterator iter = endpoints.iterator(); iter.hasNext();) {
            WebServiceEndpoint next = (WebServiceEndpoint) iter.next();
            writeDescriptor(parent, WebServicesTagNames.WEB_SERVICE_ENDPOINT, 
                            next);
        }