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

ContainerTransactionNode

public class ContainerTransactionNode extends DeploymentDescriptorNode
This node is responsible for handling the container-transaction XML node
author
Jerome Dochez
version

Fields Summary
private String
trans_attribute
private String
description
private Vector
methods
Constructors Summary
public ContainerTransactionNode()
Creates new ContainerTransactionNode

    
        
      
       registerElementHandler(new XMLElement(EjbTagNames.METHOD), MethodNode.class);                         
    
Methods Summary
public voidaddDescriptor(java.lang.Object newDescriptor)
Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNode

param
descriptor the new descriptor

        if (newDescriptor instanceof MethodDescriptor) {
            methods.add(newDescriptor);
        }
    
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

        boolean doneWithNode = super.endElement(element);
        
        if (doneWithNode) {
            ContainerTransaction ct =  new ContainerTransaction(trans_attribute, description);
            for (Iterator methodsIterator = methods.iterator();methodsIterator.hasNext();) {
                MethodDescriptor md = (MethodDescriptor) methodsIterator.next();
                EjbBundleDescriptor bundle = (EjbBundleDescriptor) getParentNode().getDescriptor();
                EjbDescriptor ejb = bundle.getEjbByName(md.getEjbName(), true);
                ejb.getMethodContainerTransactions().put(md, ct);
            }
        }        
        return doneWithNode;
    
public java.lang.ObjectgetDescriptor()

return
the Descriptor subclass that was populated by reading the source XML file

        return null;
    
public voidsetElementValue(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 (EjbTagNames.DESCRIPTION.equals(element.getQName())) {
            description = value;
        } 
        if (EjbTagNames.TRANSACTION_ATTRIBUTE.equals(element.getQName())) {
            trans_attribute = value;
        }
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.EjbDescriptor ejb)
write the descriptor class to a 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

    
        
        Map methodToTransactions = ejb.getMethodContainerTransactions();
        MethodNode mn = new MethodNode();
        for (Iterator e=methodToTransactions.keySet().iterator();e.hasNext();) {
            MethodDescriptor md = (MethodDescriptor) e.next();
            Node ctNode = super.writeDescriptor(parent, nodeName, ejb);            
            ContainerTransaction ct = (ContainerTransaction) methodToTransactions.get(md);
            appendTextChild(ctNode, EjbTagNames.DESCRIPTION, ct.getDescription());
            mn.writeDescriptor(ctNode, EjbTagNames.METHOD, md, ejb.getName());
            appendTextChild(ctNode, EjbTagNames.TRANSACTION_ATTRIBUTE, ct.getTransactionAttribute());
        }
        return null;