FileDocCategorySizeDatePackage
EjbBundleRuntimeNode.javaAPI DocGlassfish v2 API8392Fri May 04 22:31:42 BST 2007com.sun.enterprise.deployment.node.runtime

EjbBundleRuntimeNode

public class EjbBundleRuntimeNode extends RuntimeBundleNode
This node handles runtime deployment descriptors for ejb bundle
author
Jerome Dochez
version

Fields Summary
com.sun.enterprise.deployment.EjbBundleDescriptor
descriptor
Constructors Summary
public EjbBundleRuntimeNode(com.sun.enterprise.deployment.EjbBundleDescriptor descriptor)
Creates new EjbBundleRuntimeNode

    
    
        
       
        super(descriptor);
        this.descriptor = descriptor;      
        registerElementHandler(new XMLElement(RuntimeTagNames.SECURITY_ROLE_MAPPING), 
                               SecurityRoleMappingNode.class);
        registerElementHandler(new XMLElement(RuntimeTagNames.EJBS), 
                               EntrepriseBeansRuntimeNode.class);   
    
public EjbBundleRuntimeNode()
Creates new EjbBundleRuntimeNode

        super(null);    
    
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 SecurityRoleMapping) {
            SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor;
            descriptor.addSecurityRoleMapping(roleMap);
            Application app = descriptor.getApplication();
            if (app!=null) {
                Role role = new Role(roleMap.getRoleName());
                SecurityRoleMapper rm = app.getRoleMapper();
                if (rm != null) {
                    List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
                    for (int i = 0; i < principals.size(); i++) {
                        rm.assignRole(principals.get(i).getPrincipal(),
                            role, descriptor);
                    }
                    List<String> groups = roleMap.getGroupNames();
                    for (int i = 0; i < groups.size(); i++) {
                        rm.assignRole(new Group(groups.get(i)),
                            role, descriptor);
                    }
                }
            }
        }
    
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        return descriptor;
    
public java.lang.StringgetDocType()

return
the DOCTYPE that should be written to the XML file

	return DTDRegistry.SUN_EJBJAR_300_DTD_PUBLIC_ID;
    
public java.lang.StringgetSystemID()

return
the SystemID of the XML file

	return DTDRegistry.SUN_EJBJAR_300_DTD_SYSTEM_ID;
    
public java.util.ListgetSystemIDs()

return
NULL for all runtime nodes.

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

return
the XML tag associated with this XMLNode

        return new XMLElement(RuntimeTagNames.S1AS_EJB_RUNTIME_TAG);
    
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(DTDRegistry.SUN_EJBJAR_200_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_200_DTD_SYSTEM_ID);
       publicIDToDTD.put(DTDRegistry.SUN_EJBJAR_201_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_201_DTD_SYSTEM_ID);
       publicIDToDTD.put(DTDRegistry.SUN_EJBJAR_210_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_210_DTD_SYSTEM_ID);
       publicIDToDTD.put(DTDRegistry.SUN_EJBJAR_211_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_211_DTD_SYSTEM_ID);
       publicIDToDTD.put(DTDRegistry.SUN_EJBJAR_300_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_300_DTD_SYSTEM_ID);
       if (!restrictDTDDeclarations()) {
           publicIDToDTD.put(DTDRegistry.SUN_EJBJAR_210beta_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_210beta_DTD_SYSTEM_ID);
       }           
       return RuntimeTagNames.S1AS_EJB_RUNTIME_TAG;
   
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 EjbBundleDescriptor)) {
            throw new IllegalArgumentException(getClass() + 
                " cannot handles descriptors of type " + descriptor.getClass());
        }
        EjbBundleDescriptor bundleDescriptor = (EjbBundleDescriptor) descriptor;
        Node ejbs = super.writeDescriptor(parent, descriptor);

        // security-role-mapping*
        List<SecurityRoleMapping> roleMappings = bundleDescriptor.getSecurityRoleMappings();
        for (int i = 0; i < roleMappings.size(); i++) { 
            SecurityRoleMappingNode srmn = new SecurityRoleMappingNode();
            srmn.writeDescriptor(ejbs, RuntimeTagNames.SECURITY_ROLE_MAPPING, roleMappings.get(i));
        }
	
	    // entreprise-beans
        EntrepriseBeansRuntimeNode ejbsNode = new EntrepriseBeansRuntimeNode();
        ejbsNode.writeDescriptor(ejbs, RuntimeTagNames.EJBS, bundleDescriptor);
        return ejbs;