1 23 24 package com.sun.enterprise.deployment.node.runtime.common; 25 26 import java.util.ArrayList ; 27 import java.util.Iterator ; 28 29 import org.w3c.dom.Node ; 30 import org.w3c.dom.Element ; 31 32 import com.sun.enterprise.deployment.node.XMLElement; 33 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 34 import com.sun.enterprise.deployment.xml.WebServicesTagNames; 35 import com.sun.enterprise.deployment.runtime.common.MessageSecurityDescriptor; 36 import com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor; 37 38 42 public class MessageSecurityBindingNode extends DeploymentDescriptorNode { 43 44 MessageSecurityBindingDescriptor descriptor = null; 45 46 public MessageSecurityBindingNode() { 47 registerElementHandler(new XMLElement( 48 WebServicesTagNames.MESSAGE_SECURITY), MessageSecurityNode.class, 49 "addMessageSecurityDescriptor"); 50 } 51 52 55 public Object getDescriptor() { 56 if (descriptor == null) { 57 descriptor = new MessageSecurityBindingDescriptor(); 58 } 59 return descriptor; 60 } 61 62 70 protected boolean setAttributeValue(XMLElement elementName, 71 XMLElement attributeName, String value) { 72 if (attributeName.getQName().equals(WebServicesTagNames.AUTH_LAYER)) { 73 descriptor.setAttributeValue(descriptor.AUTH_LAYER, value); 74 return true; 75 } else if (attributeName.getQName().equals( 76 WebServicesTagNames.PROVIDER_ID)) { 77 descriptor.setAttributeValue(descriptor.PROVIDER_ID, value); 78 return true; 79 } 80 return false; 81 } 82 83 91 public Node writeDescriptor(Node parent, String nodeName, 92 MessageSecurityBindingDescriptor messageSecurityBindingDesc) { 93 Element messageSecurityBindingNode = (Element )super.writeDescriptor(parent, nodeName, messageSecurityBindingDesc); 94 95 ArrayList messageSecDescs = 97 messageSecurityBindingDesc.getMessageSecurityDescriptors(); 98 if (!messageSecDescs.isEmpty()) { 99 MessageSecurityNode messageSecurityNode = 100 new MessageSecurityNode(); 101 for (Iterator messageSecIterator = messageSecDescs.iterator(); 102 messageSecIterator.hasNext();) { 103 MessageSecurityDescriptor messageSecDesc = 104 (MessageSecurityDescriptor) messageSecIterator.next(); 105 messageSecurityNode.writeDescriptor(messageSecurityBindingNode, WebServicesTagNames.MESSAGE_SECURITY, messageSecDesc); 106 } 107 } 108 109 if (messageSecurityBindingDesc.getAttributeValue( 111 messageSecurityBindingDesc.AUTH_LAYER) != null) { 112 setAttribute(messageSecurityBindingNode, WebServicesTagNames.AUTH_LAYER, messageSecurityBindingDesc.getAttributeValue(messageSecurityBindingDesc.AUTH_LAYER)); 113 } 114 115 if (messageSecurityBindingDesc.getAttributeValue( 117 messageSecurityBindingDesc.PROVIDER_ID) != null) { 118 setAttribute(messageSecurityBindingNode, WebServicesTagNames.PROVIDER_ID, messageSecurityBindingDesc.getAttributeValue(messageSecurityBindingDesc.PROVIDER_ID)); 119 } 120 121 return messageSecurityBindingNode; 122 } 123 } 124 | Popular Tags |