|
@@ -68,6 +68,21 @@ public class OssServiceImpl implements OssService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void uploadFilesToTraceDir(File[] files, String traceId) {
|
|
|
|
+ OSSClient client = new OSSClient(endPoint, accessKeyId, accessKeySecret);
|
|
|
|
+ for (File file: files){
|
|
|
|
+ try {
|
|
|
|
+ String filePath = Consts.TRACE_DATA_PATH + traceId + "/" + file.getName();
|
|
|
|
+ InputStream is = new FileInputStream(file);
|
|
|
|
+ client.putObject(bucketName, filePath , is);
|
|
|
|
+ }catch (FileNotFoundException ignored) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ client.shutdown();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public String uploadInputStreamToTraceDir(InputStream is, String traceId, String fileName){
|
|
public String uploadInputStreamToTraceDir(InputStream is, String traceId, String fileName){
|
|
String filePath = Consts.TRACE_DATA_PATH + traceId + "/" + fileName;
|
|
String filePath = Consts.TRACE_DATA_PATH + traceId + "/" + fileName;
|
|
OSSClient client = new OSSClient(endPoint, accessKeyId, accessKeySecret);
|
|
OSSClient client = new OSSClient(endPoint, accessKeyId, accessKeySecret);
|