1 23 24 package com.sun.enterprise.deployment.node.runtime; 25 26 import java.util.Iterator ; 27 import org.w3c.dom.Node ; 28 import org.w3c.dom.Document ; 29 30 import com.sun.enterprise.deployment.EjbBundleDescriptor; 31 import com.sun.enterprise.deployment.Application; 32 import com.sun.enterprise.deployment.EjbDescriptor; 33 import com.sun.enterprise.deployment.ResourceReferenceDescriptor; 34 import com.sun.enterprise.deployment.RelationshipDescriptor; 35 import com.sun.enterprise.deployment.Descriptor; 36 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 37 import com.sun.enterprise.deployment.node.XMLElement; 38 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 39 import com.sun.enterprise.deployment.xml.WebServicesTagNames; 40 import com.sun.enterprise.deployment.util.DOLUtils; 41 42 48 public class EntrepriseBeansRuntimeNode extends RuntimeDescriptorNode { 49 50 53 public EntrepriseBeansRuntimeNode() { 54 handlers = null; 56 57 registerElementHandler(new XMLElement(RuntimeTagNames.EJB), 58 EjbNode.class); 59 registerElementHandler(new XMLElement(RuntimeTagNames.PM_DESCRIPTORS), 60 PMDescriptorsNode.class); 61 registerElementHandler(new XMLElement(RuntimeTagNames.CMP_RESOURCE), 62 CmpResourceNode.class); 63 registerElementHandler 64 (new XMLElement(RuntimeTagNames.MESSAGE_DESTINATION), 65 MessageDestinationRuntimeNode.class); 66 67 registerElementHandler 68 (new XMLElement(WebServicesTagNames.WEB_SERVICE), 69 WebServiceRuntimeNode.class); 70 } 71 72 75 public Object getDescriptor() { 76 return getParentNode().getDescriptor(); 77 } 78 79 80 protected XMLElement getXMLRootTag() { 81 return new XMLElement(RuntimeTagNames.EJBS); 82 } 83 84 90 public void setElementValue(XMLElement element, String value) { 91 92 if (RuntimeTagNames.NAME.equals(element.getQName())) { 93 DOLUtils.getDefaultLogger().finer("Ignoring runtime bundle name " + value); 94 return; 95 } 96 if (getDescriptor()!=null && RuntimeTagNames.UNIQUE_ID.equals(element.getQName())) { 97 ((EjbBundleDescriptor) getDescriptor()).setUniqueId(Long.parseLong(value)); 98 } else super.setElementValue(element, value); 99 } 100 101 108 public Node writeDescriptor(Node parent, String nodeName, EjbBundleDescriptor bundleDescriptor) { 109 110 Node ejbs = super.writeDescriptor(parent, nodeName, bundleDescriptor); 111 112 appendTextChild(ejbs, RuntimeTagNames.UNIQUE_ID, String.valueOf(bundleDescriptor.getUniqueId())); 113 114 EjbNode ejbNode = new EjbNode(); 116 for (Iterator ejbIterator = bundleDescriptor.getEjbs().iterator();ejbIterator.hasNext();) { 117 EjbDescriptor ejbDescriptor = (EjbDescriptor) ejbIterator.next(); 118 ejbNode.writeDescriptor(ejbs, RuntimeTagNames.EJB, ejbDescriptor); 119 } 120 121 PMDescriptorsNode pmsNode = new PMDescriptorsNode(); 123 pmsNode.writeDescriptor(ejbs, RuntimeTagNames.PM_DESCRIPTORS, bundleDescriptor); 124 125 ResourceReferenceDescriptor rrd = bundleDescriptor.getCMPResourceReference(); 127 if ( rrd != null ) { 128 CmpResourceNode crn = new CmpResourceNode(); 129 crn.writeDescriptor(ejbs, RuntimeTagNames.CMP_RESOURCE, rrd); 130 } 131 132 writeMessageDestinationInfo(ejbs, bundleDescriptor); 134 135 WebServiceRuntimeNode webServiceNode = new WebServiceRuntimeNode(); 137 webServiceNode.writeWebServiceRuntimeInfo(ejbs, bundleDescriptor); 138 139 return ejbs; 140 } 141 142 } 143 | Popular Tags |