use of com.jeesuite.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.jeesuite.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));
}
}
use of com.jeesuite.cos.CObjectMetadata in project jeesuite-libs by vakinge.
the class QiniuProvider method getObjectMetadata.
@Override
public CObjectMetadata getObjectMetadata(String bucketName, String fileKey) {
try {
bucketName = buildBucketName(bucketName);
FileInfo stat = bucketManager.stat(bucketName, fileKey);
CObjectMetadata objectMetadata = new CObjectMetadata();
objectMetadata.setCreateTime(new Date(stat.putTime));
objectMetadata.setFilesize(stat.fsize);
objectMetadata.setHash(stat.md5);
objectMetadata.setMimeType(stat.mimeType);
return objectMetadata;
} catch (QiniuException e) {
processQiniuException(bucketName, e);
return null;
}
}
use of com.jeesuite.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());
}
}
Aggregations