Example #1
0
  /**
   * write the descriptor class to a DOM tree and return it
   *
   * @param parent node for the DOM tree
   * @param nodeName the node name
   * @param application the descriptor to write
   * @return the DOM tree top node
   */
  public Node writeDescriptor(Node parent, String nodeName, Application application) {
    Node appNode = super.writeDescriptor(parent, nodeName, application);

    // web*
    for (ModuleDescriptor module : application.getModules()) {
      if (module.getModuleType().equals(DOLUtils.warType())) {
        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()));
    }

    // NOTE : unique-id is no longer written out to sun-ejb-jar.xml.  It is persisted via
    // domain.xml deployment context properties instead.

    // 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());

    // references
    RuntimeDescriptorNode.writeCommonComponentInfo(appNode, application);
    RuntimeDescriptorNode.writeMessageDestinationInfo(appNode, application);

    // archive-name
    appendTextChild(appNode, RuntimeTagNames.ARCHIVE_NAME, application.getArchiveName());

    // compatibility
    appendTextChild(appNode, RuntimeTagNames.COMPATIBILITY, application.getCompatibility());

    // keep-state
    appendTextChild(
        appNode, RuntimeTagNames.KEEP_STATE, String.valueOf(application.getKeepState()));

    return appNode;
  }