1 23 package com.sun.enterprise.deployment.node.runtime.connector; 24 25 import java.util.Map ; 26 import org.w3c.dom.Node ; 27 import org.w3c.dom.Element ; 28 29 import com.sun.enterprise.deployment.node.XMLElement; 30 import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode; 31 import com.sun.enterprise.deployment.runtime.connector.Principal; 32 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 33 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 34 35 41 public class PrincipalNode extends RuntimeDescriptorNode { 42 43 49 public void setElementValue(XMLElement element, String value) { 50 RuntimeDescriptor descriptor = (RuntimeDescriptor) getDescriptor(); 51 if (descriptor==null) { 52 throw new RuntimeException ("Trying to set values on a null descriptor"); 53 } 54 if (element.getQName().equals(RuntimeTagNames.USER_NAME)) { 55 descriptor.setAttributeValue(Principal.USER_NAME, value); 56 } else 57 if (element.getQName().equals(RuntimeTagNames.PASSWORD)) { 58 descriptor.setAttributeValue(Principal.PASSWORD, value); 59 } else 60 if (element.getQName().equals(RuntimeTagNames.CREDENTIAL)) { 61 descriptor.setAttributeValue(Principal.CREDENTIAL, value); 62 } else 63 super.setElementValue(element, value); 64 } 65 66 67 75 public Node writeDescriptor(Node parent, String nodeName, Principal descriptor) { 76 Element principalNode = (Element ) super.writeDescriptor(parent, nodeName, descriptor); 77 appendTextChild(principalNode, RuntimeTagNames.DESCRIPTION, descriptor.getDescription()); 78 setAttribute(principalNode, RuntimeTagNames.USER_NAME, (String ) descriptor.getValue(Principal.USER_NAME)); 79 setAttribute(principalNode, RuntimeTagNames.PASSWORD, (String ) descriptor.getValue(Principal.PASSWORD)); 80 setAttribute(principalNode, RuntimeTagNames.CREDENTIAL, (String ) descriptor.getValue(Principal.CREDENTIAL)); 81 return principalNode; 82 } 83 } 84 | Popular Tags |