Beispiel #1
0
  private void updateChipsterConfigFilePasswords(File configFile) throws Exception {
    Document doc = openForUpdating("Chipster", configFile);

    Element securityModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "security");
    Element usernameElement =
        XmlUtil.getChildWithAttributeValue(securityModule, "entryKey", "username");
    String username =
        ((Element) usernameElement.getElementsByTagName("value").item(0)).getTextContent();
    for (int i = 0; i < passwords.length; i++) {
      if (username.equals(passwords[i][KEY_INDEX])) {
        updateConfigEntryValue(securityModule, "password", passwords[i][VAL_INDEX]);
        break;
      }
    }
    writeLater(configFile, doc);
  }
Beispiel #2
0
  private void updateChipsterConfigFile(File configFile) throws Exception {
    Document doc = openForUpdating("Chipster", configFile);

    Element messagingModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "messaging");
    updateConfigEntryValue(messagingModule, "broker-host", configs[BROKER_HOST_INDEX][VAL_INDEX]);
    updateConfigEntryValue(
        messagingModule, "broker-protocol", configs[BROKER_PROTOCOL_INDEX][VAL_INDEX]);
    updateConfigEntryValue(messagingModule, "broker-port", configs[BROKER_PORT_INDEX][VAL_INDEX]);

    Element filebrokerModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "filebroker");
    if (filebrokerModule != null) {
      updateConfigEntryValue(filebrokerModule, "port", configs[FILEBROKER_PORT_INDEX][VAL_INDEX]);
      updateConfigEntryValue(filebrokerModule, "url", createFilebrokerUrl());
    }

    Element analyserModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "comp");
    if (analyserModule != null) {
      updateConfigEntryValue(analyserModule, "max-jobs", configs[MAX_JOBS_INDEX][VAL_INDEX]);
    }

    Element webstartModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "webstart");
    if (webstartModule != null) {
      updateConfigEntryValue(webstartModule, "port", configs[WS_PORT][VAL_INDEX]);
    }

    Element clientModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "client");
    if (clientModule != null) {
      updateConfigEntryValue(
          clientModule, "manual-root", configs[WS_CODEBASE_INDEX][VAL_INDEX] + "/manual/");
    }

    Element managerModule =
        XmlUtil.getChildWithAttributeValue(doc.getDocumentElement(), "moduleId", "manager");
    if (managerModule != null) {
      updateConfigEntryValue(managerModule, "web-console-port", configs[MANAGER_PORT][VAL_INDEX]);
      updateConfigEntryValue(managerModule, "admin-email", configs[MANAGER_EMAIL][VAL_INDEX]);
    }

    writeLater(configFile, doc);
  }
Beispiel #3
0
 private void updateConfigEntryValue(Element module, String name, String newValue) {
   Element entry = XmlUtil.getChildWithAttributeValue(module, "entryKey", name);
   Element value = (Element) entry.getElementsByTagName("value").item(0);
   updateElementValue(value, name, newValue);
 }