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.PrefetchDisabledDescriptor; 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 PrefetchDisabledNode extends DeploymentDescriptorNode { 42 43 protected PrefetchDisabledDescriptor descriptor=null; 44 45 46 public PrefetchDisabledNode() { 47 registerElementHandler(new XMLElement(RuntimeTagNames.QUERY_METHOD), MethodNode.class); 48 } 49 50 53 public Object getDescriptor() { 54 if (descriptor==null) { 55 descriptor = new PrefetchDisabledDescriptor(); 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 PrefetchDisabledDescriptor prefetchDisabledDescriptor) { 88 Node prefetchDisabledNode = super.writeDescriptor(parent, nodeName, 89 prefetchDisabledDescriptor); 90 ArrayList methodDescs = 91 prefetchDisabledDescriptor.getConvertedMethodDescs(); 92 if (!methodDescs.isEmpty()) { 93 MethodNode methodNode = new MethodNode(); 94 for (Iterator methodIterator = methodDescs.iterator(); 95 methodIterator.hasNext();) { 96 MethodDescriptor methodDesc = 97 (MethodDescriptor) methodIterator.next(); 98 methodNode.writeQueryMethodDescriptor(prefetchDisabledNode, 99 RuntimeTagNames.QUERY_METHOD, methodDesc); 100 } 101 } 102 103 return prefetchDisabledNode; 104 } 105 } 106 | Popular Tags |