@Override
  public List<URI> listDirectories(URI storageArea) {
    S3StorageHelper.checkValidS3Uri(storageArea);

    String bucket = getS3Bucket(storageArea);
    String key = getS3ObjectKey(storageArea);
    Iterator<String> iter =
        new S3PrefixListing(s3Service, new ListObjectsRequest(bucket, key, null, "/", null))
            .iterator();

    ImmutableList.Builder<URI> builder = ImmutableList.builder();
    while (iter.hasNext()) {
      builder.add(buildS3Location("s3://", bucket, iter.next()));
    }
    return builder.build();
  }
  @Override
  public List<StoredObject> listObjects(URI storageArea) {
    S3StorageHelper.checkValidS3Uri(storageArea);

    String s3Path = getS3ObjectKey(storageArea);
    Iterator<S3ObjectSummary> iter =
        new S3ObjectListing(
                s3Service,
                new ListObjectsRequest(getS3Bucket(storageArea), s3Path, null, "/", null))
            .iterator();

    ImmutableList.Builder<StoredObject> builder = ImmutableList.builder();
    while (iter.hasNext()) {
      S3ObjectSummary summary = iter.next();
      builder.add(
          new StoredObject(
              buildS3Location(storageArea, summary.getKey().substring(s3Path.length())),
              summary.getETag(),
              summary.getSize(),
              summary.getLastModified().getTime()));
    }
    return builder.build();
  }