1 23 24 package com.sun.enterprise.deployment.node.runtime; 25 26 import org.w3c.dom.Node ; 27 28 import com.sun.enterprise.deployment.node.XMLElement; 29 import com.sun.enterprise.deployment.ResourceReferenceDescriptor; 30 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 31 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 32 import com.sun.enterprise.deployment.ResourcePrincipal; 33 34 41 public class DefaultResourcePrincipalNode extends DeploymentDescriptorNode { 42 43 private String name = null; 44 private String passwd = null; 45 46 49 public Object getDescriptor() { 50 return null; 51 } 52 53 59 public void setElementValue(XMLElement element, String value) { 60 if (RuntimeTagNames.NAME.equals(element.getQName())) { 61 name = value; 62 } else if (RuntimeTagNames.PASSWORD.equals(element.getQName())) { 63 passwd = value; 64 } else super.setElementValue(element, value); 65 } 66 67 70 public void postParsing() { 71 if (getParentNode().getDescriptor() instanceof ResourceReferenceDescriptor) { 72 ((ResourceReferenceDescriptor) getParentNode().getDescriptor()).setResourcePrincipal(new ResourcePrincipal(name, passwd)); 73 } else { 74 getParentNode().addDescriptor(new ResourcePrincipal(name, passwd)); 75 } 76 } 77 78 86 public Node writeDescriptor(Node parent, String nodeName, ResourcePrincipal rpDescriptor) { 87 Node principalNode = super.writeDescriptor(parent, nodeName, null); 88 appendTextChild(principalNode, RuntimeTagNames.NAME, rpDescriptor.getName()); 89 appendTextChild(principalNode, RuntimeTagNames.PASSWORD, rpDescriptor.getPassword()); 90 return principalNode; 91 } 92 } 93 | Popular Tags |