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

RANode

public final class RANode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
author
Sheetal Vartak
version

Fields Summary
private com.sun.enterprise.deployment.ConnectorDescriptor
descriptor
public static final String
VERSION_10
public static final String
VERSION_15
Constructors Summary
public RANode()


    //default constructor
      
	register();
    
public RANode(com.sun.enterprise.deployment.node.XMLElement element)

	this.setXMLRootTag(element);	
	register();
    
Methods Summary
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        if (descriptor == null) {
	    descriptor = (ConnectorDescriptor)getParentNode().getDescriptor();
        } 
	return descriptor;
    
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

        // no need to be synchronized for now
        Map table = super.getDispatchTable();
     	table.put(ConnectorTagNames.RESOURCE_ADAPTER_CLASS, "setResourceAdapterClass");	
	return table;
    
private voidregister()

	//check for the version of DTD
	registerElementHandler(new XMLElement(ConnectorTagNames.OUTBOUND_RESOURCE_ADAPTER),
			       OutBoundRANode.class);       
	registerElementHandler(new XMLElement(ConnectorTagNames.INBOUND_RESOURCE_ADAPTER),
			       InBoundRANode.class); 
	registerElementHandler(new XMLElement(ConnectorTagNames.CONFIG_PROPERTY),
			       ConfigPropertyNode.class, "addConfigProperty"); 
	registerElementHandler(new XMLElement(ConnectorTagNames.ADMIN_OBJECT),
			       AdminObjectNode.class, "addAdminObject"); 
	registerElementHandler(new XMLElement(ConnectorTagNames.SECURITY_PERMISSION),
			       SecurityPermissionNode.class, "addSecurityPermission");         
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node connectorNode, 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 ConnectorDescriptor)) {
            throw new IllegalArgumentException(getClass() + " cannot handle descriptors of type " + descriptor.getClass());
        }
        ConnectorDescriptor conDesc = (ConnectorDescriptor) descriptor;
      	Node raNode = appendChild(connectorNode, ConnectorTagNames.RESOURCE_ADAPTER);

	appendTextChild(raNode, ConnectorTagNames.RESOURCE_ADAPTER_CLASS, conDesc.getResourceAdapterClass());  
	
	//config-property
	ConfigPropertyNode config = new ConfigPropertyNode();
	raNode = config.writeDescriptor(raNode, conDesc);
	
	if (conDesc.getOutBoundDefined() == true) {
	    //outbound RA info	
	    OutBoundRANode obNode = new OutBoundRANode();
	    raNode = obNode.writeDescriptor(raNode, conDesc);
	}
	
	if (conDesc.getInBoundDefined() == true) {
	    //inbound RA info
	    InBoundRANode inNode = new InBoundRANode();
	    raNode = inNode.writeDescriptor(raNode, conDesc);	    
	}
	
	//adminobject
	AdminObjectNode admin = new AdminObjectNode();
	raNode = admin.writeDescriptor(raNode, conDesc);
	//}
        
        // security-permission*
	SecurityPermissionNode secPerm = new SecurityPermissionNode();
	raNode = secPerm.writeDescriptor(raNode, conDesc);        
			     
	return connectorNode;