*/
public Node writeDescriptor(Node parent, String nodeName, Descriptor descriptor) {
if (! (descriptor instanceof Application)) {
throw new IllegalArgumentException(getClass() + " cannot handles descriptors of type " + descriptor.getClass());
}
Application application = (Application) descriptor;
Node appNode = super.writeDescriptor(parent, nodeName, descriptor);
// web*
for (Iterator modules=application.getModules();modules.hasNext();) {
ModuleDescriptor module = (ModuleDescriptor) modules.next();
if (module.getModuleType().equals(ModuleType.WAR)) {
Node web = appendChild(appNode, RuntimeTagNames.WEB);
appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri());
appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot());
}
}
// pass-by-reference ?
if (application.isPassByReferenceDefined()) {
appendTextChild(appNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(application.getPassByReference()));
}
// unique-id
appendTextChild(appNode, RuntimeTagNames.UNIQUE_ID, String.valueOf(application.getUniqueId()));
// security-role-mapping*
List<SecurityRoleMapping> roleMappings = application.getSecurityRoleMappings();
for (int i = 0; i < roleMappings.size(); i++) {
SecurityRoleMappingNode srmn = new SecurityRoleMappingNode();
srmn.writeDescriptor(appNode, RuntimeTagNames.SECURITY_ROLE_MAPPING, roleMappings.get(i));
}
// realm?
appendTextChild(appNode, RuntimeTagNames.REALM, application.getRealm());
return appNode;
}