1 23 24 package com.sun.enterprise.deployment.node.ejb; 25 26 import java.util.Map ; 27 import org.w3c.dom.Node ; 28 import org.xml.sax.Attributes ; 29 30 import com.sun.enterprise.deployment.node.XMLElement; 31 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 32 import com.sun.enterprise.deployment.node.DescriptorFactory; 33 import com.sun.enterprise.deployment.node.RunAsNode; 34 35 import com.sun.enterprise.deployment.Descriptor; 36 import com.sun.enterprise.deployment.EjbDescriptor; 37 import com.sun.enterprise.deployment.xml.EjbTagNames; 38 39 45 public class SecurityIdentityNode extends DeploymentDescriptorNode { 46 47 48 public SecurityIdentityNode() { 49 super(); 50 registerElementHandler(new XMLElement(EjbTagNames.RUNAS_SPECIFIED_IDENTITY), RunAsNode.class); 51 } 52 53 57 public Object getDescriptor() { 58 return null; 59 } 60 61 67 protected Map getDispatchTable() { 68 return null; 69 } 70 71 public void startElement(XMLElement element, Attributes attributes) { 72 if( EjbTagNames.USE_CALLER_IDENTITY.equals(element.getQName()) ) { 73 ((EjbDescriptor) getParentNode().getDescriptor()). 74 setUsesCallerIdentity(true); 75 } else { 76 super.startElement(element, attributes); 77 } 78 return; 79 } 80 81 87 public void setElementValue(XMLElement element, String value) { 88 if (EjbTagNames.DESCRIPTION.equals(element.getQName())) { 89 ((EjbDescriptor) getParentNode().getDescriptor()).setSecurityIdentityDescription(value); 90 } else { 91 super.setElementValue(element, value); 92 } 93 } 94 95 103 public Node writeDescriptor(Node parent, String nodeName, EjbDescriptor descriptor) { 104 Node subNode = appendChild(parent, nodeName); 105 appendTextChild(subNode, EjbTagNames.DESCRIPTION, descriptor.getSecurityIdentityDescription()); 106 if (descriptor.getUsesCallerIdentity()) { 107 Node useCaller = subNode.getOwnerDocument().createElement(EjbTagNames.USE_CALLER_IDENTITY); 108 subNode.appendChild(useCaller); 109 } else { 110 RunAsNode runAs = new RunAsNode(); 111 runAs.writeDescriptor(subNode, EjbTagNames.RUNAS_SPECIFIED_IDENTITY, descriptor.getRunAsIdentity()); 112 } 113 return subNode; 114 } 115 } 116 | Popular Tags |