|
|
|
@ -86,7 +86,9 @@ public class S3PluginManager extends TransportManager {
|
|
|
|
|
public String put(Upload upload) throws FileNotFoundException, IOException {
|
|
|
|
|
logger.info("put method invoked ");
|
|
|
|
|
File file= new File(upload.getResource().getLocalPath());
|
|
|
|
|
return BucketOperator.getInstance(s3).putObject(bucket, Utils.convertToS3Format(upload.getResource().getRemotePath()), file).toString();
|
|
|
|
|
// return BucketOperator.getInstance(s3).putObject(bucket, Utils.convertToS3Format(upload.getResource().getRemotePath()), file).toString();
|
|
|
|
|
int hashcode=BucketOperator.getInstance(s3).putObject(bucket, Utils.convertToS3Format(upload.getResource().getRemotePath()), file).hashCode();
|
|
|
|
|
return hashcode+"";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -96,7 +98,7 @@ public class S3PluginManager extends TransportManager {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void removeRemoteFile(String bucket, MyFile resource) throws UnknownHostException {
|
|
|
|
|
throw new RemoteBackendException("method not implemented yet on s3 plugin");
|
|
|
|
|
BucketOperator.getInstance(s3).deleteObject(bucket, Utils.convertToS3Format(resource.getRemotePath()));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -107,8 +109,14 @@ public class S3PluginManager extends TransportManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long getSize(String bucket) {
|
|
|
|
|
throw new RemoteBackendException("method not implemented yet on s3 plugin");
|
|
|
|
|
public long getSize(String key, MyFile file) {
|
|
|
|
|
logger.info("remoteObject identifier "+key);
|
|
|
|
|
try {
|
|
|
|
|
return BucketOperator.getObjectSize(bucket, Utils.convertToS3Format(file.getRemotePath()));
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RemoteBackendException("Problem during getSize Operation on s3 cloud storage");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|