/** * * @return * @throws StorageCommunicationException * @see org.opencredo.cloud.storage.StorageOperations#listContainerNames() */ public List<String> listContainerNames() throws StorageCommunicationException { LOG.debug("List buckets"); try { S3Bucket[] s3buckets = s3Service.listAllBuckets(); List<String> bucketNames = new ArrayList<String>(s3buckets.length); for (int i = 0; i < s3buckets.length; i++) { bucketNames.add(s3buckets[i].getName()); } return bucketNames; } catch (S3ServiceException e) { throw new StorageCommunicationException("Bucket list problem", e); } }
@Override public AbstractFile[] ls() throws IOException { try { org.jets3t.service.model.S3Bucket buckets[] = service.listAllBuckets(); int nbBuckets = buckets.length; AbstractFile bucketFiles[] = new AbstractFile[nbBuckets]; FileURL bucketURL; for(int i=0; i<nbBuckets; i++) { bucketURL = (FileURL)fileURL.clone(); bucketURL.setPath("/"+buckets[i].getName()); bucketFiles[i] = FileFactory.getFile(bucketURL, null, service, buckets[i]); } return bucketFiles; } catch(S3ServiceException e) { throw getIOException(e); } }
final S3Bucket[] buckets = s3ServiceMulti.getS3Service().listAllBuckets();
S3Bucket[] bucketArray; try { bucketArray = s3.listAllBuckets(); for (S3Bucket s3Bucket : bucketArray) { DefaultMutableTreeNode tempTreeNode = s3Tree.addObject((DefaultMutableTreeNode) null,
final S3Bucket[] buckets = s3ServiceMulti.getS3Service().listAllBuckets();
/** * * @param awsCredentials * @param defaultContainerName * @throws StorageException */ public S3Template(final AwsCredentials awsCredentials, final String defaultContainerName) throws StorageException { this.defaultContainerName = defaultContainerName; try { s3Service = new RestS3Service(new org.jets3t.service.security.AWSCredentials(awsCredentials.getAccessKey(), awsCredentials.getSecretAccessKey())); // Next statement checks if connection works. This is sugested by jets3t documentation. s3Service.listAllBuckets(); } catch (S3ServiceException e) { throw new StorageException("Failed to prepare S3 service.", e); } }
devPayService.listAllBuckets();