diff --git a/build.gradle b/build.gradle index c83b776c..f3f1b9ba 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,7 @@ allprojects { group = 'com.webank.wedpr' version = '1.0.0-rc1-SNAPSHOT' apply plugin: 'maven-publish' + apply plugin: 'com.github.sherter.google-java-format' apply plugin: 'idea' apply plugin: 'eclipse' apply plugin: 'java' @@ -174,6 +175,13 @@ subprojects { resources.srcDir file('src/integration-test/resources') } } + googleJavaFormat { + //toolVersion = '1.7' + options style: 'AOSP' + source = sourceSets*.allJava + include '**/*.java' + //source = *.allJava + } configurations { integrationTestCompile.extendsFrom testCompile integrationTestRuntime.extendsFrom testRuntime diff --git a/wedpr-adm/build.gradle b/wedpr-adm/build.gradle index 227986b0..237e4efc 100644 --- a/wedpr-adm/build.gradle +++ b/wedpr-adm/build.gradle @@ -18,10 +18,3 @@ dependencies { compile project(":wedpr-components-security") compile project(":wedpr-components-report") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-admin/build.gradle b/wedpr-admin/build.gradle index edf27365..34387c06 100644 --- a/wedpr-admin/build.gradle +++ b/wedpr-admin/build.gradle @@ -9,10 +9,3 @@ dependencies { compile project(":wedpr-components-security") compile project(":wedpr-components-admin") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} \ No newline at end of file diff --git a/wedpr-components/admin/build.gradle b/wedpr-components/admin/build.gradle index 7a9fc5a8..1378445b 100644 --- a/wedpr-components/admin/build.gradle +++ b/wedpr-components/admin/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(":wedpr-components-token-auth") compile project(":wedpr-components-mybatis") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} +} \ No newline at end of file diff --git a/wedpr-components/authorization/build.gradle b/wedpr-components/authorization/build.gradle index 60d475b7..7dbd8cdc 100644 --- a/wedpr-components/authorization/build.gradle +++ b/wedpr-components/authorization/build.gradle @@ -1,18 +1,10 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") compile project(":wedpr-components-uuid") compile project(":wedpr-components-sync") compile project(":wedpr-components-resource-follower") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava } \ No newline at end of file diff --git a/wedpr-components/blockchain/build.gradle b/wedpr-components/blockchain/build.gradle index a8ff6858..7c749e1e 100644 --- a/wedpr-components/blockchain/build.gradle +++ b/wedpr-components/blockchain/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(":wedpr-core-utils") compile ("org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:${bcosSDKVersion}") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava } \ No newline at end of file diff --git a/wedpr-components/dataset/build.gradle b/wedpr-components/dataset/build.gradle index ecd176f1..fa0af9a9 100644 --- a/wedpr-components/dataset/build.gradle +++ b/wedpr-components/dataset/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } // Additional attribute definition @@ -38,14 +37,4 @@ dependencies { // shen tong compile files('libs/oscarJDBC8.jar') // compile files('libs/oscarHibernate54.jar') -} - -googleJavaFormat { - toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' -// exclude '**/*Test.java' -// exclude '**/Test*.java' -// exclude '**/Mock*.java' -} +} \ No newline at end of file diff --git a/wedpr-components/dataset/src/main/java/com/webank/wedpr/components/dataset/service/DatasetServiceImpl.java b/wedpr-components/dataset/src/main/java/com/webank/wedpr/components/dataset/service/DatasetServiceImpl.java index 5459eed4..29a36b70 100644 --- a/wedpr-components/dataset/src/main/java/com/webank/wedpr/components/dataset/service/DatasetServiceImpl.java +++ b/wedpr-components/dataset/src/main/java/com/webank/wedpr/components/dataset/service/DatasetServiceImpl.java @@ -253,7 +253,8 @@ public void deleteDatasetList(UserInfo userInfo, List datasetIdList) // sort and distinct List newDatasetIdList = - datasetIdList.stream() + datasetIdList + .stream() .distinct() .sorted(String::compareTo) .collect(Collectors.toList()); diff --git a/wedpr-components/env-integration/jupyter/build.gradle b/wedpr-components/env-integration/jupyter/build.gradle index cf858da8..b2a0a892 100644 --- a/wedpr-components/env-integration/jupyter/build.gradle +++ b/wedpr-components/env-integration/jupyter/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") compile project(":wedpr-components-uuid") compile project(":wedpr-components-sys-config") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/http-client/build.gradle b/wedpr-components/http-client/build.gradle index d0ca6f90..abe6c597 100644 --- a/wedpr-components/http-client/build.gradle +++ b/wedpr-components/http-client/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile ("org.apache.httpcomponents:httpclient:${httpClientVersion}") compile project(":wedpr-core-utils") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/initializer/build.gradle b/wedpr-components/initializer/build.gradle index fcf8821b..4eca7881 100644 --- a/wedpr-components/initializer/build.gradle +++ b/wedpr-components/initializer/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { @@ -10,10 +9,3 @@ dependencies { compile project(":wedpr-components-mybatis") compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/leader-election/build.gradle b/wedpr-components/leader-election/build.gradle index b20a7991..712e6c72 100644 --- a/wedpr-components/leader-election/build.gradle +++ b/wedpr-components/leader-election/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(":wedpr-components-sys-config") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/meta/agency/build.gradle b/wedpr-components/meta/agency/build.gradle index bf016261..71ea8c94 100644 --- a/wedpr-components/meta/agency/build.gradle +++ b/wedpr-components/meta/agency/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") compile project(":wedpr-components-uuid") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/meta/project/build.gradle b/wedpr-components/meta/project/build.gradle index 8f7ec106..912671ff 100644 --- a/wedpr-components/meta/project/build.gradle +++ b/wedpr-components/meta/project/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") @@ -10,10 +9,3 @@ dependencies{ compile project(":wedpr-components-resource-follower") compile project(":wedpr-components-dataset") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/meta/resource-follower/build.gradle b/wedpr-components/meta/resource-follower/build.gradle index 2663f194..db8a70ae 100644 --- a/wedpr-components/meta/resource-follower/build.gradle +++ b/wedpr-components/meta/resource-follower/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-uuid") compile project(":wedpr-components-mybatis") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} +} \ No newline at end of file diff --git a/wedpr-components/meta/setting-template/build.gradle b/wedpr-components/meta/setting-template/build.gradle index 37c27c3d..0e7854b6 100644 --- a/wedpr-components/meta/setting-template/build.gradle +++ b/wedpr-components/meta/setting-template/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") compile project(":wedpr-core-protocol") compile project(":wedpr-components-uuid") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} +} \ No newline at end of file diff --git a/wedpr-components/meta/sys-config/build.gradle b/wedpr-components/meta/sys-config/build.gradle index 60dc11d7..54f880f9 100644 --- a/wedpr-components/meta/sys-config/build.gradle +++ b/wedpr-components/meta/sys-config/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-mybatis") compile project(":wedpr-core-protocol") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava } \ No newline at end of file diff --git a/wedpr-components/mybatis/build.gradle b/wedpr-components/mybatis/build.gradle index 905c6908..7a04a77d 100644 --- a/wedpr-components/mybatis/build.gradle +++ b/wedpr-components/mybatis/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { @@ -13,10 +12,3 @@ dependencies { compile("com.baomidou:mybatis-plus-generator:${mybatisPlusGeneratorVersion}") compile("org.apache.velocity:velocity-engine-core:${velocityVersion}") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/report/build.gradle b/wedpr-components/report/build.gradle index 6a1a9dd1..e58fbbbe 100644 --- a/wedpr-components/report/build.gradle +++ b/wedpr-components/report/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(":wedpr-components-mybatis") implementation("org.springframework.boot:spring-boot-starter-quartz:${springBootVersion}") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/scheduler/build.gradle b/wedpr-components/scheduler/build.gradle index 7c7235ca..7ac869fc 100644 --- a/wedpr-components/scheduler/build.gradle +++ b/wedpr-components/scheduler/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { @@ -11,11 +10,4 @@ dependencies { compile project(":wedpr-components-project") compile project(":wedpr-components-sync") compile project(":wedpr-components-http-client") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} +} \ No newline at end of file diff --git a/wedpr-components/security/build.gradle b/wedpr-components/security/build.gradle index a9884735..b085590e 100644 --- a/wedpr-components/security/build.gradle +++ b/wedpr-components/security/build.gradle @@ -1,17 +1,9 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(":wedpr-components-token-auth") compile project(":wedpr-components-user") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} +} \ No newline at end of file diff --git a/wedpr-components/spi/build.gradle b/wedpr-components/spi/build.gradle index 2222d9d7..a772c57d 100644 --- a/wedpr-components/spi/build.gradle +++ b/wedpr-components/spi/build.gradle @@ -1,15 +1,7 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-core-utils") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/FileStorageInterface.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/FileStorageInterface.java index 5d70750d..c8e1acab 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/FileStorageInterface.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/FileStorageInterface.java @@ -16,16 +16,19 @@ package com.webank.wedpr.components.storage.api; import com.webank.wedpr.core.protocol.StorageType; + public interface FileStorageInterface { /** * base dir + * * @return */ String getBaseDir(); /** * open storage for input stream + * * @param storagePath * @return */ @@ -46,7 +49,8 @@ public interface FileStorageInterface { * @param remotePath the remote dest-path * @param isAbsPath */ - StoragePath upload(boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath); + StoragePath upload( + boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath); /** * download the file from remotePath to localPath @@ -64,7 +68,6 @@ public interface FileStorageInterface { void delete(StoragePath storagePath); /** - * * @param storagePath * @return */ diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StoragePath.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StoragePath.java index a216b83c..6bbc6cde 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StoragePath.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StoragePath.java @@ -1,11 +1,9 @@ package com.webank.wedpr.components.storage.api; -import com.webank.wedpr.core.utils.ObjectMapperFactory; -import lombok.Getter; -import lombok.Setter; - import java.nio.file.Path; import java.nio.file.Paths; +import lombok.Getter; +import lombok.Setter; @Getter @Setter @@ -21,8 +19,8 @@ public String getFilePath() { return this.filePath.toString(); } - public void setFilePath(String filePath){ - if(filePath == null){ + public void setFilePath(String filePath) { + if (filePath == null) { return; } this.filePath = Paths.get(filePath); diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StorageStreamApi.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StorageStreamApi.java index 462b2464..ff6ae89a 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StorageStreamApi.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/api/StorageStreamApi.java @@ -1,18 +1,18 @@ package com.webank.wedpr.components.storage.api; + import java.io.Closeable; import java.io.IOException; import java.io.InputStream; public interface StorageStreamApi extends Closeable { - InputStream stream(); - + InputStream stream(); - long length() throws IOException; + long length() throws IOException; - long skip(long length) throws IOException; + long skip(long length) throws IOException; - int read(byte[] buffer) throws IOException; + int read(byte[] buffer) throws IOException; - void close() throws IOException; + void close() throws IOException; } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/builder/StoragePathBuilder.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/builder/StoragePathBuilder.java index 326c2bc2..bfb260d3 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/builder/StoragePathBuilder.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/builder/StoragePathBuilder.java @@ -9,9 +9,9 @@ import com.webank.wedpr.core.protocol.StorageType; import com.webank.wedpr.core.utils.ObjectMapperFactory; import com.webank.wedpr.core.utils.WeDPRException; -import lombok.SneakyThrows; import java.util.HashMap; import java.util.Map; +import lombok.SneakyThrows; public class StoragePathBuilder { @@ -41,22 +41,23 @@ public static StoragePath getInstance(String storageType, String strStoragePath) ObjectMapperFactory.getObjectMapper().readValue(strStoragePath, aClass); } - public static StoragePath getInstanceByFilePath(String storageType, String filePath)throws WeDPRException { - if(storageType.compareToIgnoreCase(StorageType.HDFS.getName()) == 0){ + public static StoragePath getInstanceByFilePath(String storageType, String filePath) + throws WeDPRException { + if (storageType.compareToIgnoreCase(StorageType.HDFS.getName()) == 0) { return new HDFSStoragePath(filePath); } - if(storageType.compareToIgnoreCase(StorageType.LOCAL.getName()) == 0){ + if (storageType.compareToIgnoreCase(StorageType.LOCAL.getName()) == 0) { return new LocalStoragePath(filePath); } throw new WeDPRException("getInstanceByFilePath: Invalid storageType: " + storageType); } @SneakyThrows(Exception.class) - public String getPathWithHome(String storageType, String filePath){ - if(storageType.compareToIgnoreCase(StorageType.HDFS.getName()) == 0){ + public String getPathWithHome(String storageType, String filePath) { + if (storageType.compareToIgnoreCase(StorageType.HDFS.getName()) == 0) { return hdfsConfig.getAbsPathInHdfs(filePath); } - if(storageType.compareToIgnoreCase(StorageType.LOCAL.getName()) == 0){ + if (storageType.compareToIgnoreCase(StorageType.LOCAL.getName()) == 0) { return localStorageConfig.getStorageAbsPath(filePath); } throw new WeDPRException("getPathWithHome: Invalid storageType: " + storageType); diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/HdfsStorageConfig.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/HdfsStorageConfig.java index bb0a02d3..4410e1b3 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/HdfsStorageConfig.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/HdfsStorageConfig.java @@ -1,12 +1,10 @@ package com.webank.wedpr.components.storage.config; +import java.io.File; import lombok.Data; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; -import java.io.File; - @ConfigurationProperties(prefix = "wedpr.storage.hdfs") @Configuration @Data @@ -16,9 +14,6 @@ public class HdfsStorageConfig { private String baseDir = "/user"; public String getAbsPathInHdfs(String path) { - return getBaseDir() - + File.separator - + getUser() - + File.separator + path; + return getBaseDir() + File.separator + getUser() + File.separator + path; } } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/LocalStorageConfig.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/LocalStorageConfig.java index d548c337..f8069876 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/LocalStorageConfig.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/LocalStorageConfig.java @@ -1,17 +1,16 @@ package com.webank.wedpr.components.storage.config; +import java.io.File; import lombok.Data; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; -import java.io.File; - @Configuration @ConfigurationProperties(prefix = "wedpr.storage.local") @Data public class LocalStorageConfig { private String baseDir; + public String getStorageAbsPath(String filePath) { return baseDir + File.separator + filePath; } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/StorageInitializer.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/StorageInitializer.java index 6f711b29..10f8e73e 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/StorageInitializer.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/config/StorageInitializer.java @@ -17,7 +17,6 @@ public class StorageInitializer { @Autowired(required = false) private LocalStorageConfig localStorageConfig; - @Autowired(required = false) private HdfsStorageConfig hdfsStorageConfig; diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStorage.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStorage.java index 791e0875..d39faccc 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStorage.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStorage.java @@ -18,14 +18,13 @@ import com.webank.wedpr.components.storage.api.FileStorageInterface; import com.webank.wedpr.components.storage.api.StorageMeta; import com.webank.wedpr.components.storage.api.StoragePath; -import com.webank.wedpr.components.storage.stream.HdfsStorageStream; import com.webank.wedpr.components.storage.config.HdfsStorageConfig; +import com.webank.wedpr.components.storage.stream.HdfsStorageStream; import com.webank.wedpr.core.protocol.StorageType; import com.webank.wedpr.core.utils.Common; import com.webank.wedpr.core.utils.WeDPRException; import java.io.Closeable; import java.io.IOException; - import lombok.SneakyThrows; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; @@ -147,9 +146,7 @@ public FileStatus getMetaInfo(String path) { "getMetaInfo", (fsHandlerArgs, fsActionResult) -> fsActionResult.setFileStatus( - fsHandlerArgs - .getFileSystem() - .getFileStatus(new Path(path)))); + fsHandlerArgs.getFileSystem().getFileStatus(new Path(path)))); return result.getFileStatus(); } @@ -162,7 +159,8 @@ public FileStatus getMetaInfo(String path) { */ @SneakyThrows(Exception.class) @Override - public StoragePath upload(boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath) { + public StoragePath upload( + boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath) { logger.debug("update file: {}=>{}", localPath, remotePath); String remoteAbsPath; @@ -261,7 +259,8 @@ public StorageMeta getMeta(StoragePath storagePath) { FileStatus metaInfo = getMetaInfo(filePath); - logger.error("get hdfs storage meta, filePath: {}, length: {}", filePath, metaInfo.getLen()); + logger.error( + "get hdfs storage meta, filePath: {}, length: {}", filePath, metaInfo.getLen()); StorageMeta storageMeta = new StorageMeta(); storageMeta.setLength(metaInfo.getLen()); @@ -290,7 +289,6 @@ public HdfsStorageStream open(StoragePath storagePath) { return new HdfsStorageStream(fileSystem, fsDataInputStream); } - @Override public StorageType type() { return StorageType.HDFS; diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStoragePath.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStoragePath.java index ee3d62aa..e493c549 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStoragePath.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/hdfs/HDFSStoragePath.java @@ -2,13 +2,10 @@ import com.webank.wedpr.components.storage.api.StoragePath; import com.webank.wedpr.core.protocol.StorageType; -import com.webank.wedpr.core.utils.ObjectMapperFactory; +import java.nio.file.Paths; import lombok.Getter; import lombok.Setter; -import java.nio.file.Path; -import java.nio.file.Paths; - @Getter @Setter public class HDFSStoragePath extends StoragePath { @@ -16,7 +13,8 @@ public class HDFSStoragePath extends StoragePath { protected HDFSStoragePath() { super(StorageType.HDFS.getName()); } - public HDFSStoragePath(String path){ + + public HDFSStoragePath(String path) { super(StorageType.HDFS.getName()); this.filePath = Paths.get(path); } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalFileStorage.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalFileStorage.java index d24cac3d..7b98333a 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalFileStorage.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalFileStorage.java @@ -3,10 +3,11 @@ import com.webank.wedpr.components.storage.api.FileStorageInterface; import com.webank.wedpr.components.storage.api.StorageMeta; import com.webank.wedpr.components.storage.api.StoragePath; -import com.webank.wedpr.components.storage.stream.LocalStorageStream; import com.webank.wedpr.components.storage.config.LocalStorageConfig; +import com.webank.wedpr.components.storage.stream.LocalStorageStream; import com.webank.wedpr.core.protocol.StorageType; - +import com.webank.wedpr.core.utils.Common; +import com.webank.wedpr.core.utils.WeDPRException; import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; @@ -14,9 +15,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; - -import com.webank.wedpr.core.utils.Common; -import com.webank.wedpr.core.utils.WeDPRException; import lombok.Data; import lombok.SneakyThrows; import org.slf4j.Logger; @@ -60,7 +58,8 @@ public boolean exists(StoragePath storagePath) { } @Override - public StoragePath upload(boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath) { + public StoragePath upload( + boolean enforceOverwrite, String localPath, String remotePath, boolean isAbsPath) { LocalStoragePath localStoragePath = new LocalStoragePath(); String remoteAbsPath; @@ -122,7 +121,7 @@ public void delete(StoragePath storagePath) { String filePath = localStoragePath.getFilePath(); File file = new File(filePath); - if(!file.delete()){ + if (!file.delete()) { throw new WeDPRException("delete " + storagePath + " failed!"); } } @@ -152,7 +151,8 @@ public StorageMeta getMeta(StoragePath storagePath) { @Override public void rename(StoragePath sourceStoragePath, StoragePath destStoragePath) { LocalStoragePath destLocalStoragePath = (LocalStoragePath) destStoragePath; - String destStorageAbsPath = localStorageConfig.getStorageAbsPath(destLocalStoragePath.getFilePath()); + String destStorageAbsPath = + localStorageConfig.getStorageAbsPath(destLocalStoragePath.getFilePath()); download(sourceStoragePath, destStorageAbsPath); delete(sourceStoragePath); } @@ -177,7 +177,8 @@ public LocalStorageStream open(StoragePath storagePath) { logger.info("open local storage stream, filePath: {}", filePath); - BufferedInputStream bufferedInputStream = new BufferedInputStream(Files.newInputStream(Paths.get(filePath))); + BufferedInputStream bufferedInputStream = + new BufferedInputStream(Files.newInputStream(Paths.get(filePath))); return new LocalStorageStream(bufferedInputStream); } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalStoragePath.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalStoragePath.java index e3968cb8..aefd20e4 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalStoragePath.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/impl/local/LocalStoragePath.java @@ -2,12 +2,10 @@ import com.webank.wedpr.components.storage.api.StoragePath; import com.webank.wedpr.core.protocol.StorageType; -import com.webank.wedpr.core.utils.ObjectMapperFactory; +import java.nio.file.Paths; import lombok.Getter; import lombok.Setter; -import java.nio.file.Paths; - @Getter @Setter public class LocalStoragePath extends StoragePath { @@ -15,7 +13,7 @@ public LocalStoragePath() { super(StorageType.LOCAL.getName()); } - public LocalStoragePath(String path){ + public LocalStoragePath(String path) { super(StorageType.LOCAL.getName()); this.filePath = Paths.get(path); } diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/HdfsStorageStream.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/HdfsStorageStream.java index 46269842..8c72cdde 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/HdfsStorageStream.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/HdfsStorageStream.java @@ -1,15 +1,14 @@ package com.webank.wedpr.components.storage.stream; import com.webank.wedpr.components.storage.api.StorageStreamApi; +import java.io.IOException; +import java.io.InputStream; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.io.InputStream; - -public class HdfsStorageStream implements StorageStreamApi { +public class HdfsStorageStream implements StorageStreamApi { private static final Logger logger = LoggerFactory.getLogger(HdfsStorageStream.class); diff --git a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/LocalStorageStream.java b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/LocalStorageStream.java index 76ec7061..61ffca2e 100644 --- a/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/LocalStorageStream.java +++ b/wedpr-components/storage/src/main/java/com/webank/wedpr/components/storage/stream/LocalStorageStream.java @@ -1,13 +1,12 @@ package com.webank.wedpr.components.storage.stream; import com.webank.wedpr.components.storage.api.StorageStreamApi; +import java.io.IOException; +import java.io.InputStream; import lombok.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.io.InputStream; - @Data public class LocalStorageStream implements StorageStreamApi { diff --git a/wedpr-components/sync/build.gradle b/wedpr-components/sync/build.gradle index 21e28c9d..3e21923b 100644 --- a/wedpr-components/sync/build.gradle +++ b/wedpr-components/sync/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { @@ -11,11 +10,4 @@ dependencies { compile project(":wedpr-components-sys-config") compile project(":wedpr-components-blockchain") compile project(":wedpr-components-leader-election") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava } \ No newline at end of file diff --git a/wedpr-components/task-plugin/api/build.gradle b/wedpr-components/task-plugin/api/build.gradle index 09e66a9e..648fc23f 100644 --- a/wedpr-components/task-plugin/api/build.gradle +++ b/wedpr-components/task-plugin/api/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-core-utils") compile project(":wedpr-components-spi") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/task-plugin/shell/build.gradle b/wedpr-components/task-plugin/shell/build.gradle index d30f09e0..51f90371 100644 --- a/wedpr-components/task-plugin/shell/build.gradle +++ b/wedpr-components/task-plugin/shell/build.gradle @@ -1,15 +1,7 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-components-task-plugin-api") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/token-auth/build.gradle b/wedpr-components/token-auth/build.gradle index fa530135..b076354b 100644 --- a/wedpr-components/token-auth/build.gradle +++ b/wedpr-components/token-auth/build.gradle @@ -1,18 +1,10 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile project(":wedpr-core-utils") compile project(":wedpr-core-protocol") compile("com.auth0:java-jwt:${jwtVersion}") compile("javax.servlet:javax.servlet-api:4.0.1") -} -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava } \ No newline at end of file diff --git a/wedpr-components/user/build.gradle b/wedpr-components/user/build.gradle index 3168c8a6..46f45eed 100644 --- a/wedpr-components/user/build.gradle +++ b/wedpr-components/user/build.gradle @@ -1,7 +1,6 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { @@ -11,10 +10,3 @@ dependencies { compile project(":wedpr-components-uuid") compile project(":wedpr-components-mybatis") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-components/uuid/build.gradle b/wedpr-components/uuid/build.gradle index 5eacae09..756e0619 100644 --- a/wedpr-components/uuid/build.gradle +++ b/wedpr-components/uuid/build.gradle @@ -1,16 +1,8 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies{ compile ("com.github.yitter:yitter-idgenerator:${yitterIdGeneratorVersion}") compile project(":wedpr-core-utils") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-core/protocol/build.gradle b/wedpr-core/protocol/build.gradle index a971af30..e89e1183 100644 --- a/wedpr-core/protocol/build.gradle +++ b/wedpr-core/protocol/build.gradle @@ -1,15 +1,7 @@ // Apply the java-library plugin to add support for Java Library plugins { id 'java' - id 'com.github.sherter.google-java-format' } dependencies { compile project(':wedpr-core-utils') } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -} diff --git a/wedpr-core/utils/build.gradle b/wedpr-core/utils/build.gradle index f0807b3e..17cd692f 100644 --- a/wedpr-core/utils/build.gradle +++ b/wedpr-core/utils/build.gradle @@ -10,10 +10,3 @@ dependencies { compile ("com.opencsv:opencsv:${opencsvVersion}") } -googleJavaFormat { - //toolVersion = '1.7' - options style: 'AOSP' - source = sourceSets*.allJava - include '**/*.java' - //source = *.allJava -}