net.sf.xsltmp.util
Class UnArchiverHelper

java.lang.Object
  extended by net.sf.xsltmp.util.UnArchiverHelper

public class UnArchiverHelper
extends Object

Gets files from archives.

Maintains a repository of all extracted files in a given directory. The repository is organized by the archive name and the path of the files within the archives.

When a file has already been extracted previously, it is served from the repository and not extracted again.

When it is not present in the repository, extracts it from the archive to the repository based on the requested file path within the archive and then serves it from the repository.

Once a file has been extracted from a given archive, remembers the path of the file within the archive. Subsequent requests for files within the same archive may specify the path relative to the path of the last request.


Constructor Summary
UnArchiverHelper(org.apache.maven.plugin.logging.Log log, org.apache.maven.project.MavenProject project, org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, String commonExtractDir)
          Constructor.
 
Method Summary
 void extract(File archive, String filePath)
          Extract a file from an archive.
 org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()
           
 Map getArchiveValidSubdirs()
           
 File getCommonExtractDir()
           
 File getFile(File archive, String filePath)
          Get a file from an archive.
 org.apache.maven.plugin.logging.Log getLog()
           
 org.apache.maven.project.MavenProject getProject()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnArchiverHelper

public UnArchiverHelper(org.apache.maven.plugin.logging.Log log,
                        org.apache.maven.project.MavenProject project,
                        org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager,
                        String commonExtractDir)
Constructor.

Parameters:
log - Maven log
project - Maven project
archiverManager - Plexus archiver manager
commonExtractDir - The directory of the repository of extracted files
Method Detail

getLog

public org.apache.maven.plugin.logging.Log getLog()

getProject

public org.apache.maven.project.MavenProject getProject()

getArchiverManager

public org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()

getCommonExtractDir

public File getCommonExtractDir()

getArchiveValidSubdirs

public Map getArchiveValidSubdirs()

getFile

public File getFile(File archive,
                    String filePath)
Get a file from an archive.

Parameters:
archive - The archive file
filePath - Relative path to the file within the archive
Returns:
File The file from the archive

extract

public void extract(File archive,
                    String filePath)
Extract a file from an archive.

Parameters:
archive - The archive file
filePath - Relative path to the file to be extracted within the archive


Copyright © 2008-2010 SEAF. All Rights Reserved.