1 23 24 package com.sun.enterprise.deployment.node; 25 26 import java.util.Iterator ; 27 import java.util.Map ; 28 import java.util.Set ; 29 import org.w3c.dom.Node ; 30 31 import com.sun.enterprise.deployment.LifecycleCallbackDescriptor; 32 import com.sun.enterprise.deployment.Descriptor; 33 import com.sun.enterprise.deployment.EjbDescriptor; 34 import com.sun.enterprise.deployment.EjbInterceptor; 35 import com.sun.enterprise.deployment.ApplicationClientDescriptor; 36 import com.sun.enterprise.deployment.xml.TagNames; 37 38 39 42 public class LifecycleCallbackNode extends DeploymentDescriptorNode { 43 44 private LifecycleCallbackDescriptor descriptor; 45 46 49 public Object getDescriptor() { 50 51 if (descriptor==null) { 52 descriptor = new LifecycleCallbackDescriptor(); 53 Descriptor parentDesc = (Descriptor)getParentNode().getDescriptor(); 54 if (parentDesc instanceof EjbDescriptor) { 55 EjbDescriptor ejbDesc = (EjbDescriptor)parentDesc; 56 descriptor.setDefaultLifecycleCallbackClass( 57 ejbDesc.getEjbClassName()); 58 } else if (parentDesc instanceof EjbInterceptor) { 59 EjbInterceptor ejbInterceptor = 60 (EjbInterceptor)parentDesc; 61 descriptor.setDefaultLifecycleCallbackClass( 62 ejbInterceptor.getInterceptorClassName()); 63 } 64 } 68 return descriptor; 69 } 70 71 77 protected Map getDispatchTable() { 78 Map table = super.getDispatchTable(); 79 table.put(TagNames.LIFECYCLE_CALLBACK_CLASS, 80 "setLifecycleCallbackClass"); 81 table.put(TagNames.LIFECYCLE_CALLBACK_METHOD, 82 "setLifecycleCallbackMethod"); 83 return table; 84 } 85 86 94 public Node writeDescriptor(Node parent, String nodeName, LifecycleCallbackDescriptor descriptor) { 95 Node myNode = appendChild(parent, nodeName); 96 appendTextChild(myNode, TagNames.LIFECYCLE_CALLBACK_CLASS, 97 descriptor.getLifecycleCallbackClass()); 98 appendTextChild(myNode, TagNames.LIFECYCLE_CALLBACK_METHOD, 99 descriptor.getLifecycleCallbackMethod()); 100 return myNode; 101 } 102 } 103 | Popular Tags |