use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project components by Talend.
the class S3SparkRuntimeTestIT method testAvro_noEncryption.
/**
* Basic Avro test.
*/
@Test
public void testAvro_noEncryption() throws IOException {
S3DatasetProperties datasetProps = s3.createS3DatasetProperties();
datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
test_noEncryption(datasetProps);
// Get some object metadata from the results.
ObjectMetadata md = s3.getObjectMetadata(datasetProps);
assertThat(md.getSSEAlgorithm(), nullValue());
assertThat(md.getSSEAwsKmsKeyId(), nullValue());
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project components by Talend.
the class S3RoundTripRuntimeTestIT method testAvro_noEncryption.
/**
* Basic Avro test.
*/
@Test
public void testAvro_noEncryption() throws IOException {
S3DatasetProperties datasetProps = s3.createS3DatasetProperties();
datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
test_noEncryption(datasetProps);
// Get some object metadata from the results.
ObjectMetadata md = s3.getObjectMetadata(datasetProps);
assertThat(md.getSSEAlgorithm(), nullValue());
assertThat(md.getSSEAwsKmsKeyId(), nullValue());
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project components by Talend.
the class S3RoundTripRuntimeTestIT method testAvro_sseKmsEncryption.
/**
* Basic Avro test with sseKmsEncryption.
*/
@Test
public void testAvro_sseKmsEncryption() throws IOException {
S3DatasetProperties datasetProps = s3.createS3DatasetProperties(true, false);
datasetProps.format.setValue(SimpleFileIOFormat.AVRO);
test_noEncryption(datasetProps);
// Get some object metadata from the results.
ObjectMetadata md = s3.getObjectMetadata(datasetProps);
assertThat(md.getSSEAlgorithm(), is("aws:kms"));
assertThat(md.getSSEAwsKmsKeyId(), is(datasetProps.kmsForDataAtRest.getValue()));
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project jackrabbit-oak by apache.
the class S3Backend method addMetadataRecord.
@Override
public void addMetadataRecord(final InputStream input, final String name) throws DataStoreException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Upload upload = tmx.upload(s3ReqDecorator.decorate(new PutObjectRequest(bucket, addMetaKeyPrefix(name), input, new ObjectMetadata())));
upload.waitForUploadResult();
} catch (InterruptedException e) {
LOG.error("Error in uploading", e);
throw new DataStoreException("Error in uploading", e);
} finally {
if (contextClassLoader != null) {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project jackrabbit-oak by apache.
the class S3Backend method exists.
/**
* Check if record identified by identifier exists in Amazon S3.
*/
@Override
public boolean exists(DataIdentifier identifier) throws DataStoreException {
long start = System.currentTimeMillis();
String key = getKeyName(identifier);
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
ObjectMetadata objectMetaData = s3service.getObjectMetadata(bucket, key);
if (objectMetaData != null) {
LOG.trace("exists [{}]: [true] took [{}] ms.", identifier, (System.currentTimeMillis() - start));
return true;
}
return false;
} catch (AmazonServiceException e) {
if (e.getStatusCode() == 404 || e.getStatusCode() == 403) {
LOG.debug("exists [{}]: [false] took [{}] ms.", identifier, (System.currentTimeMillis() - start));
return false;
}
throw new DataStoreException("Error occured to getObjectMetadata for key [" + identifier.toString() + "]", e);
} finally {
if (contextClassLoader != null) {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
Aggregations