Skip to content

Commit 75d644e

Browse files
Compression module simplification an improvements
(cherry picked from commit e4961fe)
1 parent 96065bd commit 75d644e

File tree

6 files changed

+313
-363
lines changed

6 files changed

+313
-363
lines changed

gxcompress/pom.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,12 @@
1616
<dependency>
1717
<groupId>org.apache.commons</groupId>
1818
<artifactId>commons-compress</artifactId>
19-
<version>${commons.compress.version}</version>
19+
<version>1.27.1</version>
2020
</dependency>
2121
<dependency>
2222
<groupId>org.tukaani</groupId>
2323
<artifactId>xz</artifactId>
24-
<version>1.9</version>
25-
</dependency>
26-
<dependency>
27-
<groupId>com.github.junrar</groupId>
28-
<artifactId>junrar</artifactId>
29-
<version>7.5.5</version>
24+
<version>1.10</version>
3025
</dependency>
3126
<dependency>
3227
<groupId>org.apache.logging.log4j</groupId>

gxcompress/src/main/java/com/genexus/compression/Compression.java

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,32 @@
1414
public class Compression {
1515
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Compression.class);
1616

17-
private String path;
18-
private String format;
17+
private String absolutePath;
1918
private GXBaseCollection<SdtMessages_Message>[] messages;
2019
private ArrayList<String> filesToCompress;
2120

2221
public Compression() {}
2322

24-
public Compression(String path, String format, GXBaseCollection<SdtMessages_Message>[] messages) {
25-
this.path = path;
26-
this.format = format;
23+
public Compression(String absolutePath, GXBaseCollection<SdtMessages_Message>[] messages) {
24+
this.absolutePath = absolutePath;
2725
this.messages = messages;
2826
filesToCompress = new ArrayList<>();
2927
}
3028

31-
public void setPath(String path) {
32-
this.path = path;
29+
public void setAbsolutePath(String path) {
30+
this.absolutePath = path;
3331
}
3432

35-
public void setFormat(String format) {
36-
this.format = format;
37-
}
38-
39-
public void addFile(String filePath) {
33+
public void addElement(String filePath) {
4034
filesToCompress.add(filePath);
4135
}
4236

43-
public void addFolder(String folderPath) {
44-
Path path = Paths.get(folderPath);
45-
try (Stream<Path> stream = Files.walk(path)) {
46-
stream.filter(Files::isRegularFile)
47-
.forEach(p -> addFile(p.toAbsolutePath().toString()));
48-
} catch (IOException e) {
49-
log.error("Failed to process directory: {}", folderPath, e);
50-
}
51-
}
52-
5337
public Boolean save() {
54-
return GXCompressor.compressFiles(filesToCompress, path, format, messages);
38+
return GXCompressor.compress(filesToCompress, absolutePath, messages);
5539
}
5640

5741
public void clear() {
58-
path = "";
59-
format = "";
42+
absolutePath = "";
6043
filesToCompress = new ArrayList<>();
6144
}
6245
}

gxcompress/src/main/java/com/genexus/compression/CompressionFormat.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)