FileDocCategorySizeDatePackage
SecurityRoleMappingNode.javaAPI DocGlassfish v2 API4542Fri May 04 22:31:46 BST 2007com.sun.enterprise.deployment.node.runtime.common

SecurityRoleMappingNode

public class SecurityRoleMappingNode extends com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode
This node handles all the role mapping information
author
Jerome Dochez
version

Fields Summary
Constructors Summary
public SecurityRoleMappingNode()

        registerElementHandler(
            new XMLElement(RuntimeTagNames.PRINCIPAL_NAME),
            PrincipalNameNode.class, "addPrincipalName");
    
Methods Summary
public voidsetElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)
receives notiification of the value for a particular tag

param
element the xml element
param
value it's associated value

   
        SecurityRoleMapping srm = (SecurityRoleMapping) getDescriptor();
        if (RuntimeTagNames.ROLE_NAME.equals(element.getQName())) {
            srm.setRoleName(value);
        } else if (RuntimeTagNames.GROUP_NAME.equals(element.getQName())) {
            srm.addGroupName(value);
        } else super.setElementValue(element, value);
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping descriptor)
write the descriptor class to a DOM tree and return it

param
parent node for the DOM tree
param
node name
param
the descriptor to write
return
the DOM tree top node

  
        Node roleMapping = appendChild(parent, nodeName);

        //role-name
        appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName());

        //principal-name+
        PrincipalNameNode principal = new PrincipalNameNode();
        List<PrincipalNameDescriptor> principals = descriptor.getPrincipalNames();
	    for (int i = 0; i < principals.size(); i++) {
            principal.writeDescriptor(
                roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i));
	    }

        //group+
        List<String> groups = descriptor.getGroupNames();
        for (int i = 0; i < groups.size(); i++) {
	        appendTextChild(roleMapping, RuntimeTagNames.GROUP_NAME, groups.get(i));
        }
        return roleMapping;