FileDocCategorySizeDatePackage
ApplicationNode.javaAPI DocGlassfish v2 API8514Fri May 04 22:31:38 BST 2007com.sun.enterprise.deployment.node

ApplicationNode

public class ApplicationNode extends BundleNode implements RootXMLNode
This class is responsible for loading and saving XML elements
author
Jerome Dochez
version

Fields Summary
public static final String
PUBLIC_DTD_ID
The public ID.
public static final String
PUBLIC_DTD_ID_12
public static final String
SYSTEM_ID
The system ID.
public static final String
SYSTEM_ID_12
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 XMLElement
tag
private com.sun.enterprise.deployment.Application
descriptor
Constructors Summary
public ApplicationNode()
Creates new ApplicationNode

     
        super();	
        registerElementHandler(new XMLElement(ApplicationTagNames.MODULE), ModuleNode.class, "addModule");    
        registerElementHandler(new XMLElement(ApplicationTagNames.ROLE), SecurityRoleNode.class, "addAppRole");            
    
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 EjbBundleDescriptor) {
	    if(DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
		DOLUtils.getDefaultLogger().fine("In  " + toString() + 
		    " adding descriptor " + newDescriptor);
	    }
           descriptor.addEjbBundleDescriptor((EjbBundleDescriptor)  newDescriptor);
       } else  if (newDescriptor instanceof WebBundleDescriptor) {
           DOLUtils.getDefaultLogger().fine("In  " + toString() + " adding web descriptor " + newDescriptor);
           descriptor.addWebBundleDescriptor((WebBundleDescriptor)  newDescriptor);
       }           
    
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        if (descriptor==null) {
            descriptor = (Application) DescriptorFactory.getDescriptor(getXMLPath());
        }
        return descriptor;
    
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 XMLElementgetXMLRootTag()

return
the XML tag associated with this XMLNode

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

    
         
        List<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 voidsetElementValue(XMLElement element, java.lang.String value)
receives notiification of the value for a particular tag

param
element the xml element
param
value it's associated value

        Application application = (Application)getDescriptor();
        if (element.getQName().equals(
            ApplicationTagNames.LIBRARY_DIRECTORY)) {          
            application.setLibraryDirectory(value);
        } else super.setElementValue(element, value);
    
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
the descriptor to write
return
the DOM tree top node

        if (! (descriptor instanceof Application)) {
            throw new IllegalArgumentException(getClass() + " cannot handles descriptors of type " + descriptor.getClass());
        }            
        Application application = (Application) descriptor;
        Node appNode = super.writeDescriptor(parent, application);
        
        // module
        ModuleNode moduleNode = new ModuleNode();
        for (Iterator modules = application.getModules();modules.hasNext();) {
            ModuleDescriptor next = (ModuleDescriptor) modules.next();
            moduleNode.writeDescriptor(appNode, ApplicationTagNames.MODULE, next);
        }

        // security-role* 
        // this information is not written out since it's already included
        // in the sub module deployment descriptors


        // library-directory
        if (application.getLibraryDirectoryRawValue() != null) {
            appendTextChild(appNode, ApplicationTagNames.LIBRARY_DIRECTORY, 
                application.getLibraryDirectoryRawValue());
        }
        return appNode;