@Override protected InputStream openObjectStream(S3Object object) throws IOException { try { // Get data of the given object and open an input stream return s3Client.getObject(object.getBucketName(), object.getKey()).getDataInputStream(); } catch (ServiceException e) { throw new IOException(e); } }
currentObject.getBucketName(), currentObject.getKey(), specialParamName, null, secondsSinceEpoch, virtualHostCheckBox.isSelected(), httpsUrlsCheckBox.isSelected(), disableDnsBuckets);
public boolean grantAcl(S3Object object) throws ServiceException, InterruptedException { if(Strings.isNullOrEmpty(s3Acl)){ return true; } for (int i = 0; i < s3AclRetries; ++i) { try { AccessControlList acl = s3Service.getObjectAcl(object.getBucketName(), object.getKey()); for (String id : s3Acl.split(",")) { acl.grantPermission(new CanonicalGrantee(id), Permission.PERMISSION_READ); } s3Service.putObjectAcl(object.getBucketName(), object.getKey(), acl); return true; } catch (Exception e) { log.error("Exception while granting ACL: " + e.getMessage(), e); Thread.sleep(1000 * (i + 1)); } } return false; } }
currentObject.getBucketName(), currentObject.getKey(), specialParamName, null, secondsSinceEpoch, virtualHostCheckBox.isSelected(), httpsUrlsCheckBox.isSelected(), disableDnsBuckets);
protected InputStream getInputStream(S3Object nextFile) throws ServiceException, IOException { return s3.getObject(nextFile.getBucketName(), nextFile.getName()).getDataInputStream(); }
@Override public URI call() throws Exception { final S3Coords coords = new S3Coords(checkURI(uri)); long mostRecent = Long.MIN_VALUE; URI latest = null; S3Object[] objects = s3Client.listObjects(coords.bucket, coords.path, null); if (objects == null) { return null; } for (S3Object storageObject : objects) { storageObject.closeDataInputStream(); String keyString = storageObject.getKey().substring(coords.path.length()); if (keyString.startsWith("/")) { keyString = keyString.substring(1); } if (pattern != null && !pattern.matcher(keyString).matches()) { continue; } final long latestModified = storageObject.getLastModifiedDate().getTime(); if (latestModified >= mostRecent) { mostRecent = latestModified; latest = new URI(StringUtils.format("s3://%s/%s", storageObject.getBucketName(), storageObject.getKey())); } } return latest; } },
objectLastModifiedTextField.setText(String.valueOf(object.getLastModifiedDate())); objectETagTextField.setText(object.getETag()); bucketNameTextField.setText(object.getBucketName());
/** * * @param containerName * @return * @throws StorageCommunicationException * @see org.opencredo.cloud.storage.StorageOperations#listContainerObjectDetails(java.lang.String) */ public List<BlobDetails> listContainerObjectDetails(String containerName) throws StorageCommunicationException { Assert.notNull(containerName, "Bucket name cannot be null"); LOG.debug("Get objects list for bucket '{}'", containerName); try { S3Object[] s3Objects = this.s3Service.listObjects(new S3Bucket(containerName)); List<BlobDetails> keys = new ArrayList<BlobDetails>(s3Objects.length); for (S3Object s : s3Objects) { keys.add(new BlobDetails(s.getBucketName(), s.getKey(), s.getETag(), s.getLastModifiedDate())); } return keys; } catch (S3ServiceException e) { throw new StorageCommunicationException("Failed to get bucket " + containerName + " object details.", e); } }
objectLastModifiedTextField.setText(String.valueOf(object.getLastModifiedDate())); objectETagTextField.setText(object.getETag()); bucketNameTextField.setText(object.getBucketName());
destination.getBucketName(), destination); if(log.isDebugEnabled()) { log.debug(String.format("Multipart upload started for %s with ID %s",
objectLastModifiedTextField.setText(String.valueOf(currentObject.getLastModifiedDate())); objectETagTextField.setText(currentObject.getETag()); bucketLocationTextField.setText(currentObject.getBucketName()); String storageClass = (currentObject.getStorageClass() != null ? currentObject.getStorageClass()
sourceObjectKeys[i] = objects[i].getKey(); sourceBucketName = destinationObjects[0].getBucketName();
objectLastModifiedTextField.setText(String.valueOf(currentObject.getLastModifiedDate())); objectETagTextField.setText(currentObject.getETag()); bucketLocationTextField.setText(currentObject.getBucketName()); String storageClass = (currentObject.getStorageClass() != null ? currentObject.getStorageClass()
protected String copy(final Path source, final S3Object destination, final TransferStatus status) throws BackgroundException { try { // Copying object applying the metadata of the original final Map<String, Object> stringObjectMap = session.getClient().copyVersionedObject(source.attributes().getVersionId(), containerService.getContainer(source).getName(), containerService.getKey(source), destination.getBucketName(), destination, false); final Map complete = (Map) stringObjectMap.get(Constants.KEY_FOR_COMPLETE_METADATA); return (String) complete.get(Constants.AMZ_VERSION_ID); } catch(ServiceException e) { throw new S3ExceptionMappingService().map("Cannot copy {0}", e, source); } }
sourceObjectKeys[i] = objects[i].getKey(); sourceBucketName = destinationObjects[0].getBucketName();
Map clonedMetadata = new HashMap(); clonedMetadata.putAll(object.getMetadataMap()); xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(), clonedMetadata, request);
Map clonedMetadata = new HashMap(); clonedMetadata.putAll(object.getMetadataMap()); xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(), clonedMetadata, request);