-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
s3 based case store #11
Merged
Merged
Changes from 143 commits
Commits
Show all changes
155 commits
Select commit
Hold shift + click to select a range
4f5d98a
s3 based case store
jonenst db41032
Merge branch 'main' into case_s3
7c7157f
implement and handle the two mode of object and file storage system
e94e02c
clean code
ebba256
fix code review remarqs
833c839
fix unused import
4dc872d
fix code review remarqs
80566f7
fix some code smell issues
ffbb128
fix sonar smells
ghazwarhili a657b8a
fix using publicly writable directories is security-sensitive java:S5443
ghazwarhili ee1d7be
Handle Catch Exception instead of Throwable smells
ghazwarhili bdb2a2e
refacto s3 test without bean mock
ghazwarhili 1d96977
unify testcontainer config
ghazwarhili e5cea59
fix code review remarqs
ghazwarhili 36b2454
clean code
ghazwarhili 5b619ba
Merge remote-tracking branch 'origin/case_s3' into case_s3
ghazwarhili 2f5e41d
Refactor duplication endpoint
anistouri 4e225e5
Fix TU
anistouri 5a13fc9
Code refactoring
anistouri 3075cda
remove whitespace
anistouri 7f458a3
Merge pull request #28 from powsybl/refactor-duplication-elements
anistouri 35106ac
Parent 19: update liquibase maven plugin
anistouri 7ba466c
Merge pull request #32 from powsybl/upgrade-to-parent-19
anistouri c200713
Update to powsybl dependencies 2024.1.0 (#31)
etiennehomer 933e75d
Enable Prometheus in every microservice (#33)
antoinebhs 51f6bf9
resolve conflicts and merge main
ghazwarhili 93b531c
Fix case names when exported
achour94 700852a
Fix case names when exported
achour94 92d5796
Fix case names when exported
achour94 40e669e
Fix case names when exported #34
achour94 ca90c16
update to powsybl-ws-dependencies v2.11.0 (#35)
AbdelHedhili 95129ae
fix test
ghazwarhili 18e2b33
fix checkstyle and unused import
ghazwarhili 883e509
Migrate to PowSyBl 2023.2.1 (#10)
SlimaneAmar 6dc48bc
s3 based case store
jonenst 5c37e6a
Update parent 12 (#12)
Tristan-WorkGH 2a413cf
support parentheses in case name file for creation (#14)
Walid-Sahnoun 6b38ec4
springboot 3.1.2 (#13)
AbdelHedhili e536feb
implement and handle the two mode of object and file storage system
7fa0c59
clean code
4546ac1
fix code review remarqs
642689d
fix unused import
87559a2
fix code review remarqs
c387a19
fix some code smell issues
cab43d0
fix sonar smells
ghazwarhili b0a8706
fix using publicly writable directories is security-sensitive java:S5443
ghazwarhili cbf8acc
Handle Catch Exception instead of Throwable smells
ghazwarhili 55203cd
refacto s3 test without bean mock
ghazwarhili 1cb4564
unify testcontainer config
ghazwarhili e3167e2
clean code
ghazwarhili 2b04ca6
Parent 17: update liquibase maven plugin (#15)
anistouri bfeea3f
Add our classic logback-test.xml for nicer logs (#17)
jonenst 9e0ac92
powsybl ws dependencies 2.5.0 (#16)
AbdelHedhili 0cb0674
Update to powsybl-ws-dependencies 2.6.0 (#18)
sBouzols b02628e
Add environment variable for embedded ES container (#19)
antoinebhs ccf3f6d
powsybl-ws-dependencies 2.7.0 (#23)
antoinebhs 5717e8a
update to powsybl-ws-dependencies 2.8.0 (#25)
ayolab ab90e91
update to powsybl-ws-dependencies 2.9.0 (#27)
antoinebhs 74e7e54
Disable index auto-creation by ElasticSearch (#30)
antoinebhs 2eccb66
Refactor duplication endpoint
anistouri 0dd6fba
Fix TU
anistouri cadf860
Code refactoring
anistouri 6435368
remove whitespace
anistouri 6cbad7e
Parent 19: update liquibase maven plugin
anistouri 678e89b
Update to powsybl dependencies 2024.1.0 (#31)
etiennehomer dc833bc
Enable Prometheus in every microservice (#33)
antoinebhs cd2955f
update to powsybl-ws-dependencies v2.11.0 (#35)
AbdelHedhili d3b815d
replace OffsetDateTime with Instant
anistouri 17b5b1f
add comment
anistouri 7438f1d
Merge pull request #36 from powsybl/replace-LocalDateTime-by-Instant
anistouri 6b5761c
refactor
souissimai 3b1f5b2
Merge pull request #37 from powsybl/rename_file_when_converting_case
souissimai d05bd80
conflicts resolving
ghazwarhili 7bd2878
merge main into branch
ghazwarhili bed9105
handle zip case file with s3
ghazwarhili e98c4fb
Merge branch 'main' into case_s3
jonenst 099c976
Do not download the whole case file when it's not necessary + refacto
etiennehomer 2f4a6b7
Rename test package to service
etiennehomer 65edac3
Do not index case when withIndexation=false + tmp
etiennehomer d991f20
tmp
4a784cb
tmp
etiennehomer 22a5b7e
Tmp
etiennehomer e0c40e0
tmp
etiennehomer 2aba9eb
tmp
etiennehomer 59cdeed
fix test
etiennehomer a8636cf
Merge branch 'main' into case_s3
etiennehomer 4670e3c
Fix sonar
etiennehomer a1c8d60
secured zip
etiennehomer d302c6b
revert
etiennehomer ea91965
set back todo
etiennehomer 1950468
start minioContainer only for s3 test
ghazwarhili 2db73b4
fix some sonar code issues
ghazwarhili dba9843
code review remarqs
ghazwarhili a38600f
fix securityHotSpot
ghazwarhili 7c2ac02
clean
etiennehomer 2ab52f2
Merge branch 'case_s3' of https://github.com/powsybl/powsybl-case-ser…
etiennehomer 2b051e6
d
etiennehomer 8544992
Add test with LF.zip
etiennehomer 83d68de
originalCaseName in postgres
etiennehomer 8b61aa3
Compression format + originalName in postgres
etiennehomer 5cbf729
Clean
etiennehomer df12461
Add test for .gz, .xml
etiennehomer 5be2ad3
Sonar fixes
etiennehomer b7ce30c
Sonar fixes
etiennehomer c723614
Sonar fixes
etiennehomer ee478f5
Remove outdated TODO
etiennehomer faf83c1
Review changes
etiennehomer 82a556a
Use file storage
etiennehomer 3a27d6f
Fix bug datasourceExists() on compressed files
etiennehomer b775a19
Use spring-cloud-aws-starter-s3 3.2.0
etiennehomer 7440835
Clean CaseException
etiennehomer 63bc15f
Reviews fixes
etiennehomer 93ac483
Reviews fixes
etiennehomer 014afa9
Reviews fixes
etiennehomer ba149cd
Reviews fixes
etiennehomer d1d5557
Review fixes
etiennehomer 7974e2a
review changes
etiennehomer b50cd85
Optimize archive duplication
etiennehomer addb864
use existing application-local.yml
etiennehomer c0671dc
Back to type: file
etiennehomer 9883652
Merge branch 'main' into case_s3
etiennehomer 34ff54a
remove infosFromDownloadCaseFileSummary()
etiennehomer 7ade436
Use Jimfs !
etiennehomer 5644ca7
Compress archived files
etiennehomer 2ef97e9
Clean
etiennehomer a347c0a
Clean
etiennehomer 5c8918e
Remove nested ternary
etiennehomer 7c6e17e
Clean listName()
etiennehomer a4568c9
Merge branch 'case_s3' into case_s3_compress_archived_files
etiennehomer 0398643
Decompress gz files from archives before calling DataSource API
etiennehomer 143eab2
clean
etiennehomer 4418273
Merge branch 'main' into case_s3
etiennehomer 28cc495
Merge branch 'case_s3' into case_s3_compress_archived_files
etiennehomer 6b73714
Add comments + clean
etiennehomer 5d4c720
Clean author, licence
etiennehomer 8f2d24b
Remove second withS3DownloadedDataSource() method
etiennehomer 7706ee5
Clean
etiennehomer 0d12be6
Merge branch 'case_s3_compress_archived_files' into case_s3
etiennehomer 5acd02f
Fix .gz regex
etiennehomer 9cbca2e
Fix sonar
etiennehomer c3bdd4f
Remove last compression extension
etiennehomer 355c498
Space after if
etiennehomer 460af0e
Clean removeExtension()
etiennehomer 904215f
Fix
etiennehomer ccfc5cc
Remove Throwable
etiennehomer 8d25d02
Clean
etiennehomer 80e331a
Add fileName as requestParam to exportCase endpoint
etiennehomer 2099593
Remove 'summaries' + remove warning on multiple files
etiennehomer e69fa42
clean comment
etiennehomer 23a212b
use DELIMITER
etiennehomer 97c4f56
listName(): filter and map fileNames in one instruction + call getOri…
etiennehomer 16a7625
fileNames to filenames
etiennehomer 5c8f7f0
Clean
etiennehomer 6cf316c
remove Delete.builder()
etiennehomer 9d69962
Rename storage to FS
etiennehomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,17 @@ public final class CaseException extends RuntimeException { | |
|
||
public enum Type { | ||
FILE_NOT_IMPORTABLE, | ||
FILE_NOT_FOUND, | ||
STORAGE_DIR_NOT_CREATED, | ||
ILLEGAL_FILE_NAME, | ||
DIRECTORY_ALREADY_EXISTS, | ||
DIRECTORY_EMPTY, | ||
DIRECTORY_NOT_FOUND, | ||
ORIGINAL_FILE_NOT_FOUND, | ||
TEMP_FILE_INIT, | ||
TEMP_FILE_PROCESS, | ||
TEMP_DIRECTORY_CREATION, | ||
ZIP_FILE_PROCESS, | ||
UNSUPPORTED_FORMAT | ||
} | ||
|
||
|
@@ -35,7 +41,16 @@ private CaseException(Type type, String msg) { | |
this.type = Objects.requireNonNull(type); | ||
} | ||
|
||
public static CaseException createDirectoryAreadyExists(Path directory) { | ||
public CaseException(Type type, String message, Throwable e) { | ||
super(message, e); | ||
this.type = type; | ||
} | ||
|
||
public Type getType() { | ||
return type; | ||
} | ||
|
||
public static CaseException createDirectoryAreadyExists(String directory) { | ||
Objects.requireNonNull(directory); | ||
return new CaseException(Type.DIRECTORY_ALREADY_EXISTS, "A directory with the same name already exists: " + directory); | ||
} | ||
|
@@ -50,11 +65,26 @@ public static CaseException createDirectoryNotFound(UUID uuid) { | |
return new CaseException(Type.DIRECTORY_NOT_FOUND, "The directory with the following uuid doesn't exist: " + uuid); | ||
} | ||
|
||
public static CaseException createOriginalFileNotFound(UUID uuid) { | ||
Objects.requireNonNull(uuid); | ||
return new CaseException(Type.ORIGINAL_FILE_NOT_FOUND, "The original file were not retrieved in the directory with the following uuid: " + uuid); | ||
} | ||
|
||
public static CaseException createFileNotImportable(Path file) { | ||
Objects.requireNonNull(file); | ||
return new CaseException(Type.FILE_NOT_IMPORTABLE, "This file cannot be imported: " + file); | ||
} | ||
|
||
public static CaseException createFileNotImportable(String file, Exception e) { | ||
Objects.requireNonNull(file); | ||
return new CaseException(Type.FILE_NOT_IMPORTABLE, "This file cannot be imported: " + file, e); | ||
} | ||
|
||
public static CaseException createFileNameNotFound(UUID uuid) { | ||
Objects.requireNonNull(uuid); | ||
return new CaseException(Type.FILE_NOT_FOUND, "The file name with the following uuid doesn't exist: " + uuid); | ||
} | ||
|
||
public static CaseException createStorageNotInitialized(Path storageRootDir) { | ||
Objects.requireNonNull(storageRootDir); | ||
return new CaseException(Type.STORAGE_DIR_NOT_CREATED, "The storage is not initialized: " + storageRootDir); | ||
|
@@ -65,6 +95,29 @@ public static CaseException createIllegalCaseName(String caseName) { | |
return new CaseException(Type.ILLEGAL_FILE_NAME, "This is not an acceptable case name: " + caseName); | ||
} | ||
|
||
public static CaseException createTempDirectory(UUID uuid, Exception e) { | ||
Objects.requireNonNull(uuid); | ||
return new CaseException(Type.TEMP_DIRECTORY_CREATION, "Error creating temporary directory: " + uuid, e); | ||
} | ||
|
||
public static CaseException initTempFile(UUID uuid, Throwable e) { | ||
Objects.requireNonNull(uuid); | ||
return new CaseException(Type.TEMP_FILE_INIT, "Error initializing temporary case file: " + uuid, e); | ||
} | ||
|
||
public static CaseException processTempFile(UUID uuid, Throwable e) { | ||
Objects.requireNonNull(uuid); | ||
return new CaseException(Type.TEMP_FILE_PROCESS, "Error processing temporary case file: " + uuid, e); | ||
} | ||
|
||
public static CaseException importZipContent(UUID uuid, Exception e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. importZipContent and processTempFile unused to be removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
return new CaseException(Type.ZIP_FILE_PROCESS, "Error processing zip content file: " + uuid, e); | ||
} | ||
|
||
public static CaseException copyZipContent(UUID uuid, Exception e) { | ||
return new CaseException(Type.ZIP_FILE_PROCESS, "Error copying zip content file: " + uuid, e); | ||
} | ||
|
||
public static CaseException createUnsupportedFormat(String format) { | ||
return new CaseException(Type.UNSUPPORTED_FORMAT, "The format: " + format + " is unsupported"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/powsybl/caseserver/datasource/CaseDataSourceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) 2023, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.caseserver.datasource; | ||
|
||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author Abdelsalem Hedhili <abdelsalem.hedhili at rte-france.com> | ||
*/ | ||
public interface CaseDataSourceService { | ||
String getBaseName(UUID caseUuid); | ||
|
||
Boolean datasourceExists(UUID caseUuid, String suffix, String ext); | ||
|
||
Boolean datasourceExists(UUID caseUuid, String fileName); | ||
|
||
byte[] getInputStream(UUID caseUuid, String suffix, String ext); | ||
|
||
byte[] getInputStream(UUID caseUuid, String fileName); | ||
|
||
Set<String> listName(UUID caseUuid, String regex); | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not need version with exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done