FileDocCategorySizeDatePackage
AppClientNode.javaAPI DocGlassfish v2 API12111Fri May 04 22:31:40 BST 2007com.sun.enterprise.deployment.node.appclient

AppClientNode

public class AppClientNode extends com.sun.enterprise.deployment.node.BundleNode implements com.sun.enterprise.deployment.node.RootXMLNode
This class is responsible for handling app clients
author
Sheetal Vartak
version

Fields Summary
private com.sun.enterprise.deployment.ApplicationClientDescriptor
descriptor
public static final String
PUBLIC_DTD_ID_12
public static final String
SYSTEM_ID_12
public static final String
PUBLIC_DTD_ID
public static final String
SYSTEM_ID
public static final String
SCHEMA_ID_14
public static final String
SCHEMA_ID
public static final String
SPEC_VERSION
private static final List
systemIDs
public static final com.sun.enterprise.deployment.node.XMLElement
tag
Constructors Summary
public AppClientNode()
Creates new AppClientNode

	registerElementHandler(new XMLElement(TagNames.ENVIRONMENT_PROPERTY), 
                                                             EnvEntryNode.class, "addEnvironmentProperty");     
        registerElementHandler(new XMLElement(EjbTagNames.EJB_REFERENCE), EjbReferenceNode.class);     
        registerElementHandler(new XMLElement(EjbTagNames.EJB_LOCAL_REFERENCE), EjbLocalReferenceNode.class);     
        registerElementHandler(new XMLElement(WebServicesTagNames.SERVICE_REF), ServiceReferenceNode.class, "addServiceReferenceDescriptor");     
        registerElementHandler(new XMLElement(EjbTagNames.RESOURCE_REFERENCE), 
                                                             ResourceRefNode.class, "addResourceReferenceDescriptor");   
	registerElementHandler(new XMLElement(TagNames.RESOURCE_ENV_REFERENCE), 
                                                            ResourceEnvRefNode.class, "addJmsDestinationReferenceDescriptor");               
        registerElementHandler(new XMLElement(TagNames.MESSAGE_DESTINATION_REFERENCE), MessageDestinationRefNode.class, "addMessageDestinationReferenceDescriptor");
        registerElementHandler(new XMLElement(TagNames.PERSISTENCE_UNIT_REF), EntityManagerFactoryReferenceNode.class, "addEntityManagerFactoryReferenceDescriptor");
        registerElementHandler(new XMLElement(TagNames.MESSAGE_DESTINATION),
                               MessageDestinationNode.class,
                               "addMessageDestination");
        registerElementHandler(new XMLElement(TagNames.POST_CONSTRUCT), LifecycleCallbackNode.class, "addPostConstructDescriptor");
        registerElementHandler(new XMLElement(TagNames.PRE_DESTROY), LifecycleCallbackNode.class, "addPreDestroyDescriptor");
    
Methods Summary
public voidaddDescriptor(java.lang.Object newDescriptor)
Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNode

param
descriptor the new descriptor

       
        if (newDescriptor instanceof EjbReference) {            
            DOLUtils.getDefaultLogger().fine("Adding ejb ref " + newDescriptor);
            ((ApplicationClientDescriptor)getDescriptor()).addEjbReferenceDescriptor(
                        (EjbReference) newDescriptor);
        } else {
            super.addDescriptor(newDescriptor);
        }
    
public java.lang.ObjectgetDescriptor()

        if (descriptor == null) {
            descriptor = (ApplicationClientDescriptor) DescriptorFactory.getDescriptor(getXMLPath());
        } 
        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(ApplicationClientTagNames.CALLBACK_HANDLER, "setCallbackHandler");        
        return table;
    
public java.lang.StringgetDocType()

return
the DOCTYPE of the XML file

        return null;
    
public java.lang.StringgetSpecVersion()

return
the default spec version level this node complies to

        return SPEC_VERSION;
    
public java.lang.StringgetSystemID()

return
the SystemID of the XML file

        return SCHEMA_ID;
    
public java.util.ListgetSystemIDs()

return
the list of SystemID of the XML schema supported

        return systemIDs;
    
protected com.sun.enterprise.deployment.node.XMLElementgetXMLRootTag()

return
the XML tag associated with this XMLNode

        return tag;
    
private static java.util.ListinitSystemIDs()


        
        final ArrayList<String> systemIDs = new ArrayList<String>();
        systemIDs.add(SCHEMA_ID);
        systemIDs.add(SCHEMA_ID_14);
        return Collections.unmodifiableList(systemIDs);
    
public static java.lang.StringregisterBundle(java.util.Map publicIDToDTD)
register this node as a root node capable of loading entire DD files

param
publicIDToDTD is a mapping between xml Public-ID to DTD
return
the doctype tag name

        publicIDToDTD.put(PUBLIC_DTD_ID, SYSTEM_ID);
        publicIDToDTD.put(PUBLIC_DTD_ID_12, SYSTEM_ID_12);
        return tag.getQName();
   
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 ApplicationClientDescriptor)) {
            throw new IllegalArgumentException(getClass() + " cannot handle descriptors of type " + descriptor.getClass());
        }
        ApplicationClientDescriptor appclientDesc = (ApplicationClientDescriptor) descriptor;
        Node appclientNode = super.writeDescriptor(parent, appclientDesc);      

	// env-entry*
        writeEnvEntryDescriptors(appclientNode, appclientDesc.getEnvironmentProperties().iterator());
        
        // ejb-ref * and ejb-local-ref*
        writeEjbReferenceDescriptors(appclientNode, appclientDesc.getEjbReferenceDescriptors().iterator());

        // service-ref*
        writeServiceReferenceDescriptors(appclientNode, appclientDesc.getServiceReferenceDescriptors().iterator());

        // resource-ref*
        writeResourceRefDescriptors(appclientNode, appclientDesc.getResourceReferenceDescriptors().iterator());
        
        // resource-env-ref*
        writeResourceEnvRefDescriptors(appclientNode, appclientDesc.getJmsDestinationReferenceDescriptors().iterator());

        // message-destination-ref*
        writeMessageDestinationRefDescriptors(appclientNode, appclientDesc.getMessageDestinationReferenceDescriptors().iterator());

        // persistence-unit-ref*
        writeEntityManagerFactoryReferenceDescriptors(appclientNode, appclientDesc.getEntityManagerFactoryReferenceDescriptors().iterator());

        // post-construct
        writePostConstructDescriptors(appclientNode, appclientDesc.getPostConstructDescriptors().iterator());
        
        // pre-destroy
        writePreDestroyDescriptors(appclientNode, appclientDesc.getPreDestroyDescriptors().iterator());
        
        appendTextChild(appclientNode, ApplicationClientTagNames.CALLBACK_HANDLER, appclientDesc.getCallbackHandler());                

         // message-destination*
        writeMessageDestinations
           (appclientNode, appclientDesc.getMessageDestinations().iterator());      
        
	return appclientNode;