/**
   * Creates a new connection.
   *
   * @param url the url; cannot be null.
   * @param configuration service configuration; cannot be null
   * @throws MalformedURLException in case of a malformed url
   */
  public Connection(final URL url, final MavenConfiguration configuration)
      throws MalformedURLException {
    super(url);
    NullArgumentException.validateNotNull(url, "URL cannot be null");
    NullArgumentException.validateNotNull(configuration, "Service configuration");
    m_parser = new Parser(url.getPath());

    ArrayList<String> r = new ArrayList<String>();

    for (MavenRepositoryURL s : configuration.getRepositories()) {
      if (!s.isFileRepository()) {
        r.add(s.getURL().toExternalForm());
      }
    }

    // String[] repos = "http://repo1.maven.org/maven2/".split(",");

    String local = configuration.getLocalRepository().getFile().getAbsolutePath();

    m_aetherBasedResolver = new AetherBasedResolver(local, r.toArray(new String[r.size()]));
  }