FileDocCategorySizeDatePackage
AuthMechNode.javaAPI DocGlassfish v2 API5207Fri May 04 22:31:40 BST 2007com.sun.enterprise.deployment.node.connector

AuthMechNode

public class AuthMechNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
This node is responsible for handling the Connector DTD related auth-mechanism XML tag
author
Sheetal Vartak
version

Fields Summary
private com.sun.enterprise.deployment.AuthMechanism
auth
Constructors Summary
Methods Summary
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        if (auth == null) {
            auth = (AuthMechanism) DescriptorFactory.getDescriptor(getXMLPath());
        } 
        return auth;
    
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(ConnectorTagNames.CREDENTIAL_INTF, "setCredentialInterface");
        table.put(ConnectorTagNames.AUTH_MECH_TYPE, "setAuthMechVal");
        return table;
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, com.sun.enterprise.deployment.Descriptor descriptor)
write the descriptor class to a DOM tree and return it

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


        if (! (descriptor instanceof OutboundResourceAdapter) &&
	    ! (descriptor instanceof ConnectorDescriptor)) {
            throw new IllegalArgumentException(getClass() + " cannot handle descriptors of type " + descriptor.getClass());
        }

	Iterator authMechs = null;

	if (descriptor instanceof ConnectorDescriptor) {
	    authMechs = ((ConnectorDescriptor)descriptor).getAuthMechanisms().iterator();
	} else if (descriptor instanceof OutboundResourceAdapter) {
	    authMechs = ((OutboundResourceAdapter)descriptor).getAuthMechanisms().iterator();
	}

	//auth mechanism info
	for (;authMechs.hasNext();) {
	    AuthMechanism auth = (AuthMechanism) authMechs.next();
	    Node authNode = appendChild(parent, ConnectorTagNames.AUTH_MECHANISM);
	    appendTextChild(authNode, TagNames.DESCRIPTION, auth.getDescription()); 
	    appendTextChild(authNode, ConnectorTagNames.AUTH_MECH_TYPE, auth.getAuthMechType());   
	    appendTextChild(authNode, ConnectorTagNames.CREDENTIAL_INTF, auth.getCredentialInterface());  
	}
	return parent;