justinwwhuang commented on code in PR #9901:
URL: https://github.com/apache/inlong/pull/9901#discussion_r1544160407
##########
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java:
##########
@@ -233,4 +282,28 @@ public void join() {
public void stop() throws Exception {
waitForTerminate();
}
+
+ private static String calcFileMd5(String path) {
+ BigInteger bi = null;
+ try {
+ byte[] buffer = new byte[DOWNLOAD_PACKAGE_READ_BUFF_SIZE];
+ int len = 0;
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ File f = new File(path);
+ FileInputStream fis = new FileInputStream(f);
+ while ((len = fis.read(buffer)) != -1) {
+ md.update(buffer, 0, len);
+ }
+ fis.close();
Review Comment:
ok
##########
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java:
##########
@@ -213,6 +219,49 @@ private boolean updateModules(List<ModuleConfig>
managerModuleList) {
return true;
}
+ private boolean downloadModule(ModuleConfig module) {
+ LOGGER.info("download module {} begin", module.getId());
+ try {
+ LOGGER.info("download url {}",
module.getPackageConfig().getDownloadUrl());
+ URL url = new URL(module.getPackageConfig().getDownloadUrl());
+ URLConnection conn = url.openConnection();
+ Map<String, String> authHeader = httpManager.getAuthHeader();
+ authHeader.forEach((k, v) -> {
+ conn.setRequestProperty(k, v);
+ });
+ InputStream inStream = conn.getInputStream();
+ String path = module.getPackageConfig().getStoragePath() + "/" +
module.getPackageConfig().getFileName();
+ FileOutputStream fs = new FileOutputStream(path);
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]