From 6925115ced3453e483a3348e8079f023f8762db4 Mon Sep 17 00:00:00 2001 From: Plamen Totev Date: Sun, 8 Apr 2018 10:56:01 +0300 Subject: [PATCH] Add new method (postCreateArchive) to AbstractArchiver The purpose of the method is to allow subclasses to augment the archive after it is created. This is going to be used to update Jar archives to modular Jar archives. Closes #83 --- pom.xml | 2 +- .../plexus/archiver/AbstractArchiver.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8fcb6091a..8d68f3d22 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ plexus-archiver - 3.5.1-SNAPSHOT + 3.6.0-SNAPSHOT Plexus Archiver Component diff --git a/src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java b/src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java index f88583d44..3fab3dd2a 100755 --- a/src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java +++ b/src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java @@ -1007,6 +1007,8 @@ public final void createArchive() { cleanUp(); } + + postCreateArchive(); } protected boolean hasVirtualFiles() @@ -1036,6 +1038,21 @@ protected void validate() { } + /** + * This method is called after the archive creation + * completes successfully (no exceptions are thrown). + * + * Subclasses may override this method in order to + * augment or validate the archive after it is + * created. + * + * @since 3.6 + */ + protected void postCreateArchive() + throws ArchiverException, IOException + { + } + protected abstract String getArchiveType(); private void addCloseable( Object maybeCloseable )