Skip to content

Commit

Permalink
!42 v3.1.4.1
Browse files Browse the repository at this point in the history
Merge pull request !42 from 码匠君/develop
  • Loading branch information
herodotus-ecosystem authored and gitee-org committed Sep 27, 2023
2 parents 85dfe5a + 652211e commit e55a5f5
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 74 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<p align="center">
<a href="https://spring.io/projects/spring-boot" target="_blank"><img src="https://shields.io/badge/Spring%20Boot-3.1.4-blue.svg?logo=spring" alt="Spring Boot 3.1.4"></a>
<a href="#" target="_blank"><img src="https://shields.io/badge/Version-3.1.4.0-red.svg?logo=spring" alt="Version 3.1.4.0"></a>
<a href="#" target="_blank"><img src="https://shields.io/badge/Version-3.1.4.1-red.svg?logo=spring" alt="Version 3.1.4.1"></a>
<a href="https://bell-sw.com/pages/downloads/#downloads" target="_blank"><img src="https://img.shields.io/badge/JDK-17%2B-green.svg?logo=openjdk" alt="Java 17"></a>
<a href="./LICENSE"><img src="https://shields.io/badge/License-Apache--2.0-blue.svg?logo=apache" alt="License Apache 2.0"></a>
<a href="https://www.herodotus.cn"><img src="https://visitor-badge.laobi.icu/badge?page_id=dante-cloud&title=Total%20Visits" alt="Total Visits"></a>
Expand Down
2 changes: 1 addition & 1 deletion oss-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>cn.herodotus.engine</groupId>
<artifactId>dependencies</artifactId>
<version>3.1.4.0</version>
<version>3.1.4.1</version>
<relativePath/>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion oss-dialect/dialect-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>cn.herodotus.oss</groupId>
<artifactId>oss-dialect</artifactId>
<version>3.1.4.0</version>
<version>3.1.4.1</version>
</parent>

<artifactId>dialect-autoconfigure</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

package cn.herodotus.oss.dialect.autoconfigure;

import cn.herodotus.engine.assistant.core.definition.exception.ErrorCodeMapperBuilderCustomizer;
import cn.herodotus.oss.dialect.aliyun.configuration.OssDialectAliyunConfiguration;
import cn.herodotus.oss.dialect.autoconfigure.annotation.ConditionalOnUseAliyunDialect;
import cn.herodotus.oss.dialect.autoconfigure.annotation.ConditionalOnUseMinioDialect;
import cn.herodotus.oss.dialect.autoconfigure.annotation.ConditionalOnUseS3Dialect;
import cn.herodotus.oss.dialect.autoconfigure.customizer.OssErrorCodeMapperBuilderCustomizer;
import cn.herodotus.oss.dialect.autoconfigure.properties.OssProperties;
import cn.herodotus.oss.dialect.minio.configuration.OssDialectMinioConfiguration;
import cn.herodotus.oss.dialect.s3.configuration.OssDialectS3Configuration;
Expand All @@ -37,6 +39,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

Expand All @@ -57,6 +60,13 @@ public void postConstruct() {
log.info("[Herodotus] |- Module [OSS Dialect] Auto Configure.");
}

@Bean
public ErrorCodeMapperBuilderCustomizer ossErrorCodeMapperBuilderCustomizer() {
OssErrorCodeMapperBuilderCustomizer customizer = new OssErrorCodeMapperBuilderCustomizer();
log.trace("[Herodotus] |- Strategy [Oss ErrorCodeMapper Builder Customizer] Auto Configure.");
return customizer;
}

