From a7aaeabc7873a0eafb4a7ecad7f65b018b7a9bc9 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 24 Feb 2023 19:31:23 +0800
Subject: [PATCH] What's new? 1. Add license for dock. 2. Modify the logic corresponding to the firmware file and device type. 3. Add multiple mqtt clients options. 4. Modify the structure of the interface for obtaining the device list. 5. Fixed some issues.
---
src/main/java/com/dji/sample/component/oss/service/impl/OssServiceContext.java | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/dji/sample/component/oss/service/impl/OssServiceContext.java b/src/main/java/com/dji/sample/component/oss/service/impl/OssServiceContext.java
index e131889..28333ca 100644
--- a/src/main/java/com/dji/sample/component/oss/service/impl/OssServiceContext.java
+++ b/src/main/java/com/dji/sample/component/oss/service/impl/OssServiceContext.java
@@ -6,6 +6,7 @@
import com.dji.sample.media.model.CredentialsDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
import java.io.InputStream;
import java.net.URL;
@@ -22,16 +23,13 @@
private IOssService ossService;
- private OssConfiguration configuration;
-
@Autowired
public OssServiceContext(List<IOssService> ossServices, OssConfiguration configuration) {
- this.configuration = configuration;
- if (!configuration.isEnable()) {
+ if (!OssConfiguration.enable) {
return;
}
this.ossService = ossServices.stream()
- .filter(ossService -> ossService.getOssType().equals(configuration.getProvider()))
+ .filter(ossService -> ossService.getOssType().equals(OssConfiguration.provider))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Oss provider is illegal. Optional: " +
Arrays.toString(Arrays.stream(OssTypeEnum.values()).map(OssTypeEnum::getType).toArray())));
@@ -46,6 +44,9 @@
}
public URL getObjectUrl(String bucket, String objectKey) {
+ if (!StringUtils.hasText(bucket) || !StringUtils.hasText(objectKey)) {
+ throw new IllegalArgumentException();
+ }
return this.ossService.getObjectUrl(bucket, objectKey);
}
@@ -60,4 +61,8 @@
public void putObject(String bucket, String objectKey, InputStream stream) {
this.ossService.putObject(bucket, objectKey, stream);
}
+
+ void createClient() {
+ this.ossService.createClient();
+ }
}
--
Gitblit v1.9.3