diff --git a/oss-center/oss-center-biz/pom.xml b/oss-center/oss-center-biz/pom.xml
new file mode 100644
index 00000000..4e51d192
--- /dev/null
+++ b/oss-center/oss-center-biz/pom.xml
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+
+ oss-center-biz
+ Muscle and Fitness Server :: OSS Center - Biz
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
+
+
+ com.jmsoftware.maf
+ oss-center-domain
+
+
+
diff --git a/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/package-info.java b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
new file mode 100644
index 00000000..91ed1eb1
--- /dev/null
+++ b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
@@ -0,0 +1 @@
+package com.jmsoftware.maf.osscenter;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/ReadResourceService.java b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/ReadResourceService.java
similarity index 80%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/ReadResourceService.java
rename to oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/ReadResourceService.java
index 0237b0d6..4922e8ce 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/ReadResourceService.java
+++ b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/ReadResourceService.java
@@ -1,9 +1,8 @@
-package com.jmsoftware.maf.osscenter.read.service;
+package com.jmsoftware.maf.osscenter.service;
-import com.jmsoftware.maf.osscenter.read.entity.SerializableStatObjectResponse;
+import com.jmsoftware.maf.osscenter.response.SerializableStatObjectResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.Nullable;
-import org.springframework.util.unit.DataSize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
@@ -18,12 +17,6 @@
**/
@Validated
public interface ReadResourceService {
- String BUCKET_OBJECT_NAME_REGEX = "^.+/.+$";
- DataSize TINY_CHUNK_SIZE = DataSize.ofBytes(512);
- DataSize SMALL_CHUNK_SIZE = DataSize.ofMegabytes(1);
- DataSize MEDIUM_CHUNK_SIZE = DataSize.ofMegabytes(4);
- DataSize LARGE_CHUNK_SIZE = DataSize.ofMegabytes(8);
-
/**
* Get single resource, especially pictures, or other small size file.
*
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/WriteResourceService.java b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/WriteResourceService.java
similarity index 83%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/WriteResourceService.java
rename to oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/WriteResourceService.java
index 62e13d0e..2a10dd98 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/WriteResourceService.java
+++ b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/WriteResourceService.java
@@ -1,8 +1,8 @@
-package com.jmsoftware.maf.osscenter.write.service;
+package com.jmsoftware.maf.osscenter.service;
import com.jmsoftware.maf.common.domain.osscenter.write.ObjectResponse;
-import com.jmsoftware.maf.osscenter.write.entity.MergeResourceChunkPayload;
-import com.jmsoftware.maf.osscenter.write.entity.UploadResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.payload.MergeResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.payload.UploadResourceChunkPayload;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;
@@ -18,8 +18,6 @@
**/
@Validated
public interface WriteResourceService {
- long MAX_CHUNK_NUMBER = 999;
-
/**
* Upload single resource string.
*
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/ReadResourceServiceImpl.java b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/ReadResourceServiceImpl.java
similarity index 94%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/ReadResourceServiceImpl.java
rename to oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/ReadResourceServiceImpl.java
index e5d7ad09..08845046 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/ReadResourceServiceImpl.java
+++ b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/ReadResourceServiceImpl.java
@@ -1,10 +1,10 @@
-package com.jmsoftware.maf.osscenter.read.service.impl;
+package com.jmsoftware.maf.osscenter.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.NioUtil;
-import com.jmsoftware.maf.osscenter.read.entity.SerializableStatObjectResponse;
-import com.jmsoftware.maf.osscenter.read.service.ReadResourceService;
+import com.jmsoftware.maf.osscenter.response.SerializableStatObjectResponse;
+import com.jmsoftware.maf.osscenter.service.ReadResourceService;
import com.jmsoftware.maf.springcloudstarter.minio.MinioHelper;
import io.minio.StatObjectResponse;
import lombok.RequiredArgsConstructor;
@@ -18,6 +18,9 @@
import javax.validation.constraints.NotBlank;
import java.util.List;
+import static com.jmsoftware.maf.osscenter.constant.Chunk.LARGE_CHUNK_SIZE;
+import static com.jmsoftware.maf.osscenter.constant.Chunk.TINY_CHUNK_SIZE;
+
/**
*
ReadResourceServiceImpl
*
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/impl/WriteResourceServiceImpl.java b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/WriteResourceServiceImpl.java
similarity index 86%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/impl/WriteResourceServiceImpl.java
rename to oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/WriteResourceServiceImpl.java
index 3540de0d..3f4dddac 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/impl/WriteResourceServiceImpl.java
+++ b/oss-center/oss-center-biz/src/main/java/com/jmsoftware/maf/osscenter/service/impl/WriteResourceServiceImpl.java
@@ -1,13 +1,12 @@
-package com.jmsoftware.maf.osscenter.write.service.impl;
+package com.jmsoftware.maf.osscenter.service.impl;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.StrUtil;
import com.jmsoftware.maf.common.domain.osscenter.write.ObjectResponse;
-import com.jmsoftware.maf.osscenter.read.service.ReadResourceService;
-import com.jmsoftware.maf.osscenter.write.entity.MergeResourceChunkPayload;
-import com.jmsoftware.maf.osscenter.write.entity.UploadResourceChunkPayload;
-import com.jmsoftware.maf.osscenter.write.service.WriteResourceService;
+import com.jmsoftware.maf.osscenter.payload.MergeResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.payload.UploadResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.service.WriteResourceService;
import com.jmsoftware.maf.springcloudstarter.minio.MinioHelper;
import io.minio.ComposeSource;
import lombok.Cleanup;
@@ -29,6 +28,8 @@
import java.util.Objects;
import java.util.stream.Collectors;
+import static com.jmsoftware.maf.osscenter.constant.Chunk.TINY_CHUNK_SIZE;
+
/**
*
WriteResourceServiceImpl
*
@@ -86,17 +87,19 @@ public ObjectResponse uploadSingleResource(@NotNull MultipartFile multipartFile)
*/
@Override
@SneakyThrows
- public ObjectResponse uploadResourceChunk(@NotNull MultipartFile multipartFile,
- @Valid @NotNull UploadResourceChunkPayload payload) {
- if (StrUtil.isBlank(multipartFile.getOriginalFilename())) {
+ public ObjectResponse uploadResourceChunk(
+ @NotNull MultipartFile multipartFile,
+ @Valid @NotNull UploadResourceChunkPayload payload
+ ) {
+ if (CharSequenceUtil.isBlank(multipartFile.getOriginalFilename())) {
throw new IllegalArgumentException("File name required");
}
MediaType mediaType = null;
- if (StrUtil.isBlank(payload.getBucket())) {
+ if (CharSequenceUtil.isBlank(payload.getBucket())) {
mediaType = this.parseMediaType(multipartFile);
}
// bucketName is either mediaType of given 'bucket'
- val bucketName = StrUtil.isBlank(payload.getBucket()) ?
+ val bucketName = CharSequenceUtil.isBlank(payload.getBucket()) ?
Objects.requireNonNull(mediaType).getType() : payload.getBucket();
val orderedFilename = String.format("%s.chunk%s", payload.getFilename(),
NumberUtil.decimalFormat("000", payload.getChunkNumber()));
@@ -121,7 +124,7 @@ public ObjectResponse mergeResourceChunk(@Valid @NotNull MergeResourceChunkPaylo
@Cleanup val firstChunk = this.minioHelper.getObject(payload.getBucket(),
CollUtil.getFirst(payload.getObjectList()),
0,
- ReadResourceService.TINY_CHUNK_SIZE.toBytes());
+ TINY_CHUNK_SIZE.toBytes());
val mediaType = this.parseMediaType(firstChunk);
val headers = new HashMap(4);
headers.put("Content-Type", mediaType.toString());
@@ -138,8 +141,8 @@ public ObjectResponse mergeResourceChunk(@Valid @NotNull MergeResourceChunkPaylo
private String validateObject(List objectList) {
val objectNameSet = objectList.stream().map(object -> {
- val lastIndexOfDot = StrUtil.lastIndexOfIgnoreCase(object, ".");
- return StrUtil.subPre(object, lastIndexOfDot);
+ val lastIndexOfDot = CharSequenceUtil.lastIndexOfIgnoreCase(object, ".");
+ return CharSequenceUtil.subPre(object, lastIndexOfDot);
}).collect(Collectors.toSet());
if (CollUtil.size(objectNameSet) != 1) {
log.error("Object list is not valid! {}", objectNameSet);
@@ -152,7 +155,7 @@ private MediaType parseMediaType(MultipartFile multipartFile) throws IOException
val tika = new Tika();
val detectedMediaType = tika.detect(multipartFile.getInputStream());
log.info("Detected media type: {}", detectedMediaType);
- if (StrUtil.isBlank(detectedMediaType)) {
+ if (CharSequenceUtil.isBlank(detectedMediaType)) {
throw new IllegalStateException("Media extension detection failed!");
}
return MediaType.parse(detectedMediaType);
@@ -162,7 +165,7 @@ private MediaType parseMediaType(InputStream inputStream) throws IOException {
val tika = new Tika();
val detectedMediaType = tika.detect(inputStream);
log.info("Detected media type: {}", detectedMediaType);
- if (StrUtil.isBlank(detectedMediaType)) {
+ if (CharSequenceUtil.isBlank(detectedMediaType)) {
throw new IllegalStateException("Media extension detection failed!");
}
return MediaType.parse(detectedMediaType);
diff --git a/oss-center/oss-center-bootstrap/pom.xml b/oss-center/oss-center-bootstrap/pom.xml
new file mode 100644
index 00000000..6c78d0bb
--- /dev/null
+++ b/oss-center/oss-center-bootstrap/pom.xml
@@ -0,0 +1,186 @@
+
+
+ 4.0.0
+
+
+ oss-center-bootstrap
+ Muscle and Fitness Server :: OSS Center - Bootstrap
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ build-info
+ compile
+
+ build-info
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ ${maven-pmd-plugin.version}
+
+ ${project.build.sourceEncoding}
+ ${java.version}
+ true
+
+ rulesets/java/ali-comment.xml
+ rulesets/java/ali-concurrent.xml
+ rulesets/java/ali-constant.xml
+ rulesets/java/ali-exception.xml
+ rulesets/java/ali-flowcontrol.xml
+ rulesets/java/ali-naming.xml
+ rulesets/java/ali-oop.xml
+ rulesets/java/ali-orm.xml
+ rulesets/java/ali-other.xml
+ rulesets/java/ali-set.xml
+
+
+
+
+ verify
+
+ check
+
+
+
+
+
+ com.alibaba.p3c
+ p3c-pmd
+ ${p3c-pmd.version}
+
+
+
+
+
+
+ com.google.cloud.tools
+ jib-maven-plugin
+ ${jib-maven-plugin.version}
+
+
+ com.google.cloud.tools
+ jib-spring-boot-extension-maven
+ ${jib-spring-boot-extension-maven.version}
+
+
+
+
+
+
+ buildAndPushDockerImagePhase
+ install
+
+ build
+
+
+
+
+
+
+ adoptopenjdk/openjdk11:${adoptopenjdk11.tag}
+
+
+ docker.io/ijohnnymiller/${project.parent.artifactId}.${project.artifactId}
+
+ ${git.commit.id.abbrev}-${project.version}
+
+
+
+
+ /${project.artifactId}
+
+ -Dfile.encoding=${project.build.sourceEncoding}
+
+
+ ${oss-center.port}
+
+ USE_CURRENT_TIMESTAMP
+
+
+
+
+ com.google.cloud.tools.jib.maven.extension.springboot.JibSpringBootExtension
+
+
+ true
+
+
+
+
+
+
+
+
+ io.github.git-commit-id
+ git-commit-id-maven-plugin
+ 5.0.0
+
+
+ get-the-git-info
+
+ revision
+
+ initialize
+
+
+
+ true
+ ${project.build.outputDirectory}/git.properties
+
+
+ ^git.build.(time|version)$
+ ^git.commit.id.(abbrev|full)$
+
+ full
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.3
+
+
+
+
+
+
+ com.jmsoftware.maf
+ oss-center-web
+
+
+ com.jmsoftware.maf
+ oss-center-message
+
+
+
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java b/oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java
similarity index 92%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java
rename to oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java
index 99dcc5c6..51e03472 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java
+++ b/oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/OssCenterApplication.java
@@ -20,6 +20,7 @@
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
+@SuppressWarnings("scwjava_Createprivateconstructorforutilityclassallfieldsmethodsarestatic")
public class OssCenterApplication {
public static void main(String[] args) {
val stopWatch = new StopWatch();
diff --git a/oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/package-info.java b/oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
new file mode 100644
index 00000000..91ed1eb1
--- /dev/null
+++ b/oss-center/oss-center-bootstrap/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
@@ -0,0 +1 @@
+package com.jmsoftware.maf.osscenter;
diff --git a/oss-center/src/main/resources/application.yml b/oss-center/oss-center-bootstrap/src/main/resources/application.yml
similarity index 76%
rename from oss-center/src/main/resources/application.yml
rename to oss-center/oss-center-bootstrap/src/main/resources/application.yml
index f194e85e..d6997d7e 100644
--- a/oss-center/src/main/resources/application.yml
+++ b/oss-center/oss-center-bootstrap/src/main/resources/application.yml
@@ -7,16 +7,36 @@ server:
context-path:
spring:
+ application:
+ name: @project.parent.artifactId@
profiles:
active: @environment@
- mvc:
- throw-exception-if-no-handler-found: true
- jackson:
- date-format: yyyy-MM-dd HH:mm:ss
- time-zone: Asia/Hong_Kong
- sleuth:
- sampler:
- probability: 1.0
+ config:
+ import: consul:${spring.cloud.consul.host}:${spring.cloud.consul.port}
+ cloud:
+ # https://docs.spring.io/spring-cloud-consul/docs/current/reference/html/index.html#spring-cloud-consul-config
+ consul:
+ host: "should-be-passed-by-java-opts"
+ port: 8500
+ config:
+ # `default-context` should not be modified, keeps "application" for common configuration.
+ # Properties in the config/application folder are applicable to all applications using consul for configuration.
+ profile-separator: "::"
+ format: YAML
+ data-key: "data"
+ watch:
+ enabled: true
+ delay: 1000
+ prefixes:
+ - config
+ discovery:
+ register: true
+ instance-id: ${spring.application.name}-${spring.cloud.client.hostname}-${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
+ service-name: ${spring.application.name}
+ port: ${server.port}
+ prefer-ip-address: true
+ ip-address: ${spring.cloud.client.ip-address}
+ health-check-critical-timeout: 15s
servlet:
multipart:
# `location` specifies the directory where uploaded files will be stored. When not specified,
@@ -29,54 +49,6 @@ spring:
# `file-size-threshold` specifies the size threshold after which files will be written to disk.
# The default is 0. We set it as 0 too.
file-size-threshold: 0
- cloud:
- consul:
- discovery:
- register: true
- instance-id: ${spring.application.name}-${spring.cloud.client.hostname}-${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
- service-name: ${spring.application.name}
- port: ${server.port}
- prefer-ip-address: true
- ip-address: ${spring.cloud.client.ip-address}
- health-check-critical-timeout: 15s
- redis:
- database: 0
- timeout: 10000ms
- client-type: LETTUCE
- lettuce:
- pool:
- max-active: 20
- max-idle: 10
- max-wait: -1ms
- min-idle: 0
-
-feign:
- circuitbreaker:
- enabled: true
- httpclient:
- enabled: false
- okhttp:
- enabled: true
- client:
- config:
- default:
- connectTimeout: 5000
- readTimeout: 10000
- loggerLevel: full
- compression:
- request:
- enabled: true
- response:
- enabled: true
-
-management:
- endpoints:
- web:
- exposure:
- include: "*"
- endpoint:
- health:
- show-details: ALWAYS
logging:
config: classpath:logback-configuration/logback-${spring.profiles.active}.xml
diff --git a/oss-center/src/main/resources/banner.txt b/oss-center/oss-center-bootstrap/src/main/resources/banner.txt
similarity index 100%
rename from oss-center/src/main/resources/banner.txt
rename to oss-center/oss-center-bootstrap/src/main/resources/banner.txt
diff --git a/oss-center/src/main/resources/logback-configuration/logback-base.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-base.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-base.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-base.xml
diff --git a/oss-center/src/main/resources/logback-configuration/logback-development-docker.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-development-docker.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-development-docker.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-development-docker.xml
diff --git a/oss-center/src/main/resources/logback-configuration/logback-development-local.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-development-local.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-development-local.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-development-local.xml
diff --git a/oss-center/src/main/resources/logback-configuration/logback-production.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-production.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-production.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-production.xml
diff --git a/oss-center/src/main/resources/logback-configuration/logback-stage.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-stage.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-stage.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-stage.xml
diff --git a/oss-center/src/main/resources/logback-configuration/logback-test.xml b/oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-test.xml
similarity index 100%
rename from oss-center/src/main/resources/logback-configuration/logback-test.xml
rename to oss-center/oss-center-bootstrap/src/main/resources/logback-configuration/logback-test.xml
diff --git a/oss-center/src/test/java/com/jmsoftware/maf/osscenter/OssCenterApplicationTests.java b/oss-center/oss-center-bootstrap/src/test/java/com/jmsoftware/maf/osscenter/OssCenterApplicationTests.java
similarity index 100%
rename from oss-center/src/test/java/com/jmsoftware/maf/osscenter/OssCenterApplicationTests.java
rename to oss-center/oss-center-bootstrap/src/test/java/com/jmsoftware/maf/osscenter/OssCenterApplicationTests.java
diff --git a/oss-center/oss-center-domain/pom.xml b/oss-center/oss-center-domain/pom.xml
new file mode 100644
index 00000000..b181e138
--- /dev/null
+++ b/oss-center/oss-center-domain/pom.xml
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+
+ oss-center-domain
+ Muscle and Fitness Server :: OSS Center - Domain
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
+
+
+ com.jmsoftware.maf
+ oss-center-infra
+
+
+
diff --git a/oss-center/oss-center-domain/src/main/java/com/jmsoftware/maf/osscenter/package-info.java b/oss-center/oss-center-domain/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
new file mode 100644
index 00000000..91ed1eb1
--- /dev/null
+++ b/oss-center/oss-center-domain/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
@@ -0,0 +1 @@
+package com.jmsoftware.maf.osscenter;
diff --git a/oss-center/oss-center-infra/pom.xml b/oss-center/oss-center-infra/pom.xml
new file mode 100644
index 00000000..236e3571
--- /dev/null
+++ b/oss-center/oss-center-infra/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+
+ oss-center-infra
+ Muscle and Fitness Server :: OSS Center - Infra
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
diff --git a/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/constant/Chunk.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/constant/Chunk.java
new file mode 100644
index 00000000..c9507e36
--- /dev/null
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/constant/Chunk.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright By ZATI
+ * Copyright By 3a3c88295d37870dfd3b25056092d1a9209824b256c341f2cdc296437f671617
+ * All rights reserved.
+ *
+ * If you are not the intended user, you are hereby notified that any use, disclosure, copying, printing, forwarding or
+ * dissemination of this property is strictly prohibited. If you have got this file in error, delete it from your
+ * system.
+ */
+package com.jmsoftware.maf.osscenter.constant;
+
+import org.springframework.util.unit.DataSize;
+
+/**
+ * Description: ChunkSize, change description here.
+ *
+ * @author Johnny Miller (鍾俊), e-mail: johnnysviva@outlook.com, date: 2/3/2022 10:28 PM
+ **/
+@SuppressWarnings("unused")
+public class Chunk {
+ private Chunk() {
+ }
+
+ public static final String BUCKET_OBJECT_NAME_REGEX = "^.+/.+$";
+ public static final DataSize TINY_CHUNK_SIZE = DataSize.ofBytes(512);
+ public static final DataSize SMALL_CHUNK_SIZE = DataSize.ofMegabytes(1);
+ public static final DataSize MEDIUM_CHUNK_SIZE = DataSize.ofMegabytes(4);
+ public static final DataSize LARGE_CHUNK_SIZE = DataSize.ofMegabytes(8);
+ public static final int MAX_CHUNK_NUMBER = 999;
+}
diff --git a/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/package-info.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
new file mode 100644
index 00000000..91ed1eb1
--- /dev/null
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
@@ -0,0 +1 @@
+package com.jmsoftware.maf.osscenter;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/MergeResourceChunkPayload.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/MergeResourceChunkPayload.java
similarity index 90%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/MergeResourceChunkPayload.java
rename to oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/MergeResourceChunkPayload.java
index 6417a0ce..615a5231 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/MergeResourceChunkPayload.java
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/MergeResourceChunkPayload.java
@@ -1,4 +1,4 @@
-package com.jmsoftware.maf.osscenter.write.entity;
+package com.jmsoftware.maf.osscenter.payload;
import lombok.Data;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/UploadResourceChunkPayload.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/UploadResourceChunkPayload.java
similarity index 76%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/UploadResourceChunkPayload.java
rename to oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/UploadResourceChunkPayload.java
index 38fd5f7f..95f7c30b 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/entity/UploadResourceChunkPayload.java
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/payload/UploadResourceChunkPayload.java
@@ -1,6 +1,5 @@
-package com.jmsoftware.maf.osscenter.write.entity;
+package com.jmsoftware.maf.osscenter.payload;
-import com.jmsoftware.maf.osscenter.write.service.WriteResourceService;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
@@ -8,6 +7,8 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
+import static com.jmsoftware.maf.osscenter.constant.Chunk.MAX_CHUNK_NUMBER;
+
/**
* Description: UploadResourceChunkPayload, change description here.
*
@@ -17,7 +18,7 @@
public class UploadResourceChunkPayload {
private String bucket;
@NotNull
- @Range(max = WriteResourceService.MAX_CHUNK_NUMBER)
+ @Range(max = MAX_CHUNK_NUMBER)
private Integer chunkNumber;
@NotBlank
@Pattern(regexp = "^[^<>:;,?\"*|/]+$")
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableGenericResponse.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableGenericResponse.java
similarity index 90%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableGenericResponse.java
rename to oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableGenericResponse.java
index 23c829b3..0c374810 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableGenericResponse.java
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableGenericResponse.java
@@ -1,4 +1,4 @@
-package com.jmsoftware.maf.osscenter.read.entity;
+package com.jmsoftware.maf.osscenter.response;
import lombok.AccessLevel;
import lombok.Data;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableStatObjectResponse.java b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableStatObjectResponse.java
similarity index 97%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableStatObjectResponse.java
rename to oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableStatObjectResponse.java
index 075e959d..40119887 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/entity/SerializableStatObjectResponse.java
+++ b/oss-center/oss-center-infra/src/main/java/com/jmsoftware/maf/osscenter/response/SerializableStatObjectResponse.java
@@ -1,4 +1,4 @@
-package com.jmsoftware.maf.osscenter.read.entity;
+package com.jmsoftware.maf.osscenter.response;
import io.minio.StatObjectResponse;
import io.minio.messages.LegalHold;
diff --git a/oss-center/src/main/resources/messages.properties b/oss-center/oss-center-infra/src/main/resources/messages.properties
similarity index 100%
rename from oss-center/src/main/resources/messages.properties
rename to oss-center/oss-center-infra/src/main/resources/messages.properties
diff --git a/oss-center/src/main/resources/messages_zh_CN.properties b/oss-center/oss-center-infra/src/main/resources/messages_zh_CN.properties
similarity index 100%
rename from oss-center/src/main/resources/messages_zh_CN.properties
rename to oss-center/oss-center-infra/src/main/resources/messages_zh_CN.properties
diff --git a/oss-center/oss-center-message/pom.xml b/oss-center/oss-center-message/pom.xml
new file mode 100644
index 00000000..8abd1fba
--- /dev/null
+++ b/oss-center/oss-center-message/pom.xml
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+
+ oss-center-message
+ Muscle and Fitness Server :: OSS Center - Message
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
+
+
+ com.jmsoftware.maf
+ oss-center-biz
+
+
+
diff --git a/oss-center/oss-center-message/src/main/java/com/jmsoftware/maf/osscenter/package-info.java b/oss-center/oss-center-message/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
new file mode 100644
index 00000000..91ed1eb1
--- /dev/null
+++ b/oss-center/oss-center-message/src/main/java/com/jmsoftware/maf/osscenter/package-info.java
@@ -0,0 +1 @@
+package com.jmsoftware.maf.osscenter;
diff --git a/oss-center/oss-center-web/pom.xml b/oss-center/oss-center-web/pom.xml
new file mode 100644
index 00000000..58d0953b
--- /dev/null
+++ b/oss-center/oss-center-web/pom.xml
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+
+ oss-center-web
+ Muscle and Fitness Server :: OSS Center - Web
+ Object Storage Service (OSS) Center for M&F.
+
+ com.jmsoftware.maf
+ oss-center
+ 0.0.8-SNAPSHOT
+ ../pom.xml
+
+
+
+
+ com.jmsoftware.maf
+ oss-center-biz
+
+
+
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/controller/ReadResourceController.java b/oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/ReadResourceController.java
similarity index 91%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/controller/ReadResourceController.java
rename to oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/ReadResourceController.java
index 78e52440..2bf10df7 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/controller/ReadResourceController.java
+++ b/oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/ReadResourceController.java
@@ -1,8 +1,8 @@
-package com.jmsoftware.maf.osscenter.read.controller;
+package com.jmsoftware.maf.osscenter;
import com.jmsoftware.maf.common.bean.ResponseBodyBean;
-import com.jmsoftware.maf.osscenter.read.entity.SerializableStatObjectResponse;
-import com.jmsoftware.maf.osscenter.read.service.ReadResourceService;
+import com.jmsoftware.maf.osscenter.response.SerializableStatObjectResponse;
+import com.jmsoftware.maf.osscenter.service.ReadResourceService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java b/oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/WriteResourceController.java
similarity index 72%
rename from oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java
rename to oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/WriteResourceController.java
index b8207675..cdd324bf 100644
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java
+++ b/oss-center/oss-center-web/src/main/java/com/jmsoftware/maf/osscenter/WriteResourceController.java
@@ -1,10 +1,10 @@
-package com.jmsoftware.maf.osscenter.write.controller;
+package com.jmsoftware.maf.osscenter;
import com.jmsoftware.maf.common.bean.ResponseBodyBean;
import com.jmsoftware.maf.common.domain.osscenter.write.ObjectResponse;
-import com.jmsoftware.maf.osscenter.write.entity.MergeResourceChunkPayload;
-import com.jmsoftware.maf.osscenter.write.entity.UploadResourceChunkPayload;
-import com.jmsoftware.maf.osscenter.write.service.WriteResourceService;
+import com.jmsoftware.maf.osscenter.payload.MergeResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.payload.UploadResourceChunkPayload;
+import com.jmsoftware.maf.osscenter.service.WriteResourceService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
@@ -29,7 +29,9 @@ public class WriteResourceController {
private final MessageSource messageSource;
@PostMapping("/upload/single")
- public ResponseBodyBean uploadSingleResource(@RequestPart("file") MultipartFile multipartFile) {
+ public ResponseBodyBean uploadSingleResource(
+ @RequestPart("file") MultipartFile multipartFile
+ ) {
return ResponseBodyBean.ofSuccess(
this.writeResourceService.uploadSingleResource(multipartFile),
this.messageSource.getMessage(
@@ -41,13 +43,17 @@ public ResponseBodyBean uploadSingleResource(@RequestPart("file"
}
@PostMapping("/upload/chunk")
- public ResponseBodyBean uploadResourceChunk(@RequestPart("file") MultipartFile multipartFile,
- @Valid UploadResourceChunkPayload payload) {
+ public ResponseBodyBean uploadResourceChunk(
+ @RequestPart("file") MultipartFile multipartFile,
+ @Valid UploadResourceChunkPayload payload
+ ) {
return ResponseBodyBean.ofSuccess(this.writeResourceService.uploadResourceChunk(multipartFile, payload));
}
@PutMapping("/merge/chunk")
- public ResponseBodyBean mergeResourceChunk(@Valid @RequestBody MergeResourceChunkPayload payload) {
+ public ResponseBodyBean mergeResourceChunk(
+ @Valid @RequestBody MergeResourceChunkPayload payload
+ ) {
return ResponseBodyBean.ofSuccess(this.writeResourceService.mergeResourceChunk(payload));
}
}
diff --git a/oss-center/pom.xml b/oss-center/pom.xml
index facd8d29..4cbde140 100644
--- a/oss-center/pom.xml
+++ b/oss-center/pom.xml
@@ -12,163 +12,51 @@
muscle-and-fitness-server
0.0.8-SNAPSHOT
+ pom
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- build-info
- compile
-
- build-info
-
-
-
-
+
+ oss-center-bootstrap
+ oss-center-web
+ oss-center-message
+ oss-center-biz
+ oss-center-domain
+ oss-center-infra
+
-
- org.apache.maven.plugins
- maven-pmd-plugin
- ${maven-pmd-plugin.version}
-
- ${project.build.sourceEncoding}
- ${java.version}
- true
-
- rulesets/java/ali-comment.xml
- rulesets/java/ali-concurrent.xml
- rulesets/java/ali-constant.xml
- rulesets/java/ali-exception.xml
- rulesets/java/ali-flowcontrol.xml
- rulesets/java/ali-naming.xml
- rulesets/java/ali-oop.xml
- rulesets/java/ali-orm.xml
- rulesets/java/ali-other.xml
- rulesets/java/ali-set.xml
-
-
-
-
- verify
-
- check
-
-
-
-
-
- com.alibaba.p3c
- p3c-pmd
- ${p3c-pmd.version}
-
-
-
-
-
-
- com.google.cloud.tools
- jib-maven-plugin
- ${jib-maven-plugin.version}
-
-
- com.google.cloud.tools
- jib-spring-boot-extension-maven
- ${jib-spring-boot-extension-maven.version}
-
-
-
-
-
-
- buildAndPushDockerImagePhase
- install
-
- build
-
-
-
-
-
-
- adoptopenjdk/openjdk11:${adoptopenjdk11.tag}
-
-
- docker.io/ijohnnymiller/${project.parent.artifactId}.${project.artifactId}
-
- ${git.commit.id.abbrev}-${project.version}
-
-
-
-
- /${project.artifactId}
-
- -Dfile.encoding=${project.build.sourceEncoding}
-
-
- ${oss-center.port}
-
- USE_CURRENT_TIMESTAMP
-
-
-
-
- com.google.cloud.tools.jib.maven.extension.springboot.JibSpringBootExtension
-
-
- true
-
-
-
-
-
-
-
-
- io.github.git-commit-id
- git-commit-id-maven-plugin
- 5.0.0
-
-
- get-the-git-info
-
- revision
-
- initialize
-
-
-
- true
- ${project.build.outputDirectory}/git.properties
-
- ^git.build.(time|version)$
- ^git.commit.id.(abbrev|full)$
-
- full
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jxr-plugin
- 2.3
-
-
-
+
+
+
+ com.jmsoftware.maf
+ oss-center-bootstrap
+ ${project.version}
+
+
+ com.jmsoftware.maf
+ oss-center-web
+ ${project.version}
+
+
+ com.jmsoftware.maf
+ oss-center-message
+ ${project.version}
+
+
+ com.jmsoftware.maf
+ oss-center-biz
+ ${project.version}
+
+
+ com.jmsoftware.maf
+ oss-center-domain
+ ${project.version}
+
+
+ com.jmsoftware.maf
+ oss-center-infra
+ ${project.version}
+
+
+
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/package-info.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/package-info.java
deleted file mode 100644
index 0cb19f7c..00000000
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.jmsoftware.maf.osscenter.read;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/package-info.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/package-info.java
deleted file mode 100644
index bc6eee9a..00000000
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/impl/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.jmsoftware.maf.osscenter.read.service.impl;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/package-info.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/package-info.java
deleted file mode 100644
index 0b7241e8..00000000
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/read/service/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.jmsoftware.maf.osscenter.read.service;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/package-info.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/package-info.java
deleted file mode 100644
index 4540037f..00000000
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.jmsoftware.maf.osscenter.write;
diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/package-info.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/package-info.java
deleted file mode 100644
index a421fd8c..00000000
--- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/service/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.jmsoftware.maf.osscenter.write.service;
diff --git a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/aspect/CommonExceptionControllerAdvice.java b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/aspect/CommonExceptionControllerAdvice.java
index a1191fb8..9f028cb4 100644
--- a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/aspect/CommonExceptionControllerAdvice.java
+++ b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/aspect/CommonExceptionControllerAdvice.java
@@ -1,5 +1,6 @@
package com.jmsoftware.maf.springcloudstarter.aspect;
+import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.jmsoftware.maf.common.bean.ResponseBodyBean;
@@ -238,7 +239,7 @@ private String getFieldErrorMessageFromException(MethodArgumentNotValidException
* @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 12/24/2020 11:22 AM
*/
private String removeLineSeparator(String source) {
- if (StrUtil.isBlank(source)) {
+ if (CharSequenceUtil.isBlank(source)) {
return "source is blank";
}
return source.replaceAll(System.lineSeparator(), " ");