List of usage examples for com.amazonaws ClientConfiguration setSocketTimeout
public void setSocketTimeout(int socketTimeout)
From source file:alluxio.underfs.s3a.S3AUnderFileSystem.java
License:Apache License
/** * Constructs a new instance of {@link S3AUnderFileSystem}. * * @param uri the {@link AlluxioURI} for this UFS *//*from w w w. j av a 2s. co m*/ public S3AUnderFileSystem(AlluxioURI uri) { super(uri); mBucketName = uri.getHost(); mBucketPrefix = PathUtils.normalizePath(Constants.HEADER_S3A + mBucketName, PATH_SEPARATOR); // Set the aws credential system properties based on Alluxio properties, if they are set if (Configuration.containsKey(PropertyKey.S3A_ACCESS_KEY)) { System.setProperty(SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY, Configuration.get(PropertyKey.S3A_ACCESS_KEY)); } if (Configuration.containsKey(PropertyKey.S3A_SECRET_KEY)) { System.setProperty(SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY, Configuration.get(PropertyKey.S3A_SECRET_KEY)); } // Checks, in order, env variables, system properties, profile file, and instance profile AWSCredentialsProvider credentials = new AWSCredentialsProviderChain( new DefaultAWSCredentialsProviderChain()); // Set the client configuration based on Alluxio configuration values ClientConfiguration clientConf = new ClientConfiguration(); // Socket timeout clientConf.setSocketTimeout(Configuration.getInt(PropertyKey.UNDERFS_S3A_SOCKET_TIMEOUT_MS)); // HTTP protocol if (Configuration.getBoolean(PropertyKey.UNDERFS_S3A_SECURE_HTTP_ENABLED)) { clientConf.setProtocol(Protocol.HTTPS); } else { clientConf.setProtocol(Protocol.HTTP); } // Proxy host if (Configuration.containsKey(PropertyKey.UNDERFS_S3_PROXY_HOST)) { clientConf.setProxyHost(Configuration.get(PropertyKey.UNDERFS_S3_PROXY_HOST)); } // Proxy port if (Configuration.containsKey(PropertyKey.UNDERFS_S3_PROXY_PORT)) { clientConf.setProxyPort(Configuration.getInt(PropertyKey.UNDERFS_S3_PROXY_PORT)); } mClient = new AmazonS3Client(credentials, clientConf); if (Configuration.containsKey(PropertyKey.UNDERFS_S3_ENDPOINT)) { mClient.setEndpoint(Configuration.get(PropertyKey.UNDERFS_S3_ENDPOINT)); } mManager = new TransferManager(mClient); TransferManagerConfiguration transferConf = new TransferManagerConfiguration(); transferConf.setMultipartCopyThreshold(MULTIPART_COPY_THRESHOLD); mManager.setConfiguration(transferConf); mAccountOwnerId = mClient.getS3AccountOwner().getId(); // Gets the owner from user-defined static mapping from S3 canonical user id to Alluxio // user name. String owner = CommonUtils.getValueFromStaticMapping( Configuration.get(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING), mAccountOwnerId); // If there is no user-defined mapping, use the display name. if (owner == null) { owner = mClient.getS3AccountOwner().getDisplayName(); } mAccountOwner = owner == null ? mAccountOwnerId : owner; AccessControlList acl = mClient.getBucketAcl(mBucketName); mBucketMode = S3AUtils.translateBucketAcl(acl, mAccountOwnerId); }
From source file:br.puc_rio.ele.lvc.interimage.core.datamanager.AWSSource.java
License:Apache License
public AWSSource(String accessKey, String secretKey, String bucket) { _accessKey = accessKey;/*www. j ava2 s . c om*/ _secretKey = secretKey; _bucket = bucket; AWSCredentials credentials = new BasicAWSCredentials(_accessKey, _secretKey); ClientConfiguration conf = new ClientConfiguration(); conf.setConnectionTimeout(0); conf.setSocketTimeout(0); AmazonS3 conn = new AmazonS3Client(credentials); conn.setEndpoint("https://s3.amazonaws.com"); _manager = new TransferManager(conn); }
From source file:br.puc_rio.ele.lvc.interimage.core.datamanager.AWSSource.java
License:Apache License
public AWSSource(String accessKey, String secretKey, String bucket) { _accessKey = accessKey;//ww w .j ava2s. com _secretKey = secretKey; _bucket = bucket; AWSCredentials credentials = new BasicAWSCredentials(_accessKey, _secretKey); ClientConfiguration conf = new ClientConfiguration(); conf.setConnectionTimeout(0); conf.setSocketTimeout(0); AmazonS3 conn = new AmazonS3Client(credentials); conn.setEndpoint("https://s3.amazonaws.com"); _manager = new TransferManager(conn); }
From source file:com.amazon.kinesis.streaming.agent.AgentContext.java
License:Open Source License
public ClientConfiguration getAwsClientConfiguration() { ClientConfiguration config = new ClientConfiguration(); config.setUserAgent(userAgent(config)); config.setMaxConnections(maxConnections()); config.setConnectionTimeout(connectionTimeoutMillis()); config.setSocketTimeout(socketTimeoutMillis()); config.setUseTcpKeepAlive(useTcpKeepAlive()); config.setConnectionTTL(connectionTTLMillis()); config.setUseGzip(useHttpGzip());/*from ww w . j a v a2s . c o m*/ return config; }
From source file:com.brianmcmichael.sagu.SAGU.java
License:Open Source License
@Override public void actionPerformed(ActionEvent e) { String accessString = getAccessKey(); String secretString = getSecretKey(); String vaultString = getVaultName(); int regionInt = getServerRegion(); if (e.getSource() == newVaultButton && checkAWSFields()) { AmazonGlacierClient newVaultClient = makeClient(accessString, secretString, regionInt); AddVaultFrame avf = new AddVaultFrame(newVaultClient, regionInt); avf.setVisible(true);// www . ja va 2s. c om } if (e.getSource() == vaultSelector) { if (vaultSelector.getSelectedItem() != null) { if (vaultSelector.getSelectedIndex() == 0) { vaultField.setText(""); } else { vaultField.setText(vaultSelector.getSelectedItem().toString()); } } } if (e.getSource() == loginButton) { repopulateVaults(accessString, secretString); } if (e.getSource() == exitApplicationMnu) { System.exit(0); } if (e.getSource() == updateMnu || e.getSource() == checkUpdateButton) { JHyperlinkLabel.OpenURI(URL_STRING); } if (e.getSource() == saveFileMnu) { FileDialog fd = new FileDialog(new Frame(), "Save...", FileDialog.SAVE); fd.setFile("Glacier.txt"); fd.setDirectory(appProperties.getDir()); fd.setLocation(50, 50); fd.setVisible(true); String filePath = "" + fd.getDirectory() + System.getProperty("file.separator") + fd.getFile(); File outFile = new File(filePath); if (!outFile.equals("") && !outFile.equals("null")) { try { FileReader fr = new FileReader(getLogFile(0, appProperties)); BufferedReader br = new BufferedReader(fr); FileWriter saveFile = new FileWriter(outFile.toString()); int count = 0; boolean moreLines = true; String ln1; String ln2; String ln3; while (moreLines) { ln1 = br.readLine(); ln2 = br.readLine(); ln3 = br.readLine(); if (ln1 == null) { ln1 = ""; } if (ln2 == null) { ln2 = ""; } if (ln3 == null) { ln3 = ""; } saveFile.write(ln1); saveFile.write("\r\n"); saveFile.write(ln2); saveFile.write("\r\n"); saveFile.write(ln3); saveFile.write("\r\n"); count++; if (ln3.equals("")) { moreLines = false; br.close(); saveFile.close(); JOptionPane.showMessageDialog(null, "Successfully exported " + count + " archive records to " + outFile.toString(), "Export", JOptionPane.INFORMATION_MESSAGE); } } } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog(null, "Unable to locate Glacier.log", "Error", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } if (e.getSource() == viewLog || e.getSource() == logButton) { File f = getLogFile(logTypes.getSelectedIndex(), appProperties); if (f.exists()) { JHyperlinkLabel.OpenURI("" + f.toURI()); } else { JOptionPane.showMessageDialog(null, "Log file " + f.getName() + " does not exist.", "Error", JOptionPane.ERROR_MESSAGE); } } if (e.getSource() == deleteArchiveMnu) { if (checkAllFields()) { AmazonGlacierClient newDeleteClient = makeClient(accessString, secretString, regionInt); DeleteArchiveFrame daf = new DeleteArchiveFrame(newDeleteClient, vaultString, regionInt); daf.setVisible(true); } } if (e.getSource() == inventoryRequestButton) { if (checkAllFields()) { AmazonGlacierClient newInventoryClient = makeClient(accessString, secretString, regionInt); InventoryRequest ir = new InventoryRequest(newInventoryClient, vaultString, regionInt); ir.setVisible(true); } } if (e.getSource() == downloadRequestButton || e.getSource() == downloadFileMnu) { if (checkAllFields()) { AmazonGlacierClient newDownloadClient = makeClient(accessString, secretString, regionInt); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); AmazonDownloadRequest adr = new AmazonDownloadRequest(newDownloadClient, vaultString, regionInt, credentials); adr.setVisible(true); } } if (e.getSource() == aboutMnu) { JOptionPane.showMessageDialog(null, format(ABOUT_PATTERN, versionNumber), "About", JOptionPane.INFORMATION_MESSAGE); } if (e.getSource() == clearButton) { ddText.setText(""); uploadButton.setText("Select Files"); multiFiles = null; } if (e.getSource() == locationChoice) { repopulateVaults(accessString, secretString); } if (e.getSource() == selectFileButton) { int returnVal = fc.showOpenDialog(SAGU.this); if (returnVal == JFileChooser.APPROVE_OPTION) { if (fc.getSelectedFile().isFile()) { File[] thisFile = new File[1]; thisFile[0] = fc.getSelectedFile(); try { ddText.append(thisFile[0].getCanonicalPath() + "\n"); } catch (java.io.IOException f) { } if (multiFiles != null) { multiFiles = SAGUUtils.concatFileArrays(multiFiles, thisFile); } else { multiFiles = thisFile; } } else { JOptionPane.showMessageDialog(null, NO_DIRECTORIES_ERROR, "Error", JOptionPane.ERROR_MESSAGE); } } } if (e.getSource() == uploadButton) { if ((checkAllFields()) && (checkForFile())) { SwingWorker<Object, Void> uploadWorker = new SwingWorker<Object, Void>() { @Override protected Object doInBackground() throws Exception { String accessString = getAccessKey(); String secretString = getSecretKey(); String vaultName = getVaultName(); File[] uploadFileBatch = multiFiles; // work out exactly how much we are going to upload // so we can support a second total upload progress bar long totalSize = 0; long uploadedSize = 0; for (File f : uploadFileBatch) { totalSize += f.length(); } int locInt = getServerRegion(); multiFiles = null; clearFile(); UploadWindow uw = new UploadWindow(); if (uploadFileBatch.length > 0) { ArrayList<String> uploadList = new ArrayList<String>(); for (int i = 0; i < uploadFileBatch.length; i++) { try { Thread.sleep(100L); // why? } catch (InterruptedException e1) { e1.printStackTrace(); } ClientConfiguration config = new ClientConfiguration(); config.setSocketTimeout(SOCKET_TIMEOUT); config.setMaxErrorRetry(MAX_RETRIES); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); client = new AmazonGlacierClient(credentials, config); final Endpoint endpoint = Endpoint.getByIndex(locInt); client.setEndpoint(endpoint.getGlacierEndpoint()); String locationUpped = endpoint.name(); String thisFile = uploadFileBatch[i].getCanonicalPath(); final String description = SAGUUtils.pathToDescription(thisFile); try { ArchiveTransferManager atm = new ArchiveTransferManager(client, credentials); String fileLength = Long.toString(uploadFileBatch[i].length()); uw.setTitle("(" + (i + 1) + "/" + uploadFileBatch.length + ")" + " Uploading: " + thisFile); UploadResult result = atm.upload(null, vaultName, description, uploadFileBatch[i], new OneFileProgressListener(uw, uploadFileBatch[i].length())); uw.addToFinishedFiles(thisFile + "\n"); uploadedSize += uploadFileBatch[i].length(); int percentage = (int) (((double) uploadedSize / totalSize) * 100); uw.updateAllFilesProgress(percentage); final LogWriter logWriter; // write to file if (logCheckMenuItem.isSelected()) { String treeHash = TreeHashGenerator.calculateTreeHash(uploadFileBatch[i]); try { logWriter = new LogWriter(appProperties); try { String thisResult = result.getArchiveId(); logWriter.logUploadedFile(vaultName, locationUpped, thisFile, fileLength, treeHash, thisResult); uploadList.add("Successfully uploaded " + thisFile + " to vault " + vaultName + " at " + locationUpped + ". Bytes: " + fileLength + ". ArchiveID Logged.\n"); } catch (IOException c) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } } catch (IOException ex) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } } else { JOptionPane.showMessageDialog(null, "Upload Complete!\nArchive ID: " + result.getArchiveId() + "\nIt may take some time for Amazon to update the inventory.", "Uploaded", JOptionPane.INFORMATION_MESSAGE); multiFiles = null; uw.dispose(); } clearFile(); } catch (Exception h) { if (logCheckMenuItem.isSelected()) { writeToErrorLog(h, thisFile); } JOptionPane.showMessageDialog(null, "" + h, "Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); } } StringBuilder sb = new StringBuilder(); for (int j = 0; j < uploadFileBatch.length; j++) { sb.append(uploadList.get(j)); } uw.dispose(); // Move the actual results string to a JTextArea JTextArea uploadCompleteMsg = new JTextArea("Upload Complete! \n" + sb); uploadCompleteMsg.setLineWrap(true); uploadCompleteMsg.setWrapStyleWord(true); uploadCompleteMsg.setEditable(false); // Put the JTextArea in a JScollPane and present that in the JOptionPane JScrollPane uploadCompleteScroll = new JScrollPane(uploadCompleteMsg); uploadCompleteScroll.setPreferredSize(new Dimension(500, 400)); JOptionPane.showMessageDialog(null, uploadCompleteScroll, "Uploaded", JOptionPane.INFORMATION_MESSAGE); // Close the JProgressBar multiFiles = null; clearFile(); } else { JOptionPane.showMessageDialog(null, "This wasn't supposed to happen.", "Bug!", JOptionPane.ERROR_MESSAGE); uw.dispose(); } return null; } private void writeToErrorLog(Exception h, String thisFile) { String thisError = h.toString(); Writer errorOutputLog = null; try { errorOutputLog = new BufferedWriter(new FileWriter(getLogFile(4, appProperties), true)); } catch (Exception badLogCreate) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } try { Date d = new Date(); errorOutputLog.write(System.getProperty("line.separator")); errorOutputLog.write("" + d.toString() + ": \"" + thisFile + "\" *ERROR* " + thisError); errorOutputLog.write(System.getProperty("line.separator")); } catch (Exception badLogWrite) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } }; uploadWorker.execute(); } } }
From source file:com.brianmcmichael.sagu.SimpleGlacierUploader.java
License:Open Source License
@Override public void actionPerformed(ActionEvent e) { String accessString = getAccessField(); String secretString = getSecretField(); String vaultString = getVaultField(); int regionInt = getServerRegion(); if (e.getSource() == newVaultButton && checkAWSFields()) { AmazonGlacierClient newVaultClient = makeClient(accessString, secretString, regionInt); AddVaultFrame avf = new AddVaultFrame(newVaultClient, regionInt); avf.setVisible(true);//from w ww . j a v a2 s . c o m } if (e.getSource() == vaultSelector) { if (vaultSelector.getSelectedItem() != null) { if (vaultSelector.getSelectedIndex() == 0) { vaultField.setText(""); } else { vaultField.setText(vaultSelector.getSelectedItem().toString()); } } } if (e.getSource() == loginButton) { repopulateVaults(accessString, secretString); } if (e.getSource() == exitApplicationMnu) { System.exit(0); } if (e.getSource() == updateMnu || e.getSource() == checkUpdateButton) { JHyperlinkLabel.OpenURI(URL_STRING); } if (e.getSource() == saveFileMnu) { FileDialog fd = new FileDialog(new Frame(), "Save...", FileDialog.SAVE); fd.setFile("Glacier.txt"); fd.setDirectory(curDir); fd.setLocation(50, 50); fd.setVisible(true); String filePath = "" + fd.getDirectory() + System.getProperty("file.separator") + fd.getFile(); File outFile = new File(filePath); if (!outFile.equals("") && !outFile.equals("null")) { try { FileReader fr = new FileReader(getLogFilenamePath(0)); BufferedReader br = new BufferedReader(fr); FileWriter saveFile = new FileWriter(outFile.toString()); int count = 0; boolean moreLines = true; String ln1; String ln2; String ln3; while (moreLines) { ln1 = br.readLine(); ln2 = br.readLine(); ln3 = br.readLine(); if (ln1 == null) { ln1 = ""; } if (ln2 == null) { ln2 = ""; } if (ln3 == null) { ln3 = ""; } saveFile.write(ln1); saveFile.write("\r\n"); saveFile.write(ln2); saveFile.write("\r\n"); saveFile.write(ln3); saveFile.write("\r\n"); count++; if (ln3.equals("")) { moreLines = false; br.close(); saveFile.close(); JOptionPane.showMessageDialog(null, "Successfully exported " + count + " archive records to " + outFile.toString(), "Export", JOptionPane.INFORMATION_MESSAGE); } } } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog(null, "Unable to locate Glacier.log", "Error", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } if (e.getSource() == viewLog || e.getSource() == logButton) { File f = SimpleGlacierUploader.getLogFilenamePath(getLogFileType()); if (f.exists()) { JHyperlinkLabel.OpenURI("" + f.toURI()); } else { JOptionPane.showMessageDialog(null, "Log file " + f.getName() + " does not exist.", "Error", JOptionPane.ERROR_MESSAGE); } } if (e.getSource() == deleteArchiveMnu) { if (checkAllFields()) { AmazonGlacierClient newDeleteClient = makeClient(accessString, secretString, regionInt); DeleteArchiveFrame daf = new DeleteArchiveFrame(newDeleteClient, vaultString, regionInt); daf.setVisible(true); } } if (e.getSource() == inventoryRequestButton) { if (checkAllFields()) { AmazonGlacierClient newInventoryClient = makeClient(accessString, secretString, regionInt); InventoryRequest ir = new InventoryRequest(newInventoryClient, vaultString, regionInt); ir.setVisible(true); } } if (e.getSource() == downloadRequestButton || e.getSource() == downloadFileMnu) { if (checkAllFields()) { AmazonGlacierClient newDownloadClient = makeClient(accessString, secretString, regionInt); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); AmazonDownloadRequest adr = new AmazonDownloadRequest(newDownloadClient, vaultString, regionInt, credentials); adr.setVisible(true); } } if (e.getSource() == aboutMnu) { JOptionPane.showMessageDialog(null, ABOUT_WINDOW_STRING, "About", JOptionPane.INFORMATION_MESSAGE); } if (e.getSource() == clearButton) { ddText.setText(""); uploadButton.setText("Select Files"); multiFiles = null; } if (e.getSource() == locationChoice) { repopulateVaults(accessString, secretString); } if (e.getSource() == selectFileButton) { int returnVal = fc.showOpenDialog(SimpleGlacierUploader.this); if (returnVal == JFileChooser.APPROVE_OPTION) { if (fc.getSelectedFile().isFile()) { File[] thisFile = new File[1]; thisFile[0] = fc.getSelectedFile(); try { ddText.append(thisFile[0].getCanonicalPath() + "\n"); } catch (java.io.IOException f) { } if (multiFiles != null) { multiFiles = concatFileArray(multiFiles, thisFile); } else { multiFiles = thisFile; } } else { JOptionPane.showMessageDialog(null, NO_DIRECTORIES_ERROR, "Error", JOptionPane.ERROR_MESSAGE); } } } if (e.getSource() == uploadButton) { if ((checkAllFields()) && (checkForFile())) { SaveCurrentProperties(accessString, secretString, vaultString, locationChoice.getSelectedIndex()); SwingWorker uploadWorker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { String accessString = getAccessField(); String secretString = getSecretField(); String vaultName = getVaultField(); File[] uploadFileBatch = multiFiles; // work out exactly how much we are going to upload // so we can support a second total upload progress bar long totalSize = 0; long uploadedSize = 0; for (File f : uploadFileBatch) { totalSize += f.length(); } int locInt = locationChoice.getSelectedIndex(); multiFiles = null; clearFile(); UploadWindow uw = new UploadWindow(); if (uploadFileBatch.length > 0) { ArrayList<String> uploadList = new ArrayList<String>(); for (int i = 0; i < uploadFileBatch.length; i++) { // Save Current Settings to properties try { Thread.sleep(100L); } catch (InterruptedException e1) { e1.printStackTrace(); } ClientConfiguration config = new ClientConfiguration(); config.setSocketTimeout(SOCKET_TIMEOUT); config.setMaxErrorRetry(MAX_RETRIES); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); client = new AmazonGlacierClient(credentials, config); final Endpoint endpoint = Endpoint.getByIndex(locInt); client.setEndpoint(endpoint.getGlacierEndpoint()); String locationUpped = endpoint.name(); String thisFile = uploadFileBatch[i].getCanonicalPath(); String cleanFile = regexClean(thisFile); try { ArchiveTransferManager atm = new ArchiveTransferManager(client, credentials); String fileLength = Long.toString(uploadFileBatch[i].length()); uw.setTitle("(" + (i + 1) + "/" + uploadFileBatch.length + ")" + " Uploading: " + thisFile); UploadResult result = atm.upload(vaultName, cleanFile, uploadFileBatch[i]); uw.addToLog("Done: " + thisFile + "\n"); uploadedSize += uploadFileBatch[i].length(); int percentage = (int) (((double) uploadedSize / totalSize) * 100); uw.updateProgress(percentage); Writer plainOutputLog = null; Writer plainOutputTxt = null; Writer plainOutputCsv = null; Writer plainOutputYaml = null; // write to file if (logCheckMenuItem.isSelected()) { String treeHash = TreeHashGenerator.calculateTreeHash(uploadFileBatch[i]); try { plainOutputLog = new BufferedWriter( new FileWriter(getLogFilenamePath(0), true)); plainOutputTxt = new BufferedWriter( new FileWriter(getLogFilenamePath(1), true)); plainOutputCsv = new BufferedWriter( new FileWriter(getLogFilenamePath(2), true)); plainOutputYaml = new BufferedWriter( new FileWriter(getLogFilenamePath(3), true)); } catch (IOException ex) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } try { Date d = new Date(); String thisResult = result.getArchiveId(); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.write(" | ArchiveID: " + thisResult + " "); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.write(" | File: " + thisFile + " "); plainOutputLog.write(" | Bytes: " + fileLength + " "); plainOutputLog.write(" | Vault: " + vaultName + " "); plainOutputLog.write(" | Location: " + locationUpped + " "); plainOutputLog.write(" | Date: " + d.toString() + " "); plainOutputLog.write(" | Hash: " + treeHash + " "); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.close(); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.write(" | ArchiveID: " + thisResult + " "); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.write(" | File: " + thisFile + " "); plainOutputTxt.write(" | Bytes: " + fileLength + " "); plainOutputTxt.write(" | Vault: " + vaultName + " "); plainOutputTxt.write(" | Location: " + locationUpped + " "); plainOutputTxt.write(" | Date: " + d.toString() + " "); plainOutputTxt.write(" | Hash: " + treeHash + " "); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.close(); plainOutputCsv.write("" + thisResult + ","); plainOutputCsv.write("" + thisFile + ","); plainOutputCsv.write("" + fileLength + ","); plainOutputCsv.write("" + vaultName + ","); plainOutputCsv.write("" + locationUpped + ","); plainOutputCsv.write("" + d.toString() + ","); plainOutputCsv.write("" + treeHash + ","); plainOutputCsv.write(System.getProperty("line.separator")); plainOutputCsv.close(); plainOutputYaml.write(System.getProperty("line.separator")); plainOutputYaml.write("- ArchiveID: \"" + thisResult + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" File: \"" + thisFile + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" Bytes: \"" + fileLength + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" Vault: \"" + vaultName + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" Location: \"" + locationUpped + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" Date: \"" + d.toString() + "\"" + System.getProperty("line.separator")); plainOutputYaml.write(" Hash: \"" + treeHash + "\"" + System.getProperty("line.separator")); plainOutputYaml.close(); uploadList.add("Successfully uploaded " + thisFile + " to vault " + vaultName + " at " + locationUpped + ". Bytes: " + fileLength + ". ArchiveID Logged.\n"); } catch (IOException c) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } } else { JOptionPane.showMessageDialog(null, "Upload Complete!\nArchive ID: " + result.getArchiveId() + "\nIt may take some time for Amazon to update the inventory.", "Uploaded", JOptionPane.INFORMATION_MESSAGE); multiFiles = null; uw.dispose(); } clearFile(); } catch (Exception h) { if (logCheckMenuItem.isSelected()) { writeToErrorLog(h, thisFile); } JOptionPane.showMessageDialog(null, "" + h, "Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); } } StringBuilder sb = new StringBuilder(); for (int j = 0; j < uploadFileBatch.length; j++) { sb.append(uploadList.get(j)); } uw.dispose(); // Move the actual results string to a JTextArea JTextArea uploadCompleteMsg = new JTextArea("Upload Complete! \n" + sb); uploadCompleteMsg.setLineWrap(true); uploadCompleteMsg.setWrapStyleWord(true); uploadCompleteMsg.setEditable(false); // Put the JTextArea in a JScollPane and present that in the JOptionPane JScrollPane uploadCompleteScroll = new JScrollPane(uploadCompleteMsg); uploadCompleteScroll.setPreferredSize(new Dimension(500, 400)); JOptionPane.showMessageDialog(null, uploadCompleteScroll, "Uploaded", JOptionPane.INFORMATION_MESSAGE); // Close the JProgressBar multiFiles = null; clearFile(); } else { JOptionPane.showMessageDialog(null, "This wasn't supposed to happen.", "Bug!", JOptionPane.ERROR_MESSAGE); uw.dispose(); } return null; } private void writeToErrorLog(Exception h, String thisFile) { String thisError = h.toString(); Writer errorOutputLog = null; try { errorOutputLog = new BufferedWriter(new FileWriter(getLogFilenamePath(4), true)); } catch (Exception badLogCreate) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } try { Date d = new Date(); errorOutputLog.write(System.getProperty("line.separator")); errorOutputLog.write("" + d.toString() + ": \"" + thisFile + "\" *ERROR* " + thisError); errorOutputLog.write(System.getProperty("line.separator")); } catch (Exception badLogWrite) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } }; uploadWorker.execute(); } } }
From source file:com.brianmcmichael.SimpleGlacierUploader.SimpleGlacierUploader.java
License:Open Source License
@Override public void actionPerformed(ActionEvent e) { String accessString = getAccessField(); String secretString = getSecretField(); String vaultString = getVaultField(); int regionInt = getServerRegion(); if (e.getSource() == newVaultButton && checkAWSFields()) { AmazonGlacierClient newVaultClient = new AmazonGlacierClient(); newVaultClient = makeClient(accessString, secretString, regionInt); AddVaultFrame avf = new AddVaultFrame(newVaultClient, regionInt); avf.setVisible(true);/*from www.j av a 2 s. c om*/ } if (e.getSource() == vaultSelector) { if (vaultSelector.getSelectedItem() != null) { if (vaultSelector.getSelectedIndex() == 0) { vaultField.setText(""); } else { vaultField.setText(vaultSelector.getSelectedItem().toString()); } } else { } } if (e.getSource() == loginButton) { repopulateVaults(accessString, secretString, regionInt); } if (e.getSource() == exitApplicationMnu) { System.exit(0); } if (e.getSource() == updateMnu || e.getSource() == checkUpdateButton) { JHyperlinkLabel.OpenURI(URL_STRING); } if (e.getSource() == saveFileMnu) { FileDialog fd = new FileDialog(new Frame(), "Save...", FileDialog.SAVE); fd.setFile("Glacier.txt"); fd.setDirectory(curDir); fd.setLocation(50, 50); fd.setVisible(true); // fd.show(); String filePath = "" + fd.getDirectory() + System.getProperty("file.separator") + fd.getFile(); File outFile = new File(filePath); if ((outFile.equals("") == false) && (outFile.equals("null") == false) && ((outFile == null) == false)) { try { FileReader fr = new FileReader(getLogFilenamePath(0)); BufferedReader br = new BufferedReader(fr); FileWriter saveFile = new FileWriter(outFile.toString()); int count = 0; boolean moreLines = true; String ln1 = ""; String ln2 = ""; String ln3 = ""; while (moreLines == true) { ln1 = br.readLine(); ln2 = br.readLine(); ln3 = br.readLine(); if (ln1 == null) { ln1 = ""; } if (ln2 == null) { ln2 = ""; } if (ln3 == null) { ln3 = ""; } saveFile.write(ln1); saveFile.write("\r\n"); saveFile.write(ln2); saveFile.write("\r\n"); saveFile.write(ln3); saveFile.write("\r\n"); count++; if (ln3.equals("")) { moreLines = false; br.close(); saveFile.close(); JOptionPane.showMessageDialog(null, "Successfully exported " + count + " archive records to " + outFile.toString(), "Export", JOptionPane.INFORMATION_MESSAGE); } } } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog(null, "Unable to locate Glacier.log", "Error", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } if (e.getSource() == viewLog || e.getSource() == logButton) { JHyperlinkLabel.OpenURI("" + SimpleGlacierUploader.getLogFilenamePath(getLogFileType()).toURI()); } if (e.getSource() == deleteArchiveMnu) { if (checkAllFields()) { AmazonGlacierClient newDeleteClient = new AmazonGlacierClient(); newDeleteClient = makeClient(accessString, secretString, regionInt); DeleteArchiveFrame daf = new DeleteArchiveFrame(newDeleteClient, vaultString, regionInt); daf.setVisible(true); } } if (e.getSource() == inventoryRequestButton) { if (checkAllFields()) { AmazonGlacierClient newInventoryClient = new AmazonGlacierClient(); newInventoryClient = makeClient(accessString, secretString, regionInt); InventoryRequest ir = new InventoryRequest(newInventoryClient, vaultString, regionInt); ir.setVisible(true); } } if (e.getSource() == downloadRequestButton || e.getSource() == downloadFileMnu) { if (checkAllFields()) { AmazonGlacierClient newDownloadClient = new AmazonGlacierClient(); newDownloadClient = makeClient(accessString, secretString, regionInt); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); AmazonDownloadRequest adr = new AmazonDownloadRequest(newDownloadClient, vaultString, regionInt, credentials); adr.setVisible(true); } } if (e.getSource() == aboutMnu) { JOptionPane.showMessageDialog(null, ABOUT_WINDOW_STRING, "About", JOptionPane.INFORMATION_MESSAGE); } if (e.getSource() == clearButton) { ddText.setText(""); uploadButton.setText("Select Files"); multiFiles = null; } if (e.getSource() == locationChoice) { repopulateVaults(accessString, secretString, regionInt); } if (e.getSource() == selectFileButton) { int returnVal = fc.showOpenDialog(SimpleGlacierUploader.this); if (returnVal == JFileChooser.APPROVE_OPTION) { if (fc.getSelectedFile().isFile()) { /* * Removed for v. 0.72 if (fc.getSelectedFile().length() > * max_file_size == true) { * JOptionPane.showMessageDialog(null, * FILE_TOO_BIG_ERROR,"Error",JOptionPane.ERROR_MESSAGE); * try { //ddText.setForeground(rc); ddText.append( * "Unable to upload: " + * fc.getSelectedFile().getCanonicalPath() + "\n" ); } // * end try catch( java.io.IOException g ) {} } else { */ File[] thisFile = new File[1]; thisFile[0] = fc.getSelectedFile(); try { ddText.append(thisFile[0].getCanonicalPath() + "\n"); } // end try catch (java.io.IOException f) { } if (multiFiles != null) { multiFiles = concatFileArray(multiFiles, thisFile); } else { multiFiles = thisFile; } // } } else { JOptionPane.showMessageDialog(null, NO_DIRECTORIES_ERROR, "Error", JOptionPane.ERROR_MESSAGE); } } else { } } if (e.getSource() == uploadButton) { if ((checkAllFields()) && (checkForFile())) { SaveCurrentProperties(accessString, secretString, vaultString, locationChoice.getSelectedIndex()); SwingWorker uploadWorker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { String accessString = getAccessField(); String secretString = getSecretField(); // String vaultString = getVaultField(); String vaultName = getVaultField(); File[] uploadFileBatch = multiFiles; // work out exactly how much we are going to upload // so we can support a second total upload progress bar long totalSize = 0; long uploadedSize = 0; for (File f : uploadFileBatch) { totalSize += f.length(); } int locInt = locationChoice.getSelectedIndex(); multiFiles = null; clearFile(); UploadWindow uw = new UploadWindow(); if (uploadFileBatch.length > 0) { ArrayList<String> uploadList = new ArrayList<String>(); for (int i = 0; i < uploadFileBatch.length; i++) { // Save Current Settings to properties try { Thread.sleep(100L); } catch (InterruptedException e1) { e1.printStackTrace(); } ClientConfiguration config = new ClientConfiguration(); config.setSocketTimeout(SOCKET_TIMEOUT); config.setMaxErrorRetry(MAX_RETRIES); BasicAWSCredentials credentials = new BasicAWSCredentials(accessString, secretString); client = new AmazonGlacierClient(credentials, config); Endpoints ep = new Endpoints(locInt); // String endpointUrl = ep.Endpoint(locInt); client.setEndpoint(ep.Endpoint()); String locationUpped = ep.Location(); String thisFile = uploadFileBatch[i].getCanonicalPath(); String cleanFile = regexClean(thisFile); // char emptyChar = 0xFFFA; // String thisCleanFile = // thisFile.valueOf(emptyChar).replaceAll("\\p{C}", // "?"); try { ArchiveTransferManager atm = new ArchiveTransferManager(client, credentials); String fileLength = Long.toString(uploadFileBatch[i].length()); uw.setTitle("(" + (i + 1) + "/" + uploadFileBatch.length + ")" + " Uploading: " + thisFile); UploadResult result = atm.upload(vaultName, cleanFile, uploadFileBatch[i]); uw.addToLog("Done: " + thisFile + "\n"); uploadedSize += uploadFileBatch[i].length(); int percentage = (int) (((double) uploadedSize / totalSize) * 100); uw.updateProgress(percentage); Writer plainOutputLog = null; Writer plainOutputTxt = null; Writer plainOutputCsv = null; // write to file if (logCheckMenuItem.isSelected()) { String treeHash = TreeHashGenerator.calculateTreeHash(uploadFileBatch[i]); try { plainOutputLog = new BufferedWriter( new FileWriter(getLogFilenamePath(0), true)); plainOutputTxt = new BufferedWriter( new FileWriter(getLogFilenamePath(1), true)); plainOutputCsv = new BufferedWriter( new FileWriter(getLogFilenamePath(2), true)); } catch (IOException ex) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } try { Date d = new Date(); String thisResult = result.getArchiveId(); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.write(" | ArchiveID: " + thisResult + " "); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.write(" | File: " + thisFile + " "); plainOutputLog.write(" | Bytes: " + fileLength + " "); plainOutputLog.write(" | Vault: " + vaultName + " "); plainOutputLog.write(" | Location: " + locationUpped + " "); plainOutputLog.write(" | Date: " + d.toString() + " "); plainOutputLog.write(" | Hash: " + treeHash + " "); plainOutputLog.write(System.getProperty("line.separator")); plainOutputLog.close(); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.write(" | ArchiveID: " + thisResult + " "); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.write(" | File: " + thisFile + " "); plainOutputTxt.write(" | Bytes: " + fileLength + " "); plainOutputTxt.write(" | Vault: " + vaultName + " "); plainOutputTxt.write(" | Location: " + locationUpped + " "); plainOutputTxt.write(" | Date: " + d.toString() + " "); plainOutputTxt.write(" | Hash: " + treeHash + " "); plainOutputTxt.write(System.getProperty("line.separator")); plainOutputTxt.close(); plainOutputCsv.write("" + thisResult + ","); plainOutputCsv.write("" + thisFile + ","); plainOutputCsv.write("" + fileLength + ","); plainOutputCsv.write("" + vaultName + ","); plainOutputCsv.write("" + locationUpped + ","); plainOutputCsv.write("" + d.toString() + ","); plainOutputCsv.write("" + treeHash + ","); plainOutputCsv.write(System.getProperty("line.separator")); plainOutputCsv.close(); uploadList.add("Successfully uploaded " + thisFile + " to vault " + vaultName + " at " + locationUpped + ". Bytes: " + fileLength + ". ArchiveID Logged.\n"); } // v0.4 logging code // output.writeUTF("ArchiveID: " + // thisResult + " "); // output.writeUTF(" | File: " + // thisFile + " "); // output.writeUTF(" | Vault: " // +vaultName + " "); // output.writeUTF(" | Location: " + // locationUpped + " "); // output.writeUTF(" | Date: "+d.toString()+"\n\n"); catch (IOException c) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); System.exit(1); } } else { JOptionPane.showMessageDialog(null, "Upload Complete!\nArchive ID: " + result.getArchiveId() + "\nIt may take some time for Amazon to update the inventory.", "Uploaded", JOptionPane.INFORMATION_MESSAGE); multiFiles = null; uw.dispose(); } clearFile(); } catch (Exception h) { if (logCheckMenuItem.isSelected()) { writeToErrorLog(h, thisFile); } JOptionPane.showMessageDialog(null, "" + h, "Error", JOptionPane.ERROR_MESSAGE); uw.dispose(); } } StringBuilder sb = new StringBuilder(); for (int j = 0; j < uploadFileBatch.length; j++) { sb.append(uploadList.get(j)); } uw.dispose(); JOptionPane.showMessageDialog(null, "Upload Complete! \n" + sb, "Uploaded", JOptionPane.INFORMATION_MESSAGE); // Close the JProgressBar multiFiles = null; clearFile(); } else { JOptionPane.showMessageDialog(null, "This wasn't supposed to happen.", "Bug!", JOptionPane.ERROR_MESSAGE); uw.dispose(); } return null; } private void writeToErrorLog(Exception h, String thisFile) { String thisError = h.toString(); Writer errorOutputLog = null; try { errorOutputLog = new BufferedWriter(new FileWriter(getLogFilenamePath(3), true)); } catch (Exception badLogCreate) { JOptionPane.showMessageDialog(null, LOG_CREATION_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } try { Date d = new Date(); errorOutputLog.write(System.getProperty("line.separator")); errorOutputLog.write("" + d.toString() + ": \"" + thisFile + "\" *ERROR* " + thisError); errorOutputLog.write(System.getProperty("line.separator")); } catch (Exception badLogWrite) { JOptionPane.showMessageDialog(null, LOG_WRITE_ERROR, "IO Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } }; uploadWorker.execute(); } } else { } }
From source file:com.cloud.utils.S3Utils.java
License:Apache License
private static AmazonS3 acquireClient(final ClientOptions clientOptions) { final AWSCredentials credentials = new BasicAWSCredentials(clientOptions.getAccessKey(), clientOptions.getSecretKey()); final ClientConfiguration configuration = new ClientConfiguration(); if (clientOptions.isHttps() != null) { configuration.setProtocol(clientOptions.isHttps() == true ? HTTPS : HTTP); }//from www .j ava2s.c o m if (clientOptions.getConnectionTimeout() != null) { configuration.setConnectionTimeout(clientOptions.getConnectionTimeout()); } if (clientOptions.getMaxErrorRetry() != null) { configuration.setMaxErrorRetry(clientOptions.getMaxErrorRetry()); } if (clientOptions.getSocketTimeout() != null) { configuration.setSocketTimeout(clientOptions.getSocketTimeout()); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(format( "Creating S3 client with configuration: [protocol: %1$s, connectionTimeOut: " + "%2$s, maxErrorRetry: %3$s, socketTimeout: %4$s]", configuration.getProtocol(), configuration.getConnectionTimeout(), configuration.getMaxErrorRetry(), configuration.getSocketTimeout())); } final AmazonS3Client client = new AmazonS3Client(credentials, configuration); if (isNotBlank(clientOptions.getEndPoint())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(format("Setting the end point for S3 client %1$s to %2$s.", client, clientOptions.getEndPoint())); } client.setEndpoint(clientOptions.getEndPoint()); } return client; }
From source file:com.emc.ecs.sync.source.S3Source.java
License:Open Source License
@Override public void configure(SyncSource source, Iterator<SyncFilter> filters, SyncTarget target) { Assert.hasText(accessKey, "accessKey is required"); Assert.hasText(secretKey, "secretKey is required"); Assert.hasText(bucketName, "bucketName is required"); Assert.isTrue(bucketName.matches("[A-Za-z0-9._-]+"), bucketName + " is not a valid bucket name"); AWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration config = new ClientConfiguration(); if (protocol != null) config.setProtocol(Protocol.valueOf(protocol.toUpperCase())); if (legacySignatures) config.setSignerOverride("S3SignerType"); if (socketTimeoutMs >= 0) config.setSocketTimeout(socketTimeoutMs); s3 = new AmazonS3Client(creds, config); if (endpoint != null) s3.setEndpoint(endpoint);//from w w w . j av a 2 s .c o m // TODO: generalize uri translation AwsS3Util.S3Uri s3Uri = new AwsS3Util.S3Uri(); s3Uri.protocol = protocol; s3Uri.endpoint = endpoint; s3Uri.accessKey = accessKey; s3Uri.secretKey = secretKey; s3Uri.rootKey = rootKey; if (sourceUri == null) sourceUri = s3Uri.toUri(); if (disableVHosts) { log.info( "The use of virtual hosted buckets on the s3 source has been DISABLED. Path style buckets will be used."); S3ClientOptions opts = new S3ClientOptions(); opts.setPathStyleAccess(true); s3.setS3ClientOptions(opts); } if (!s3.doesBucketExist(bucketName)) { throw new ConfigurationException("The bucket " + bucketName + " does not exist."); } if (rootKey == null) rootKey = ""; // make sure rootKey isn't null // for version support. TODO: genericize version support if (target instanceof S3Target) { s3Target = (S3Target) target; if (s3Target.isIncludeVersions()) { BucketVersioningConfiguration versioningConfig = s3.getBucketVersioningConfiguration(bucketName); List<String> versionedStates = Arrays.asList(BucketVersioningConfiguration.ENABLED, BucketVersioningConfiguration.SUSPENDED); versioningEnabled = versionedStates.contains(versioningConfig.getStatus()); } } }
From source file:com.emc.ecs.sync.target.S3Target.java
License:Open Source License
@Override public void configure(SyncSource source, Iterator<SyncFilter> filters, SyncTarget target) { Assert.hasText(accessKey, "accessKey is required"); Assert.hasText(secretKey, "secretKey is required"); Assert.hasText(bucketName, "bucketName is required"); Assert.isTrue(bucketName.matches("[A-Za-z0-9._-]+"), bucketName + " is not a valid bucket name"); AWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration config = new ClientConfiguration(); if (protocol != null) config.setProtocol(Protocol.valueOf(protocol.toUpperCase())); if (legacySignatures) config.setSignerOverride("S3SignerType"); if (socketTimeoutMs >= 0) config.setSocketTimeout(socketTimeoutMs); s3 = new AmazonS3Client(creds, config); if (endpoint != null) s3.setEndpoint(endpoint);//from www . j av a 2s . com // TODO: generalize uri translation AwsS3Util.S3Uri s3Uri = new AwsS3Util.S3Uri(); s3Uri.protocol = protocol; s3Uri.endpoint = endpoint; s3Uri.accessKey = accessKey; s3Uri.secretKey = secretKey; s3Uri.rootKey = rootKey; if (targetUri == null) targetUri = s3Uri.toUri(); if (disableVHosts) { log.info( "The use of virtual hosted buckets on the s3 source has been DISABLED. Path style buckets will be used."); S3ClientOptions opts = new S3ClientOptions(); opts.setPathStyleAccess(true); s3.setS3ClientOptions(opts); } // for version support. TODO: genericize version support if (source instanceof S3Source) { s3Source = (S3Source) source; if (!s3Source.isVersioningEnabled()) includeVersions = false; // don't include versions if source versioning is off } else if (includeVersions) { throw new ConfigurationException( "Object versions are currently only supported with the S3 source & target plugins."); } if (!s3.doesBucketExist(bucketName)) { if (createBucket) { s3.createBucket(bucketName); if (includeVersions) s3.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucketName, new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED))); } else { throw new ConfigurationException("The bucket " + bucketName + " does not exist."); } } if (rootKey == null) rootKey = ""; // make sure rootKey isn't null if (includeVersions) { String status = s3.getBucketVersioningConfiguration(bucketName).getStatus(); if (BucketVersioningConfiguration.OFF.equals(status)) throw new ConfigurationException("The specified bucket does not have versioning enabled."); } if (mpuThresholdMB > AwsS3Util.MAX_PUT_SIZE_MB) { log.warn("{}MB is above the maximum PUT size of {}MB. the maximum will be used instead", mpuThresholdMB, AwsS3Util.MAX_PUT_SIZE_MB); mpuThresholdMB = AwsS3Util.MAX_PUT_SIZE_MB; } if (mpuPartSizeMB < AwsS3Util.MIN_PART_SIZE_MB) { log.warn("{}MB is below the minimum MPU part size of {}MB. the minimum will be used instead", mpuPartSizeMB, AwsS3Util.MIN_PART_SIZE_MB); mpuPartSizeMB = AwsS3Util.MIN_PART_SIZE_MB; } }