use of com.mendmix.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class AwsProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
GetObjectRequest getObjectRequest = GetObjectRequest.builder().bucket(bucketName).key(fileKey).build();
ResponseInputStream<GetObjectResponse> object = s3Client.getObject(getObjectRequest);
Map<String, String> metadata = object.response().metadata();
if (metadata != null) {
CObjectMetadata cObjectMetadata = new CObjectMetadata();
cObjectMetadata.setCustomMetadatas(metadata);
return cObjectMetadata;
}
return null;
}
use of com.mendmix.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class MinioProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
CObjectMetadata metadata = null;
try {
StatObjectResponse stat = minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(fileKey).build());
metadata = new CObjectMetadata();
if (stat != null) {
metadata.setCustomMetadatas(stat.userMetadata());
metadata.setFilesize(stat.size());
}
return metadata;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.mendmix.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class AliyunProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
try {
bucketName = buildBucketName(bucketName);
fileKey = resolveFileKey(bucketName, fileKey);
ObjectMetadata metadata = ossClient.getObjectMetadata(bucketName, fileKey);
CObjectMetadata objectMetadata = new CObjectMetadata();
objectMetadata.setCreateTime(metadata.getLastModified());
objectMetadata.setMimeType(metadata.getContentType());
objectMetadata.setFilesize(metadata.getContentLength());
objectMetadata.setHash(metadata.getContentMD5());
objectMetadata.setExpirationTime(metadata.getExpirationTime());
objectMetadata.setCustomMetadatas(metadata.getUserMetadata());
return objectMetadata;
} catch (Exception e) {
throw new JeesuiteBaseException(500, e.getMessage());
}
}
use of com.mendmix.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class HuaweicloudProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
ObjectMetadata objectMetadata = obsClient.getObjectMetadata(bucketName, fileKey);
if (objectMetadata == null) {
return null;
}
CObjectMetadata result = new CObjectMetadata();
Map<String, Object> customMetadata = objectMetadata.getMetadata();
if (customMetadata != null) {
Map<String, String> metadata = Maps.newHashMap();
for (Map.Entry<String, Object> entry : customMetadata.entrySet()) {
metadata.put(entry.getKey(), entry.getValue().toString());
}
result.setCustomMetadatas(metadata);
}
result.setMimeType(objectMetadata.getContentType());
result.setFilesize(objectMetadata.getContentLength());
return result;
}
use of com.mendmix.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class QcloudProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
try {
String _bucketName = buildBucketName(bucketName);
String _fileKey = resolveFileKey(bucketName, fileKey);
ObjectMetadata metadata = cosclient.getObjectMetadata(_bucketName, _fileKey);
CObjectMetadata objectMetadata = new CObjectMetadata();
objectMetadata.setCreateTime(metadata.getLastModified());
objectMetadata.setMimeType(metadata.getContentType());
objectMetadata.setFilesize(metadata.getContentLength());
objectMetadata.setHash(metadata.getContentMD5());
objectMetadata.setExpirationTime(metadata.getExpirationTime());
objectMetadata.setCustomMetadatas(metadata.getUserMetadata());
return objectMetadata;
} catch (Exception e) {
throw new JeesuiteBaseException(500, buildMessage(bucketName, e));
}
}
Aggregations