org.codehaus.plexus.archiver
Class AbstractArchiver

java.lang.Object
  extended byorg.codehaus.plexus.logging.AbstractLogEnabled
      extended byorg.codehaus.plexus.archiver.AbstractArchiver
All Implemented Interfaces:
Archiver, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, org.codehaus.plexus.logging.LogEnabled
Direct Known Subclasses:
AbstractZipArchiver, BZip2Archiver, DirectoryArchiver, GZipArchiver, TarArchiver

public abstract class AbstractArchiver
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements Archiver, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

Version:
$Id: AbstractArchiver.java 3651 2006-08-21 21:05:02Z jvanzyl $

Field Summary
static int DEFAULT_DIR_MODE
          Default value for the dirmode attribute.
static int DEFAULT_FILE_MODE
          Default value for the filemode attribute.
 
Fields inherited from interface org.codehaus.plexus.archiver.Archiver
ROLE
 
Constructor Summary
AbstractArchiver()
           
 
Method Summary
 void addArchivedFileSet(java.io.File archiveFile)
           
 void addArchivedFileSet(java.io.File archiveFile, java.lang.String prefix)
           
 void addArchivedFileSet(java.io.File archiveFile, java.lang.String[] includes, java.lang.String[] excludes)
           
 void addArchivedFileSet(java.io.File archiveFile, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes)
           
 void addDirectory(java.io.File directory)
           
 void addDirectory(java.io.File directory, java.lang.String prefix)
           
 void addDirectory(java.io.File directory, java.lang.String[] includes, java.lang.String[] excludes)
           
 void addDirectory(java.io.File directory, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes)
           
 void addFile(java.io.File inputFile, java.lang.String destFileName)
           
 void addFile(java.io.File inputFile, java.lang.String destFileName, int permissions)
           
protected  boolean checkForced()
           
 void contextualize(org.codehaus.plexus.context.Context context)
          Allows us to pull the ArchiverManager instance out of the container without causing a chicken-and-egg instantiation/composition problem.
 int getDefaultDirectoryMode()
           
 int getDefaultFileMode()
           
 java.io.File getDestFile()
           
 java.util.Map getDirs()
           
 java.util.Map getFiles()
           
 boolean getIncludeEmptyDirs()
           
protected  org.codehaus.plexus.logging.Logger getLogger()
           
 boolean isForced()
          Returns, whether recreating the archive is forced (default).
 boolean isSupportingForced()
          Returns, whether the archive supports uptodate checks.
protected  boolean isUptodate()
           
 void setDefaultDirectoryMode(int mode)
           
 void setDefaultFileMode(int mode)
           
 void setDestFile(java.io.File destFile)
           
 void setForced(boolean forced)
          Sets, whether recreating the archive is forced (default).
 void setIncludeEmptyDirs(boolean includeEmptyDirs)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.plexus.archiver.Archiver
createArchive
 

Field Detail

DEFAULT_DIR_MODE

public static final int DEFAULT_DIR_MODE
Default value for the dirmode attribute.

See Also:
Constant Field Values

DEFAULT_FILE_MODE

public static final int DEFAULT_FILE_MODE
Default value for the filemode attribute.

See Also:
Constant Field Values
Constructor Detail

AbstractArchiver

public AbstractArchiver()
Method Detail

setDefaultFileMode

public void setDefaultFileMode(int mode)
Specified by:
setDefaultFileMode in interface Archiver

getDefaultFileMode

public int getDefaultFileMode()
Specified by:
getDefaultFileMode in interface Archiver

setDefaultDirectoryMode

public void setDefaultDirectoryMode(int mode)
Specified by:
setDefaultDirectoryMode in interface Archiver

getDefaultDirectoryMode

public int getDefaultDirectoryMode()
Specified by:
getDefaultDirectoryMode in interface Archiver

getIncludeEmptyDirs

public boolean getIncludeEmptyDirs()
Specified by:
getIncludeEmptyDirs in interface Archiver

setIncludeEmptyDirs

public void setIncludeEmptyDirs(boolean includeEmptyDirs)
Specified by:
setIncludeEmptyDirs in interface Archiver

