Class DelgatingArchiver
-
Field Summary
Fields inherited from interface org.codehaus.plexus.archiver.Archiver
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DEFAULT_SYMLILNK_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addArchivedFileSet
(File archiveFile) Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.void
addArchivedFileSet
(File archiveFile, String prefix) Deprecated.void
addArchivedFileSet
(File archiveFile, String[] includes, String[] excludes) Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.void
addArchivedFileSet
(File archiveFile, String prefix, String[] includes, String[] excludes) Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.void
addArchivedFileSet
(ArchivedFileSet fileSet) Adds the given archive file set to the archive.void
addArchivedFileSet
(ArchivedFileSet fileSet, Charset charset) Adds the given archive file set to the archive.void
addDirectory
(File directory) Deprecated.void
addDirectory
(File directory, String prefix) Deprecated.void
addDirectory
(File directory, String[] includes, String[] excludes) Deprecated.void
addDirectory
(File directory, String prefix, String[] includes, String[] excludes) Obsolete, useArchiver.addFileSet(FileSet)
.void
void
void
addFileSet
(FileSet fileSet) Adds the given file set to the archive.void
addResource
(org.codehaus.plexus.components.io.resources.PlexusIoResource resource, 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
(String symlinkName, int permissions, String symlinkDestination) void
addSymlink
(String symlinkName, String symlinkDestination) void
configureReproducible
(Date lastModifiedDate) Deprecated.void
configureReproducibleBuild
(FileTime lastModifiedTime) Configure the archiver to create archives in a reproducible way (see Reproducible Builds).void
int
int
int
Gets the forced mode for directories, falling back to default if none is forced.Returns the behavior of this archiver when duplicate files are detected.int
getFiles()
boolean
Deprecated.UsegetLastModifiedTime()
instead.Returns the last modification time of the archiver.int
int
int
int
Returns an iterator over instances ofArchiveEntry
, which have previously been added by calls toArchiver.addResources(PlexusIoResourceCollection)
,Archiver.addResource(PlexusIoResource, String, int)
,Archiver.addFileSet(FileSet)
, etc.int
getUmask()
boolean
isForced()
Returns, whether recreating the archive is forced (default).boolean
boolean
Returns, whether the archive supports uptodate checks.boolean
void
setDefaultDirectoryMode
(int mode) This is the "default" value we should use if no other value is specifiedvoid
setDefaultFileMode
(int mode) void
setDestFile
(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
(File dotFileDirectory) void
setDuplicateBehavior
(String duplicate) Set the behavior of this archiver when duplicate files are detected.void
setFileMode
(int mode) void
setFilenameComparator
(Comparator<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
(Date lastModifiedDate) Deprecated.UsesetLastModifiedTime(FileTime)
instead.void
setLastModifiedTime
(FileTime lastModifiedTime) Sets the last modification time of the entries (if non null).void
setOverrideGid
(int gid) void
setOverrideGroupName
(String groupName) void
setOverrideUid
(int uid) void
setOverrideUserName
(String userName) void
setUmask
(int umask) void
setUseJvmChmod
(boolean useJvmChmod) to use or not the jvm method for file permissions: user all not active for group permissions
-
Constructor Details
-
DelgatingArchiver
-
-
Method Details
-
createArchive
- Specified by:
createArchive
in interfaceArchiver
- Throws:
ArchiverException
IOException
-
addDirectory
Deprecated.Description copied from interface:Archiver
Obsolete, useArchiver.addFileSet(FileSet)
.- Specified by:
addDirectory
in interfaceArchiver
- Throws:
ArchiverException
-
addDirectory
@Deprecated public void addDirectory(@Nonnull File directory, String prefix) throws ArchiverException Deprecated.Description copied from interface:Archiver
Obsolete, useArchiver.addFileSet(FileSet)
.- Specified by:
addDirectory
in interfaceArchiver
- Throws:
ArchiverException
-
addDirectory
@Deprecated public void addDirectory(@Nonnull File directory, String[] includes, String[] excludes) throws ArchiverException Deprecated.Description copied from interface:Archiver
Obsolete, useArchiver.addFileSet(FileSet)
.- Specified by:
addDirectory
in interfaceArchiver
- Throws:
ArchiverException
-
addDirectory
public void addDirectory(@Nonnull File directory, String prefix, String[] includes, String[] excludes) throws ArchiverException Description copied from interface:Archiver
Obsolete, useArchiver.addFileSet(FileSet)
.- Specified by:
addDirectory
in interfaceArchiver
- Throws:
ArchiverException
-
addFileSet
Description copied from interface:Archiver
Adds the given file set to the archive. This method is basically obsoletingArchiver.addDirectory(File)
,Archiver.addDirectory(File, String)
,Archiver.addDirectory(File, String[], String[])
, andArchiver.addDirectory(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be deprecated.- Specified by:
addFileSet
in interfaceArchiver
- Throws:
ArchiverException
- Adding the file set failed.
-
addSymlink
- Specified by:
addSymlink
in interfaceArchiver
- Throws:
ArchiverException
-
addSymlink
public void addSymlink(String symlinkName, int permissions, String symlinkDestination) throws ArchiverException - Specified by:
addSymlink
in interfaceArchiver
- Throws:
ArchiverException
-
addFile
- Specified by:
addFile
in interfaceArchiver
- Throws:
ArchiverException
-
addFile
public void addFile(@Nonnull File inputFile, @Nonnull String destFileName, int permissions) throws ArchiverException - Specified by:
addFile
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
Description copied from interface:Archiver
Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.- Specified by:
addArchivedFileSet
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
@Deprecated public void addArchivedFileSet(@Nonnull File archiveFile, String prefix) throws ArchiverException Deprecated.Description copied from interface:Archiver
Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.- Specified by:
addArchivedFileSet
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
public void addArchivedFileSet(File archiveFile, String[] includes, String[] excludes) throws ArchiverException Description copied from interface:Archiver
Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.- Specified by:
addArchivedFileSet
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
public void addArchivedFileSet(@Nonnull File archiveFile, String prefix, String[] includes, String[] excludes) throws ArchiverException Description copied from interface:Archiver
Obsolete, useArchiver.addArchivedFileSet(ArchivedFileSet)
.- Specified by:
addArchivedFileSet
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
Description copied from interface:Archiver
Adds the given archive file set to the archive. This method is basically obsoletingArchiver.addArchivedFileSet(File)
,Archiver.addArchivedFileSet(File, String[], String[])
, andArchiver.addArchivedFileSet(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be deprecated. Stream transformers are supported on this method- Specified by:
addArchivedFileSet
in interfaceArchiver
- Throws:
ArchiverException
-
addArchivedFileSet
Description copied from interface:Archiver
Adds the given archive file set to the archive. This method is basically obsoletingArchiver.addArchivedFileSet(File)
,Archiver.addArchivedFileSet(File, String[], String[])
, andArchiver.addArchivedFileSet(File, String, String[], String[])
. However, as these methods are in widespread use, they cannot easily be deprecated.- Specified by:
addArchivedFileSet
in interfaceArchiver
- Parameters:
fileSet
- the fileSet to addcharset
- 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 method- Throws:
ArchiverException
-
addResource
public void addResource(org.codehaus.plexus.components.io.resources.PlexusIoResource resource, String destFileName, int permissions) throws ArchiverException Description copied from interface:Archiver
Adds the given resource collection to the archive. Stream transformers are *not* supported on this method- Specified by:
addResource
in interfaceArchiver
- Throws:
ArchiverException
-
addResources
public void addResources(org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection resources) throws ArchiverException Description copied from interface:Archiver
Adds the given resource collection to the archive. Stream transformers are supported on this method- Specified by:
addResources
in interfaceArchiver
- Throws:
ArchiverException
-
getDestFile
- Specified by:
getDestFile
in interfaceArchiver
-
setDestFile
- Specified by:
setDestFile
in interfaceArchiver
-
setFileMode
public void setFileMode(int mode) - Specified by:
setFileMode
in interfaceArchiver
-
getFileMode
public int getFileMode()- Specified by:
getFileMode
in interfaceArchiver
-
getOverrideFileMode
public int getOverrideFileMode()- Specified by:
getOverrideFileMode
in interfaceArchiver
-
setDefaultFileMode
public void setDefaultFileMode(int mode) - Specified by:
setDefaultFileMode
in interfaceArchiver
-
getDefaultFileMode
public int getDefaultFileMode()- Specified by:
getDefaultFileMode
in interfaceArchiver
-
setDirectoryMode
public void setDirectoryMode(int mode) Description copied from interface:Archiver
This is the forced mode that should be used regardless if set, otherwise falls back to default.- Specified by:
setDirectoryMode
in interfaceArchiver
- Parameters:
mode
-
-
getDirectoryMode
public int getDirectoryMode()Description copied from interface:Archiver
Gets the forced mode for directories, falling back to default if none is forced.- Specified by:
getDirectoryMode
in interfaceArchiver
- Returns:
-
getOverrideDirectoryMode
public int getOverrideDirectoryMode()- Specified by:
getOverrideDirectoryMode
in interfaceArchiver
-
setDefaultDirectoryMode
public void setDefaultDirectoryMode(int mode) Description copied from interface:Archiver
This is the "default" value we should use if no other value is specified- Specified by:
setDefaultDirectoryMode
in interfaceArchiver
- Parameters:
mode
-
-
getDefaultDirectoryMode
public int getDefaultDirectoryMode()- Specified by:
getDefaultDirectoryMode
in interfaceArchiver
-
getIncludeEmptyDirs
public boolean getIncludeEmptyDirs()- Specified by:
getIncludeEmptyDirs
in interfaceArchiver
-
setIncludeEmptyDirs
public void setIncludeEmptyDirs(boolean includeEmptyDirs) - Specified by:
setIncludeEmptyDirs
in interfaceArchiver
-
setDotFileDirectory
- Specified by:
setDotFileDirectory
in interfaceArchiver
-
getResources
Description copied from interface:Archiver
Returns an iterator over instances ofArchiveEntry
, which have previously been added by calls toArchiver.addResources(PlexusIoResourceCollection)
,Archiver.addResource(PlexusIoResource, String, int)
,Archiver.addFileSet(FileSet)
, etc.- Specified by:
getResources
in interfaceArchiver
- Throws:
ArchiverException
-
getFiles
-
isForced
public boolean isForced()Description copied from interface:Archiver
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
Archiver.isSupportingForced()
may be called to check whether an archiver does support uptodate checks. -
setForced
public void setForced(boolean forced) Description copied from interface:Archiver
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
Archiver.isSupportingForced()
may be called to check whether an archiver does support uptodate checks. -
isSupportingForced
public boolean isSupportingForced()Description copied from interface:Archiver
Returns, whether the archive supports uptodate checks. If so, you may setArchiver.setForced(boolean)
to true.- Specified by:
isSupportingForced
in interfaceArchiver
- Returns:
- true, if the archiver does support uptodate checks, false otherwise
- See Also:
-
getDuplicateBehavior
Description copied from interface:Archiver
Returns the behavior of this archiver when duplicate files are detected.- Specified by:
getDuplicateBehavior
in interfaceArchiver
-
setDuplicateBehavior
Description copied from interface:Archiver
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
SeeArchiver.DUPLICATES_ADD
,Archiver.DUPLICATES_SKIP
,Archiver.DUPLICATES_PRESERVE
,Archiver.DUPLICATES_FAIL
.- Specified by:
setDuplicateBehavior
in interfaceArchiver
-
setUseJvmChmod
public void setUseJvmChmod(boolean useJvmChmod) Description copied from interface:Archiver
to use or not the jvm method for file permissions: user all not active for group permissions- Specified by:
setUseJvmChmod
in interfaceArchiver
- Parameters:
useJvmChmod
-
-
isUseJvmChmod
public boolean isUseJvmChmod()- Specified by:
isUseJvmChmod
in interfaceArchiver
- Returns:
-
isIgnorePermissions
public boolean isIgnorePermissions()- Specified by:
isIgnorePermissions
in interfaceArchiver
-
setIgnorePermissions
public void setIgnorePermissions(boolean ignorePermissions) - Specified by:
setIgnorePermissions
in interfaceArchiver
-
setLastModifiedDate
Deprecated.UsesetLastModifiedTime(FileTime)
instead.Description copied from interface:Archiver
Define forced last modification date for entries (if non null).- Specified by:
setLastModifiedDate
in interfaceArchiver
- Parameters:
lastModifiedDate
-
-
getLastModifiedDate
Deprecated.UsegetLastModifiedTime()
instead.- Specified by:
getLastModifiedDate
in interfaceArchiver
-
setLastModifiedTime
Description copied from interface:Archiver
Sets the last modification time of the entries (if non null).- Specified by:
setLastModifiedTime
in interfaceArchiver
- Parameters:
lastModifiedTime
- to set in the archive entries- See Also:
-
getLastModifiedTime
Description copied from interface:Archiver
Returns the last modification time of the archiver.- Specified by:
getLastModifiedTime
in interfaceArchiver
- Returns:
- The last modification time of the archiver, null if not specified
- See Also:
-
setFilenameComparator
Description copied from interface:Archiver
Set filename comparator, used to sort file entries when scanning directories since File.list() does not guarantee any order.- Specified by:
setFilenameComparator
in interfaceArchiver
-
setOverrideUid
public void setOverrideUid(int uid) - Specified by:
setOverrideUid
in interfaceArchiver
-
setOverrideUserName
- Specified by:
setOverrideUserName
in interfaceArchiver
-
getOverrideUid
public int getOverrideUid()- Specified by:
getOverrideUid
in interfaceArchiver
-
getOverrideUserName
- Specified by:
getOverrideUserName
in interfaceArchiver
-
setOverrideGid
public void setOverrideGid(int gid) - Specified by:
setOverrideGid
in interfaceArchiver
-
setOverrideGroupName
- Specified by:
setOverrideGroupName
in interfaceArchiver
-
getOverrideGid
public int getOverrideGid()- Specified by:
getOverrideGid
in interfaceArchiver
-
getOverrideGroupName
- Specified by:
getOverrideGroupName
in interfaceArchiver
-
setUmask
-
getUmask
-
configureReproducible
Deprecated.UseconfigureReproducibleBuild(FileTime)
instead.Description copied from interface:Archiver
This method is obsolete and will just callArchiver.configureReproducibleBuild(FileTime)
with the Date transformed into FileTime.- Specified by:
configureReproducible
in interfaceArchiver
- Parameters:
lastModifiedDate
- the date to use for archive entries last modified time
-
configureReproducibleBuild
Description copied from interface:Archiver
Configure the archiver to create archives in a reproducible way (see Reproducible Builds).This will configure:
- reproducible archive entries order,
- defined entries timestamp
- Specified by:
configureReproducibleBuild
in interfaceArchiver
- Parameters:
lastModifiedTime
- The last modification time of the entries- See Also:
-
configureReproducibleBuild(FileTime)
instead.