private void sanitizeObjectKey(S3Object object) { if (object.getKey().startsWith(usersPath)) { object.setKey(object.getKey().substring(usersPath.length())); } }
private void sanitizeObjectKey(S3Object object) { if (object.getKey().startsWith(usersPath)) { object.setKey(object.getKey().substring(usersPath.length())); } }
@Override protected void upload(String localFilePath, String remoteFilePath) throws Exception { S3Object file = new S3Object(new File(localFilePath)); file.setBucketName(bucket); file.setKey(remoteFilePath); file.setAcl(GSAccessControlList.REST_CANNED_BUCKET_OWNER_FULL_CONTROL); List objectsToUploadAsMultipart = new ArrayList(); objectsToUploadAsMultipart.add(file); mpUtils.uploadObjects(bucket, s3Service, objectsToUploadAsMultipart, null); if (!grantAcl.grantAcl(file)) { throw new RuntimeException("Failed to set Acl"); } } }
/** * Event handler for this dialog. */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { copyActionApproved = true; for (int i = 0; i < destinationObjects.length; i++) { destinationObjects[i].setKey( renameObjectKey(destinationObjects[i].getKey(), i)); if ("Publically Accessible".equals(destinationAclComboBox.getSelectedItem())) { destinationObjects[i].setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); } else if ("Unchanged".equals(destinationAclComboBox.getSelectedItem())) { copyOriginalAccessControlLists = true; } // Apply storage class destinationObjects[i].setStorageClass( (String) destinationStorageClassComboBox.getSelectedItem()); } this.setVisible(false); } else if ("Cancel".equals(e.getActionCommand())) { copyActionApproved = false; this.setVisible(false); } }
/** * Event handler for this dialog. */ public void actionPerformed(ActionEvent e) { if ("OK".equals(e.getActionCommand())) { copyActionApproved = true; for (int i = 0; i < destinationObjects.length; i++) { destinationObjects[i].setKey( renameObjectKey(destinationObjects[i].getKey(), i)); if ("Publically Accessible".equals(destinationAclComboBox.getSelectedItem())) { destinationObjects[i].setAcl(AccessControlList.REST_CANNED_PUBLIC_READ); } else if ("Unchanged".equals(destinationAclComboBox.getSelectedItem())) { copyOriginalAccessControlLists = true; } // Apply storage class destinationObjects[i].setStorageClass( (String) destinationStorageClassComboBox.getSelectedItem()); } this.setVisible(false); } else if ("Cancel".equals(e.getActionCommand())) { copyActionApproved = false; this.setVisible(false); } }
/** * * @param containerName * @param objectName * @param fileToSend * @throws StorageCommunicationException * @see org.opencredo.cloud.storage.StorageOperations#send(java.lang.String, * java.lang.String, java.io.File) */ public void send(String containerName, String objectName, File fileToSend) throws StorageCommunicationException { Assert.notNull(containerName, "Bucket name can not be null"); Assert.hasText(objectName, "Blob name must be set"); Assert.notNull(fileToSend, "File to send can not be null"); if (LOG.isDebugEnabled()) { LOG.debug("Send file '{}' to bucket '{}' with key '{}'", new Object[] { fileToSend.getAbsolutePath(), containerName, objectName }); } try { S3Object object = new S3Object(fileToSend); object.setKey(objectName); s3Service.putObject(new S3Bucket(containerName), object); } catch (S3ServiceException e) { throw new StorageCommunicationException("Sending file problem", e); } catch (NoSuchAlgorithmException e) { throw new StorageCommunicationException("No such algorithm", e); } catch (IOException e) { throw new StorageCommunicationException("Sending string IO problem", e); } }
private void putObject(String bucketName, String path, S3Object object) throws ServiceException { object.setBucketName(bucketName); object.setKey(path); if (!config.getDisableAcl()) { object.setAcl(GSAccessControlList.REST_CANNED_BUCKET_OWNER_FULL_CONTROL); } log.info("Pushing %s.", object); s3Client.putObject(bucketName, object); } }
object.setKey(request.getObjectKey());
object.setKey(request.getObjectKey());