diff --git a/build.gradle b/build.gradle index c56b872..0d9769c 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,8 @@ ext { */ libPath = "$projectDir/../webroot/WEB-INF/lib" + fineVersion = '11.0-jsy-20220713' + /** * 是否对插件的class进行加密保护,防止反编译 */ @@ -118,5 +120,8 @@ dependencies { //使用本地jar implementation fileTree(dir: 'lib', include: ['**/*.jar']) implementation fileTree(dir: libPath, include: ['**/*.jar']) + compileOnly('com.fanruan.hihidata:fine-core:' + fineVersion) + compileOnly('com.fanruan.hihidata:fine-cbb:' + fineVersion) + compileOnly('com.fanruan.hihidata:fine-decision:' + fineVersion) } diff --git a/plugin.xml b/plugin.xml index 5d9902d..f8285e7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,7 +5,7 @@ com.fanruan.fs yes no - 1.3.4 + 1.3.5 11.0~11.0 2021-08-30 richie diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java index 5821864..57306c7 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java @@ -32,11 +32,14 @@ public class S3Config extends CommonRepoConfig { @Identifier("bucket") private Conf bucket = HolderKit.simple(StringUtils.EMPTY); - @Identifier("enablePathStyleAccess") - private Conf enablePathStyleAccess = HolderKit.simple(false); + @Identifier("keepAlive") + private Conf keepAlive = HolderKit.simple(false); - @Identifier("signerOverride") - private Conf signerOverride = HolderKit.simple(StringUtils.EMPTY); + @Identifier("useGzip") + private Conf useGzip = HolderKit.simple(false); + + @Identifier("maxConnection") + private Conf maxConnection = HolderKit.simple(50); @GetConfig("endPoint") public String getEndPoint() { @@ -78,24 +81,34 @@ public class S3Config extends CommonRepoConfig { this.bucket.set(bucket); } - @GetConfig("enablePathStyleAccess") - public boolean isEnablePathStyleAccess() { - return enablePathStyleAccess.get(); + @GetConfig("keepAlive") + public boolean getKeepAlive() { + return this.keepAlive.get(); + } + + @SetConfig("keepAlive") + public void setKeepAlive(boolean keepAlive) { + this.keepAlive.set(keepAlive); + } + + @GetConfig("useGzip") + public boolean getUseGzip() { + return useGzip.get(); } - @SetConfig("enablePathStyleAccess") - public void setEnablePathStyleAccess(boolean enablePathStyleAccess) { - this.enablePathStyleAccess.set(enablePathStyleAccess); + @SetConfig("useGzip") + public void setUseGzip(boolean useGzip) { + this.useGzip.set(useGzip); } - @GetConfig("signerOverride") - public String getSignerOverride() { - return signerOverride.get(); + @GetConfig("maxConnection") + public int getMaxConnection() { + return maxConnection.get(); } - @SetConfig("signerOverride") - public void setSignerOverride(String signerOverride) { - this.signerOverride.set(signerOverride); + @SetConfig("maxConnection") + public void setMaxConnection(int maxConnection) { + this.maxConnection.set(maxConnection); } @Override @@ -107,8 +120,9 @@ public class S3Config extends CommonRepoConfig { this.setRegion(newConfig.getRegion()); this.setAccessKeyId(newConfig.getAccessKeyId()); this.setBucket(newConfig.getBucket()); - this.setEnablePathStyleAccess(newConfig.isEnablePathStyleAccess()); - this.setSignerOverride(newConfig.getSignerOverride()); + this.setKeepAlive(newConfig.getKeepAlive()); + this.setUseGzip(newConfig.getUseGzip()); + this.setMaxConnection(newConfig.getMaxConnection()); } } @@ -119,8 +133,9 @@ public class S3Config extends CommonRepoConfig { cloned.region = (Conf) region.clone(); cloned.accessKeyId = (Conf) accessKeyId.clone(); cloned.bucket = (Conf) bucket.clone(); - cloned.enablePathStyleAccess = (Conf) enablePathStyleAccess.clone(); - cloned.signerOverride = (Conf) signerOverride.clone(); + cloned.useGzip = (Conf) useGzip.clone(); + cloned.keepAlive = (Conf) keepAlive.clone(); + cloned.maxConnection = (Conf) maxConnection.clone(); return cloned; } } diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java index 560d81e..714c01c 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryFactory.java @@ -43,15 +43,8 @@ public class S3RepositoryFactory extends ConfigRepositoryFactory { AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3ClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(config.getEndPoint(), config.getRegion())) .withCredentials(new AWSStaticCredentialsProvider(credentials)); - if (config.isEnablePathStyleAccess()) { - amazonS3ClientBuilder = amazonS3ClientBuilder.enablePathStyleAccess(); - } - if (StringUtils.isNotEmpty(config.getSignerOverride())) { - ClientConfiguration clientConfiguration = new ClientConfiguration(); - clientConfiguration.setSignerOverride(config.getSignerOverride()); - clientConfiguration.setProtocol(Protocol.HTTP); - amazonS3ClientBuilder = amazonS3ClientBuilder.withClientConfiguration(clientConfiguration); - } + ClientConfiguration clientConfiguration = new ClientConfiguration(); + amazonS3ClientBuilder = amazonS3ClientBuilder.withClientConfiguration(clientConfiguration); AmazonS3 s3 = amazonS3ClientBuilder.build(); s3.listObjects(config.getBucket()); } catch (Exception e) { diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryProfile.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryProfile.java index 372a8f2..6331dfb 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryProfile.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3RepositoryProfile.java @@ -30,8 +30,6 @@ public class S3RepositoryProfile extends RepositoryProfile { this.s3Config.set(s3Config); } - - @Override public RepositoryProfile clone() throws CloneNotSupportedException { S3RepositoryProfile cloned = (S3RepositoryProfile) super.clone(); diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java index 51db511..a4a4a3d 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java @@ -18,8 +18,8 @@ import com.fanruan.api.log.LogKit; import com.fanruan.api.util.StringKit; import com.fr.io.repository.FineFileEntry; import com.fr.io.repository.base.BaseResourceRepository; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Filter; -import com.fr.stable.StringUtils; import com.fr.workspace.resource.ResourceIOException; import java.io.ByteArrayInputStream; @@ -48,14 +48,10 @@ public class S3ResourceRepository extends BaseResourceRepository { AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3ClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(config.getEndPoint(), config.getRegion())) .withCredentials(new AWSStaticCredentialsProvider(credentials)).disableChunkedEncoding(); - if (config.isEnablePathStyleAccess()) { - amazonS3ClientBuilder = amazonS3ClientBuilder.enablePathStyleAccess(); - } ClientConfiguration clientConfiguration = new ClientConfiguration(); - if (StringUtils.isNotEmpty(config.getSignerOverride())) { - clientConfiguration.setSignerOverride(config.getSignerOverride()); - } - clientConfiguration.setProtocol(Protocol.HTTP); + clientConfiguration.setUseGzip(config.getUseGzip()); + clientConfiguration.setUseTcpKeepAlive(config.getKeepAlive()); + clientConfiguration.setMaxConnections(config.getMaxConnection()); amazonS3ClientBuilder = amazonS3ClientBuilder.withClientConfiguration(clientConfiguration); this.s3 = amazonS3ClientBuilder.build(); this.bucket = config.getBucket(); @@ -63,7 +59,7 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public String getSeparator() { - return "/"; + return DELIMITER; } @Override @@ -72,10 +68,9 @@ public class S3ResourceRepository extends BaseResourceRepository { ObjectMetadata metadata = s3.getObjectMetadata(bucket, path); return s3Object2FileEntry(metadata, path); } catch (Exception e) { - LogKit.info("{} not exist!", path); + FineLoggerFactory.getLogger().error(e, "{} not exist!", path); + return null; } - - return null; } @Override @@ -84,21 +79,26 @@ public class S3ResourceRepository extends BaseResourceRepository { if (!dir.endsWith(DELIMITER)) { dir += DELIMITER; } - ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket) + ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(this.bucket) .withPrefix(dir).withDelimiter(DELIMITER); - ObjectListing objectListing = s3.listObjects(listObjectsRequest); - for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { - String key = summary.getKey(); - if (!key.endsWith(DELIMITER)) { - result.add(s3Object2FileEntry(summary, key)); + String nextMarker = null; + ObjectListing objectListing; + do { + objectListing = this.s3.listObjects(listObjectsRequest.withMarker(nextMarker)); + for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { + String key = summary.getKey(); + if (!key.endsWith(DELIMITER)) { + result.add(s3Object2FileEntry(summary, key)); + } + } + for (String prefix : objectListing.getCommonPrefixes()) { + FineFileEntry entry = new FineFileEntry(prefix); + entry.setDirectory(true); + result.add(entry); } - } - for (String prefix : objectListing.getCommonPrefixes()) { - FineFileEntry entry = new FineFileEntry(prefix); - entry.setDirectory(true); - result.add(entry); - } + nextMarker = objectListing.getNextMarker(); + } while (objectListing.isTruncated()); return result.toArray(new FineFileEntry[0]); } @@ -113,27 +113,18 @@ public class S3ResourceRepository extends BaseResourceRepository { try { return s3.getObject(request).getObjectContent(); } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, "[S3] read path {} is error!", filePath); return new ByteArrayInputStream(new byte[0]); } } @Override public void write(String path, byte[] data) { - - List paths = getAllNecessaryPath(path); - for (int i = paths.size() - 1; i > 0; i--) { - String parent = paths.get(i); - PutObjectRequest req = new PutObjectRequest(bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); - try { - s3.putObject(req); - } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); - } - } ObjectMetadata metadata; try { - metadata = s3.getObjectMetadata(bucket, path); + metadata = this.s3.getObjectMetadata(this.bucket, path); } catch (Exception e) { + FineLoggerFactory.getLogger().warn("[S3] getObjectMetaData error ,path {}", path); metadata = new ObjectMetadata(); String mimeType = URLConnection.guessContentTypeFromName(path); if (mimeType != null) { @@ -146,18 +137,38 @@ public class S3ResourceRepository extends BaseResourceRepository { s3.putObject(bucket, path, new ByteArrayInputStream(data), metadata); } + @Override + public void write(String path, InputStream inputStream) throws ResourceIOException { + if (null == inputStream) { + this.s3.putObject(this.bucket, path, ""); + } else { + ObjectMetadata metadata = new ObjectMetadata(); + try { + metadata.setContentLength(inputStream.available()); + this.s3.putObject(this.bucket, path, inputStream, metadata); + } catch (Exception e) { + FineLoggerFactory.getLogger().info("S3 inputStream.putObject error,path is {}, error message {}", path, e.getMessage()); + } finally { + try { + inputStream.close(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, "[S3] error,path is {}, error message {}", path, e.getMessage()); + } + } + } + } + @Override public boolean createFile(String path) { - List paths = getAllNecessaryPath(path); for (int i = paths.size() - 1; i >= 0; i--) { String parent = paths.get(i); - PutObjectRequest req = new PutObjectRequest(bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); + PutObjectRequest req = new PutObjectRequest(this.bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); try { - s3.putObject(req); + this.s3.putObject(req); } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); + FineLoggerFactory.getLogger().error(e, "[S3] Failed to create parent path {}", parent); return false; } } @@ -166,7 +177,6 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean createDirectory(String path) { - if (!path.endsWith(DELIMITER)) { path += DELIMITER; } @@ -177,7 +187,7 @@ public class S3ResourceRepository extends BaseResourceRepository { try { s3.putObject(req); } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); + FineLoggerFactory.getLogger().error(e, "[S3] Failed to create parent path {}", parent); return false; } } @@ -186,37 +196,42 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean delete(String path) { - - s3.deleteObject(bucket, path); + this.s3.deleteObject(this.bucket, path); String prefix = path; if (!path.endsWith(DELIMITER)) { prefix = path + DELIMITER; } try { - ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket) + ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(this.bucket) .withPrefix(prefix).withDelimiter(DELIMITER); - ObjectListing objectListing = s3.listObjects(listObjectsRequest); - for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { - String key = summary.getKey(); - if (!key.endsWith(DELIMITER)) { - s3.deleteObject(bucket, key); + ObjectListing objectListing; + String nextMarker = null; + do { + objectListing = this.s3.listObjects(listObjectsRequest.withMarker(nextMarker)); + for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { + String key = summary.getKey(); + if (!key.endsWith(DELIMITER)) { + this.s3.deleteObject(this.bucket, key); + } } - } - for (String pre : objectListing.getCommonPrefixes()) { - delete(pre); - } + for (String pre : objectListing.getCommonPrefixes()) { + delete(pre); + } + nextMarker = objectListing.getNextMarker(); + } while (objectListing.isTruncated()); } catch (Exception e) { - LogKit.error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e, "[S3] delete error path {}", path); } - s3.deleteObject(bucket, prefix); + this.s3.deleteObject(this.bucket, prefix); return true; } @Override public boolean exist(String path) { try { - return s3.doesObjectExist(bucket, path) || s3.doesObjectExist(bucket, path + DELIMITER); + return this.s3.doesObjectExist(this.bucket, path) || this.s3.doesObjectExist(this.bucket, path + DELIMITER); } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, "[S3] exist error path {}", path); return false; } } @@ -227,36 +242,40 @@ public class S3ResourceRepository extends BaseResourceRepository { if (!dir.endsWith(DELIMITER)) { dir += DELIMITER; } - ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket) + ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(this.bucket) .withPrefix(dir).withDelimiter(DELIMITER); - ObjectListing objectListing = s3.listObjects(listObjectsRequest); - for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) { - - String key = objectSummary.getKey(); - if (StringKit.equals(key, dir)) { - continue; - } - String[] arr = key.split(DELIMITER); - String name = arr[arr.length - 1]; - if (filter == null) { - result.add(name); - } else { - if (filter.accept(name)) { + String nextMarker = null; + ObjectListing objectListing; + do { + objectListing = this.s3.listObjects(listObjectsRequest.withMarker(nextMarker)); + for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) { + String key = objectSummary.getKey(); + if (StringKit.equals(key, dir)) { + continue; + } + String[] arr = key.split(DELIMITER); + String name = arr[arr.length - 1]; + if (filter == null) { result.add(name); + } else { + if (filter.accept(name)) { + result.add(name); + } } } - } - for (String prefix : objectListing.getCommonPrefixes()) { - String[] arr = prefix.split(DELIMITER); - String name = arr[arr.length - 1] + DELIMITER; - if (filter == null) { - result.add(name); - } else { - if (filter.accept(name)) { + for (String prefix : objectListing.getCommonPrefixes()) { + String[] arr = prefix.split(DELIMITER); + String name = arr[arr.length - 1] + DELIMITER; + if (filter == null) { result.add(name); + } else { + if (filter.accept(name)) { + result.add(name); + } } } - } + nextMarker = objectListing.getNextMarker(); + } while (objectListing.isTruncated()); return result.toArray(new String[0]); } @@ -268,7 +287,7 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public long lastModified(String path) { try { - S3Object s3Object = s3.getObject(bucket, path); + S3Object s3Object = this.s3.getObject(this.bucket, path); if (s3Object != null) { try { return s3Object.getObjectMetadata().getLastModified().getTime(); @@ -277,19 +296,18 @@ public class S3ResourceRepository extends BaseResourceRepository { } } } catch (Exception e) { - LogKit.info("{} not exist!", path); + FineLoggerFactory.getLogger().error(e, "[S3] {} not exist!", path); } - return -1L; } @Override public long length(String path) { try { - ObjectMetadata metadata = s3.getObjectMetadata(bucket, path); + ObjectMetadata metadata = this.s3.getObjectMetadata(this.bucket, path); return metadata.getContentLength(); } catch (Exception e) { - LogKit.info("{} not exist!", path); + LogKit.info("[S3] {} not exist!", path); } return -1L; @@ -297,15 +315,15 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean rename(String path, String newPath) throws ResourceIOException { - if (copy(path, newPath) && delete(path)) { - if (LogKit.isDebugEnabled()) { - LogKit.debug("[S3] rename {} to {} success.", path, newPath); + if (FineLoggerFactory.getLogger().isDebugEnabled()) { + FineLoggerFactory.getLogger().debug("[S3] rename {} to {} success.", path, newPath); } return true; + } else { + FineLoggerFactory.getLogger().error("[S3] rename {} to {} failed.", path, newPath); + return false; } - LogKit.error("[S3] rename {} to {} failed.", path, newPath); - return false; } @Override diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties index 9eca906..fce08eb 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties @@ -4,4 +4,7 @@ Plugin-S3_Region=Region Plugin-S3_Access_Key_Id=AccessKeyId Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket -Dec-Error_Start_With_Slash_Or_End_Without_Slash=The path cannot start with "/", but must end with "/" \ No newline at end of file +Dec-Error_Start_With_Slash_Or_End_Without_Slash=The path cannot start with "/", but must end with "/" +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties index 9e212ba..688e080 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties @@ -4,4 +4,7 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=Please input -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties index 0276339..b1fb764 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties @@ -4,4 +4,7 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties index 6380db9..d82bbab 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties @@ -4,4 +4,7 @@ Plugin-S3_Access_Key_Secret= Plugin-S3_Bucket= Plugin-S3_End_Point= Plugin-S3_Input= -Plugin-S3_Region= \ No newline at end of file +Plugin-S3_Region= +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties index 91b6745..194357c 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties @@ -4,4 +4,6 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8BF7\u8F93\u5165 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties index 019e745..d09a594 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties @@ -4,4 +4,7 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8ACB\u8F38\u5165 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Keep_Alive=keepAlive +Plugin-S3_Use_Gzip=useGzip +Plugin-S3_Max_Connection=maxConnection \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js index d47df6d..b7a90d8 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js +++ b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js @@ -101,7 +101,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { text: BI.i18nText("Plugin-S3_Access_Key_Secret"), value: this.model.password, el: { - disabled: !o.editable, + disabled: !o.editable }, ref: function (_ref) { self.passwordRow = _ref; @@ -115,7 +115,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { text: BI.i18nText("Plugin-S3_Bucket"), value: this.model.bucket, el: { - disabled: !o.editable, + disabled: !o.editable }, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, @@ -137,6 +137,59 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { ref: function (_ref) { self.filePathRow = _ref; }, + },{ + type: "dec.label.editor.item", + textWidth: LABEL_WIDTH, + editorWidth: EDITOR_WIDTH, + watermark: BI.i18nText("Plugin-S3_Input"), + text: "keepAlive", + value: this.model.keepAlive, + el: { + disabled: !o.editable, + type: "bi.switch", + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + self.store.setKeepAlive(this.isSelected()); + }, + }], + }, + + },{ + type: "dec.label.editor.item", + textWidth: LABEL_WIDTH, + editorWidth: EDITOR_WIDTH, + watermark: BI.i18nText("Plugin-S3_Input"), + text: "useGzip", + value: this.model.useGzip, + el: { + disabled: !o.editable, + type: "bi.switch", + listeners: [ + { + eventName: BI.Switcher.EVENT_CHANGE, + action: function () { + self.store.setUseGzip(this.isSelected()); + }, + }, + ], + }, + },{ + type: "dec.label.editor.item", + textWidth: LABEL_WIDTH, + editorWidth: EDITOR_WIDTH, + watermark: BI.i18nText("Plugin-S3_Input"), + text: "maxConnection", + value: this.model.maxConnection, + el: { + disabled: !o.editable, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + self.store.setMaxConnection(this.getValue()); + }, + }], + }, }], }; }, @@ -148,6 +201,9 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { accessKeyId: this.model.accessKeyId, password: this.passwordRow.getCipher(), bucket: this.model.bucket, + keepAlive: this.model.keepAlive, + useGzip: this.model.useGzip, + maxConnection: this.model.maxConnection, workRoot: this.filePathRow.getValue(), }; }, @@ -189,6 +245,9 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { password: val.password, bucket: val.bucket, workRoot: val.workRoot, + keepAlive: val.keepAlive, + useGzip: val.useGzip, + maxConnection: val.maxConnection, }; }, @@ -218,6 +277,15 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { setBucket: function (v) { this.model.bucket = v; }, + setKeepAlive: function (v){ + this.model.keepAlive = v; + }, + setUseGzip: function (v){ + this.model.useGzip = v; + }, + setMaxConnection: function (v){ + this.model.maxConnection = Number.parseInt(v); + } }, }); BI.model("dec.model.intelligence.cluster.file.s3", Model);