public @Nonnull List<String> get(@Nullable String bucket) throws CloudException, InternalException { AuthenticationContext context = provider.getAuthenticationContext(); String endpoint = context.getStorageUrl(); if (endpoint == null) { throw new CloudException("No storage endpoint exists for " + context.getMyRegion()); } String response = getString(context.getAuthToken(), endpoint, bucket == null ? "/" : "/" + bucket); ArrayList<String> entries = new ArrayList<String>(); if (response != null) { response = response.trim(); if (response.length() > 0) { String[] lines = response.split("\n"); if (lines.length < 1) { entries.add(response); } else { for (String line : lines) { entries.add(line.trim()); } } } } return entries; }
public void delete(@Nonnull String bucket) throws CloudException, InternalException { AuthenticationContext context = provider.getAuthenticationContext(); String endpoint = context.getStorageUrl(); if (endpoint == null) { throw new CloudException("No storage endpoint exists for " + context.getMyRegion()); } delete(context.getAuthToken(), endpoint, "/" + bucket); }
public @Nullable InputStream get(@Nonnull String bucket, @Nonnull String object) throws CloudException, InternalException { AuthenticationContext context = provider.getAuthenticationContext(); String endpoint = context.getStorageUrl(); if (endpoint == null) { throw new CloudException("No storage endpoint exists for " + context.getMyRegion()); } return getStream(context.getAuthToken(), endpoint, "/" + bucket + "/" + object); }
@SuppressWarnings("unused") public @Nullable Map<String, String> head(@Nonnull String bucket) throws CloudException, InternalException { AuthenticationContext context = provider.getAuthenticationContext(); String endpoint = context.getStorageUrl(); if (endpoint == null) { throw new CloudException("No storage endpoint exists for " + context.getMyRegion()); } return head(context.getAuthToken(), endpoint, "/" + bucket); }
public void put( @Nonnull String bucket, @Nonnull String object, @Nullable String md5Hash, @Nonnull InputStream payload) throws CloudException, InternalException { AuthenticationContext context = provider.getAuthenticationContext(); String endpoint = context.getStorageUrl(); if (endpoint == null) { throw new CloudException("No storage endpoint exists for " + context.getMyRegion()); } putStream(context.getAuthToken(), endpoint, "/" + bucket + "/" + object, md5Hash, payload); }