protected Metadata downloadMetadataFromRepository(Gav gav, String repoId)
      throws IOException, XmlPullParserException {
    // File f =
    // new File( nexusWorkDir, "storage/" + repoId + "/" + gav.getGroupId() + "/" +
    // gav.getArtifactId()
    // + "/maven-metadata.xml" );
    //
    // if ( !f.exists() )
    // {
    // throw new FileNotFoundException( "Metadata do not exist! " + f.getAbsolutePath() );
    // }

    String url =
        this.getBaseNexusUrl()
            + REPOSITORY_RELATIVE_URL
            + repoId
            + "/"
            + gav.getGroupId()
            + "/"
            + gav.getArtifactId()
            + "/maven-metadata.xml";

    Response response = RequestFacade.sendMessage(new URL(url), Method.GET, null);
    if (response.getStatus().isError()) {
      return null;
    }

    InputStream stream = response.getEntity().getStream();
    try {
      MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
      return metadataReader.read(stream);
    } finally {
      IOUtil.close(stream);
    }
  }
  protected boolean deleteFromRepository(String repository, String groupOrArtifactPath)
      throws IOException {
    String serviceURI =
        "service/local/repositories/" + repository + "/content/" + groupOrArtifactPath;

    Response response = RequestFacade.doGetRequest(serviceURI);
    if (response.getStatus().equals(Status.CLIENT_ERROR_NOT_FOUND)) {
      log.debug("It was not deleted because it didn't exist " + serviceURI);
      return true;
    }

    log.debug("deleting: " + serviceURI);
    response = RequestFacade.sendMessage(serviceURI, Method.DELETE);

    boolean deleted = response.getStatus().isSuccess();

    if (!deleted) {
      log.debug("Failed to delete: " + serviceURI + "  - Status: " + response.getStatus());
    }

    // fake it because the artifact doesn't exist
    // TODO: clean this up.
    if (response.getStatus().getCode() == 404) {
      deleted = true;
    }

    return deleted;
  }