1 23 24 29 30 package com.sun.enterprise.deployment.node.ejb; 31 32 import java.util.Map ; 33 import java.util.Map.Entry; 34 import java.util.Set ; 35 import java.util.Iterator ; 36 import org.w3c.dom.Node ; 37 38 import com.sun.enterprise.deployment.xml.TagNames; 39 import com.sun.enterprise.deployment.node.XMLElement; 40 import com.sun.enterprise.deployment.node.LifecycleCallbackNode; 41 import com.sun.enterprise.deployment.node.MethodNode; 42 import com.sun.enterprise.deployment.node.DescriptorFactory; 43 44 import com.sun.enterprise.deployment.Descriptor; 45 import com.sun.enterprise.deployment.EjbDescriptor; 46 import com.sun.enterprise.deployment.EjbBundleDescriptor; 47 import com.sun.enterprise.deployment.EntityManagerReferenceDescriptor; 48 import com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptor; 49 import com.sun.enterprise.deployment.EjbInterceptor; 50 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 51 import com.sun.enterprise.deployment.xml.EjbTagNames; 52 53 59 public class MessageDrivenBeanNode extends EjbNode { 60 61 private EjbMessageBeanDescriptor descriptor; 62 63 public MessageDrivenBeanNode() { 64 super(); 65 registerElementHandler(new XMLElement(EjbTagNames.ACTIVATION_CONFIG), 66 ActivationConfigNode.class, 67 "setActivationConfigDescriptor"); 68 69 registerElementHandler(new XMLElement(EjbTagNames.AROUND_INVOKE_METHOD), AroundInvokeNode.class, "addAroundInvokeDescriptor"); 70 71 registerElementHandler(new XMLElement(TagNames.POST_CONSTRUCT), LifecycleCallbackNode.class, "addPostConstructDescriptor"); 72 73 registerElementHandler(new XMLElement(TagNames.PRE_DESTROY), LifecycleCallbackNode.class, "addPreDestroyDescriptor"); 74 75 registerElementHandler(new XMLElement(EjbTagNames.TIMEOUT_METHOD), MethodNode.class, "setEjbTimeoutMethod"); 76 77 } 78 79 82 public EjbDescriptor getEjbDescriptor() { 83 84 if (descriptor==null) { 85 descriptor = (EjbMessageBeanDescriptor) DescriptorFactory.getDescriptor(getXMLPath()); 86 descriptor.setEjbBundleDescriptor((EjbBundleDescriptor) getParentNode().getDescriptor()); 87 } 88 return descriptor; 89 } 90 91 97 protected Map getDispatchTable() { 98 Map table = super.getDispatchTable(); 100 101 table.put(EjbTagNames.MESSAGING_TYPE, "setMessageListenerType"); 102 table.put(EjbTagNames.TRANSACTION_TYPE, "setTransactionType"); 103 table.put(EjbTagNames.MESSAGE_DESTINATION_TYPE, "setDestinationType"); 104 table.put(TagNames.MESSAGE_DESTINATION_LINK, 105 "setMessageDestinationLinkName"); 106 107 table.put(EjbTagNames.MSG_SELECTOR, "setJmsMessageSelector"); 111 table.put(EjbTagNames.JMS_ACKNOWLEDGE_MODE, "setJmsAcknowledgeMode"); 112 table.put(EjbTagNames.JMS_DEST_TYPE, "setDestinationType"); 113 table.put(EjbTagNames.JMS_SUBSCRIPTION_DURABILITY, 114 "setSubscriptionDurability"); 115 return table; 116 } 117 118 126 public Node writeDescriptor(Node parent, String nodeName, Descriptor descriptor) { 127 if (! (descriptor instanceof EjbMessageBeanDescriptor)) { 128 throw new IllegalArgumentException (getClass() + " cannot handles descriptors of type " + descriptor.getClass()); 129 } 130 EjbMessageBeanDescriptor ejbDesc = (EjbMessageBeanDescriptor) descriptor; 131 132 Node ejbNode = super.writeDescriptor(parent, nodeName, descriptor); 133 writeDisplayableComponentInfo(ejbNode, descriptor); 134 writeCommonHeaderEjbDescriptor(ejbNode, ejbDesc); 135 appendTextChild(ejbNode, EjbTagNames.EJB_CLASS, ejbDesc.getEjbClassName()); 136 appendTextChild(ejbNode, EjbTagNames.MESSAGING_TYPE, ejbDesc.getMessageListenerType()); 137 138 139 MethodNode methodNode = new MethodNode(); 140 141 if( ejbDesc.isTimedObject() ) { 142 methodNode.writeJavaMethodDescriptor 143 (ejbNode, EjbTagNames.TIMEOUT_METHOD, 144 ejbDesc.getEjbTimeoutMethod()); 145 } 146 147 appendTextChild(ejbNode, EjbTagNames.TRANSACTION_TYPE, ejbDesc.getTransactionType()); 148 149 appendTextChild(ejbNode, TagNames.MESSAGE_DESTINATION_TYPE, 151 ejbDesc.getDestinationType()); 152 153 String link = ejbDesc.getMessageDestinationLinkName(); 155 appendTextChild(ejbNode, TagNames.MESSAGE_DESTINATION_LINK, link); 156 157 ActivationConfigNode activationConfigNode = new ActivationConfigNode(); 158 activationConfigNode.writeDescriptor 159 (ejbNode, EjbTagNames.ACTIVATION_CONFIG, 160 ejbDesc.getActivationConfigDescriptor()); 161 162 writeAroundInvokeDescriptors(ejbNode, ejbDesc.getAroundInvokeDescriptors().iterator()); 164 165 writeEnvEntryDescriptors(ejbNode, ejbDesc.getEnvironmentProperties().iterator()); 167 168 writeEjbReferenceDescriptors(ejbNode, ejbDesc.getEjbReferenceDescriptors().iterator()); 170 171 writeServiceReferenceDescriptors(ejbNode, ejbDesc.getServiceReferenceDescriptors().iterator()); 173 174 writeResourceRefDescriptors(ejbNode, ejbDesc.getResourceReferenceDescriptors().iterator()); 176 177 writeResourceEnvRefDescriptors(ejbNode, ejbDesc.getJmsDestinationReferenceDescriptors().iterator()); 179 180 writeMessageDestinationRefDescriptors(ejbNode, ejbDesc.getMessageDestinationReferenceDescriptors().iterator()); 182 183 writeEntityManagerReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerReferenceDescriptors().iterator()); 185 186 writeEntityManagerFactoryReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerFactoryReferenceDescriptors().iterator()); 188 189 writePostConstructDescriptors(ejbNode, ejbDesc.getPostConstructDescriptors().iterator()); 191 192 writePreDestroyDescriptors(ejbNode, ejbDesc.getPreDestroyDescriptors().iterator()); 194 195 writeSecurityIdentityDescriptor(ejbNode, ejbDesc); 197 198 return ejbNode; 199 } 200 } 201 | Popular Tags |