summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-12-10 13:50:49 +0100
committerSimon Rettberg2020-12-10 13:50:49 +0100
commitc11c062cfc0c401d09111ac69ffccfc3b4d66644 (patch)
tree5928688ccbfc9ea783ccdb4db08c6f41d51165d6
parent[util/Archive] Fix tar entry copying (symlinks etc.) (diff)
downloadtmlite-bwlp-c11c062cfc0c401d09111ac69ffccfc3b4d66644.tar.gz
tmlite-bwlp-c11c062cfc0c401d09111ac69ffccfc3b4d66644.tar.xz
tmlite-bwlp-c11c062cfc0c401d09111ac69ffccfc3b4d66644.zip
[ListArchive] Add more data to output
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/ListArchive.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/ListArchive.java b/src/main/java/org/openslx/taskmanager/tasks/ListArchive.java
index 38c2227..b45c0ed 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/ListArchive.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/ListArchive.java
@@ -8,6 +8,7 @@ import java.util.List;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveInputStream;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.io.FilenameUtils;
import org.openslx.satserver.util.Archive;
import org.openslx.satserver.util.Util;
@@ -25,8 +26,7 @@ public class ListArchive extends AbstractTask
* Own vars/constants not being deserialized
*/
- protected static final String[] ALLOWED_DIRS =
- { "/tmp/", "/opt/openslx/" };
+ protected static final String[] ALLOWED_DIRS = { "/tmp/", "/opt/openslx/" };
private Output status = new Output();
@@ -65,6 +65,15 @@ public class ListArchive extends AbstractTask
Output.Entry entry = new Output.Entry();
entry.name = archiveEntry.getName();
entry.isdir = archiveEntry.isDirectory();
+ if ( archiveEntry instanceof TarArchiveEntry ) {
+ entry.user = ( (TarArchiveEntry)archiveEntry ).getUserName();
+ entry.userId = ( (TarArchiveEntry)archiveEntry ).getLongUserId();
+ entry.group = ( (TarArchiveEntry)archiveEntry ).getGroupName();
+ entry.groupId = ( (TarArchiveEntry)archiveEntry ).getLongGroupId();
+ if ( ( (TarArchiveEntry)archiveEntry ).isSymbolicLink() ) {
+ entry.linkTarget = ( (TarArchiveEntry)archiveEntry ).getLinkName();
+ }
+ }
entry.size = archiveEntry.getSize();
entries.add( entry );
}
@@ -109,7 +118,12 @@ public class ListArchive extends AbstractTask
public static class Entry
{
protected String name = null;
+ protected String linkTarget = null;
protected boolean isdir = false;
+ protected String user;
+ protected long userId = -1;
+ protected long groupId = -1;
+ protected String group;
protected long size = -1;
}
}