@Configuration(proxyBeanMethods = false)
@ConditionalOnUseAliyunDialect
@Import({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2020-2030 码匠君<[email protected]>
*
* Dante Cloud 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.
*
* Dante OSS 采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
*
* 1.请不要删除和修改根目录下的LICENSE文件。
* 2.请不要删除和修改 Dante Cloud 源码头部的版权声明。
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
* 4.分发源码时候,请注明软件出处 <https://gitee.com/herodotus/dante-oss>
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 <https://gitee.com/herodotus/dante-oss>
* 6.若您的项目无法满足以上几点,可申请商业授权
*/

package cn.herodotus.oss.dialect.autoconfigure.customizer;

import cn.herodotus.engine.assistant.core.definition.constants.ErrorCodeMapperBuilderOrdered;
import cn.herodotus.engine.assistant.core.definition.exception.ErrorCodeMapperBuilderCustomizer;
import cn.herodotus.engine.assistant.core.exception.ErrorCodeMapperBuilder;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;
import org.springframework.core.Ordered;

/**
* <p>Description: Oss 模块错误代码自定义 </p>
*
* @author : gengwei.zheng
* @date : 2023/9/27 10:36
*/
public class OssErrorCodeMapperBuilderCustomizer implements ErrorCodeMapperBuilderCustomizer, Ordered {
@Override
public void customize(ErrorCodeMapperBuilder builder) {
builder
.internalServerError(
OssErrorCodes.OSS_CLIENT_POOL_ERROR,
OssErrorCodes.OSS_ERROR_RESPONSE,
OssErrorCodes.OSS_INSUFFICIENT_DATA,
OssErrorCodes.OSS_INTERNAL,
OssErrorCodes.OSS_INVALID_KEY,
OssErrorCodes.OSS_INVALID_RESPONSE,
OssErrorCodes.OSS_IO,
OssErrorCodes.OSS_NO_SUCH_ALGORITHM,
OssErrorCodes.OSS_SERVER,
OssErrorCodes.OSS_XML_PARSER,
OssErrorCodes.OSS_EXECUTION,
OssErrorCodes.OSS_INTERRUPTED,
OssErrorCodes.OSS_BUCKET_POLICY_TOO_LARGE,
OssErrorCodes.OSS_INVALID_CIPHER_TEXT)
.serviceUnavailable(OssErrorCodes.OSS_CONNECTION);
}

@Override
public int getOrder() {
return ErrorCodeMapperBuilderOrdered.OSS;
}
}
2 changes: 1 addition & 1 deletion oss-dialect/dialect-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>cn.herodotus.oss</groupId>
<artifactId>oss-dialect</artifactId>
<version>3.1.4.0</version>
<version>3.1.4.1</version>
</parent>

<artifactId>dialect-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,4 @@ public interface OssConstants extends BaseConstants {
String PROPERTY_OSS_ALIYUN = PROPERTY_PREFIX_OSS + ".aliyun";

String ITEM_OSS_DIALECT = PROPERTY_PREFIX_OSS + ".dialect";

String MINIO_BUCKET_HANDLER = "MINIO_BUCKET";
String MINIO_OBJECT_HANDLER = "MINIO_OBJECT";
String S3_BUCKET_HANDLER = "S3_BUCKET";
String S3_OBJECT_HANDLER = "S3_OBJECT";
String ALIYUN_BUCKET_HANDLER = "ALIYUN_BUCKET";
String ALIYUN_OBJECT_HANDLER = "ALIYUN_OBJECT";

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,31 @@

package cn.herodotus.oss.dialect.core.constants;

import cn.herodotus.engine.assistant.core.definition.constants.ErrorCodes;
import cn.herodotus.engine.assistant.core.exception.feedback.InternalServerErrorFeedback;
import cn.herodotus.engine.assistant.core.exception.feedback.ServiceUnavailableFeedback;

/**
* <p>Description: 对象存储错误代码 </p>
*
* @author : gengwei.zheng
* @date : 2022/6/30 13:15
*/
public interface OssErrorCodes extends ErrorCodes {
public interface OssErrorCodes {

int OSS_CLIENT_POOL_ERROR = OSS_MODULE_500_BEGIN + 1;
int MINIO_ERROR_RESPONSE = OSS_CLIENT_POOL_ERROR + 1;
int MINIO_INSUFFICIENT_DATA = MINIO_ERROR_RESPONSE + 1;
int MINIO_INTERNAL = MINIO_INSUFFICIENT_DATA + 1;
int MINIO_INVALID_KEY = MINIO_INTERNAL + 1;
int MINIO_INVALID_RESPONSE = MINIO_INVALID_KEY + 1;
int MINIO_IO = MINIO_INVALID_RESPONSE + 1;
int MINIO_NO_SUCH_ALGORITHM = MINIO_IO + 1;
int MINIO_SERVER = MINIO_NO_SUCH_ALGORITHM + 1;
int MINIO_XML_PARSER = MINIO_SERVER + 1;
int MINIO_EXECUTION = MINIO_XML_PARSER + 1;
int MINIO_INTERRUPTED = MINIO_EXECUTION + 1;
int MINIO_BUCKET_POLICY_TOO_LARGE = MINIO_INTERRUPTED + 1;
int MINIO_INVALID_CIPHER_TEXT = MINIO_BUCKET_POLICY_TOO_LARGE + 1;
InternalServerErrorFeedback OSS_CLIENT_POOL_ERROR = new InternalServerErrorFeedback("无法从Oss对象池中获取对象");
InternalServerErrorFeedback OSS_ERROR_RESPONSE = new InternalServerErrorFeedback("对象存储服务器返回错误响应");
InternalServerErrorFeedback OSS_INSUFFICIENT_DATA = new InternalServerErrorFeedback("对象存储服务器返回数据不足");
InternalServerErrorFeedback OSS_INTERNAL = new InternalServerErrorFeedback("对象存储服务器内部错误");
InternalServerErrorFeedback OSS_INVALID_KEY = new InternalServerErrorFeedback("对象存储使用无效的秘钥");
InternalServerErrorFeedback OSS_INVALID_RESPONSE = new InternalServerErrorFeedback("对象存储返回无效的响应");
InternalServerErrorFeedback OSS_IO = new InternalServerErrorFeedback("对象存储出现IO错误");
InternalServerErrorFeedback OSS_NO_SUCH_ALGORITHM = new InternalServerErrorFeedback("使用对象存储不支持算法错误");
InternalServerErrorFeedback OSS_SERVER = new InternalServerErrorFeedback("对象存储服务器出现错误");
InternalServerErrorFeedback OSS_XML_PARSER = new InternalServerErrorFeedback("对象存储 XML 解析出现错误");
InternalServerErrorFeedback OSS_EXECUTION = new InternalServerErrorFeedback("对象存储服务器异步执行错误");
InternalServerErrorFeedback OSS_INTERRUPTED = new InternalServerErrorFeedback("对象存储服务器异步执行中断错误");
InternalServerErrorFeedback OSS_BUCKET_POLICY_TOO_LARGE = new InternalServerErrorFeedback("存储桶访问策略过大");
InternalServerErrorFeedback OSS_INVALID_CIPHER_TEXT = new InternalServerErrorFeedback("无效密码文本错误");

int MINIO_CONNECTION = OSS_MODULE_503_BEGIN + 1;
ServiceUnavailableFeedback OSS_CONNECTION = new ServiceUnavailableFeedback("Minio 服务器无法访问或未启动");
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssBucketPolicyTooLargeException(String message, Throwable cause, bool

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_BUCKET_POLICY_TOO_LARGE, "存储桶访问策略过大");
return OssErrorCodes.OSS_BUCKET_POLICY_TOO_LARGE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssClientPoolErrorException(String message, Throwable cause, boolean e

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.OSS_CLIENT_POOL_ERROR, "无法从Oss对象池中获取对象");
return OssErrorCodes.OSS_CLIENT_POOL_ERROR;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssConnectException(String message, Throwable cause, boolean enableSup

@Override
public Feedback getFeedback() {
return FeedbackFactory.serviceUnavailable(OssErrorCodes.MINIO_CONNECTION, "Minio 服务器无法访问或未启动");
return OssErrorCodes.OSS_CONNECTION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssErrorResponseException(String message, Throwable cause, boolean ena

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_ERROR_RESPONSE, "对象存储服务器返回错误响应");
return OssErrorCodes.OSS_ERROR_RESPONSE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssExecutionException(String message, Throwable cause, boolean enableS

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_EXECUTION, "对象存储服务器异步执行错误");
return OssErrorCodes.OSS_EXECUTION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssIOException(String message, Throwable cause, boolean enableSuppress

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_IO, "对象存储出现IO错误");
return OssErrorCodes.OSS_IO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInsufficientDataException(String message, Throwable cause, boolean

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INSUFFICIENT_DATA, "对象存储服务器返回数据不足");
return OssErrorCodes.OSS_INSUFFICIENT_DATA;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInternalException(String message, Throwable cause, boolean enableSu

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INTERNAL, "对象存储服务器内部错误");
return OssErrorCodes.OSS_INTERNAL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInterruptedException(String message, Throwable cause, boolean enabl

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INTERRUPTED, "对象存储服务器异步执行中断错误");
return OssErrorCodes.OSS_INTERRUPTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInvalidCipherTextException(String message, Throwable cause, boolean

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INVALID_CIPHER_TEXT, "无效密码文本错误");
return OssErrorCodes.OSS_INVALID_CIPHER_TEXT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInvalidKeyException(String message, Throwable cause, boolean enable

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INVALID_KEY, "对象存储使用无效的秘钥");
return OssErrorCodes.OSS_INVALID_KEY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package cn.herodotus.oss.dialect.core.exception;

import cn.herodotus.engine.assistant.core.domain.Feedback;
import cn.herodotus.engine.assistant.core.exception.FeedbackFactory;
import cn.herodotus.engine.assistant.core.exception.PlatformException;
import cn.herodotus.oss.dialect.core.constants.OssErrorCodes;

Expand Down Expand Up @@ -60,6 +59,6 @@ protected OssInvalidResponseException(String message, Throwable cause, boolean e

@Override
public Feedback getFeedback() {
return FeedbackFactory.internalServerError(OssErrorCodes.MINIO_INVALID_RESPONSE, "对象存储返回无效的响应");
return OssErrorCodes.OSS_INVALID_RESPONSE;
}
}
Loading

0 comments on commit e55a5f5

Please sign in to comment.