1 23 package com.sun.enterprise.deployment.node.runtime; 24 25 import java.util.ArrayList ; 26 import java.util.Iterator ; 27 import org.w3c.dom.Node ; 28 29 import com.sun.enterprise.deployment.node.XMLElement; 30 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 31 import com.sun.enterprise.deployment.node.MethodNode; 32 import com.sun.enterprise.deployment.runtime.CheckpointAtEndOfMethodDescriptor; 33 import com.sun.enterprise.deployment.MethodDescriptor; 34 import com.sun.enterprise.deployment.EjbDescriptor; 35 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 36 37 41 public class CheckpointAtEndOfMethodNode extends DeploymentDescriptorNode { 42 43 protected CheckpointAtEndOfMethodDescriptor descriptor=null; 44 45 46 public CheckpointAtEndOfMethodNode() { 47 registerElementHandler(new XMLElement(RuntimeTagNames.METHOD), MethodNode.class); 48 } 49 50 53 public Object getDescriptor() { 54 if (descriptor==null) { 55 descriptor = new CheckpointAtEndOfMethodDescriptor(); 56 Object parentDesc = getParentNode().getDescriptor(); 57 if (parentDesc instanceof EjbDescriptor) { 58 descriptor.setEjbDescriptor((EjbDescriptor)parentDesc); 59 } 60 } 61 return descriptor; 62 } 63 64 65 71 public void addDescriptor(Object newDescriptor) { 72 if (newDescriptor instanceof MethodDescriptor) { 73 descriptor.addMethodDescriptor( 74 (MethodDescriptor) newDescriptor); 75 } 76 } 77 78 86 public Node writeDescriptor(Node parent, String nodeName, 87 CheckpointAtEndOfMethodDescriptor checkpointMethodDescriptor) { 88 Node checkpointMethodNode = super.writeDescriptor(parent, nodeName, 89 checkpointMethodDescriptor); 90 ArrayList methodDescs = checkpointMethodDescriptor.getConvertedMethodDescs(); 91 if (!methodDescs.isEmpty()) { 92 MethodNode methodNode = new MethodNode(); 93 for (Iterator methodIterator = methodDescs.iterator(); 94 methodIterator.hasNext();) { 95 MethodDescriptor methodDesc = 96 (MethodDescriptor) methodIterator.next(); 97 methodNode.writeDescriptor(checkpointMethodNode, 99 RuntimeTagNames.METHOD, methodDesc, null); 100 } 101 } 102 103 return checkpointMethodNode; 104 } 105 } 106 | Popular Tags |