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

ConfigPropertyNode

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

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

return
the descriptor instance to associate with this XMLNode

        if (config == null) {
            config = (EnvironmentProperty) DescriptorFactory.getDescriptor(getXMLPath());
        } 
        return config;
    
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.CONFIG_PROPERTY_NAME, "setName");
        table.put(ConnectorTagNames.CONFIG_PROPERTY_VALUE, "setValue");
        table.put(ConnectorTagNames.CONFIG_PROPERTY_TYPE, "setType");        
        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 ConnectorDescriptor) && 
	    ! (descriptor instanceof AdminObject) && 
	    ! (descriptor instanceof ConnectionDefDescriptor) &&
	    ! (descriptor instanceof OutboundResourceAdapter)) {
            throw new IllegalArgumentException(getClass() + " cannot handle descriptors of type " + descriptor.getClass());
        }
	Iterator configProps = null;
	if (descriptor instanceof ConnectorDescriptor) {
	    configProps = ((ConnectorDescriptor)descriptor).getConfigProperties().iterator();
	} else if (descriptor instanceof ConnectionDefDescriptor) {
	    configProps = ((ConnectionDefDescriptor)descriptor).getConfigProperties().iterator();
	} else if (descriptor instanceof AdminObject) {
	    configProps = ((AdminObject)descriptor).getConfigProperties().iterator();
	} else if (descriptor instanceof OutboundResourceAdapter) {
	    configProps = ((OutboundResourceAdapter)descriptor).getConfigProperties().iterator();
	}
	//config property info
	for (;configProps.hasNext();) {
	    EnvironmentProperty config = (EnvironmentProperty) configProps.next();
	    Node configNode = appendChild(parent, ConnectorTagNames.CONFIG_PROPERTY);
	    writeLocalizedDescriptions(configNode, config);  
	    appendTextChild(configNode, ConnectorTagNames.CONFIG_PROPERTY_NAME, config.getName());  
	    appendTextChild(configNode, ConnectorTagNames.CONFIG_PROPERTY_TYPE, config.getType());  
	    appendTextChild(configNode, ConnectorTagNames.CONFIG_PROPERTY_VALUE, config.getValue());  
	}
	return parent;