FileDocCategorySizeDatePackage
SecurityConstraintNode.javaAPI DocGlassfish v2 API5402Fri May 04 22:31:48 BST 2007com.sun.enterprise.deployment.node.web

SecurityConstraintNode

public class SecurityConstraintNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
This node handles the security-contraint xml tag
author
Jerome Dochez
version

Fields Summary
Constructors Summary
public SecurityConstraintNode()

        super();
        registerElementHandler(new XMLElement(WebTagNames.USERDATA_CONSTRAINT), 
                    UserDataConstraintNode.class, "setUserDataConstraint");
        registerElementHandler(new XMLElement(WebTagNames.AUTH_CONSTRAINT),         
                    AuthConstraintNode.class, "setAuthorizationConstraint");
        registerElementHandler(new XMLElement(WebTagNames.WEB_RESOURCE_COLLECTION),         
                    WebResourceCollectionNode.class, "addWebResourceCollection");        
    
Methods Summary
protected java.util.MapgetDispatchTable()
all sub-implementation of this class can use a dispatch table to map xml element to method name on the descriptor class for setting the element value.

return
the map with the element name as a key, the setter method as a value

    
        Map table = super.getDispatchTable();
        table.put(WebTagNames.NAME, "setName");
	return table;
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.SecurityConstraintImpl descriptor)
write the descriptor class to a DOM tree and return it

param
parent node in the DOM tree
param
node name for the root element of this xml fragment
param
the descriptor to write
return
the DOM tree top node

        Node myNode = appendChild(parent, nodeName);
        appendTextChild(myNode, WebTagNames.NAME, descriptor.getName());
        
        // web-resource-collection+
        WebResourceCollectionNode wrcNode = new WebResourceCollectionNode();
        for (Enumeration webResources = descriptor.getWebResourceCollections(); 
            webResources.hasMoreElements();) {
                wrcNode.writeDescriptor(myNode, WebTagNames.WEB_RESOURCE_COLLECTION, 
                    (WebResourceCollectionImpl) webResources.nextElement());
        }
        
        // auth-constaint?
        AuthorizationConstraintImpl aci = (AuthorizationConstraintImpl) descriptor.getAuthorizationConstraint();
        if (aci!=null) {
            AuthConstraintNode acNode = new AuthConstraintNode();
            acNode.writeDescriptor(myNode, WebTagNames.AUTH_CONSTRAINT, aci);
        }
        
        // user-data-constraint?
        UserDataConstraintImpl udci = (UserDataConstraintImpl) descriptor.getUserDataConstraint();
        if (udci!=null) {
            UserDataConstraintNode udcn = new UserDataConstraintNode();
            udcn.writeDescriptor(myNode, WebTagNames.USERDATA_CONSTRAINT, udci);
        }
        return myNode;