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

MethodNode

public class MethodNode extends DeploymentDescriptorNode
This class handle the method element
author
Jerome Dochez
version

Fields Summary
Constructors Summary
Methods Summary
public booleanendElement(XMLElement element)
receives notification of the end of an XML element by the Parser

param
element the xml tag identification
return
true if this node is done processing the XML sub tree

        String qname = element.getQName();
        if (EjbTagNames.METHOD_PARAMS.equals(qname)) {
            MethodDescriptor desc = (MethodDescriptor) getDescriptor();
            // this means we have an empty method-params element
            // which means this method has no input parameter
            if (desc.getParameterClassNames() == null) {
                desc.setEmptyParameterClassNames();
            }
        }
        return super.endElement(element);
    
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(EjbTagNames.EJB_NAME, "setEjbName");
        table.put(EjbTagNames.METHOD_INTF, "setEjbClassSymbol");
        table.put(EjbTagNames.METHOD_NAME, "setName");
        table.put(EjbTagNames.METHOD_PARAM, "addParameterClass");        
        return table;
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.MethodDescriptor descriptor, java.lang.String ejbName)
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 methodNode = super.writeDescriptor(parent, nodeName, descriptor);    
        writeLocalizedDescriptions(methodNode, descriptor);
        if (ejbName != null && ejbName.length() > 0)  {
            appendTextChild(methodNode, EjbTagNames.EJB_NAME, ejbName);        
        }
        String methodIntfSymbol = descriptor.getEjbClassSymbol();
        if( (methodIntfSymbol != null) &&
            !methodIntfSymbol.equals(MethodDescriptor.EJB_BEAN) ) {
            appendTextChild(methodNode, EjbTagNames.METHOD_INTF, 
                            methodIntfSymbol);
        }
        appendTextChild(methodNode, EjbTagNames.METHOD_NAME, descriptor.getName());
        if (descriptor.getParameterClassNames()!=null) {
            Node paramsNode = appendChild(methodNode, EjbTagNames.METHOD_PARAMS);            
            writeMethodParams(paramsNode, descriptor);                
        }
        return methodNode;
    
public org.w3c.dom.NodewriteJavaMethodDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.MethodDescriptor descriptor)
write the method descriptor class to a java-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

        // Write out the java method description.  In the case of a void
        // method, a <method-params> element will *not* be written out.
        return writeJavaMethodDescriptor(parent, nodeName, descriptor, false);
    
public org.w3c.dom.NodewriteJavaMethodDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.MethodDescriptor descriptor, boolean writeEmptyMethodParamsElementForVoidMethods)
write the method descriptor class to a java-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 methodNode = super.writeDescriptor(parent, nodeName, descriptor);
        appendTextChild(methodNode, RuntimeTagNames.METHOD_NAME, 
            descriptor.getName());    
        if (descriptor.getParameterClassNames() != null) {
            Node paramsNode = 
                appendChild(methodNode, RuntimeTagNames.METHOD_PARAMS); 
            writeMethodParams(paramsNode, descriptor);            
        } else {
            if( writeEmptyMethodParamsElementForVoidMethods ) {
                appendChild(methodNode, RuntimeTagNames.METHOD_PARAMS); 
            }
        }
        return methodNode;
    
private voidwriteMethodParams(org.w3c.dom.Node paramsNode, com.sun.enterprise.deployment.MethodDescriptor descriptor)
writes the method parameters to the DOM Tree

param
the parent node for the parameters
param
the method descriptor

        String[] params = descriptor.getParameterClassNames();
        if (params==null) 
            return;
        for (int i=0; i<params.length;i++) {
            appendTextChild(paramsNode, RuntimeTagNames.METHOD_PARAM, params[i]);
        }
    
public org.w3c.dom.NodewriteQueryMethodDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.MethodDescriptor 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 methodNode = super.writeDescriptor(parent, nodeName, descriptor);
        appendTextChild(methodNode, EjbTagNames.METHOD_NAME, descriptor.getName());
        Node paramsNode = appendChild(methodNode, EjbTagNames.METHOD_PARAMS);        
        writeMethodParams(paramsNode, descriptor);           
        return methodNode;