From 67af7d400c633a9ff608a70d9f2fa7dd55f6fef3 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Sun, 26 Nov 2023 22:02:25 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.0.4=E3=80=91=E3=80=90file=E3=80=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=9D=92=E4=BA=91=E7=9A=84oss?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/pojo/props/QingYunOssProperties.java | 50 +++++++ kernel-d-file/file-sdk-qingyun/README.md | 1 + kernel-d-file/file-sdk-qingyun/pom.xml | 36 +++++ .../file/qingyun/QingYunFileOperator.java | 123 ++++++++++++++++++ kernel-d-file/pom.xml | 1 + pom.xml | 8 ++ 6 files changed, 219 insertions(+) create mode 100644 kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/QingYunOssProperties.java create mode 100644 kernel-d-file/file-sdk-qingyun/README.md create mode 100644 kernel-d-file/file-sdk-qingyun/pom.xml create mode 100644 kernel-d-file/file-sdk-qingyun/src/main/java/cn/stylefeng/roses/kernel/file/qingyun/QingYunFileOperator.java diff --git a/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/QingYunOssProperties.java b/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/QingYunOssProperties.java new file mode 100644 index 000000000..2e54d0558 --- /dev/null +++ b/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/QingYunOssProperties.java @@ -0,0 +1,50 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.file.api.pojo.props; + +import lombok.Data; + +/** + * 青云OSS的配置 + *

+ * https://github.com/qingstor/qingstor-sdk-java/blob/master/README_zh-CN.md + * + * @author fengshuonan + * @since 2023/11/26 21:59 + */ +@Data +public class QingYunOssProperties { + + /** + * 秘钥id + */ + private String qyAccessKeyId; + + /** + * 秘钥secret + */ + private String qySecretAccessKey; + +} diff --git a/kernel-d-file/file-sdk-qingyun/README.md b/kernel-d-file/file-sdk-qingyun/README.md new file mode 100644 index 000000000..d3a2bb274 --- /dev/null +++ b/kernel-d-file/file-sdk-qingyun/README.md @@ -0,0 +1 @@ +青云OSS适配 \ No newline at end of file diff --git a/kernel-d-file/file-sdk-qingyun/pom.xml b/kernel-d-file/file-sdk-qingyun/pom.xml new file mode 100644 index 000000000..b2cf6521a --- /dev/null +++ b/kernel-d-file/file-sdk-qingyun/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-file + 8.0.4 + ../pom.xml + + + file-sdk-qingyun + + jar + + + + + + cn.stylefeng.roses + file-api + ${roses.version} + + + + + com.yunify + qingstor.sdk.java + + + + + + diff --git a/kernel-d-file/file-sdk-qingyun/src/main/java/cn/stylefeng/roses/kernel/file/qingyun/QingYunFileOperator.java b/kernel-d-file/file-sdk-qingyun/src/main/java/cn/stylefeng/roses/kernel/file/qingyun/QingYunFileOperator.java new file mode 100644 index 000000000..a3a037474 --- /dev/null +++ b/kernel-d-file/file-sdk-qingyun/src/main/java/cn/stylefeng/roses/kernel/file/qingyun/QingYunFileOperator.java @@ -0,0 +1,123 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.file.qingyun; + +import cn.stylefeng.roses.kernel.file.api.FileOperatorApi; +import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum; +import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum; +import cn.stylefeng.roses.kernel.file.api.pojo.props.QingYunOssProperties; + +import java.io.InputStream; + +/** + * 青云的OSS操作 + * + * @author fengshuonan + * @since 2023/11/26 22:01 + */ +public class QingYunFileOperator implements FileOperatorApi { + + private final QingYunOssProperties qingYunOssProperties; + + public QingYunFileOperator(QingYunOssProperties qingYunOssProperties) { + this.qingYunOssProperties = qingYunOssProperties; + this.initClient(); + } + + @Override + public void initClient() { + } + + @Override + public void destroyClient() { + + } + + @Override + public Object getClient() { + return null; + } + + @Override + public boolean doesBucketExist(String bucketName) { + return false; + } + + @Override + public void setBucketAcl(String bucketName, BucketAuthEnum bucketAuthEnum) { + + } + + @Override + public boolean isExistingFile(String bucketName, String key) { + return false; + } + + @Override + public void storageFile(String bucketName, String key, byte[] bytes) { + + } + + @Override + public void storageFile(String bucketName, String key, InputStream inputStream) { + + } + + @Override + public byte[] getFileBytes(String bucketName, String key) { + return new byte[0]; + } + + @Override + public void setFileAcl(String bucketName, String key, BucketAuthEnum bucketAuthEnum) { + + } + + @Override + public void copyFile(String originBucketName, String originFileKey, String newBucketName, String newFileKey) { + + } + + @Override + public String getFileAuthUrl(String bucketName, String key, Long timeoutMillis) { + return null; + } + + @Override + public String getFileUnAuthUrl(String bucketName, String key) { + return null; + } + + @Override + public void deleteFile(String bucketName, String key) { + + } + + @Override + public FileLocationEnum getFileLocationEnum() { + return null; + } + +} diff --git a/kernel-d-file/pom.xml b/kernel-d-file/pom.xml index 4b546e392..6a645e2d7 100644 --- a/kernel-d-file/pom.xml +++ b/kernel-d-file/pom.xml @@ -22,6 +22,7 @@ file-sdk-tencent file-sdk-local file-sdk-minio + file-sdk-qingyun file-spring-boot-starter diff --git a/pom.xml b/pom.xml index 9eda98dda..1dd813c24 100644 --- a/pom.xml +++ b/pom.xml @@ -132,6 +132,7 @@ 1.1.3 4.4.6 4.17.6 + 2.5.1 3.1.57 7.9.2 1.11.106 @@ -219,6 +220,13 @@ ${aliyun.oss.version} + + + com.yunify + qingstor.sdk.java + ${qingyun.oss.version} + + com.qcloud