org.codehaus.plexus.archiver
Class AbstractUnArchiver

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.archiver.AbstractUnArchiver
All Implemented Interfaces:
FilterEnabled, FinalizerEnabled, UnArchiver, org.codehaus.plexus.logging.LogEnabled
Direct Known Subclasses:
AbstractZipUnArchiver, BZip2UnArchiver, GZipUnArchiver

public abstract class AbstractUnArchiver
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements UnArchiver, FinalizerEnabled, FilterEnabled

Version:
$Revision$ $Date$
Author:
Emmanuel Venisse

Field Summary
 
Fields inherited from interface org.codehaus.plexus.archiver.UnArchiver
ROLE
 
Constructor Summary
AbstractUnArchiver()
           
AbstractUnArchiver(File sourceFile)
           
 
Method Summary
 void addArchiveFinalizer(ArchiveFinalizer finalizer)
           
protected abstract  void execute()
           
protected abstract  void execute(String path, File outputDirectory)
           
 void extract()
          Extract the archive.
 void extract(String path, File outputDirectory)
          Take a patch into the archive and extract it to the specified directory.
 File getDestDirectory()
           
 File getDestFile()
           
 org.codehaus.plexus.components.io.fileselectors.FileSelector[] getFileSelectors()
          Returns a set of FileSelector instances, which may be used to select the files to extract from the archive.
 File getSourceFile()
           
protected  boolean include(InputStream inputStream, String name)
           
 boolean isIgnorePermissions()
           
 boolean isOverwrite()
           
protected  boolean isSelected(String fileName, org.codehaus.plexus.components.io.resources.PlexusIoResource fileInfo)
           
 boolean isUseJvmChmod()
           
 void setArchiveFilters(List filters)
           
 void setArchiveFinalizers(List archiveFinalizers)
           
 void setDestDirectory(File destDirectory)
           
 void setDestFile(File destFile)
           
 void setFileSelectors(org.codehaus.plexus.components.io.fileselectors.FileSelector[] fileSelectors)
          Sets a set of FileSelector instances, which may be used to select the files to extract from the archive.
 void setIgnorePermissions(boolean ignorePermissions)
           
 void setOverwrite(boolean b)
          Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
 void setSourceFile(File sourceFile)
           
 void setUseJvmChmod(boolean useJvmChmod)
          to use or not the jvm method for file permissions : user all not active for group permissions
protected  void validate()
           
protected  void validate(String path, File outputDirectory)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUnArchiver

public AbstractUnArchiver()

AbstractUnArchiver

public AbstractUnArchiver(File sourceFile)
Method Detail

getDestDirectory

public File getDestDirectory()
Specified by:
getDestDirectory in interface UnArchiver

setDestDirectory

public void setDestDirectory(File destDirectory)
Specified by:
setDestDirectory in interface UnArchiver

getDestFile

public File getDestFile()
Specified by:
getDestFile in interface UnArchiver

setDestFile

public void setDestFile(File destFile)
Specified by:
setDestFile in interface UnArchiver

getSourceFile

public File getSourceFile()
Specified by:
getSourceFile in interface UnArchiver

setSourceFile

public void setSourceFile(File sourceFile)
Specified by:
setSourceFile in interface UnArchiver

isOverwrite

public boolean isOverwrite()

setOverwrite

public void setOverwrite(boolean b)
Description copied from interface: UnArchiver
Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?

Specified by:
setOverwrite in interface UnArchiver

extract

public final void extract()
                   throws ArchiverException
Description copied from interface: UnArchiver
Extract the archive.

Specified by:
extract in interface UnArchiver
Throws:
ArchiverException

extract

public final void extract(String path,
                          File outputDirectory)
                   throws ArchiverException
Description copied from interface: UnArchiver
Take a patch into the archive and extract it to the specified directory.

Specified by:
extract in interface UnArchiver
Parameters:
path - Path inside the archive to be extracted.
outputDirectory - Directory to extract to.
Throws:
ArchiverException

setArchiveFilters

public void setArchiveFilters(List filters)
Specified by:
setArchiveFilters in interface FilterEnabled

addArchiveFinalizer

public void addArchiveFinalizer(ArchiveFinalizer finalizer)
Specified by:
addArchiveFinalizer in interface FinalizerEnabled

setArchiveFinalizers

public void setArchiveFinalizers(List archiveFinalizers)
Specified by:
setArchiveFinalizers in interface FinalizerEnabled

include

protected boolean include(InputStream inputStream,
                          String name)
                   throws ArchiveFilterException
Throws:
ArchiveFilterException

validate

protected void validate(String path,
                        File outputDirectory)

validate

protected void validate()
                 throws ArchiverException
Throws:
ArchiverException

setFileSelectors

public void setFileSelectors(org.codehaus.plexus.components.io.fileselectors.FileSelector[] fileSelectors)
Description copied from interface: UnArchiver
Sets a set of FileSelector instances, which may be used to select the files to extract from the archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.

Specified by:
setFileSelectors in interface UnArchiver

getFileSelectors

public org.codehaus.plexus.components.io.fileselectors.FileSelector[] getFileSelectors()
Description copied from interface: UnArchiver
Returns a set of FileSelector instances, which may be used to select the files to extract from the archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.

Specified by:
getFileSelectors in interface UnArchiver

isSelected

protected boolean isSelected(String fileName,
                             org.codehaus.plexus.components.io.resources.PlexusIoResource fileInfo)
                      throws ArchiverException
Throws:
ArchiverException

execute

protected abstract void execute()
                         throws ArchiverException
Throws:
ArchiverException

execute

protected abstract void execute(String path,
                                File outputDirectory)
                         throws ArchiverException
Throws:
ArchiverException

isUseJvmChmod

public boolean isUseJvmChmod()
Specified by:
isUseJvmChmod in interface UnArchiver
Returns:
Since:
1.1

setUseJvmChmod

public void setUseJvmChmod(boolean useJvmChmod)
Description copied from interface: UnArchiver
to use or not the jvm method for file permissions : user all not active for group permissions

Specified by:
setUseJvmChmod in interface UnArchiver
Since:
1.1

isIgnorePermissions

public boolean isIgnorePermissions()
Specified by:
isIgnorePermissions in interface UnArchiver
Since:
1.1

setIgnorePermissions

public void setIgnorePermissions(boolean ignorePermissions)
Specified by:
setIgnorePermissions in interface UnArchiver
Since:
1.1


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.