Interface Archiver
-
- All Known Implementing Classes:
AbstractArchiver
,AbstractZipArchiver
,BZip2Archiver
,DelgatingArchiver
,DirectoryArchiver
,DryRunArchiver
,EarArchiver
,GZipArchiver
,JarArchiver
,JarToolModularJarArchiver
,ModularJarArchiver
,NoOpArchiver
,TarArchiver
,TrackingArchiver
,WarArchiver
,XZArchiver
,ZipArchiver
public interface Archiver
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_DIR_MODE
Default value for the dirmode attribute.static int
DEFAULT_FILE_MODE
Default value for the filemode attribute.static int
DEFAULT_SYMLILNK_MODE
Default value for the symlinkmode attribute.static java.lang.String
DUPLICATES_ADD
static java.lang.String
DUPLICATES_FAIL
static java.lang.String
DUPLICATES_PRESERVE
static java.lang.String
DUPLICATES_SKIP
static java.util.Set<java.lang.String>
DUPLICATES_VALID_BEHAVIORS
static java.lang.String
ROLE
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addArchivedFileSet(java.io.File archiveFile)
Deprecated.Will go away in next major versionvoid
addArchivedFileSet(java.io.File archiveFile, java.lang.String prefix)
Deprecated.Will go away in next major versionvoid
addArchivedFileSet(java.io.File archiveFile, java.lang.String[] includes, java.lang.String[] excludes)
Deprecated.Will go away in next major versionvoid
addArchivedFileSet(java.io.File archiveFile, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes)
Deprecated.Will go away in next major versionvoid
addArchivedFileSet(ArchivedFileSet fileSet)
Adds the given archive file set to the archive.void
addArchivedFileSet(ArchivedFileSet fileSet, java.nio.charset.Charset charset)
Adds the given archive file set to the archive.void
addDirectory(java.io.File directory)
Deprecated.Will go away in next major versionvoid
addDirectory(java.io.File directory, java.lang.String prefix)
Deprecated.Will go away in next major versionvoid
addDirectory(java.io.File directory, java.lang.String[] includes, java.lang.String[] excludes)
Deprecated.Will go away in next major versionvoid
addDirectory(java.io.File directory, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes)
Deprecated.Will go away in next major versionvoid
addFile(java.io.File inputFile, java.lang.String destFileName)
void
addFile(java.io.File inputFile, java.lang.String destFileName, int permissions)
void
addFileSet(FileSet fileSet)
Adds the given file set to the archive.void
addResource(org.codehaus.plexus.components.io.resources.PlexusIoResource resource, java.lang.String destFileName, int permissions)
Adds the given resource collection to the archive.void
addResources(org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection resources)
Adds the given resource collection to the archive.void
addSymlink(java.lang.String symlinkName, int permissions, java.lang.String symlinkDestination)
void
addSymlink(java.lang.String symlinkName, java.lang.String symlinkDestination)
void
configureReproducible(java.util.Date lastModifiedDate)
Configure the archiver to create archives in a reproducible way (see Reproducible Builds).void
createArchive()
int
getDefaultDirectoryMode()
int
getDefaultFileMode()
java.io.File
getDestFile()
int
getDirectoryMode()
Gets the forced mode for directories, falling back to default if none is forced.java.lang.String
getDuplicateBehavior()
Returns the behavior of this archiver when duplicate files are detected.int
getFileMode()
java.util.Map<java.lang.String,ArchiveEntry>
getFiles()
Deprecated.UsegetResources()
boolean
getIncludeEmptyDirs()
java.util.Date
getLastModifiedDate()
int
getOverrideDirectoryMode()
int
getOverrideFileMode()
int
getOverrideGid()
java.lang.String
getOverrideGroupName()
int
getOverrideUid()
java.lang.String
getOverrideUserName()
ResourceIterator
getResources()
Returns an iterator over instances ofArchiveEntry
, which have previously been added by calls toaddResources(PlexusIoResourceCollection)
,addResource(PlexusIoResource, String, int)
,addFileSet(FileSet)
, etc.boolean
isForced()
Returns, whether recreating the archive is forced (default).boolean
isIgnorePermissions()
boolean
isSupportingForced()
Returns, whether the archive supports uptodate checks.boolean
isUseJvmChmod()
Deprecated.this setting is now ignored.void
setDefaultDirectoryMode(int mode)
This is the "default" value we should use if no other value is specifiedvoid
setDefaultFileMode(int mode)
void
setDestFile(java.io.File destFile)
void
setDirectoryMode(int mode)
This is the forced mode that should be used regardless if set, otherwise falls back to default.void
setDotFileDirectory(java.io.File dotFileDirectory)
void
setDuplicateBehavior(java.lang.String duplicate)
Set the behavior of this archiver when duplicate files are detected.void
setFileMode(int mode)
void
setFilenameComparator(java.util.Comparator<java.lang.String> filenameComparator)
Set filename comparator, used to sort file entries when scanning directories since File.list() does not guarantee any order.void
setForced(boolean forced)
Sets, whether recreating the archive is forced (default).void
setIgnorePermissions(boolean ignorePermissions)
void
setIncludeEmptyDirs(boolean includeEmptyDirs)
void
setLastModifiedDate(java.util.Date lastModifiedDate)
Define forced last modification date for entries (if non null).void
setOverrideGid(int gid)
void
setOverrideGroupName(java.lang.String groupName)
void
setOverrideUid(int uid)
void
setOverrideUserName(java.lang.String userName)
void
setUseJvmChmod(boolean useJvmChmod)
Deprecated.this setting is now ignored.
-
-
-
Field Detail
-
DEFAULT_DIR_MODE
static final int DEFAULT_DIR_MODE
Default value for the dirmode attribute.- See Also:
- Constant Field Values
-
DEFAULT_FILE_MODE
static final int DEFAULT_FILE_MODE
Default value for the filemode attribute.- See Also:
- Constant Field Values
-
DEFAULT_SYMLILNK_MODE
static final int DEFAULT_SYMLILNK_MODE
Default value for the symlinkmode attribute.- See Also:
- Constant Field Values
-
ROLE
static final java.lang.String ROLE
-
DUPLICATES_ADD
static final java.lang.String DUPLICATES_ADD
- See Also:
- Constant Field Values
-
DUPLICATES_PRESERVE
static final java.lang.String DUPLICATES_PRESERVE
- See Also:
- Constant Field Values
-
DUPLICATES_SKIP
static final java.lang.String DUPLICATES_SKIP
- See Also:
- Constant Field Values
-
DUPLICATES_FAIL
static final java.lang.String DUPLICATES_FAIL
- See Also:
- Constant Field Values
-
DUPLICATES_VALID_BEHAVIORS
static final java.util.Set<java.lang.String> DUPLICATES_VALID_BEHAVIORS
-
-
Method Detail
-
createArchive
void createArchive() throws ArchiverException, java.io.IOException
- Throws:
ArchiverException
java.io.IOException
-
addDirectory
@Deprecated void addDirectory(@Nonnull java.io.File directory) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddFileSet(FileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addDirectory
@Deprecated void addDirectory(@Nonnull java.io.File directory, java.lang.String prefix) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddFileSet(FileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addDirectory
@Deprecated void addDirectory(@Nonnull java.io.File directory, java.lang.String[] includes, java.lang.String[] excludes) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddFileSet(FileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addDirectory
@Deprecated void addDirectory(@Nonnull java.io.File directory, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddFileSet(FileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addFileSet
void addFileSet(@Nonnull FileSet fileSet) throws ArchiverException
Adds the given file set to the archive. This method is basically obsoletingaddDirectory(File)
,addDirectory(File, String)
,addDirectory(File, String[], String[])
, andaddDirectory(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be made deprecated.- Throws:
ArchiverException
- Adding the file set failed.- Since:
- 1.0-alpha-9
-
addSymlink
void addSymlink(java.lang.String symlinkName, java.lang.String symlinkDestination) throws ArchiverException
- Throws:
ArchiverException
-
addSymlink
void addSymlink(java.lang.String symlinkName, int permissions, java.lang.String symlinkDestination) throws ArchiverException
- Throws:
ArchiverException
-
addFile
void addFile(@Nonnull java.io.File inputFile, @Nonnull java.lang.String destFileName) throws ArchiverException
- Throws:
ArchiverException
-
addFile
void addFile(@Nonnull java.io.File inputFile, @Nonnull java.lang.String destFileName, int permissions) throws ArchiverException
- Throws:
ArchiverException
-
addArchivedFileSet
void addArchivedFileSet(@Nonnull java.io.File archiveFile) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddArchivedFileSet(ArchivedFileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addArchivedFileSet
@Deprecated void addArchivedFileSet(@Nonnull java.io.File archiveFile, java.lang.String prefix) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddArchivedFileSet(ArchivedFileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addArchivedFileSet
@Deprecated void addArchivedFileSet(java.io.File archiveFile, java.lang.String[] includes, java.lang.String[] excludes) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddArchivedFileSet(ArchivedFileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addArchivedFileSet
@Deprecated void addArchivedFileSet(@Nonnull java.io.File archiveFile, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes) throws ArchiverException
Deprecated.Will go away in next major versionObsolete, useaddArchivedFileSet(ArchivedFileSet)
. You can use "inline" of this method in your IDE to get the proper implementation for this release.- Throws:
ArchiverException
-
addArchivedFileSet
void addArchivedFileSet(ArchivedFileSet fileSet) throws ArchiverException
Adds the given archive file set to the archive. This method is basically obsoletingaddArchivedFileSet(File)
,addArchivedFileSet(File, String[], String[])
, andaddArchivedFileSet(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be made deprecated. Stream transformers are supported on this method- Throws:
ArchiverException
- Since:
- 1.0-alpha-9
-
addArchivedFileSet
void addArchivedFileSet(ArchivedFileSet fileSet, java.nio.charset.Charset charset) throws ArchiverException
Adds the given archive file set to the archive. This method is basically obsoletingaddArchivedFileSet(File)
,addArchivedFileSet(File, String[], String[])
, andaddArchivedFileSet(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be made deprecated.- Parameters:
charset
- the encoding to use, particularly useful to specific non-standard filename encodings for some kinds of archives (for instance zip files) Stream transformers are supported on this methodfileSet
- the fileSet to addcharset
-- Throws:
ArchiverException
- Since:
- 1.0-alpha-9
-
addResource
void addResource(org.codehaus.plexus.components.io.resources.PlexusIoResource resource, java.lang.String destFileName, int permissions) throws ArchiverException
Adds the given resource collection to the archive. Stream transformers are *not* supported on this method- Throws:
ArchiverException
- Since:
- 1.0-alpha-10
-
addResources
void addResources(org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection resources) throws ArchiverException
Adds the given resource collection to the archive. Stream transformers are supported on this method- Throws:
ArchiverException
- Since:
- 1.0-alpha-10
-
getDestFile
java.io.File getDestFile()
-
setDestFile
void setDestFile(java.io.File destFile)
-
setFileMode
void setFileMode(int mode)
-
getFileMode
int getFileMode()
-
getOverrideFileMode
int getOverrideFileMode()
-
setDefaultFileMode
void setDefaultFileMode(int mode)
-
getDefaultFileMode
int getDefaultFileMode()
-
setDirectoryMode
void setDirectoryMode(int mode)
This is the forced mode that should be used regardless if set, otherwise falls back to default.- Parameters:
mode
-
-
getDirectoryMode
int getDirectoryMode()
Gets the forced mode for directories, falling back to default if none is forced.- Returns:
-
getOverrideDirectoryMode
int getOverrideDirectoryMode()
-
setDefaultDirectoryMode
void setDefaultDirectoryMode(int mode)
This is the "default" value we should use if no other value is specified- Parameters:
mode
-
-
getDefaultDirectoryMode
int getDefaultDirectoryMode()
-
getIncludeEmptyDirs
boolean getIncludeEmptyDirs()
-
setIncludeEmptyDirs
void setIncludeEmptyDirs(boolean includeEmptyDirs)
-
setDotFileDirectory
void setDotFileDirectory(java.io.File dotFileDirectory)
-
getResources
@Nonnull ResourceIterator getResources() throws ArchiverException
Returns an iterator over instances ofArchiveEntry
, which have previously been added by calls toaddResources(PlexusIoResourceCollection)
,addResource(PlexusIoResource, String, int)
,addFileSet(FileSet)
, etc.- Throws:
ArchiverException
- Since:
- 1.0-alpha-10
-
getFiles
java.util.Map<java.lang.String,ArchiveEntry> getFiles()
Deprecated.UsegetResources()
-
isForced
boolean isForced()
Returns, whether recreating the archive is forced (default). Setting this option to false means, that the archiver should compare the timestamps of included files with the timestamp of the target archive and rebuild the archive only, if the latter timestamp precedes the former timestamps. Checking for timestamps will typically offer a performance gain (in particular, if the following steps in a build can be suppressed, if an archive isn't recreated) on the cost that you get inaccurate results from time to time. In particular, removal of source files won't be detected.
An archiver doesn't necessarily support checks for uptodate. If so, setting this option to true will simply be ignored. The method
isSupportingForced()
may be called to check whether an archiver does support uptodate checks.- Returns:
- True, if the target archive should always be created; false otherwise
- See Also:
setForced(boolean)
,isSupportingForced()
-
setForced
void setForced(boolean forced)
Sets, whether recreating the archive is forced (default). Setting this option to false means, that the archiver should compare the timestamps of included files with the timestamp of the target archive and rebuild the archive only, if the latter timestamp precedes the former timestamps. Checking for timestamps will typically offer a performance gain (in particular, if the following steps in a build can be suppressed, if an archive isn't recreated) on the cost that you get inaccurate results from time to time. In particular, removal of source files won't be detected.
An archiver doesn't necessarily support checks for uptodate. If so, setting this option to true will simply be ignored. The method
isSupportingForced()
may be called to check whether an archiver does support uptodate checks.- Parameters:
forced
- True, if the target archive should always be created; false otherwise- See Also:
isForced()
,isSupportingForced()
-
isSupportingForced
boolean isSupportingForced()
Returns, whether the archive supports uptodate checks. If so, you may setsetForced(boolean)
to true.- Returns:
- True, if the archiver does support uptodate checks, false otherwise
- See Also:
setForced(boolean)
,isForced()
-
getDuplicateBehavior
java.lang.String getDuplicateBehavior()
Returns the behavior of this archiver when duplicate files are detected.
-
setDuplicateBehavior
void setDuplicateBehavior(java.lang.String duplicate)
Set the behavior of this archiver when duplicate files are detected. One of:
- add - Add the duplicates to the archive as duplicate entries
- skip/preserve - Leave the first entry encountered in the archive, skip the new one
- fail - throw an
ArchiverException
SeeDUPLICATES_ADD
,DUPLICATES_SKIP
,DUPLICATES_PRESERVE
,DUPLICATES_FAIL
.
-
setUseJvmChmod
@Deprecated void setUseJvmChmod(boolean useJvmChmod)
Deprecated.this setting is now ignored. The jvm is always used.to use or not the jvm method for file permissions: user all not active for group permissions- Parameters:
useJvmChmod
-- Since:
- 1.1
-
isUseJvmChmod
@Deprecated boolean isUseJvmChmod()
Deprecated.this setting is now ignored. The jvm is always used.- Returns:
- Since:
- 1.1
-
isIgnorePermissions
boolean isIgnorePermissions()
- Since:
- 1.1
-
setIgnorePermissions
void setIgnorePermissions(boolean ignorePermissions)
- Since:
- 1.1
-
setLastModifiedDate
void setLastModifiedDate(java.util.Date lastModifiedDate)
Define forced last modification date for entries (if non null).- Parameters:
lastModifiedDate
-- Since:
- 4.2.0
-
getLastModifiedDate
java.util.Date getLastModifiedDate()
- Since:
- 4.2.0
-
setFilenameComparator
void setFilenameComparator(java.util.Comparator<java.lang.String> filenameComparator)
Set filename comparator, used to sort file entries when scanning directories since File.list() does not guarantee any order.- Since:
- 4.2.0
-
setOverrideUid
void setOverrideUid(int uid)
- Since:
- 4.2.0
-
setOverrideUserName
void setOverrideUserName(java.lang.String userName)
- Since:
- 4.2.0
-
getOverrideUid
int getOverrideUid()
- Since:
- 4.2.0
-
getOverrideUserName
java.lang.String getOverrideUserName()
- Since:
- 4.2.0
-
setOverrideGid
void setOverrideGid(int gid)
- Since:
- 4.2.0
-
setOverrideGroupName
void setOverrideGroupName(java.lang.String groupName)
- Since:
- 4.2.0
-
getOverrideGid
int getOverrideGid()
- Since:
- 4.2.0
-
getOverrideGroupName
java.lang.String getOverrideGroupName()
- Since:
- 4.2.0
-
configureReproducible
void configureReproducible(java.util.Date lastModifiedDate)
Configure the archiver to create archives in a reproducible way (see Reproducible Builds).This will configure:
- reproducible archive entries order,
- defined entries timestamp
- and reproducible entries Unix mode.
- Parameters:
lastModifiedDate
- the date to use for archive entries last modified time- Since:
- 4.2.0
-
-