Exemplo n.º 1
0
  private void setupEmailConfig() throws IOException, XmlPullParserException {
    FileInputStream fis = null;
    Configuration config = null;
    try {
      fis = new FileInputStream(this.getNexusConfiguration());

      NexusConfigurationXpp3Reader reader = new NexusConfigurationXpp3Reader();
      config = reader.read(fis);

      config.getSmtpConfiguration().setPort(this.emailServerPort);
      config.getSmtpConfiguration().setHostname("localhost");
      // config.getSmtpConfiguration().setDebugMode( true );

    } finally {
      IOUtil.close(fis);
    }

    // now write it back out
    FileWriter writer = null;

    try {
      writer = new FileWriter(this.getNexusConfiguration());
      new NexusConfigurationXpp3Writer().write(writer, config);
    } finally {
      IOUtil.close(writer);
    }
  }
  protected Configuration getConfigurationFromStream(InputStream is) throws Exception {
    NexusConfigurationXpp3Reader reader = new NexusConfigurationXpp3Reader();

    Reader fr = new InputStreamReader(is);

    return reader.read(fr);
  }
  protected Configuration loadNexusConfig(File configFile) throws Exception {
    NexusConfigurationXpp3Reader reader = new NexusConfigurationXpp3Reader();

    Reader fr = new FileReader(configFile);
    try {
      return reader.read(fr);
    } finally {
      IOUtil.close(fr);
    }
  }