addDirectory

public void addDirectory(java.io.File directory)
                  throws ArchiverException
Specified by:
addDirectory in interface Archiver
Throws:
ArchiverException

addDirectory

public void addDirectory(java.io.File directory,
                         java.lang.String prefix)
                  throws ArchiverException
Specified by:
addDirectory in interface Archiver
Throws:
ArchiverException

addDirectory

public void addDirectory(java.io.File directory,
                         java.lang.String[] includes,
                         java.lang.String[] excludes)
                  throws ArchiverException
Specified by:
addDirectory in interface Archiver
Throws:
ArchiverException

addDirectory

public void addDirectory(java.io.File directory,
                         java.lang.String prefix,
                         java.lang.String[] includes,
                         java.lang.String[] excludes)
                  throws ArchiverException
Specified by:
addDirectory in interface Archiver
Throws:
ArchiverException

addFile

public void addFile(java.io.File inputFile,
                    java.lang.String destFileName)
             throws ArchiverException
Specified by:
addFile in interface Archiver
Throws:
ArchiverException

addFile

public void addFile(java.io.File inputFile,
                    java.lang.String destFileName,
                    int permissions)
             throws ArchiverException
Specified by:
addFile in interface Archiver
Throws:
ArchiverException

getFiles

public java.util.Map getFiles()
Specified by:
getFiles in interface Archiver

getDestFile

public java.io.File getDestFile()
Specified by:
getDestFile in interface Archiver

setDestFile

public void setDestFile(java.io.File destFile)
Specified by:
setDestFile in interface Archiver

getLogger

protected org.codehaus.plexus.logging.Logger getLogger()

getDirs

public java.util.Map getDirs()

addArchivedFileSet

public void addArchivedFileSet(java.io.File archiveFile,
                               java.lang.String prefix,
                               java.lang.String[] includes,
                               java.lang.String[] excludes)
                        throws ArchiverException
Specified by:
addArchivedFileSet in interface Archiver
Throws:
ArchiverException
Since:
1.0-alpha-7

addArchivedFileSet

public void addArchivedFileSet(java.io.File archiveFile,
                               java.lang.String prefix)
                        throws ArchiverException
Specified by:
addArchivedFileSet in interface Archiver
Throws:
ArchiverException
Since:
1.0-alpha-7

addArchivedFileSet

public void addArchivedFileSet(java.io.File archiveFile,
                               java.lang.String[] includes,
                               java.lang.String[] excludes)
                        throws ArchiverException
Specified by:
addArchivedFileSet in interface Archiver
Throws:
ArchiverException
Since:
1.0-alpha-7

addArchivedFileSet

public void addArchivedFileSet(java.io.File archiveFile)
                        throws ArchiverException
Specified by:
addArchivedFileSet in interface Archiver
Throws:
ArchiverException
Since:
1.0-alpha-7

contextualize

public void contextualize(org.codehaus.plexus.context.Context context)
                   throws org.codehaus.plexus.context.ContextException
Allows us to pull the ArchiverManager instance out of the container without causing a chicken-and-egg instantiation/composition problem.

Specified by:
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Throws:
org.codehaus.plexus.context.ContextException

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 recrated) 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.

Specified by:
isForced in interface Archiver
Returns:
True, if the target archive should always be created; false otherwise
See Also:
Archiver.setForced(boolean), Archiver.isSupportingForced()

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 recrated) 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.

Specified by:
setForced in interface Archiver
Parameters:
forced - True, if the target archive should always be created; false otherwise
See Also:
Archiver.isForced(), Archiver.isSupportingForced()

isUptodate

protected boolean isUptodate()

checkForced

protected boolean checkForced()

isSupportingForced

public boolean isSupportingForced()
Description copied from interface: Archiver
Returns, whether the archive supports uptodate checks. If so, you may set Archiver.setForced(boolean) to true.

Specified by:
isSupportingForced in interface Archiver
Returns:
True, if the archiver does support uptodate checks, false otherwise
See Also:
Archiver.setForced(boolean), Archiver.isForced()


Copyright © 2001-2006 Codehaus. All Rights Reserved.