1 23 24 package com.sun.enterprise.deployment.node.runtime; 25 26 import java.util.Iterator ; 27 import java.util.Map ; 28 import java.util.logging.Level ; 29 import org.w3c.dom.Node ; 30 import org.w3c.dom.Document ; 31 32 import com.sun.enterprise.deployment.Descriptor; 33 import com.sun.enterprise.deployment.JndiNameEnvironment; 34 import com.sun.enterprise.deployment.BundleDescriptor; 35 import com.sun.enterprise.deployment.MessageDestinationDescriptor; 36 import com.sun.enterprise.deployment.node.XMLElement; 37 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 38 import com.sun.enterprise.deployment.types.EjbReferenceContainer; 39 import com.sun.enterprise.deployment.types.ResourceReferenceContainer; 40 import com.sun.enterprise.deployment.types.ResourceEnvReferenceContainer; 41 import com.sun.enterprise.deployment.types.MessageDestinationReferenceContainer; 42 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 43 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 44 import com.sun.enterprise.deployment.util.DOLUtils; 45 import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorFactory; 46 47 53 public class RuntimeDescriptorNode extends DeploymentDescriptorNode 54 { 55 58 public Object getDescriptor() { 59 60 if (abstractDescriptor==null) { 61 abstractDescriptor = RuntimeDescriptorFactory.getDescriptor(getXMLPath()); 62 if (abstractDescriptor ==null) { 63 return getParentNode().getDescriptor(); 64 } 65 } 66 return abstractDescriptor; 67 } 68 69 75 public void setElementValue(XMLElement element, String value) { 76 if (getDispatchTable().containsKey(element.getQName())) { 77 super.setElementValue(element, value); 78 } else { 79 Object o = getDescriptor(); 80 if (o instanceof RuntimeDescriptor) { 81 RuntimeDescriptor rd = (RuntimeDescriptor) o; 82 rd.setValue(element.getQName(), value); 83 } else { 84 DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.addDescriptorFailure", 85 new Object []{element.getQName() , value }); 86 } 87 } 88 } 89 90 96 public static void writeCommonComponentInfo(Node parent, Descriptor descriptor) { 97 if (descriptor instanceof EjbReferenceContainer) { 98 EjbRefNode.writeEjbReferences(parent, (EjbReferenceContainer) descriptor); 99 } 100 if (descriptor instanceof ResourceReferenceContainer) { 101 ResourceRefNode.writeResourceReferences(parent, (ResourceReferenceContainer) descriptor); 102 } 103 if (descriptor instanceof ResourceEnvReferenceContainer) { 104 ResourceEnvRefNode.writeResoureEnvReferences(parent, (ResourceEnvReferenceContainer) descriptor); 105 } 106 if( descriptor instanceof JndiNameEnvironment ) { 107 ServiceRefNode.writeServiceReferences 108 (parent, (JndiNameEnvironment) descriptor); 109 } 110 if (descriptor instanceof MessageDestinationReferenceContainer) { 111 MessageDestinationRefNode.writeMessageDestinationReferences(parent, 112 (MessageDestinationReferenceContainer) descriptor); 113 } 114 } 115 116 public static void writeMessageDestinationInfo(Node parent, 117 BundleDescriptor descriptor) { 118 for(Iterator iter = descriptor.getMessageDestinations().iterator(); 119 iter.hasNext();) { 120 MessageDestinationRuntimeNode node = 121 new MessageDestinationRuntimeNode(); 122 node.writeDescriptor(parent, RuntimeTagNames.MESSAGE_DESTINATION, 123 (MessageDestinationDescriptor) iter.next()); 124 } 125 } 126 127 } 128 | Popular Tags |