Ejemplo n.º 1
0
 public static Configuration createConfig(String resourceFile) {
   DefaultConfiguration config = new DefaultConfiguration("component");
   config.setAttribute("id", resourceFile.toString());
   return config;
 }
Ejemplo n.º 2
0
  protected void addChildren(DefaultConfiguration newConfig) {
    if (!externalConfigEnabled) {
      DefaultConfiguration smtpPort = new DefaultConfiguration("smtp-port");
      DefaultConfiguration smtpServer = new DefaultConfiguration("smtp-host");
      DefaultConfiguration ssl = new DefaultConfiguration("ssl");

      smtpPort.setValue(smtpPortField.getNumber().intValue());
      smtpServer.setValue(mailServer.getValue());
      ssl.setValue(useSsl.isSelected());
      newConfig.addChild(smtpPort);
      newConfig.addChild(smtpServer);
      newConfig.addChild(ssl);
      DefaultConfiguration username = new DefaultConfiguration("username");
      DefaultConfiguration password = new DefaultConfiguration("password");
      String usernameValue = this.username.getText();
      if (usernameValue != null && usernameValue.trim().length() > 0) {
        username.setValue(usernameValue);
      }
      newConfig.addChild(username);
      String passwordString = new String(this.password.getPassword());
      if (passwordString.trim().length() > 0) {
        password.setValue(passwordString);
      }
      newConfig.addChild(password);
    }
  }