1 23 24 package com.sun.enterprise.deployment.node; 25 26 import java.util.Map ; 27 import org.w3c.dom.Node ; 28 29 import com.sun.enterprise.deployment.Descriptor; 30 import com.sun.enterprise.deployment.InjectionTarget; 31 import com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptor; 32 import com.sun.enterprise.deployment.xml.EjbTagNames; 33 import com.sun.enterprise.deployment.xml.TagNames; 34 35 41 public class EntityManagerFactoryReferenceNode extends DeploymentDescriptorNode { 42 43 public EntityManagerFactoryReferenceNode() { 44 super(); 45 registerElementHandler(new XMLElement(TagNames.INJECTION_TARGET), 46 InjectionTargetNode.class, "addInjectionTarget"); 47 } 48 49 57 protected Map getDispatchTable() { 58 Map table = super.getDispatchTable(); 60 table.put(TagNames.PERSISTENCE_UNIT_REF_NAME, "setName"); 61 table.put(TagNames.PERSISTENCE_UNIT_NAME, "setUnitName"); 62 return table; 63 } 64 65 73 public Node writeDescriptor(Node parent, String nodeName, EntityManagerFactoryReferenceDescriptor descriptor) { 74 Node entityMgrFactoryRefNode = appendChild(parent, nodeName); 75 writeLocalizedDescriptions(entityMgrFactoryRefNode, descriptor); 76 77 appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_REF_NAME, descriptor.getName()); 78 appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_NAME, descriptor.getUnitName()); 79 if( descriptor.isInjectable() ) { 80 InjectionTargetNode ijNode = new InjectionTargetNode(); 81 for (InjectionTarget target : descriptor.getInjectionTargets()) { 82 ijNode.writeDescriptor(entityMgrFactoryRefNode, TagNames.INJECTION_TARGET, target); 83 } 84 } 85 86 return entityMgrFactoryRefNode; 87 } 88 } 89 | Popular Tags |