FileDocCategorySizeDatePackage
ResourceAdapterNode.javaAPI DocGlassfish v2 API6531Fri May 04 22:31:48 BST 2007com.sun.enterprise.deployment.node.runtime.connector

ResourceAdapterNode

public class ResourceAdapterNode extends com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode
This node handles the resource-adapter runtime deployment descriptors
author
Jerome Dochez
version

Fields Summary
protected com.sun.enterprise.deployment.runtime.RuntimeDescriptor
descriptor
Constructors Summary
public ResourceAdapterNode()
Initialize the child handlers

    
             
      
        
        // we do not care about our standard DDS handles
        handlers = null;        
        
        registerElementHandler(new XMLElement(RuntimeTagNames.PROPERTY), 
                               RuntimeNameValuePairNode.class, "addPropertyElement");
    
Methods Summary
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        if (descriptor==null) {
	    descriptor = (RuntimeDescriptor) super.getDescriptor();
	    descriptor.setValue(ResourceAdapter.MAX_POOL_SIZE, "32");
	    descriptor.setValue(ResourceAdapter.STEADY_POOL_SIZE, "4");
	    descriptor.setValue(ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS, "10000");
	    descriptor.setValue(ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS, "1000");
	    
	}
        return descriptor;
    
protected booleansetAttributeValue(com.sun.enterprise.deployment.node.XMLElement elementName, com.sun.enterprise.deployment.node.XMLElement attributeName, java.lang.String value)
parsed an attribute of an element

param
the element name
param
the attribute name
param
the attribute value
return
true if the attribute was processed

	getDescriptor();
	if (descriptor==null) {
	    throw new RuntimeException("Trying to set values on a null descriptor");
	} 	
	if (attributeName.getQName().equals(RuntimeTagNames.JNDI_NAME)) {
	    descriptor.setAttributeValue(ResourceAdapter.JNDI_NAME, value);
	    return true;
	}
	if (attributeName.getQName().equals(RuntimeTagNames.MAX_POOL_SIZE)) {
	    descriptor.setAttributeValue(ResourceAdapter.MAX_POOL_SIZE, value);
	    return true;
	}
	if (attributeName.getQName().equals(RuntimeTagNames.STEADY_POOL_SIZE)) {
	    descriptor.setAttributeValue(ResourceAdapter.STEADY_POOL_SIZE, value);
	    return true;
	}
	if (attributeName.getQName().equals(RuntimeTagNames.MAX_WAIT_TIME_IN_MILLIS)) {
	    descriptor.setAttributeValue(ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS, value);
	    return true;
	}
	if (attributeName.getQName().equals(RuntimeTagNames.IDLE_TIMEOUT_IN_SECONDS)) {
	    descriptor.setAttributeValue(ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS, value);
	    return true;
	}
	return false;
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.runtime.connector.ResourceAdapter descriptor)
write the descriptor class to a DOM tree and return it

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

	Element raNode = (Element) super.writeDescriptor(parent, nodeName, descriptor);
	appendTextChild(raNode, RuntimeTagNames.DESCRIPTION, descriptor.getDescription());
	setAttribute(raNode, RuntimeTagNames.JNDI_NAME, (String) descriptor.getValue(ResourceAdapter.JNDI_NAME));
	setAttribute(raNode, RuntimeTagNames.MAX_POOL_SIZE, (String) descriptor.getValue(ResourceAdapter.MAX_POOL_SIZE));
	setAttribute(raNode, RuntimeTagNames.STEADY_POOL_SIZE, (String) descriptor.getValue(ResourceAdapter.STEADY_POOL_SIZE));
	setAttribute(raNode, RuntimeTagNames.MAX_WAIT_TIME_IN_MILLIS, (String) descriptor.getValue(ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS));
	setAttribute(raNode, RuntimeTagNames.IDLE_TIMEOUT_IN_SECONDS, (String) descriptor.getValue(ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS));

	// properties...
	NameValuePairDescriptor[] properties = descriptor.getPropertyElement();
	if (properties!=null && properties.length>0) {
	    RuntimeNameValuePairNode subNode = new RuntimeNameValuePairNode();
	    for (int i=0;i<properties.length;i++) {
		subNode.writeDescriptor(raNode, RuntimeTagNames.PROPERTY, properties[i]);
	    }
	}
	
	return raNode;