测试编译class文件
parent
fba9f67e27
commit
ed5ef7817c
|
@ -182,7 +182,7 @@ public class EngineVersionController extends BaseController {
|
||||||
public boolean insertVersion(@RequestBody EngineVersion engineVersion) {
|
public boolean insertVersion(@RequestBody EngineVersion engineVersion) {
|
||||||
log.info("数据是:{}"+engineVersion.getRuleContent());
|
log.info("数据是:{}"+engineVersion.getRuleContent());
|
||||||
OssUpload.uploadFiles(engineVersion.getRuleContent(), engineVersion.getVersionCode());
|
OssUpload.uploadFiles(engineVersion.getRuleContent(), engineVersion.getVersionCode());
|
||||||
OSSFileDownload.localDownload();
|
OSSFileDownload.streamingDownload(engineVersion.getName());
|
||||||
JavaClass.compile(engineVersion.getName());
|
JavaClass.compile(engineVersion.getName());
|
||||||
engineVersion.setId(null);
|
engineVersion.setId(null);
|
||||||
boolean insert = engineVersionService.insert(engineVersion);
|
boolean insert = engineVersionService.insert(engineVersion);
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.muyu.javacomplier;
|
||||||
|
|
||||||
import com.aliyun.oss.OSSClient;
|
import com.aliyun.oss.OSSClient;
|
||||||
import com.aliyun.oss.model.GetObjectRequest;
|
import com.aliyun.oss.model.GetObjectRequest;
|
||||||
|
import com.aliyun.oss.model.ObjectMetadata;
|
||||||
|
import com.muyu.domain.constants.Result;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -19,17 +21,28 @@ public class OSSFileDownload {
|
||||||
|
|
||||||
private static final String fileName = "engine";
|
private static final String fileName = "engine";
|
||||||
|
|
||||||
public static void localDownload() {
|
public static Result<Object> streamingDownload(String fileName) {
|
||||||
try {
|
|
||||||
// 创建 OSSClient 实例
|
String source = null;
|
||||||
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
|
// 创建 OSSClient 实例
|
||||||
// 下载Object到本地文件,并保存到指定的本地路径中。如果指定的本地文件存在会覆盖,不存在则新建。
|
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
|
||||||
// 如果未指定本地路径,则下载后的文件默认保存到示例程序所属项目对应本地路径中。
|
// 判断 bucket 是否存在
|
||||||
ossClient.getObject(new GetObjectRequest(bucketName, fileName), new File(filePath));
|
Boolean flag_bucket = ossClient.doesBucketExist(bucketName);
|
||||||
// 关闭OSSClient。
|
if (!flag_bucket) {
|
||||||
ossClient.shutdown();
|
System.out.println("bucket不存在");
|
||||||
} catch (Exception e) {
|
return Result.error("bucket不存在");
|
||||||
e.fillInStackTrace();
|
|
||||||
}
|
}
|
||||||
|
String objectName = fileName + ".java";
|
||||||
|
Boolean flag_file = ossClient.doesObjectExist(bucketName, filePath + objectName);
|
||||||
|
if (!flag_file) {
|
||||||
|
System.out.println("预下载文件不存在");
|
||||||
|
return Result.error("预下载文件不存在");
|
||||||
|
}
|
||||||
|
// 本地文件下载路径
|
||||||
|
String localPath = "home/" + objectName;
|
||||||
|
ObjectMetadata object = ossClient.getObject(new GetObjectRequest(bucketName, filePath + objectName), new File(localPath));
|
||||||
|
System.out.println(object);
|
||||||
|
ossClient.shutdown();
|
||||||
|
return Result.success(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue