use of com.mizhousoft.cloudsdk.oss.ObjectMetadata in project cloud-sdk by mizhousoft.
the class COSObjectStorageServiceImpl method getObjectMetadata.
/**
* {@inheritDoc}
*/
@Override
public ObjectMetadata getObjectMetadata(String bucketName, String objectName) throws CloudSDKException {
try {
ObjectMetadata objectMetadata = null;
com.qcloud.cos.model.ObjectMetadata metadata = cosClient.getObjectMetadata(bucketName, objectName);
if (null != metadata) {
objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(metadata.getContentLength());
objectMetadata.setContentMD5(metadata.getContentMD5());
objectMetadata.setContentType(metadata.getContentType());
objectMetadata.setLastModified(metadata.getLastModified());
objectMetadata.setObjectName(objectName);
return objectMetadata;
} else {
throw new CloudSDKException("ObjectName not found.");
}
} catch (Throwable e) {
throw new CloudSDKException(e.getMessage(), e);
}
}
use of com.mizhousoft.cloudsdk.oss.ObjectMetadata in project cloud-sdk by mizhousoft.
the class AliyunObjectStorageServiceImpl method getObjectMetadata.
/**
* {@inheritDoc}
*/
@Override
public ObjectMetadata getObjectMetadata(String bucketName, String objectName) throws CloudSDKException {
try {
ObjectMetadata objectMetadata = null;
com.aliyun.oss.model.ObjectMetadata metadata = ossClient.getObjectMetadata(bucketName, objectName);
if (null != metadata) {
objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(metadata.getContentLength());
objectMetadata.setContentMD5(metadata.getContentMD5());
objectMetadata.setContentType(metadata.getContentType());
objectMetadata.setLastModified(metadata.getLastModified());
objectMetadata.setObjectName(objectName);
return objectMetadata;
} else {
throw new CloudSDKException("ObjectName not found.");
}
} catch (Throwable e) {
throw new CloudSDKException(e.getMessage(), e);
}
}
use of com.mizhousoft.cloudsdk.oss.ObjectMetadata in project cloud-sdk by mizhousoft.
the class TestAliyunObjectStorageServiceImpl method testgetObjectMetadata.
@Test
public void testgetObjectMetadata() {
try {
ObjectMetadata objectMetadata = objectStoreageService.getObjectMetadata(BUCKETNAME, OBJECTNAME);
System.out.println(objectMetadata.toString());
} catch (CloudSDKException e) {
Assert.fail(e.getMessage());
}
}
use of com.mizhousoft.cloudsdk.oss.ObjectMetadata in project cloud-sdk by mizhousoft.
the class TestCOSObjectStorageServiceImpl method testgetObjectMetadata.
@Test
public void testgetObjectMetadata() {
try {
ObjectMetadata objectMetadata = objectStoreageService.getObjectMetadata(BUCKETNAME, OBJECTNAME);
System.out.println(objectMetadata.getContentLength());
} catch (CloudSDKException e) {
Assert.fail(e.getMessage());
}
}
Aggregations